Changeset 189 for binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Telnet/TelnetConnection.cs
- Timestamp:
- Sep 12, 2014, 11:14:11 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Telnet/TelnetConnection.cs
r187 r189 38 38 39 39 if (endpoint is IPEndPoint) { 40 endpointAddressHash = ((IPEndPoint)endpoint).Address.GetHashCode ();40 endpointAddressHash = ((IPEndPoint)endpoint).Address.GetHashCode (); 41 41 //Log.Out ("Hash: " + endpointAddressHash); 42 42 } else { 43 Log.Out ("EndPoint is not an IPEndPoint but: " + endpoint.GetType ().ToString());43 Log.Out ("EndPoint is not an IPEndPoint but: " + endpoint.GetType ().ToString ()); 44 44 } 45 45 … … 78 78 while (!IsClosed()) { 79 79 string line = reader.ReadLine (); 80 if (line != null ) {80 if (line != null && line.Length > 0) { 81 81 line = line.Trim (); 82 83 if (!IsAuthenticated ()) { 84 if (line.Equals (GamePrefs.GetString (EnumGamePrefs.TelnetPassword))) { 85 authenticated = true; 86 WriteLine ("Logon successful."); 87 WriteLine (string.Empty); 88 WriteLine (string.Empty); 89 WriteLine (string.Empty); 90 LoginMessage (); 82 if (line.Length > 0) { 83 if (!IsAuthenticated ()) { 84 if (line.Equals (GamePrefs.GetString (EnumGamePrefs.TelnetPassword))) { 85 authenticated = true; 86 WriteLine ("Logon successful."); 87 WriteLine (string.Empty); 88 WriteLine (string.Empty); 89 WriteLine (string.Empty); 90 LoginMessage (); 91 } else { 92 if (owner.RegisterFailedLogin (endpointAddressHash)) { 93 WriteLine ("Password incorrect, please enter password:"); 94 } else { 95 WriteLine ("Too many failed login attempts!"); 96 Thread.Sleep (100); 97 Close (); 98 Log.Out ("Telnet connection closed for too many login attempts: " + endpoint); 99 break; 100 } 101 } 91 102 } else { 92 if (owner.RegisterFailedLogin(endpointAddressHash)) { 93 WriteLine ("Password incorrect, please enter password:"); 94 } else { 95 WriteLine ("Too many failed login attempts!"); 96 Thread.Sleep(100); 103 if (line.ToLower ().Equals ("exit")) { 104 Log.Out ("Telnet connection closed by client: " + endpoint); 97 105 Close (); 98 Log.Out ("Telnet connection closed for too many login attempts: " + endpoint);99 106 break; 100 107 } 108 Log.Out ("Telnet executed \"" + line + "\" from: " + endpoint); 109 ConsoleOutputSeparator.QueueNetCommand (line, this); 101 110 } 102 } else {103 if (line.ToLower ().Equals ("exit")) {104 Log.Out ("Telnet connection closed by client: " + endpoint);105 Close ();106 break;107 }108 Log.Out ("Telnet executed \"" + line + "\" from: " + endpoint);109 ConsoleOutputSeparator.QueueNetCommand (line, this);110 111 } 111 112 }
Note:
See TracChangeset
for help on using the changeset viewer.