Include accountname in totp url
[mirror/userdir-ldap-cgi.git] / password-qualify-check
index 8853f46..95af588 100755 (executable)
@@ -7,10 +7,7 @@
 # Copyright (c) 2008 Peter Palfrader
 
 import sys, tempfile, os
-try:
-  import crack as cracklib
-except ImportError:
-  import cracklib
+import cracklib
 
 def cleanup(dir):
   if not dir.startswith('/tmp/pwcheck-'):
@@ -58,6 +55,13 @@ except ValueError, e:
 
 # and against a dictionary created from the ldap info on this user
 if len(ldapwords) > 0:
+  # squeeze's cracklib-packer complains about '*' on input - it
+  # says 'skipping line: 1'
+  while '-' in ldapwords:
+    ldapwords.remove('-')
+  while '*' in ldapwords:
+    ldapwords.remove('*')
+
   tmpdir = tempfile.mkdtemp('', 'pwcheck-')
   F = open(tmpdir+'/wordlist', "w")
   for w in ldapwords: