Doc update
[mirror/userdir-ldap.git] / userdir_ldap.py
index 0ea96a9..a8b62fe 100644 (file)
@@ -1,5 +1,6 @@
 # Some routines and configuration that are used by the ldap progams
 import termios, TERMIOS, re, string, imp, ldap, sys, whrandom, crypt, rfc822;
+import userdir_gpg
 
 try:
    File = open("/etc/userdir-ldap/userdir-ldap.conf");
@@ -22,6 +23,9 @@ PassDir = ConfModule.passdir;
 Ech_ErrorLog = ConfModule.ech_errorlog;
 Ech_MainLog = ConfModule.ech_mainlog;
 
+# Break up the keyring list
+userdir_gpg.SetKeyrings(string.split(ConfModule.keyrings,":"));
+
 # This is a list of common last-name prefixes
 LastNamesPre = {"van": None, "le": None, "de": None, "di": None};
 
@@ -133,7 +137,7 @@ def GenPass():
    SaltVals = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/.";
    Rand = open("/dev/urandom");
    Password = "";
-   for i in range(0,10):
+   for i in range(0,15):
       Password = Password + SaltVals[ord(Rand.read(1)[0]) % len(SaltVals)];
    return Password;
 
@@ -143,8 +147,9 @@ def HashPass(Password):
    # glibc then just change Salt = "$1$" to Salt = "";
    SaltVals = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/.";
    Salt  = "$1$";
+   Rand = open("/dev/urandom");
    for x in range(0,10):
-      Salt = Salt + SaltVals[whrandom.randint(0,len(SaltVals)-1)];
+      Salt = Salt + SaltVals[ord(Rand.read(1)[0]) % len(SaltVals)];
    Pass = crypt.crypt(Password,Salt);
    if len(Pass) < 14:
       raise "Password Error", "MD5 password hashing failed, not changing the password!";