GenSSHShadow
[mirror/userdir-ldap.git] / ud-generate
index 490376a..412e210 100755 (executable)
@@ -324,21 +324,17 @@ def GenSSHShadow():
    safe_makedirs(os.path.join(GlobalDir, 'userkeys'))
 
    for x in PasswdAttrs:
+      a = UDLdap.Account(x[0], x[1])
+      if not 'sshRSAAuthKey' in a: continue
 
-      if x[1].has_key("uidNumber") == 0 or \
-         x[1].has_key("sshRSAAuthKey") == 0:
-         continue
-
-      User = GetAttr(x, "uid")
       F = None
-
       try:
          OldMask = os.umask(0077)
-         File = os.path.join(GlobalDir, 'userkeys', User)
+         File = os.path.join(GlobalDir, 'userkeys', a['uid'])
          F = open(File + ".tmp", "w", 0600)
          os.umask(OldMask)
 
-         for I in x[1]["sshRSAAuthKey"]:
+         for I in a['sshRSAAuthKey']:
             MultipleLine = "%s" % I
             MultipleLine = Sanitize(MultipleLine) + "\n"
             F.write(MultipleLine)