d3e5311
diff -up cracklib-2.9.6/lib/fascist.c.simplistic cracklib-2.9.6/lib/fascist.c
d3e5311
--- cracklib-2.9.6/lib/fascist.c.simplistic	2015-10-22 18:21:51.099748012 +0200
d3e5311
+++ cracklib-2.9.6/lib/fascist.c	2015-10-22 18:21:51.101748060 +0200
d8d7368
@@ -55,7 +55,6 @@ static char *r_destructors[] = {
d8d7368
 
d8d7368
     "/?p@?p",                   /* purging out punctuation/symbols/junk */
d8d7368
     "/?s@?s",
d8d7368
-    "/?X@?X",
d8d7368
 
d8d7368
     /* attempt reverse engineering of password strings */
d8d7368
 
d8d7368
@@ -454,6 +453,12 @@ GTry(rawtext, password)
d8d7368
 	    continue;
d8d7368
 	}
d8d7368
 
d8d7368
+	if (len - strlen(mp) >= 3)
d8d7368
+	{
d8d7368
+	    /* purged too much */
d8d7368
+	    continue;
d8d7368
+	}
d8d7368
+
d8d7368
 #ifdef DEBUG
d8d7368
 	printf("%-16s = %-16s (destruct %s)\n", mp, rawtext, r_destructors[i]);
d8d7368
 #endif
d8d7368
@@ -480,6 +485,12 @@ GTry(rawtext, password)
d8d7368
 	    continue;
d8d7368
 	}
d8d7368
 
d8d7368
+	if (len - strlen(mp) >= 3)
d8d7368
+	{
d8d7368
+	    /* purged too much */
d8d7368
+	    continue;
d8d7368
+	}
d8d7368
+
d8d7368
 #ifdef DEBUG
d8d7368
 	printf("%-16s = %-16s (construct %s)\n", mp, password, r_constructors[i]);
d8d7368
 #endif
d8d7368
@@ -699,6 +710,7 @@ FascistLookUser(PWDICT *pwp, char *instr
d8d7368
     char rpassword[STRINGSIZE];
d8d7368
     char area[STRINGSIZE];
d8d7368
     uint32_t notfound;
d8d7368
+    int len;
d8d7368
 
d8d7368
     notfound = PW_WORDS(pwp);
d8d7368
     /* already truncated if from FascistCheck() */
d8d7368
@@ -748,6 +760,7 @@ FascistLookUser(PWDICT *pwp, char *instr
d8d7368
 	return _("it is all whitespace");
d8d7368
     }
d8d7368
 
d8d7368
+    len = strlen(password);
d8d7368
     i = 0;
d8d7368
     ptr = password;
d8d7368
     while (ptr[0] && ptr[1])
d8d7368
@@ -759,10 +772,9 @@ FascistLookUser(PWDICT *pwp, char *instr
d8d7368
 	ptr++;
d8d7368
     }
d8d7368
 
ec8362e
-    /*  Change by Ben Karsin from ITS at University of Hawaii at Manoa.  Static MAXSTEP
d8d7368
-        would generate many false positives for long passwords. */
d8d7368
-    maxrepeat = 3+(0.09*strlen(password));
d8d7368
-    if (i > maxrepeat)
d8d7368
+    /*  We were still generating false positives for long passwords.
d8d7368
+        Just count systematic double as a single character. */
d8d7368
+    if (len - i < MINLEN)
d8d7368
     {
d8d7368
 	return _("it is too simplistic/systematic");
d8d7368
     }
d8d7368
@@ -795,6 +807,12 @@ FascistLookUser(PWDICT *pwp, char *instr
d8d7368
 	    continue;
d8d7368
 	}
d8d7368
 
d8d7368
+	if (len - strlen(a) >= 3)
d8d7368
+	{
d8d7368
+	    /* purged too much */
d8d7368
+	    continue;
d8d7368
+	}
d8d7368
+
d8d7368
 #ifdef DEBUG
d8d7368
 	printf("%-16s (dict)\n", a);
d8d7368
 #endif
d8d7368
@@ -815,6 +833,13 @@ FascistLookUser(PWDICT *pwp, char *instr
d8d7368
 	{
d8d7368
 	    continue;
d8d7368
 	}
d8d7368
+
d8d7368
+	if (len - strlen(a) >= 3)
d8d7368
+	{
d8d7368
+	    /* purged too much */
d8d7368
+	    continue;
d8d7368
+	}
d8d7368
+
d8d7368
 #ifdef DEBUG
d8d7368
 	printf("%-16s (reversed dict)\n", a);
d8d7368
 #endif
d3e5311
diff -up cracklib-2.9.6/util/cracklib-format.simplistic cracklib-2.9.6/util/cracklib-format
d3e5311
--- cracklib-2.9.6/util/cracklib-format.simplistic	2015-10-22 18:21:51.101748060 +0200
d3e5311
+++ cracklib-2.9.6/util/cracklib-format	2014-07-09 17:24:45.000000000 +0200
3c36ea8
@@ -3,8 +3,10 @@
3c36ea8
 # This preprocesses a set of word lists into a suitable form for input
3c36ea8
 # into cracklib-packer
3c36ea8
 #
3c36ea8
+LC_ALL=C
3c36ea8
+export LC_ALL
3c36ea8
 gzip -cdf "$@" |
d3e5311
-    grep -v '^\(#\|$\)' |
3c36ea8
-    tr '[A-Z]' '[a-z]' |
3c36ea8
-    tr -cd '\012[a-z][0-9]' |
d3e5311
-    env LC_ALL=C sort -u
bc61ed0
+    grep -a -E -v '^.{32,}$' |
3c36ea8
+    tr '[:upper:]' '[:lower:]' |
3c36ea8
+    tr -cd '\n[:graph:]' |
d3e5311
+    sort -u