Blame SOURCES/cracklib-2.9.6-simplistic.patch

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