X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=30c9514d273550b420f97c6825f469fbb31a3279;hb=6a15e53a56957d6c60acdda0352df406646d5d4e;hp=a37b047b59a620017d86a4a80dce10f088ee3296;hpb=200c280e08a33e415aae8c7f0da289284d2c4504;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index a37b047..30c9514 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -41,12 +41,12 @@ ValidHostNames = [] # will be initialized in later SSHFingerprint = re.compile('^(\d+) ([0-9a-f\:]{47}) (.+)$') SSHRSA1Match = re.compile('^^(.* )?\d+ \d+ \d+') -GenderTable = {"male": 1, - "1": 1, - "female": 2, - "2": 2, - "unspecified": 9, - "9": 9, +GenderTable = {"male": '1', + "1": '1', + "female": '2', + "2": '2', + "unspecified": '9', + "9": '9', }; ArbChanges = {"c": "..", @@ -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);