X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=userdir_gpg.py;h=b181abed8242b30f01d2e7ec5be279911d368bfe;hb=2525bf73603cb6487cfcea096e2dc347ad360394;hp=21bc1387dbf32975fd979fdbbf7714a1ec9bf925;hpb=37b0b5875ff83d8e9a9e8ca918d42fc32b720f06;p=mirror%2Fuserdir-ldap.git diff --git a/userdir_gpg.py b/userdir_gpg.py index 21bc138..b181abe 100644 --- a/userdir_gpg.py +++ b/userdir_gpg.py @@ -19,8 +19,7 @@ import rfc822, time, fcntl, FCNTL, anydbm GPGPath = "gpg" GPGBasicOptions = ["--no-options","--batch","--load-extension","rsa",\ "--no-default-keyring","--always-trust"]; -GPGKeyRings = ["--keyring","/usr/share/keyrings/debian-keyring.pgp",\ - "--keyring","/usr/share/keyrings/debian-keyring.gpg"]; +GPGKeyRings = []; GPGSigOptions = ["--output","-"]; GPGSearchOptions = ["--dry-run","--with-colons","--fingerprint"]; GPGEncryptOptions = ["--output","-","--quiet","--always-trust",\ @@ -34,6 +33,12 @@ CleanCutOff = 7*24*60*60; AgeCutOff = 4*24*60*60; FutureCutOff = 3*24*60*60; +# Set the keyrings, the input is a list of keyrings +def SetKeyrings(Rings): + for x in Rings: + GPGKeyRings.append("--keyring"); + GPGKeyRings.append(x); + # GetClearSig takes an un-seekable email message stream (mimetools.Message) # and returns a standard PGP '---BEGIN PGP SIGNED MESSAGE---' bounded # clear signed text. @@ -88,7 +93,7 @@ def GetClearSig(Msg): if Msg.getparam('micalg') != None: Output = Output + "Hash: %s\r\n"%(string.upper(Msg.getparam('micalg')[4:])); Output = Output + "\r\n"; - Output = Output + Signed.getvalue() + Signature; + Output = Output + string.replace(Signed.getvalue(),"\n---","\n- ---") + Signature; return (Output,1); else: # Just return the message body @@ -342,6 +347,7 @@ def GPGKeySearch(SearchCriteria): Result = []; Owner = ""; KeyID = ""; + Hits = {}; try: Strm = os.popen(string.join(Args," "),"r"); @@ -360,6 +366,9 @@ def GPGKeySearch(SearchCriteria): # Output the key if Split[0] == 'fpr': + if Hits.has_key(Split[9]): + continue; + Hits[Split[9]] = None; Result.append( (KeyID,Split[9],Owner,Length) ); finally: if Strm != None: