summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Neulinger <nneul@neulinger.org>2015-08-18 13:11:43 -0500
committerNathan Neulinger <nneul@neulinger.org>2015-08-18 13:12:40 -0500
commit809dfa12c2d93930c1d031b209ae1f5ea8427aa2 (patch)
treeca1b89eaecf1e09442ec28efd9ca0195659bb8a5
parent0070be0e3609ae5dd918a3cd66c2183eb9042542 (diff)
downloadcracklib-809dfa12c2d93930c1d031b209ae1f5ea8427aa2.tar.gz
Modified patch from Mark Sirota to fix issue with locale based sorting
-rw-r--r--src/NEWS4
-rw-r--r--src/util/cracklib-format2
-rw-r--r--src/util/packer.c12
3 files changed, 16 insertions, 2 deletions
diff --git a/src/NEWS b/src/NEWS
index 92d8382..26abeee 100644
--- 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
diff --git a/src/util/cracklib-format b/src/util/cracklib-format
index 1f72005..1d7be5b 100644
--- a/src/util/cracklib-format
+++ b/src/util/cracklib-format
@@ -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
diff --git a/src/util/packer.c b/src/util/packer.c
index 70075eb..e3f9500 100644
--- a/src/util/packer.c
+++ b/src/util/packer.c
@@ -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);