diff options
Diffstat (limited to 'cgi/framework.py')
-rw-r--r-- | cgi/framework.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cgi/framework.py b/cgi/framework.py index 796703e..3cfc94a 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -56,18 +56,20 @@ def cleanDir(path, ext=None): os.remove(os.path.join(path, f)) -def addressIsBanned(ip, board, blind_only=False): +def addressIsBanned(ip, board=None, blind_only=False): query = "SELECT * FROM `bans` WHERE INET6_ATON(%s) BETWEEN `ipstart` AND `ipend`" if blind_only: query += " AND `blind` = '1'" bans = FetchAll(query, (ip,)) for ban in bans: + if not board: + return ban if ban["boards"]: boards = str2boards(ban["boards"]) if not ban["boards"] or board in boards: if board not in Settings.EXCLUDE_GLOBAL_BANS: - return True - return False + return ban + return None def addressIsTor(ip): |