X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=32985d1c2c5f6a78714798e80a58395cd7b2f0c6;hb=f60516f70fc0e00488de904c44b86428706f39f4;hp=b40be70d2488ba3469e05cba69cc1b5c3d24116d;hpb=786f3f9a89d13adcf5e742c9a7e1630d3f6b57f1;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index b40be70..32985d1 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -189,10 +189,11 @@ def DoArbChange(Str, Attrs): if i.lower() == attrName: attrName = i break - if attrName in ArbChanges: + if attrName not in ArbChanges: return None - if re.match(ArbChanges[attrName], G[1]) is None: + value = G[1] + if re.match(ArbChanges[attrName], value) is None: raise UDFormatError("Item does not match the required format" + ArbChanges[attrName]) Attrs.append((ldap.MOD_REPLACE, attrName, value)) @@ -493,7 +494,7 @@ def FinishConfirmSudopassword(lc, uid, Attrs, SudoPasswd): res = lc.search_s(BaseDn, ldap.SCOPE_ONELEVEL, "uid=" + uid, ['sudoPassword']) if len(res) != 1: raise UDFormatError("Not exactly one hit when searching for user") - if sudoPassword in res[0][1]: + if 'sudoPassword' in res[0][1]: inldap = res[0][1]['sudoPassword'] else: inldap = []