From: Peter Palfrader Date: Mon, 15 Sep 2008 13:46:23 +0000 (+0200) Subject: Make it work on lenny too X-Git-Tag: release-0.3.33~52 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=commitdiff_plain;h=b450e2760413a9fa7e5b6b37bf51b80d89f23e79 Make it work on lenny too --- diff --git a/debian/control b/debian/control index 7aef882..4f7ed66 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Uploaders: Ryan Murray , Joey Schulze , Pet Package: userdir-ldap-cgi Architecture: all -Depends: userdir-ldap, perl5, libnet-ldap-perl, libcrypt-blowfish-perl, gnupg (>= 1.0.3), libdate-manip-perl, liburi-perl, libio-socket-ssl-perl, libossp-uuid-perl, libdigest-hmac-perl, python, python-crack, cracklib-runtime +Depends: userdir-ldap, perl5, libnet-ldap-perl, libcrypt-blowfish-perl, gnupg (>= 1.0.3), libdate-manip-perl, liburi-perl, libio-socket-ssl-perl, libossp-uuid-perl, libdigest-hmac-perl, python, python-crack | python-cracklib, cracklib-runtime Recommends: wamerican, wamerican-large, wamerican-small, wbritish, wbritish-large, wbritish-small, wbulgarian, wcanadian, wcanadian-large, wcanadian-small, wcatalan, wdanish, wdutch, wfaroese, wfinnish, wfrench, wgalician-minimos, witalian, wngerman, wnorwegian, wogerman, wpolish, wspanish, wswedish, wswiss, wukrainian Replaces: userdir-ldap Description: CGI programs for the db.debian.org diff --git a/password-qualify-check b/password-qualify-check index 45fd18d..8853f46 100755 --- a/password-qualify-check +++ b/password-qualify-check @@ -6,7 +6,11 @@ # Copyright (c) 2008 Peter Palfrader -import crack, sys, tempfile, os +import sys, tempfile, os +try: + import crack as cracklib +except ImportError: + import cracklib def cleanup(dir): if not dir.startswith('/tmp/pwcheck-'): @@ -20,6 +24,21 @@ def cleanup(dir): +crack_mkdict = None +crack_packer = None +for b in "/usr/sbin/crack_mkdict /usr/sbin/cracklib-format".split(' '): + if os.path.exists(b): + crack_mkdict = b + break +for b in "/usr/sbin/crack_packer /usr/sbin/cracklib-packer".split(' '): + if os.path.exists(b): + crack_packer = b + break +if crack_mkdict is None or crack_packer is None: + print "Could not find crack formater or packer" + sys.exit(1) + + newpass = sys.stdin.readline().strip() oldpass = sys.stdin.readline().strip() ldapwords = map( lambda x: x.strip(), sys.stdin.readlines()) @@ -28,11 +47,11 @@ if oldpass == "": oldpass = None -crack.min_length = 11 +cracklib.min_length = 11 # check against the default dictionary try: - crack.VeryFascistCheck(newpass, oldpass) + cracklib.VeryFascistCheck(newpass, oldpass, '/var/cache/cracklib/cracklib_dict') except ValueError, e: print e sys.exit(1) @@ -49,19 +68,19 @@ if len(ldapwords) > 0: F.write(w1[0]+w2+"\n"); F.close() - r = os.system("/usr/sbin/crack_mkdict "+tmpdir+"/wordlist > "+tmpdir+"/wordlist-cleaned") + r = os.system(crack_mkdict+" "+tmpdir+"/wordlist > "+tmpdir+"/wordlist-cleaned") if r != 0: print "crack_mkdict returned non-zero exit status %d."%(r) cleanup(tmpdir) sys.exit(1) - r = os.system("/usr/sbin/crack_packer "+tmpdir+"/dict < "+tmpdir+"/wordlist-cleaned > /dev/null") + r = os.system(crack_packer+" "+tmpdir+"/dict < "+tmpdir+"/wordlist-cleaned > /dev/null") if r != 0: print "crack_packer returned non-zero exit status %d."%(r) cleanup(tmpdir) sys.exit(1) try: - crack.VeryFascistCheck(newpass, None, tmpdir+"/dict") + cracklib.VeryFascistCheck(newpass, None, tmpdir+"/dict") except ValueError, e: print "ldap data based check: "+str(e) cleanup(tmpdir)