From 4960a0dea00ac93cbcdb2fb82f850aee8d4fb4e9 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 28 Feb 2011 22:45:48 +0100 Subject: [PATCH] Do not mess with sudo passwords if nothing changed --- debian/changelog | 6 ++++-- ud-mailgate | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 37d711a..d8b4fe7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,10 +9,12 @@ userdir-ldap (0.3.7X) Xnstable; urgency=low * Remove .pgp (v3 pgp key) keyrings from config. * Update guest welcome template. * ud-gpgimport: handle guest keyrings. - * ud-mailgate: Make updating of gender actually work. + * ud-mailgate: + - Make updating of gender actually work. + - Do not mess with sudo passwords if nothing changed. * templates/change-reply: say a word about subjects in mail to admin@db. - -- Peter Palfrader Wed, 02 Feb 2011 21:51:43 +0100 + -- Peter Palfrader Mon, 28 Feb 2011 22:45:32 +0100 userdir-ldap (0.3.78) unstable; urgency=low diff --git a/ud-mailgate b/ud-mailgate index 952a4dc..30c9514 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -506,6 +506,9 @@ def FinishConfirmSudopassword(l, uid, Attrs): global SudoPasswd result = "\n" + if len(SudoPasswd) == 0: + return None + res = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+uid, ['sudoPassword']); if len(res) != 1: raise UDFormatError, "Not exactly one hit when searching for user" @@ -614,7 +617,8 @@ def HandleChange(Reply,DnRecord,Key): if CommitChanges == 1: # only if we are still good to go try: Res = FinishConfirmSudopassword(l, GetAttr(DnRecord,"uid"), Attrs) - Result = Result + Res + "\n"; + if not Res is None: + Result = Result + Res + "\n"; except Error, e: CommitChanges = 0 Result = Result + "FinishConfirmSudopassword raised an error (%s) - no changes committed\n"%(e); -- 2.20.1