]> granicus.if.org Git - cracklib/commitdiff
Modified patch from Mark Sirota to fix issue with locale based sorting
authorNathan Neulinger <nneul@neulinger.org>
Tue, 18 Aug 2015 18:11:43 +0000 (13:11 -0500)
committerNathan Neulinger <nneul@neulinger.org>
Tue, 18 Aug 2015 18:12:40 +0000 (13:12 -0500)
src/NEWS
src/util/cracklib-format
src/util/packer.c

index 92d83829b1b5e6832fe0fa5ad938efaf81a62a3b..26abeee98c77a952f3ec10fb96b0d8349967d321 100644 (file)
--- a/src/NEWS
+++ b/src/NEWS
@@ -1,3 +1,7 @@
+v2.9.6 updates to cracklib-words to add a bunch of other dictionary lists
+       migration to github
+       patch to add some particularly bad cases to the cracklib small dictionary (Matthew Miller)
+       patch to fix issue with sort and locale (Mark Sirota)
 v2.9.5 fix matching against first password in dictionary (Anton Dobkin)
 v2.9.4 remove doubled prototype
 v2.9.3 expose additional functions externally
index 1f72005c830898f081122c82951bc5d5f4079d22..1d7be5bb1f125e8356b040f73653c46ed9938760 100644 (file)
@@ -7,4 +7,4 @@ gzip -cdf "$@" |
     grep -v '^\(#\|$\)' |
     tr '[A-Z]' '[a-z]' |
     tr -cd '\012[a-z][0-9]' |
-    sort -u
+    env LC_ALL=C sort -u
index 70075ebb7fd45a3c30331de52903238740b8d00e..e3f9500e4283646fb82c37eae0a9809b16dc5d99 100644 (file)
@@ -20,7 +20,7 @@ main(argc, argv)
     unsigned long readed;
     unsigned long wrote;
     PWDICT *pwp;
-    char buffer[STRINGSIZE];
+    char buffer[STRINGSIZE], prev[STRINGSIZE];
     char *file;
 
     if (argc <= 1)
@@ -46,6 +46,7 @@ main(argc, argv)
     }
 
     wrote = 0;
+    prev[0] = '\0';
 
     for (readed = 0; fgets(buffer, STRINGSIZE, stdin); /* nothing */)
     {
@@ -61,6 +62,15 @@ main(argc, argv)
            continue;
        }
 
+       /*
+        * If this happens, strcmp() in FindPW() in packlib.c will be unhappy.
+        */
+       if (strcmp(buffer, prev) < 0)
+       {
+           fprintf(stderr, "warning: input out of order: '%s' should not follow '%s' (line %lu)\n", buffer, prev, readed);
+       }
+       strcpy(prev, buffer);
+
        if (PutPW(pwp, buffer))
        {
            fprintf(stderr, "error: PutPW '%s' line %luy\n", buffer, readed);