Establish *PK* as mechanism for locked accounts with mail forwarding intact.
[mirror/userdir-ldap.git] / ud-generate
index 8baf226..03a5186 100755 (executable)
@@ -4,8 +4,8 @@
 
 #   Copyright (c) 2000-2001  Jason Gunthorpe <jgg@debian.org>
 #   Copyright (c) 2003-2004  James Troup <troup@debian.org>
-#   Copyright (c) 2004-2005  Joey Schulze <joey@infodrom.org>
-#   Copyright (c) 2001-2006  Ryan Murray <rmurray@debian.org>
+#   Copyright (c) 2004-2005,7  Joey Schulze <joey@infodrom.org>
+#   Copyright (c) 2001-2007  Ryan Murray <rmurray@debian.org>
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -180,7 +180,8 @@ def GenSSHShadow(l,File):
       # If the account is locked, do not write it.
       # This is a partial stop-gap. The ssh also needs to change this
       # to ignore ~/.ssh/authorized* files.
-      if (string.find(GetAttr(x,"userPassword"),"*LK*")  != -1):
+      if (string.find(GetAttr(x,"userPassword"),"*LK*")  != -1) \
+             or (string.find(GetAttr(x,"userPassword"),"*PK*")  != -1):
          continue;
 
       if x[1].has_key("uidNumber") == 0 or \
@@ -364,7 +365,8 @@ def GenPrivate(l,File):
          continue;
 
       # If the account is locked, do not write it
-      if (string.find(GetAttr(x,"userPassword"),"*LK*")  != -1):
+      if (string.find(GetAttr(x,"userPassword"),"*LK*")  != -1) \
+             or (string.find(GetAttr(x,"userPassword"),"*PK*")  != -1):
          continue;
 
       # If the account has no PGP key, do not write it
@@ -403,8 +405,7 @@ def GenMailDisable(l,File):
       Reason = None
       
       # If the account is locked, disable incoming mail
-      if (string.find(GetAttr(x,"userPassword"),"*LK*")  != -1) or \
-         x[1].has_key("keyFingerPrint") == 0:
+      if (string.find(GetAttr(x,"userPassword"),"*LK*")  != -1):
          Reason = "user account locked"
       else:
          if x[1].has_key("mailDisableMessage"):