GenShadow
[mirror/userdir-ldap.git] / UDLdap.py
index f11c8b3..5b0caa7 100644 (file)
--- a/UDLdap.py
+++ b/UDLdap.py
@@ -3,7 +3,7 @@ import time
 import userdir_ldap
 
 class Account:
-    array_values = ['keyFingerPrint', 'mailWhitelist', 'mailRBL', 'mailRHSBL', 'supplementaryGid', 'sshRSAAuthKey']
+    array_values = ['keyFingerPrint', 'mailWhitelist', 'mailRBL', 'mailRHSBL', 'supplementaryGid', 'sshRSAAuthKey', 'sudoPassword']
     int_values = ['shadowExpire', 'gidNumber']
     defaults = {
                  'accountStatus': 'active',
@@ -55,10 +55,17 @@ class Account:
     def pw_active(self):
         if self['userPassword'] == '{crypt}*LK*':
             return False
-        if self['userPassword'].startswith("!"):
+        if self['userPassword'].startswith("{crypt}!"):
             return False
         return True
 
+    def get_password(self):
+        p = self['userPassword']
+        if not p.startswith('{crypt}') or len(p) > 50:
+            return p
+        else:
+            return p[7:]
+
     # not expired
     def shadow_active(self):
         if 'shadowExpire' in self and \