From: <los...@us...> - 2006-12-23 09:51:02
|
Revision: 501 http://svn.sourceforge.net/fail2ban/?rev=501&view=rev Author: lostcontrol Date: 2006-12-23 01:50:51 -0800 (Sat, 23 Dec 2006) Log Message: ----------- - Improved regular expression checking Modified Paths: -------------- trunk/server/filter.py Modified: trunk/server/filter.py =================================================================== --- trunk/server/filter.py 2006-12-23 09:50:03 UTC (rev 500) +++ trunk/server/filter.py 2006-12-23 09:50:51 UTC (rev 501) @@ -435,10 +435,18 @@ + "this format") else: try: - ipMatch = DNSUtils.textToIp(match.group("host")) - if ipMatch: - for ip in ipMatch: - failList.append([ip, date]) + matchGroup = match.group("host") + # For strange reasons, match.group can return None with some + # regular expressions. However, these expressions can be + # compiled successfully. + if matchGroup == None: + logSys.error("Unexpected error. Please correct your " + + "configuration.") + else: + ipMatch = DNSUtils.textToIp(match.group("host")) + if ipMatch: + for ip in ipMatch: + failList.append([ip, date]) except IndexError: logSys.error("There is no 'host' group in the rule. " + "Please correct your configuration.") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |