# -e /etc/userdir-ldap/templtes/error-reply -- test.sh
import sys, traceback, time, os;
# -e /etc/userdir-ldap/templtes/error-reply -- test.sh
import sys, traceback, time, os;
if ReplayCacheFile != None:
ErrMsg = "Failed to initialize the replay cache:";
RC = ReplayCache(ReplayCacheFile);
if ReplayCacheFile != None:
ErrMsg = "Failed to initialize the replay cache:";
RC = ReplayCache(ReplayCacheFile);
- Email = mimetools.Message(sys.stdin,0);
- MsgID = Email.getheader("Message-ID");
+ mail = email.parser.Parser().parse(sys.stdin);
+ MsgID = mail["Message-ID"]
+
if AllowMIME == 0 and Msg[1] != 0:
raise Error, "PGP/MIME disallowed";
ErrMsg = "Message is not PGP signed:"
if AllowMIME == 0 and Msg[1] != 0:
raise Error, "PGP/MIME disallowed";
ErrMsg = "Message is not PGP signed:"
raise Error, "No PGP signature";
# Check the signature
ErrMsg = "Unable to check the signature or the signature was invalid:";
raise Error, "No PGP signature";
# Check the signature
ErrMsg = "Unable to check the signature or the signature was invalid:";
- if Res[0] != None:
- raise Error, Res[0];
-
- if Res[3] == None:
- raise Error, "Null signature text";
+ if not pgp.ok:
+ raise UDFormatError, pgp.why
+ if pgp.text is None:
+ raise UDFormatError, "Null signature text"
- if string.find(Res[3],string.strip(Line)) == -1:
- raise Error,"Phrase '%s' was not found"%(string.strip(Line));
+ if pgp.text.find(Line.strip()) == -1:
+ raise Error,"Phrase '%s' was not found" % (Line.strip())
except:
ErrMsg = "[%s] \"%s\" \"%s %s\"\n"%(Now,MsgID,ErrMsg,sys.exc_value);
except:
ErrMsg = "[%s] \"%s\" \"%s %s\"\n"%(Now,MsgID,ErrMsg,sys.exc_value);