From: joey <> Date: Sat, 6 Nov 2004 15:19:05 +0000 (+0000) Subject: Update from samosa: Modified support for locked accounts, i.e. don't X-Git-Tag: debian_userdir-ldap_0-3-7~31 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=c6294c937ef25df2d39f946016efddb4eac1bbca Update from samosa: Modified support for locked accounts, i.e. don't permit to alter data of locked accounts --- diff --git a/ud-mailgate b/ud-mailgate index fa4cf86..18cebfb 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -268,6 +268,9 @@ def HandleChange(Reply,DnRecord,Key): # Modify the record l.simple_bind_s("uid="+AccessPass[0]+","+BaseDn,AccessPass[1]); + oldAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid")); + if (string.find(GetAttr(oldAttrs[0],"userPassword"),"*LK*") != -1): + raise Error, "This account is locked"; Dn = "uid=" + GetAttr(DnRecord,"uid") + "," + BaseDn; l.modify_s(Dn,Attrs); @@ -424,9 +427,6 @@ try: if Sender == None: raise Error, "Unable to determine the sender's address"; - if (string.find(GetAttr(Attrs[0],"userPassword"),"*LK*") != -1): - raise Error, "This account is locked"; - # Formulate a reply Date = time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(time.time())); Reply = "To: %s\nReply-To: %s\nDate: %s\n" % (Sender,ReplyTo,Date);