From 03bfe6ae8eff37dc249b92f4b1323423b9b06d27 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 13 Sep 2008 16:35:17 +0200 Subject: [PATCH] ud-mailgate: Do not commit any changes if one of the requests is invalid or could not be parsed or caused an error or anything. --- debian/changelog | 7 +++++++ ud-mailgate | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 310ee36..3c8dd01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +userdir-ldap (0.3.3xxx) unstable; urgency=low + + * ud-mailgate: Do not commit any changes if one of the requests is invalid + or could not be parsed or caused an error or anything. + + -- Peter Palfrader Sat, 13 Sep 2008 16:29:37 +0200 + userdir-ldap (0.3.36) unstable; urgency=low * Aha. Error is not some magic variable or exception, it's a diff --git a/ud-mailgate b/ud-mailgate index 16f6a59..fdf9d71 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -454,6 +454,7 @@ def HandleChange(Reply,DnRecord,Key): Result = ""; Attrs = []; Show = 0; + CommitChanges = 1 for Line in Lines: Line = Line.strip() if Line == "": @@ -477,7 +478,8 @@ def HandleChange(Reply,DnRecord,Key): # Fail, if someone tries to send someone elses signed email to the # daemon then we want to abort ASAP. if Res == None: - Result = Result + "Command is not understood. Halted\n"; + CommitChanges = 0 + Result = Result + "Command is not understood. Halted - no changes committed\n"; break; Result = Result + Res + "\n"; @@ -494,7 +496,8 @@ def HandleChange(Reply,DnRecord,Key): or GetAttr(oldAttrs[0],"userPassword").startswith("!")): raise Error, "This account is locked"; Dn = "uid=" + GetAttr(DnRecord,"uid") + "," + BaseDn; - l.modify_s(Dn,Attrs); + if CommitChanges == 1: + l.modify_s(Dn,Attrs); Attribs = ""; if Show == 1: -- 2.20.1