X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=userdir_gpg.py;h=d19130d0114fb776ba0c6da0cd10278abab2e7fb;hb=da220ff14d1cfc33e6606875a5260b8c73d00558;hp=39667d2c1f8ae25db0976eaaab8fc1650608a153;hpb=8ea8b0937fb83d1db795b20b96acccff2ab4025a;p=mirror%2Fuserdir-ldap.git diff --git a/userdir_gpg.py b/userdir_gpg.py index 39667d2..d19130d 100644 --- a/userdir_gpg.py +++ b/userdir_gpg.py @@ -83,7 +83,12 @@ def GetClearSig(Msg): # Append the PGP boundary header and the signature text to re-form the # original signed block [needs to convert to \r\n] - Output = "-----BEGIN PGP SIGNED MESSAGE-----\r\n\r\n" + Signed.getvalue() + Signature; + Output = "-----BEGIN PGP SIGNED MESSAGE-----\r\n"; + # Semi-evil hack to get the proper hash type inserted in the message + 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; return (Output,1); else: # Just return the message body @@ -337,6 +342,7 @@ def GPGKeySearch(SearchCriteria): Result = []; Owner = ""; KeyID = ""; + Hits = {}; try: Strm = os.popen(string.join(Args," "),"r"); @@ -355,6 +361,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: