On evite de reinitialiser sans arrete crans_ldap
darcs-hash:20050722094534-d1718-e31762b3850c57209e3dcd5af95e699ba43914d6.gz
This commit is contained in:
parent
90b49cce8e
commit
fab7e1e2e6
1 changed files with 6 additions and 5 deletions
|
@ -35,6 +35,7 @@ from iptools import AddrInNet
|
||||||
syslog.openlog('firewall')
|
syslog.openlog('firewall')
|
||||||
|
|
||||||
debug = 1
|
debug = 1
|
||||||
|
db = crans_ldap()
|
||||||
|
|
||||||
class IptablesError(Exception):
|
class IptablesError(Exception):
|
||||||
""" Gestion des erreurs d'iptables """
|
""" Gestion des erreurs d'iptables """
|
||||||
|
@ -115,7 +116,7 @@ class firewall_crans :
|
||||||
""" Liste des machines du crans """
|
""" Liste des machines du crans """
|
||||||
if not self.machines :
|
if not self.machines :
|
||||||
self.anim = anim(" Interrogation de la base LDAP")
|
self.anim = anim(" Interrogation de la base LDAP")
|
||||||
self.machines = crans_ldap().search('ip=*')['machine']
|
self.machines = db.search('ip=*')['machine']
|
||||||
print OK
|
print OK
|
||||||
return self.machines
|
return self.machines
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ class firewall_crans :
|
||||||
mac_ip_maj = {}
|
mac_ip_maj = {}
|
||||||
serveur_maj = False
|
serveur_maj = False
|
||||||
for ip in ip_list :
|
for ip in ip_list :
|
||||||
machine = crans_ldap().search('ip=%s'% ip)['machine']
|
machine = db.search('ip=%s'% ip)['machine']
|
||||||
if not machine :
|
if not machine :
|
||||||
# Destruction des occurences
|
# Destruction des occurences
|
||||||
if AddrInNet(ip,self.zone_serveur) :
|
if AddrInNet(ip,self.zone_serveur) :
|
||||||
|
@ -291,7 +292,7 @@ class firewall_crans :
|
||||||
serveur_maj = True
|
serveur_maj = True
|
||||||
else :
|
else :
|
||||||
# Il faut avoir payé ou être une machine du crans ou un invite
|
# Il faut avoir payé ou être une machine du crans ou un invite
|
||||||
if crans_ldap().search('paiement=ok&ip=%s'% ip)['machine'] or \
|
if db.search('paiement=ok&ip=%s'% ip)['machine'] or \
|
||||||
machine[0].proprietaire().__class__ == crans or \
|
machine[0].proprietaire().__class__ == crans or \
|
||||||
machine[0].proprietaire().__class__ == invite :
|
machine[0].proprietaire().__class__ == invite :
|
||||||
mac_ip_maj[ip] = machine[0]
|
mac_ip_maj[ip] = machine[0]
|
||||||
|
@ -589,7 +590,7 @@ class firewall_komaz(firewall_crans) :
|
||||||
""" Reconstruit la chaine ADMIN_VLAN """
|
""" Reconstruit la chaine ADMIN_VLAN """
|
||||||
iptables("-F ADMIN_VLAN")
|
iptables("-F ADMIN_VLAN")
|
||||||
nounou_machines = []
|
nounou_machines = []
|
||||||
for adherent in crans_ldap().search('droits=Nounou')['adherent'] :
|
for adherent in db.search('droits=Nounou')['adherent'] :
|
||||||
for machine in adherent.machines() :
|
for machine in adherent.machines() :
|
||||||
nounou_machines.append(machine.ip())
|
nounou_machines.append(machine.ip())
|
||||||
|
|
||||||
|
@ -672,7 +673,7 @@ class firewall_komaz(firewall_crans) :
|
||||||
iptables('-F BLACKLIST_SRC')
|
iptables('-F BLACKLIST_SRC')
|
||||||
|
|
||||||
blacklist=[]
|
blacklist=[]
|
||||||
search = crans_ldap().search('blacklist=*&paiement=%s'% ann_scol)
|
search = db.search('blacklist=*&paiement=%s'% ann_scol)
|
||||||
for entite in search['adherent']+search['club']+search['machine']:
|
for entite in search['adherent']+search['club']+search['machine']:
|
||||||
self.anim.cycle()
|
self.anim.cycle()
|
||||||
sanctions = entite.blacklist_actif()
|
sanctions = entite.blacklist_actif()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue