Make hostname blacklist case insensitive
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user