save client IpAddress for later

This commit is contained in:
Matthias Mailänder
2013-03-12 08:13:44 +01:00
committed by Paul Chote
parent d21875d353
commit 91115d5ba3
2 changed files with 5 additions and 2 deletions

View File

@@ -53,6 +53,7 @@ namespace OpenRA.Network
public string Country; public string Country;
public int SpawnPoint; public int SpawnPoint;
public string Name; public string Name;
public string IpAddress;
public ClientState State; public ClientState State;
public int Team; public int Team;
public string Slot; // slot ID, or null for observer public string Slot; // slot ID, or null for observer

View File

@@ -263,11 +263,13 @@ namespace OpenRA.Server
return; return;
} }
client.IpAddress = ((IPEndPoint)newConn.socket.RemoteEndPoint).Address.ToString();
// Check if IP is banned // Check if IP is banned
if (lobbyInfo.GlobalSettings.Ban != null) if (lobbyInfo.GlobalSettings.Ban != null)
{ {
var remote_addr = ((IPEndPoint)newConn.socket.RemoteEndPoint).Address.ToString();
if (lobbyInfo.GlobalSettings.Ban.Contains(remote_addr)) if (lobbyInfo.GlobalSettings.Ban.Contains(client.IpAddress))
{ {
Console.WriteLine("Rejected connection from "+client.Name+"("+newConn.socket.RemoteEndPoint+"); Banned."); Console.WriteLine("Rejected connection from "+client.Name+"("+newConn.socket.RemoteEndPoint+"); Banned.");
Log.Write("server", "Rejected connection from {0}; Banned.", Log.Write("server", "Rejected connection from {0}; Banned.",