Commit da83f591 authored by Vincent Le gallic's avatar Vincent Le gallic

Je m'en fous, j'utilise la version de la branche de dev

parent 771a76d7
......@@ -19,7 +19,7 @@ import re
import random
import string
import datetime
import gnupg
#import gnupg #disponible seulement sous wheezy
try:
import clientconfig as config
except ImportError:
......@@ -178,32 +178,32 @@ def update_keys():
def check_keys():
"""Vérifie les clés existantes"""
keys = all_keys()
gpg = gnupg.GPG(gnupghome='~/.gnupg')
localkeys = gpg.list_keys()
failed = False
for (mail, fpr) in keys.values():
if fpr:
if VERB: print "Checking %s" % (mail)
corresponds = [key for key in localkeys if key["fingerprint"] == fpr]
# On vérifie qu'on possède la clé…
if len(corresponds) == 1:
correspond = corresponds[0]
# …qu'elle correspond au mail…
if mail.lower() in sum([re.findall("<(.*)>", uid.lower()) for uid in correspond["uids"]], []):
meaning, trustvalue = GPG_TRUSTLEVELS[correspond["trust"]]
# … et qu'on lui fait confiance
if not trustvalue:
print (u"--> Fail on %s:%s\nLa confiance en la clé est : %s" % (meaning,)).encode("utf-8")
failed = True
else:
print (u"--> Fail on %s:%s\n!! Le fingerprint et le mail ne correspondent pas !" % (fpr, mail)).encode("utf-8")
failed = True
else:
print (u"--> Fail on %s:%s\nPas (ou trop) de clé avec ce fingerprint." % (fpr, mail)).encode("utf-8")
failed = True
return not failed
print "Who cares ?"
# keys = all_keys()
# gpg = gnupg.GPG(gnupghome='~/.gnupg')
# localkeys = gpg.list_keys()
# failed = False
# for (mail, fpr) in keys.values():
# if fpr:
# if VERB: print "Checking %s" % (mail)
# corresponds = [key for key in localkeys if key["fingerprint"] == fpr]
# # On vérifie qu'on possède la clé…
# if len(corresponds) == 1:
# correspond = corresponds[0]
# # …qu'elle correspond au mail…
# if mail.lower() in sum([re.findall("<(.*)>", uid.lower()) for uid in correspond["uids"]], []):
# meaning, trustvalue = GPG_TRUSTLEVELS[correspond["trust"]]
# # … et qu'on lui fait confiance
# if not trustvalue:
# print (u"--> Fail on %s:%s\nLa confiance en la clé est : %s" % (meaning,)).encode("utf-8")
# failed = True
# else:
# print (u"--> Fail on %s:%s\n!! Le fingerprint et le mail ne correspondent pas !" % (fpr, mail)).encode("utf-8")
# failed = True
# else:
# print (u"--> Fail on %s:%s\nPas (ou trop) de clé avec ce fingerprint." % (fpr, mail)).encode("utf-8")
# failed = True
# return not failed
def get_recipients_of_roles(roles):
"""Renvoie les destinataires d'un rôle"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment