X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=userdir_ldap.py;h=a8b62fe7f4d7c10303c89000dc4cf19c71340f53;hb=91ce4ae2f194d2fa00716d0bfab5b77be74e0f6e;hp=0ea96a9571cc9ded039aab066544309236e29c30;hpb=a86d975ac15e074f142c75ba5c74596be92e740d;p=mirror%2Fuserdir-ldap.git diff --git a/userdir_ldap.py b/userdir_ldap.py index 0ea96a9..a8b62fe 100644 --- a/userdir_ldap.py +++ b/userdir_ldap.py @@ -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!";