2013-12-09 10:38:54 +00:00
|
|
|
diff -up cracklib-2.9.1/lib/packer.h.lookup cracklib-2.9.1/lib/packer.h
|
|
|
|
--- cracklib-2.9.1/lib/packer.h.lookup 2013-12-09 09:52:42.153260712 +0100
|
|
|
|
+++ cracklib-2.9.1/lib/packer.h 2013-12-09 09:52:42.155260757 +0100
|
2013-08-21 13:36:05 +00:00
|
|
|
@@ -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)
|
2013-12-09 10:38:54 +00:00
|
|
|
diff -up cracklib-2.9.1/lib/packlib.c.lookup cracklib-2.9.1/lib/packlib.c
|
|
|
|
--- cracklib-2.9.1/lib/packlib.c.lookup 2013-12-03 15:00:15.000000000 +0100
|
|
|
|
+++ cracklib-2.9.1/lib/packlib.c 2013-12-09 09:53:43.580643470 +0100
|
2013-08-21 13:36:05 +00:00
|
|
|
@@ -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]);
|
2013-12-09 10:38:54 +00:00
|
|
|
@@ -526,13 +526,16 @@ GetPW(pwp, number)
|
|
|
|
return NULL;
|
2013-08-21 13:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- 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++)
|
|
|
|
{
|
2013-12-09 10:38:54 +00:00
|
|
|
@@ -543,6 +546,9 @@ GetPW(pwp, number)
|
2013-08-21 13:36:05 +00:00
|
|
|
while ((*(ostr++) = *(bptr++)));
|
|
|
|
|
|
|
|
ostr = nstr;
|
|
|
|
+#if DEBUG
|
|
|
|
+ fprintf(stderr, "data_get[%d]: %s\n", i, ostr);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return (pwp->data_get[number % NUMWORDS]);
|
2013-12-09 10:38:54 +00:00
|
|
|
@@ -621,22 +627,28 @@ fprintf(stderr, "look for (%s)\n", strin
|
2013-08-21 13:36:05 +00:00
|
|
|
return(middle);
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (middle == hwm)
|
|
|
|
- {
|
2013-12-09 10:38:54 +00:00
|
|
|
-#if DEBUG
|
2013-08-21 13:36:05 +00:00
|
|
|
- fprintf(stderr, "at terminal subdivision, stopping search\n");
|
2013-12-09 10:38:54 +00:00
|
|
|
-#endif
|
|
|
|
- break;
|
2013-08-21 13:36:05 +00:00
|
|
|
- }
|
|
|
|
-
|
2013-12-09 10:38:54 +00:00
|
|
|
if (cmp < 0)
|
|
|
|
{
|
2013-08-21 13:36:05 +00:00
|
|
|
- hwm = middle;
|
2013-12-09 10:38:54 +00:00
|
|
|
- }
|
|
|
|
+ if (middle == lwm)
|
|
|
|
+ {
|
|
|
|
+#if DEBUG
|
|
|
|
+ fprintf(stderr, "at terminal subdivision from right, stopping search\n");
|
|
|
|
+#endif
|
|
|
|
+ break;
|
2013-08-21 13:36:05 +00:00
|
|
|
+ }
|
|
|
|
+ hwm = middle - 1;
|
2013-12-09 10:38:54 +00:00
|
|
|
+ }
|
2013-08-21 13:36:05 +00:00
|
|
|
else if (cmp > 0)
|
|
|
|
{
|
|
|
|
- lwm = middle;
|
2013-12-09 10:38:54 +00:00
|
|
|
- }
|
2013-08-21 13:36:05 +00:00
|
|
|
+ if (middle == hwm)
|
|
|
|
+ {
|
|
|
|
+#if DEBUG
|
|
|
|
+ fprintf(stderr, "at terminal subdivision from left, stopping search\n");
|
|
|
|
+#endif
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ lwm = middle + 1;
|
2013-12-09 10:38:54 +00:00
|
|
|
+ }
|
2013-08-21 13:36:05 +00:00
|
|
|
}
|
|
|
|
|
2013-12-09 10:38:54 +00:00
|
|
|
return (PW_WORDS(pwp));
|