Browse Source

BF: anchoring regex for IP with "$" at the end + adjust regexp for <HOST> (closes: #514163)

manually done patching similar to the one in up/fix_searchIP_v2 branch
debian-releases/etch.security
Yaroslav Halchenko 16 years ago
parent
commit
91bb2fc938
  1. 4
      server/filter.py

4
server/filter.py

@ -171,7 +171,7 @@ class Filter(JailThread):
self.__failRegexObj = None self.__failRegexObj = None
else: else:
# Replace "<HOST>" with default regular expression for host. # Replace "<HOST>" with default regular expression for host.
regex = value.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>\S+)") regex = value.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)")
self.__failRegex = regex self.__failRegex = regex
self.__failRegexObj = re.compile(regex) self.__failRegexObj = re.compile(regex)
logSys.info("Set failregex = %s" % self.__failRegex) logSys.info("Set failregex = %s" % self.__failRegex)
@ -469,7 +469,7 @@ import socket, struct
class DNSUtils: class DNSUtils:
DNS_CRE = re.compile("(?:(?:\w|-)+\.){2,}\w+") DNS_CRE = re.compile("(?:(?:\w|-)+\.){2,}\w+")
IP_CRE = re.compile("(?:\d{1,3}\.){3}\d{1,3}") IP_CRE = re.compile("(?:\d{1,3}\.){3}\d{1,3}$")
@staticmethod @staticmethod
def dnsToIp(dns): def dnsToIp(dns):

Loading…
Cancel
Save