|
|
db558d |
diff -up cracklib-2.9.0/lib/packer.h.lookup cracklib-2.9.0/lib/packer.h
|
|
|
db558d |
--- cracklib-2.9.0/lib/packer.h.lookup 2013-08-21 14:43:16.832990712 +0200
|
|
|
db558d |
+++ cracklib-2.9.0/lib/packer.h 2013-08-21 14:43:16.835990775 +0200
|
|
|
db558d |
@@ -60,6 +60,7 @@ typedef struct
|
|
|
db558d |
int count;
|
|
|
db558d |
char data_put[NUMWORDS][MAXWORDLEN];
|
|
|
db558d |
char data_get[NUMWORDS][MAXWORDLEN];
|
|
|
db558d |
+ uint32_t prevblock;
|
|
|
db558d |
} PWDICT;
|
|
|
db558d |
|
|
|
db558d |
#define PW_WORDS(x) ((x)->header.pih_numwords)
|
|
|
db558d |
diff -up cracklib-2.9.0/lib/packlib.c.lookup cracklib-2.9.0/lib/packlib.c
|
|
|
db558d |
--- cracklib-2.9.0/lib/packlib.c.lookup 2013-06-01 16:47:13.000000000 +0200
|
|
|
db558d |
+++ cracklib-2.9.0/lib/packlib.c 2013-08-21 14:44:12.325177107 +0200
|
|
|
db558d |
@@ -84,6 +84,7 @@ PWOpen(prefix, mode)
|
|
|
db558d |
|
|
|
db558d |
memset(&pdesc, '\0', sizeof(pdesc));
|
|
|
db558d |
memset(&pdesc64, '\0', sizeof(pdesc64));
|
|
|
db558d |
+ pdesc.prevblock = 0xffffffff;
|
|
|
db558d |
|
|
|
db558d |
snprintf(iname, STRINGSIZE, "%s.pwi", prefix);
|
|
|
db558d |
snprintf(dname, STRINGSIZE, "%s.pwd", prefix);
|
|
|
db558d |
@@ -446,12 +447,11 @@ GetPW(pwp, number)
|
|
|
db558d |
register char *nstr;
|
|
|
db558d |
register char *bptr;
|
|
|
db558d |
char buffer[NUMWORDS * MAXWORDLEN];
|
|
|
db558d |
- static uint32_t prevblock = 0xffffffff;
|
|
|
db558d |
uint32_t thisblock;
|
|
|
db558d |
|
|
|
db558d |
thisblock = number / NUMWORDS;
|
|
|
db558d |
|
|
|
db558d |
- if (prevblock == thisblock)
|
|
|
db558d |
+ if (pwp->prevblock == thisblock)
|
|
|
db558d |
{
|
|
|
db558d |
#if DEBUG
|
|
|
db558d |
fprintf(stderr, "returning (%s)\n", pwp->data_get[number % NUMWORDS]);
|
|
|
db558d |
@@ -528,13 +528,16 @@ GetPW(pwp, number)
|
|
|
db558d |
return ((char *) 0);
|
|
|
db558d |
}
|
|
|
db558d |
|
|
|
db558d |
- prevblock = thisblock;
|
|
|
db558d |
+ pwp->prevblock = thisblock;
|
|
|
db558d |
|
|
|
db558d |
bptr = buffer;
|
|
|
db558d |
|
|
|
db558d |
for (ostr = pwp->data_get[0]; (*(ostr++) = *(bptr++)); /* nothing */ );
|
|
|
db558d |
|
|
|
db558d |
ostr = pwp->data_get[0];
|
|
|
db558d |
+#if DEBUG
|
|
|
db558d |
+ fprintf(stderr, "data_get[0]: %s\n", ostr);
|
|
|
db558d |
+#endif
|
|
|
db558d |
|
|
|
db558d |
for (i = 1; i < NUMWORDS; i++)
|
|
|
db558d |
{
|
|
|
db558d |
@@ -545,6 +548,9 @@ GetPW(pwp, number)
|
|
|
db558d |
while ((*(ostr++) = *(bptr++)));
|
|
|
db558d |
|
|
|
db558d |
ostr = nstr;
|
|
|
db558d |
+#if DEBUG
|
|
|
db558d |
+ fprintf(stderr, "data_get[%d]: %s\n", i, ostr);
|
|
|
db558d |
+#endif
|
|
|
db558d |
}
|
|
|
db558d |
|
|
|
db558d |
return (pwp->data_get[number % NUMWORDS]);
|
|
|
db558d |
@@ -623,21 +629,27 @@ fprintf(stderr, "look for (%s)\n", strin
|
|
|
db558d |
return(middle);
|
|
|
db558d |
}
|
|
|
db558d |
|
|
|
db558d |
- if (middle == hwm)
|
|
|
db558d |
- {
|
|
|
db558d |
+ if (cmp < 0)
|
|
|
db558d |
+ {
|
|
|
db558d |
+ if (middle == lwm)
|
|
|
db558d |
+ {
|
|
|
db558d |
#if DEBUG
|
|
|
db558d |
- fprintf(stderr, "at terminal subdivision, stopping search\n");
|
|
|
db558d |
+ fprintf(stderr, "at terminal subdivision from right, stopping search\n");
|
|
|
db558d |
#endif
|
|
|
db558d |
break;
|
|
|
db558d |
- }
|
|
|
db558d |
-
|
|
|
db558d |
- if (cmp < 0)
|
|
|
db558d |
- {
|
|
|
db558d |
- hwm = middle;
|
|
|
db558d |
+ }
|
|
|
db558d |
+ hwm = middle - 1;
|
|
|
db558d |
}
|
|
|
db558d |
else if (cmp > 0)
|
|
|
db558d |
{
|
|
|
db558d |
- lwm = middle;
|
|
|
db558d |
+ if (middle == hwm)
|
|
|
db558d |
+ {
|
|
|
db558d |
+#if DEBUG
|
|
|
db558d |
+ fprintf(stderr, "at terminal subdivision from left, stopping search\n");
|
|
|
db558d |
+#endif
|
|
|
db558d |
+ break;
|
|
|
db558d |
+ }
|
|
|
db558d |
+ lwm = middle + 1;
|
|
|
db558d |
}
|
|
|
db558d |
}
|
|
|
db558d |
|