private void PASS(string argsText) { if (this.Authenticated) { this.Socket.WriteLine("500 You are already authenticated"); return; } if (m_UserName.Length == 0) { this.Socket.WriteLine("503 please specify username first"); return; } string[] param = argsText.Split(new char[] { ' ' }); // There may be only one parameter - password if (param.Length == 1) { string password = param[0]; // Authenticate user if (m_pServer.OnAuthUser(this, m_UserName, password, "", AuthType.Plain)) { this.Socket.WriteLine("230 Password ok"); this.SetUserName(m_UserName); } else { this.Socket.WriteLine("530 UserName or Password is incorrect"); m_UserName = ""; // Reset userName !!! } } else { this.Socket.WriteLine("500 Syntax error. Syntax:{PASS userName}"); } }
private void PASS(string argsText) { if (m_Authenticated) { SendData("500 You are already authenticated\r\n"); return; } if (m_UserName.Length == 0) { SendData("503 please specify username first\r\n"); return; } string[] param = argsText.Split(new char[] { ' ' }); // There may be only one parameter - password if (param.Length == 1) { string password = param[0]; // Authenticate user if (m_pServer.OnAuthUser(this, m_UserName, password, "", AuthType.Plain)) { m_Authenticated = true; SendData("230 Password ok\r\n"); } else { SendData("530 Not logged in.\r\n"); m_UserName = ""; // Reset userName !!! } } else { SendData("500 Syntax error. Syntax:{PASS userName}\r\n"); } }