mirror of https://github.com/fail2ban/fail2ban
code review: getHostname can return ''
parent
f75c3d8a02
commit
e4ccbe7286
|
@ -147,9 +147,9 @@ class DNSUtils:
|
||||||
names = DNSUtils.CACHE_ipToName.get(key)
|
names = DNSUtils.CACHE_ipToName.get(key)
|
||||||
# get it using different ways (a set with names of localhost, hostname, fully qualified):
|
# get it using different ways (a set with names of localhost, hostname, fully qualified):
|
||||||
if names is None:
|
if names is None:
|
||||||
names = set(['localhost'])
|
names = set([
|
||||||
for fqdn in (False, True):
|
'localhost', DNSUtils.getHostname(False), DNSUtils.getHostname(True)
|
||||||
names.add(DNSUtils.getHostname(fqdn=fqdn))
|
]) - set(['']) # getHostname can return ''
|
||||||
# cache and return :
|
# cache and return :
|
||||||
DNSUtils.CACHE_ipToName.set(key, names)
|
DNSUtils.CACHE_ipToName.set(key, names)
|
||||||
return names
|
return names
|
||||||
|
|
Loading…
Reference in New Issue