aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-20 11:27:15 +0000
committerMelanie Thielker2009-05-20 11:27:15 +0000
commit20383a61b85794c6ba4d58fb287099067de0bbb7 (patch)
tree3b84235a9d8052f2964cee5ec79886f897fb5f34 /OpenSim/Region/CoreModules
parentFix a slight oversight in SceneInventory that would not enable copy to (diff)
downloadopensim-SC_OLD-20383a61b85794c6ba4d58fb287099067de0bbb7.zip
opensim-SC_OLD-20383a61b85794c6ba4d58fb287099067de0bbb7.tar.gz
opensim-SC_OLD-20383a61b85794c6ba4d58fb287099067de0bbb7.tar.bz2
opensim-SC_OLD-20383a61b85794c6ba4d58fb287099067de0bbb7.tar.xz
Thank you, StrawberryFride, for a patch to fix SceneBan behavior.
Applied with changes (commented the logging entirely, since Linux defaults to debug level) Fixes Mantis #3689
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs42
1 files changed, 23 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs b/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs
index dbfcfee..6efd090 100644
--- a/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs
+++ b/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
34{ 34{
35 internal class SceneBanner 35 internal class SceneBanner
36 { 36 {
37 private static readonly log4net.ILog m_log 37 private static readonly log4net.ILog m_log
38 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 38 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39 39
40 private List<string> bans; 40 private List<string> bans;
@@ -49,30 +49,34 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
49 49
50 void EventManager_OnClientConnect(IClientCore client) 50 void EventManager_OnClientConnect(IClientCore client)
51 { 51 {
52 IClientIPEndpoint ipEndpoint; 52 // Only need to run through all this if there are entries in the ban list
53 if (client.TryGet(out ipEndpoint)) 53 if (bans.Count > 0)
54 { 54 {
55 IPAddress end = ipEndpoint.EndPoint; 55 IClientIPEndpoint ipEndpoint;
56 56 if (client.TryGet(out ipEndpoint))
57 try
58 { 57 {
59 IPHostEntry rDNS = Dns.GetHostEntry(end); 58 IPAddress end = ipEndpoint.EndPoint;
60 foreach (string ban in bans) 59
60 try
61 { 61 {
62 if (rDNS.HostName.Contains(ban) || 62 IPHostEntry rDNS = Dns.GetHostEntry(end);
63 end.ToString().StartsWith(ban)) 63 foreach (string ban in bans)
64 { 64 {
65 client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server."); 65 if (rDNS.HostName.Contains(ban) ||
66 m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban."); 66 end.ToString().StartsWith(ban))
67 return; 67 {
68 client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
69 m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
70 return;
71 }
68 } 72 }
69 } 73 }
74 catch (System.Net.Sockets.SocketException sex)
75 {
76 m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
77 }
78 // m_log.DebugFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
70 } 79 }
71 catch (System.Net.Sockets.SocketException sex)
72 {
73 m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
74 }
75 m_log.WarnFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
76 } 80 }
77 } 81 }
78 } 82 }