Detabification massive.

darcs-hash:20051018083823-d1718-09c2df38cfb707d3c3679188b9b9a812009f4f7c.gz
This commit is contained in:
bernat 2005-10-18 10:38:23 +02:00
parent 3c54fb2904
commit 37b21339a6
40 changed files with 1473 additions and 1473 deletions

View file

@ -17,44 +17,44 @@ def chap_ok(password, challenge, clear_pass) :
retourne False sinon
"""
try :
challenge = binascii.a2b_hex(challenge.replace('0x',''))
password = binascii.a2b_hex(password.replace('0x',''))
challenge = binascii.a2b_hex(challenge.replace('0x',''))
password = binascii.a2b_hex(password.replace('0x',''))
if md5.new(password[0] + clear_pass + challenge).digest() == password[1:] :
return True
return True
except :
pass
pass
return False
if __name__ == '__main__' :
# Test chap (comme cela on est sur que c'est bien un switch qui demande)
mac=os.getenv('USER_NAME','').replace('"','')
if not chap_ok(os.getenv('CHAP_PASSWORD'), os.getenv('CHAP_CHALLENGE'), mac) :
sys.stdout.write("Echec test CHAP")
sys.exit(-1)
sys.stdout.write("Echec test CHAP")
sys.exit(-1)
# Mac dans la base LDAP
m=crans_ldap().search('mac=%s'%mac)['machine']
if len(m)!=1 :
sys.stdout.write("Pb recherche mac (nb résultat !=1)")
sys.exit(-1)
sys.stdout.write("Pb recherche mac (nb résultat !=1)")
sys.exit(-1)
# N'appartient pas au Crans (évite les spoof)
proprio=m[0].proprietaire()
# if proprio.__class__ == crans :
# sys.stdout.write("Machine du crans")
# sys.exit(-1)
# sys.stdout.write("Machine du crans")
# sys.exit(-1)
# Paiment ok ?
paid=max(proprio.paiement()+[0])
if dat[1]==9 :
# En septembre les anciennes adhésion sont OK
ann_scol -= 1
# En septembre les anciennes adhésion sont OK
ann_scol -= 1
if ann_scol > paid :
sys.stdout.write("Echec test LDAP")
sys.exit(-1)
sys.stdout.write("Echec test LDAP")
sys.exit(-1)
# C'est bon
sys.stdout.write("Acces OK")
sys.exit(0)