[ipt] On met gethostbyname au bont endrois dans le fichier

Ignore-this: e41cda310ddc3bbd819d0b70210d9308

darcs-hash:20121213223403-3a55a-428ba976ced54b09906137b5fb501730f62fcf53.gz
This commit is contained in:
Valentin Samir 2012-12-13 23:34:03 +01:00
parent 4ca0088778
commit 88339b1da5

View file

@ -69,19 +69,6 @@ db = crans_ldap()
# #
############################################################################## ##############################################################################
def gethostbyname(hostname):
hosts4=[]
hosts6=[]
try :
for host in socket.getaddrinfo(hostname,None,socket.AF_INET,socket.IPPROTO_IP,socket.AI_CANONNAME):
hosts4.append(host[4][0])
except(socket.gaierror): pass
try :
for host in socket.getaddrinfo(hostname,None,socket.AF_INET6,socket.IPPROTO_IP,socket.AI_CANONNAME):
hosts6.append(host[4][0])
except(socket.gaierror): pass
return (hosts4,hosts6)
class Chain(object): class Chain(object):
''' Classe regroupant toutes les règles du firewall ''' ''' Classe regroupant toutes les règles du firewall '''
def __init__(self): def __init__(self):
@ -427,6 +414,19 @@ class UnknowUserError(Exception):
# #
############################################################################## ##############################################################################
def gethostbyname(hostname):
hosts4=[]
hosts6=[]
try :
for host in socket.getaddrinfo(hostname,None,socket.AF_INET,socket.IPPROTO_IP,socket.AI_CANONNAME):
hosts4.append(host[4][0])
except(socket.gaierror): pass
try :
for host in socket.getaddrinfo(hostname,None,socket.AF_INET6,socket.IPPROTO_IP,socket.AI_CANONNAME):
hosts6.append(host[4][0])
except(socket.gaierror): pass
return (hosts4,hosts6)
def check_ip_proto(ip_proto): def check_ip_proto(ip_proto):
''' Vérifie que le protocole ip fourni est valide ''' ''' Vérifie que le protocole ip fourni est valide '''
if ip_proto != 4 and ip_proto != 6: if ip_proto != 4 and ip_proto != 6: