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 #36890.6.6-post-fixes
parent
a3fed17956
commit
20383a61b8
|
@ -34,7 +34,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
|
||||||
{
|
{
|
||||||
internal class SceneBanner
|
internal class SceneBanner
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog m_log
|
private static readonly log4net.ILog m_log
|
||||||
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private List<string> bans;
|
private List<string> bans;
|
||||||
|
@ -49,30 +49,34 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
|
||||||
|
|
||||||
void EventManager_OnClientConnect(IClientCore client)
|
void EventManager_OnClientConnect(IClientCore client)
|
||||||
{
|
{
|
||||||
IClientIPEndpoint ipEndpoint;
|
// Only need to run through all this if there are entries in the ban list
|
||||||
if (client.TryGet(out ipEndpoint))
|
if (bans.Count > 0)
|
||||||
{
|
{
|
||||||
IPAddress end = ipEndpoint.EndPoint;
|
IClientIPEndpoint ipEndpoint;
|
||||||
|
if (client.TryGet(out ipEndpoint))
|
||||||
try
|
|
||||||
{
|
{
|
||||||
IPHostEntry rDNS = Dns.GetHostEntry(end);
|
IPAddress end = ipEndpoint.EndPoint;
|
||||||
foreach (string ban in bans)
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (rDNS.HostName.Contains(ban) ||
|
IPHostEntry rDNS = Dns.GetHostEntry(end);
|
||||||
end.ToString().StartsWith(ban))
|
foreach (string ban in bans)
|
||||||
{
|
{
|
||||||
client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
|
if (rDNS.HostName.Contains(ban) ||
|
||||||
m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
|
end.ToString().StartsWith(ban))
|
||||||
return;
|
{
|
||||||
|
client.Disconnect("Banned - network \"" + ban + "\" is not allowed to connect to this server.");
|
||||||
|
m_log.Warn("[IPBAN] Disconnected '" + end + "' due to '" + ban + "' ban.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (System.Net.Sockets.SocketException sex)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
|
||||||
|
}
|
||||||
|
// m_log.DebugFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
|
||||||
}
|
}
|
||||||
catch (System.Net.Sockets.SocketException sex)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
|
|
||||||
}
|
|
||||||
m_log.WarnFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue