private void ProcessSaslPlainAuth(MxAuth auth)
        {
            string pass = null;
            string user = null;

            byte[] bytes = Convert.FromBase64String(auth.Value);
            string sasl  = Encoding.UTF8.GetString(bytes);

            // trim nullchars
            sasl = sasl.Trim((char)0);
            string[] split = sasl.Split((char)0);

            if (split.Length == 3)
            {
                user = split[1];
                pass = split[2];
            }
            else if (split.Length == 2)
            {
                user = split[0];
                pass = split[1];
            }

            bool passOk = m_server.Authenticate(pass);

            // check if username and password is correct
            if (user != null && passOk)
            {
                // pass correct
                User = user;
                streamParser.Reset();
                IsAuthenticated = true;
                Send(new Success());
            }
            else
            {
                {
                    // user does not exist or wrong password
                    Send(new Failure(FailureCondition.NotAuthorized));
                }
            }
        }