mirror of https://github.com/fail2ban/fail2ban
- Fixed a bug with static class members
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@283 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
9fe1efcc45
commit
ca5b70cd24
|
@ -34,6 +34,8 @@ logSys = logging.getLogger("fail2ban.client.config")
|
|||
|
||||
class JailReader(ConfigReader):
|
||||
|
||||
actionCRE = re.compile("^((?:\w|-|_|\.)+)(?:\[(.*)\])?$")
|
||||
|
||||
def __init__(self, name):
|
||||
ConfigReader.__init__(self)
|
||||
self.name = name
|
||||
|
@ -92,7 +94,7 @@ class JailReader(ConfigReader):
|
|||
|
||||
@staticmethod
|
||||
def splitAction(action):
|
||||
m = re.match("^((?:\w|-|_|\.)+)(?:\[(.*)\])?$", action)
|
||||
m = JailReader.actionCRE.match(action)
|
||||
d = dict()
|
||||
if m.group(2) <> None:
|
||||
for param in m.group(2).split(','):
|
||||
|
|
|
@ -468,8 +468,8 @@ import socket, struct
|
|||
|
||||
class DNSUtils:
|
||||
|
||||
dnsRe = re.compile("(?:(?:\w|-)+\.){2,}\w+")
|
||||
ipRe = re.compile("(?:\d{1,3}\.){3}\d{1,3}")
|
||||
dnsCRE = re.compile("(?:(?:\w|-)+\.){2,}\w+")
|
||||
ipCRE = re.compile("(?:\d{1,3}\.){3}\d{1,3}")
|
||||
|
||||
@staticmethod
|
||||
def dnsToIp(dns):
|
||||
|
@ -486,7 +486,7 @@ class DNSUtils:
|
|||
""" Search for possible DNS in an arbitrary text.
|
||||
Thanks to Tom Pike.
|
||||
"""
|
||||
match = dnsRe.find(text)
|
||||
match = DNSUtils.dnsCRE.match(text)
|
||||
if match:
|
||||
return match
|
||||
else:
|
||||
|
@ -497,7 +497,8 @@ class DNSUtils:
|
|||
""" Search if an IP address if directly available and return
|
||||
it.
|
||||
"""
|
||||
match = ipRe.find(text)
|
||||
print DNSUtils.ipCRE
|
||||
match = DNSUtils.ipCRE.match(text)
|
||||
if match:
|
||||
return match
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue