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