Update from samosa: Modified support for locked accounts, i.e. don't
authorjoey <>
Sat, 6 Nov 2004 15:19:05 +0000 (15:19 +0000)
committerjoey <>
Sat, 6 Nov 2004 15:19:05 +0000 (15:19 +0000)
permit to alter data of locked accounts

ud-mailgate

index fa4cf86..18cebfb 100755 (executable)
@@ -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);