* some ud-echelon fixes,
* userdir_gpg.py: GetClearSig: add lax_multipart to deal
with random multipart mails.
+ * naming your variable like a module is unsmart.
- -- Peter Palfrader <weasel@debian.org> Sat, 21 May 2011 15:12:23 +0200
+ -- Peter Palfrader <weasel@debian.org> Sat, 21 May 2011 16:03:00 +0200
userdir-ldap (0.3.79) unstable; urgency=low
# Get the email
ErrType = EX_PERMFAIL;
ErrMsg = "Failed to understand the email or find a signature:";
- email = email.parser.Parser().parse(sys.stdin);
- MsgID = email["Message-ID"]
+ mail = email.parser.Parser().parse(sys.stdin);
+ MsgID = mail["Message-ID"]
print "Inspecting message %s"%MsgID;
verbmsg("Processing message %s" % MsgID)
- Msg = GetClearSig(email,1);
+ Msg = GetClearSig(mail,1);
if AllowMIME == 0 and Msg[1] != 0:
raise Error, "PGP/MIME disallowed";
Debug = None;
# Try to extract a key fingerprint from a PGP siged message
-def TryGPG(email):
+def TryGPG(mail):
# Try to get a pgp text
try:
- Msg = GetClearSig(email, lax_multipart=True);
+ Msg = GetClearSig(mail, lax_multipart=True);
except:
# Log an exception.. but continue. This is to deal with 'sort of'
# PGP-MIME things
# Failed to find a matching sig
if not pgp.ok:
- S = "%s: %s -> PGP Checking failed '%s': %s %s\n" %(Now,MsgID,email["From"],str(pgp.why),str(pgp.key_info));
+ S = "%s: %s -> PGP Checking failed '%s': %s %s\n" %(Now,MsgID,mail["From"],str(pgp.why),str(pgp.key_info));
ErrLog.write(S);
return None;
return (Attrs[0][1]["uid"][0],"PGP",FormatPGPKey(pgp.key_fpr));
# Try to guess the name from the email address
-def TryMatcher(email):
- Sender = email["From"];
+def TryMatcher(mail):
+ Sender = mail["From"];
if Sender == None:
return None;
# Get the email
ErrType = EX_PERMFAIL;
ErrMsg = "Failed to understand the email or find a signature:";
- email = email.parser.Parser().parse(sys.stdin);
- MsgID = email["Message-ID"]
+ mail = email.parser.Parser().parse(sys.stdin);
+ MsgID = mail["Message-ID"]
# Connect to the ldap server
ErrType = EX_TEMPFAIL;
# Try to decode
ErrType = EX_TEMPFAIL;
ErrMsg = "An error occured while trying GPG decoding";
- User = TryGPG(email);
+ User = TryGPG(mail);
if User == None:
ErrMsg = "An error occured while trying Matcher decoding";
- User = TryMatcher(email);
+ User = TryMatcher(mail);
# Get any mailing list information
- List = email['X-Mailing-List']
+ List = mail['X-Mailing-List']
if not List: List = "-";
# Tada, write a log message
else:
print Rec;
else:
- User = ("-","UKN",email["From"]);
+ User = ("-","UKN",mail["From"]);
Msg = "[%s] \"%s\" \"%s\" \"%s\""%(Now,User[2],List,MsgID);
MainLog.write("%s %s %s\n"%(User[0],User[1],Msg));
# Get the email
ErrType = EX_PERMFAIL;
ErrMsg = "Failed to understand the email or find a signature:";
- email = email.parser.Parser().parse(sys.stdin);
- Msg = GetClearSig(email);
+ mail = email.parser.Parser().parse(sys.stdin);
+ Msg = GetClearSig(mail);
ErrMsg = "Message is not PGP signed:"
if Msg[0].find("-----BEGIN PGP SIGNED MESSAGE-----") == -1 and \
# Determine the sender address
ErrMsg = "A problem occured while trying to formulate the reply";
- Sender = email['Reply-To']
- if not Sender: Sender = email['From']
+ Sender = mail['Reply-To']
+ if not Sender: Sender = mail['From']
if not Sender: raise UDFormatError, "Unable to determine the sender's address";
# Formulate a reply