projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add changelog entry for global mail-default-options generation
[mirror/userdir-ldap.git]
/
ud-echelon
diff --git
a/ud-echelon
b/ud-echelon
index
2c0f984
..
38e0718
100755
(executable)
--- a/
ud-echelon
+++ b/
ud-echelon
@@
-11,10
+11,10
@@
EX_PERMFAIL = 65; # EX_DATAERR
Debug = None;
# Try to extract a key fingerprint from a PGP siged message
Debug = None;
# Try to extract a key fingerprint from a PGP siged message
-def TryGPG(
e
mail):
+def TryGPG(mail):
# Try to get a pgp text
try:
# Try to get a pgp text
try:
- Msg = GetClearSig(
email
);
+ Msg = GetClearSig(
mail, lax_multipart=True
);
except:
# Log an exception.. but continue. This is to deal with 'sort of'
# PGP-MIME things
except:
# Log an exception.. but continue. This is to deal with 'sort of'
# PGP-MIME things
@@
-30,7
+30,7
@@
def TryGPG(email):
# Failed to find a matching sig
if not pgp.ok:
# Failed to find a matching sig
if not pgp.ok:
- S = "%s: %s -> PGP Checking failed '%s': %s %s\n" %(Now,MsgID,
e
mail["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;
ErrLog.write(S);
return None;
@@
-44,8
+44,8
@@
def TryGPG(email):
return (Attrs[0][1]["uid"][0],"PGP",FormatPGPKey(pgp.key_fpr));
# Try to guess the name from the email address
return (Attrs[0][1]["uid"][0],"PGP",FormatPGPKey(pgp.key_fpr));
# Try to guess the name from the email address
-def TryMatcher(
e
mail):
- Sender =
e
mail["From"];
+def TryMatcher(mail):
+ Sender = mail["From"];
if Sender == None:
return None;
if Sender == None:
return None;
@@
-88,8
+88,8
@@
try:
# Get the email
ErrType = EX_PERMFAIL;
ErrMsg = "Failed to understand the email or find a signature:";
# Get the email
ErrType = EX_PERMFAIL;
ErrMsg = "Failed to understand the email or find a signature:";
-
e
mail = email.parser.Parser().parse(sys.stdin);
- MsgID =
e
mail["Message-ID"]
+ mail = email.parser.Parser().parse(sys.stdin);
+ MsgID = mail["Message-ID"]
# Connect to the ldap server
ErrType = EX_TEMPFAIL;
# Connect to the ldap server
ErrType = EX_TEMPFAIL;
@@
-107,16
+107,14
@@
try:
# Try to decode
ErrType = EX_TEMPFAIL;
ErrMsg = "An error occured while trying GPG decoding";
# Try to decode
ErrType = EX_TEMPFAIL;
ErrMsg = "An error occured while trying GPG decoding";
- User = TryGPG(
e
mail);
+ User = TryGPG(mail);
if User == None:
ErrMsg = "An error occured while trying Matcher decoding";
if User == None:
ErrMsg = "An error occured while trying Matcher decoding";
- User = TryMatcher(
e
mail);
+ User = TryMatcher(mail);
# Get any mailing list information
# Get any mailing list information
- if 'X-Mailing-List' in email:
- List = email['X-Mailing-List']
- else:
- List = "-";
+ List = mail['X-Mailing-List']
+ if not List: List = "-";
# Tada, write a log message
if User != None:
# Tada, write a log message
if User != None:
@@
-129,7
+127,7
@@
try:
else:
print Rec;
else:
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));
Msg = "[%s] \"%s\" \"%s\" \"%s\""%(Now,User[2],List,MsgID);
MainLog.write("%s %s %s\n"%(User[0],User[1],Msg));