Make hostname blacklist case insensitive

This commit is contained in:
sfan5
2017-12-24 20:42:47 +01:00
parent 0d93321f6d
commit 2f87286475
2 changed files with 4 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ PURGE_TIME = 350
BANNED_IPS = []
# List of banned servers as host/port pairs
# e.g. ['1.2.3.4/30000', 'evil.server.ua/30001']
# e.g. ['1.2.3.4/30000', 'lowercase.hostname', 'lowercase.hostname/30001']
BANNED_SERVERS = []
# Creates server entries if a server sends an 'update' and there is no entry yet.

View File

@@ -77,7 +77,9 @@ def announce():
if "%s/%d" % (server["ip"], server["port"]) in app.config["BANNED_SERVERS"]:
return "Banned (Server).", 403
elif "address" in server and "%s/%d" % (server["address"], server["port"]) in app.config["BANNED_SERVERS"]:
elif "address" in server and "%s/%d" % (server["address"].lower(), server["port"]) in app.config["BANNED_SERVERS"]:
return "Banned (Server).", 403
elif "address" in server and server["address"].lower() in app.config["BANNED_SERVERS"]:
return "Banned (Server).", 403
old = serverList.get(ip, server["port"])