|
|
017226 |
diff -up cracklib-2.9.6/lib/fascist.c.reentrant cracklib-2.9.6/lib/fascist.c
|
|
|
017226 |
--- cracklib-2.9.6/lib/fascist.c.reentrant 2015-08-18 20:41:16.000000000 +0200
|
|
|
017226 |
+++ cracklib-2.9.6/lib/fascist.c 2015-10-22 18:17:20.338290974 +0200
|
|
|
017226 |
@@ -36,8 +36,8 @@ typedef unsigned short uint16_t;
|
|
|
017226 |
#undef DEBUG
|
|
|
017226 |
#undef DEBUG2
|
|
|
017226 |
|
|
|
017226 |
-extern char *Reverse(char *buf);
|
|
|
017226 |
-extern char *Lowercase(char *buf);
|
|
|
017226 |
+extern char *Reverse(char *buf, char *area);
|
|
|
017226 |
+extern char *Lowercase(char *buf, char *area);
|
|
|
017226 |
|
|
|
017226 |
static char *r_destructors[] = {
|
|
|
017226 |
":", /* noop - must do this to test raw word. */
|
|
|
017226 |
@@ -439,6 +439,8 @@ GTry(rawtext, password)
|
|
|
017226 |
int i;
|
|
|
017226 |
int len;
|
|
|
017226 |
char *mp;
|
|
|
017226 |
+ char area[STRINGSIZE];
|
|
|
017226 |
+ char revarea[STRINGSIZE];
|
|
|
017226 |
|
|
|
017226 |
/* use destructors to turn password into rawtext */
|
|
|
017226 |
/* note use of Reverse() to save duplicating all rules */
|
|
|
017226 |
@@ -447,7 +449,7 @@ GTry(rawtext, password)
|
|
|
017226 |
|
|
|
017226 |
for (i = 0; r_destructors[i]; i++)
|
|
|
017226 |
{
|
|
|
017226 |
- if (!(mp = Mangle(password, r_destructors[i])))
|
|
|
017226 |
+ if (!(mp = Mangle(password, r_destructors[i], area)))
|
|
|
017226 |
{
|
|
|
017226 |
continue;
|
|
|
017226 |
}
|
|
|
017226 |
@@ -462,10 +464,10 @@ GTry(rawtext, password)
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
#ifdef DEBUG
|
|
|
017226 |
- printf("%-16s = %-16s (destruct %s reversed)\n", Reverse(mp), rawtext, r_destructors[i]);
|
|
|
017226 |
+ printf("%-16s = %-16s (destruct %s reversed)\n", Reverse(mp, revarea), rawtext, r_destructors[i]);
|
|
|
017226 |
#endif
|
|
|
017226 |
|
|
|
017226 |
- if (!strncmp(Reverse(mp), rawtext, len))
|
|
|
017226 |
+ if (!strncmp(Reverse(mp, revarea), rawtext, len))
|
|
|
017226 |
{
|
|
|
017226 |
return (1);
|
|
|
017226 |
}
|
|
|
017226 |
@@ -473,7 +475,7 @@ GTry(rawtext, password)
|
|
|
017226 |
|
|
|
017226 |
for (i = 0; r_constructors[i]; i++)
|
|
|
017226 |
{
|
|
|
017226 |
- if (!(mp = Mangle(rawtext, r_constructors[i])))
|
|
|
017226 |
+ if (!(mp = Mangle(rawtext, r_constructors[i], area)))
|
|
|
017226 |
{
|
|
|
017226 |
continue;
|
|
|
017226 |
}
|
|
|
017226 |
@@ -520,7 +522,7 @@ FascistGecosUser(char *password, const c
|
|
|
017226 |
|
|
|
017226 |
strncpy(tbuffer, gecos, STRINGSIZE);
|
|
|
017226 |
tbuffer[STRINGSIZE-1] = '\0';
|
|
|
017226 |
- strcpy(gbuffer, Lowercase(tbuffer));
|
|
|
017226 |
+ Lowercase(tbuffer, gbuffer);
|
|
|
017226 |
|
|
|
017226 |
wc = 0;
|
|
|
017226 |
ptr = gbuffer;
|
|
|
017226 |
@@ -695,6 +697,7 @@ FascistLookUser(PWDICT *pwp, char *instr
|
|
|
017226 |
char junk[STRINGSIZE];
|
|
|
017226 |
char *password;
|
|
|
017226 |
char rpassword[STRINGSIZE];
|
|
|
017226 |
+ char area[STRINGSIZE];
|
|
|
017226 |
uint32_t notfound;
|
|
|
017226 |
|
|
|
017226 |
notfound = PW_WORDS(pwp);
|
|
|
017226 |
@@ -731,7 +734,7 @@ FascistLookUser(PWDICT *pwp, char *instr
|
|
|
017226 |
return _("it does not contain enough DIFFERENT characters");
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- strcpy(password, (char *)Lowercase(password));
|
|
|
017226 |
+ strcpy(password, (char *)Lowercase(password, area));
|
|
|
017226 |
|
|
|
017226 |
Trim(password);
|
|
|
017226 |
|
|
|
017226 |
@@ -787,7 +790,7 @@ FascistLookUser(PWDICT *pwp, char *instr
|
|
|
017226 |
{
|
|
|
017226 |
char *a;
|
|
|
017226 |
|
|
|
017226 |
- if (!(a = Mangle(password, r_destructors[i])))
|
|
|
017226 |
+ if (!(a = Mangle(password, r_destructors[i], area)))
|
|
|
017226 |
{
|
|
|
017226 |
continue;
|
|
|
017226 |
}
|
|
|
017226 |
@@ -802,13 +805,13 @@ FascistLookUser(PWDICT *pwp, char *instr
|
|
|
017226 |
}
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- strcpy(password, (char *)Reverse(password));
|
|
|
017226 |
+ strcpy(password, (char *)Reverse(password, area));
|
|
|
017226 |
|
|
|
017226 |
for (i = 0; r_destructors[i]; i++)
|
|
|
017226 |
{
|
|
|
017226 |
char *a;
|
|
|
017226 |
|
|
|
017226 |
- if (!(a = Mangle(password, r_destructors[i])))
|
|
|
017226 |
+ if (!(a = Mangle(password, r_destructors[i], area)))
|
|
|
017226 |
{
|
|
|
017226 |
continue;
|
|
|
017226 |
}
|
|
|
017226 |
diff -up cracklib-2.9.6/lib/packer.h.reentrant cracklib-2.9.6/lib/packer.h
|
|
|
017226 |
--- cracklib-2.9.6/lib/packer.h.reentrant 2015-10-22 18:17:20.335290902 +0200
|
|
|
017226 |
+++ cracklib-2.9.6/lib/packer.h 2015-10-22 18:17:20.338290974 +0200
|
|
|
017226 |
@@ -82,7 +82,7 @@ extern int PWClose(PWDICT *pwp);
|
|
|
017226 |
extern unsigned int FindPW(PWDICT *pwp, char *string);
|
|
|
017226 |
extern int PutPW(PWDICT *pwp, char *string);
|
|
|
017226 |
extern int PMatch(char *control, char *string);
|
|
|
017226 |
-extern char *Mangle(char *input, char *control);
|
|
|
017226 |
+extern char *Mangle(char *input, char *control, char *area);
|
|
|
017226 |
extern char Chop(char *string);
|
|
|
017226 |
extern char *Trim(char *string);
|
|
|
017226 |
extern char *FascistLook(PWDICT *pwp, char *instring);
|
|
|
017226 |
diff -up cracklib-2.9.6/lib/packlib.c.reentrant cracklib-2.9.6/lib/packlib.c
|
|
|
017226 |
--- cracklib-2.9.6/lib/packlib.c.reentrant 2015-08-18 20:41:16.000000000 +0200
|
|
|
017226 |
+++ cracklib-2.9.6/lib/packlib.c 2015-10-22 18:19:52.154911451 +0200
|
|
|
017226 |
@@ -67,8 +67,8 @@ PWOpen(prefix, mode)
|
|
|
017226 |
char *mode;
|
|
|
017226 |
{
|
|
|
017226 |
int use64 = 0;
|
|
|
017226 |
- static PWDICT pdesc;
|
|
|
017226 |
- static PWDICT64 pdesc64;
|
|
|
017226 |
+ PWDICT *pdesc;
|
|
|
017226 |
+ PWDICT64 pdesc64;
|
|
|
017226 |
char iname[STRINGSIZE];
|
|
|
017226 |
char dname[STRINGSIZE];
|
|
|
017226 |
char wname[STRINGSIZE];
|
|
|
017226 |
@@ -76,13 +76,11 @@ PWOpen(prefix, mode)
|
|
|
017226 |
void *ifp;
|
|
|
017226 |
void *wfp;
|
|
|
017226 |
|
|
|
017226 |
- if (pdesc.header.pih_magic == PIH_MAGIC)
|
|
|
017226 |
- {
|
|
|
017226 |
- fprintf(stderr, "%s: another dictionary already open\n", prefix);
|
|
|
017226 |
+ pdesc = malloc(sizeof(*pdesc));
|
|
|
017226 |
+ if (pdesc == NULL)
|
|
|
017226 |
return NULL;
|
|
|
017226 |
- }
|
|
|
017226 |
|
|
|
017226 |
- memset(&pdesc, '\0', sizeof(pdesc));
|
|
|
017226 |
+ memset(pdesc, '\0', sizeof(*pdesc));
|
|
|
017226 |
memset(&pdesc64, '\0', sizeof(pdesc64));
|
|
|
017226 |
|
|
|
017226 |
snprintf(iname, STRINGSIZE, "%s.pwi", prefix);
|
|
|
017226 |
@@ -91,77 +89,80 @@ PWOpen(prefix, mode)
|
|
|
017226 |
|
|
|
017226 |
if (mode[0] == 'r')
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags &= ~PFOR_USEZLIB;
|
|
|
017226 |
+ pdesc->flags &= ~PFOR_USEZLIB;
|
|
|
017226 |
/* first try the normal db file */
|
|
|
017226 |
- if (!(pdesc.dfp = fopen(dname, mode)))
|
|
|
017226 |
+ if (!(pdesc->dfp = fopen(dname, mode)))
|
|
|
017226 |
{
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- pdesc.flags |= PFOR_USEZLIB;
|
|
|
017226 |
+ pdesc->flags |= PFOR_USEZLIB;
|
|
|
017226 |
/* try extension .gz */
|
|
|
017226 |
snprintf(dname, STRINGSIZE, "%s.pwd.gz", prefix);
|
|
|
017226 |
- if (!(pdesc.dfp = gzopen(dname, mode)))
|
|
|
017226 |
+ if (!(pdesc->dfp = gzopen(dname, mode)))
|
|
|
017226 |
{
|
|
|
017226 |
perror(dname);
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
#else
|
|
|
017226 |
perror(dname);
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
#endif
|
|
|
017226 |
}
|
|
|
017226 |
}
|
|
|
017226 |
else
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags &= ~PFOR_USEZLIB;
|
|
|
017226 |
+ pdesc->flags &= ~PFOR_USEZLIB;
|
|
|
017226 |
/* write mode: use fopen */
|
|
|
017226 |
- if (!(pdesc.dfp = fopen(dname, mode)))
|
|
|
017226 |
+ if (!(pdesc->dfp = fopen(dname, mode)))
|
|
|
017226 |
{
|
|
|
017226 |
perror(dname);
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if (!(pdesc.ifp = fopen(iname, mode)))
|
|
|
017226 |
+ if (!(pdesc->ifp = fopen(iname, mode)))
|
|
|
017226 |
{
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
- gzclose(pdesc.dfp);
|
|
|
017226 |
+ if(pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
+ gzclose(pdesc->dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
- fclose(pdesc.dfp);
|
|
|
017226 |
+ fclose(pdesc->dfp);
|
|
|
017226 |
perror(iname);
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if ((pdesc.wfp = fopen(wname, mode)))
|
|
|
017226 |
+ if ((pdesc->wfp = fopen(wname, mode)))
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags |= PFOR_USEHWMS;
|
|
|
017226 |
+ pdesc->flags |= PFOR_USEHWMS;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- ifp = pdesc.ifp;
|
|
|
017226 |
- dfp = pdesc.dfp;
|
|
|
017226 |
- wfp = pdesc.wfp;
|
|
|
017226 |
+ ifp = pdesc->ifp;
|
|
|
017226 |
+ dfp = pdesc->dfp;
|
|
|
017226 |
+ wfp = pdesc->wfp;
|
|
|
017226 |
|
|
|
017226 |
if (mode[0] == 'w')
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags |= PFOR_WRITE;
|
|
|
017226 |
- pdesc.header.pih_magic = PIH_MAGIC;
|
|
|
017226 |
- pdesc.header.pih_blocklen = NUMWORDS;
|
|
|
017226 |
- pdesc.header.pih_numwords = 0;
|
|
|
017226 |
+ pdesc->flags |= PFOR_WRITE;
|
|
|
017226 |
+ pdesc->header.pih_magic = PIH_MAGIC;
|
|
|
017226 |
+ pdesc->header.pih_blocklen = NUMWORDS;
|
|
|
017226 |
+ pdesc->header.pih_numwords = 0;
|
|
|
017226 |
|
|
|
017226 |
- fwrite((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp);
|
|
|
017226 |
+ fwrite((char *) &pdesc->header, sizeof(pdesc->header), 1, ifp);
|
|
|
017226 |
} else
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags &= ~PFOR_WRITE;
|
|
|
017226 |
+ pdesc->flags &= ~PFOR_WRITE;
|
|
|
017226 |
|
|
|
017226 |
- if (!fread((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp))
|
|
|
017226 |
+ if (!fread((char *) &pdesc->header, sizeof(pdesc->header), 1, ifp))
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "%s: error reading header\n", prefix);
|
|
|
017226 |
|
|
|
017226 |
- pdesc.header.pih_magic = 0;
|
|
|
017226 |
fclose(ifp);
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
+ if(pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
gzclose(dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
@@ -170,10 +171,11 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fclose(wfp);
|
|
|
017226 |
}
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if ((pdesc.header.pih_magic == 0) || (pdesc.header.pih_numwords == 0))
|
|
|
017226 |
+ if ((pdesc->header.pih_magic == 0) || (pdesc->header.pih_numwords == 0))
|
|
|
017226 |
{
|
|
|
017226 |
/* uh-oh. either a broken "64-bit" file or a garbage file. */
|
|
|
017226 |
rewind (ifp);
|
|
|
017226 |
@@ -181,10 +183,9 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "%s: error reading header\n", prefix);
|
|
|
017226 |
|
|
|
017226 |
- pdesc.header.pih_magic = 0;
|
|
|
017226 |
fclose(ifp);
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
+ if (pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
gzclose(dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
@@ -193,6 +194,7 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fclose(wfp);
|
|
|
017226 |
}
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
if (pdesc64.header.pih_magic != PIH_MAGIC)
|
|
|
017226 |
@@ -200,10 +202,9 @@ PWOpen(prefix, mode)
|
|
|
017226 |
/* nope, not "64-bit" after all */
|
|
|
017226 |
fprintf(stderr, "%s: error reading header\n", prefix);
|
|
|
017226 |
|
|
|
017226 |
- pdesc.header.pih_magic = 0;
|
|
|
017226 |
fclose(ifp);
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
+ if (pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
gzclose(dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
@@ -213,23 +214,23 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fclose(wfp);
|
|
|
017226 |
}
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
- pdesc.header.pih_magic = pdesc64.header.pih_magic;
|
|
|
017226 |
- pdesc.header.pih_numwords = pdesc64.header.pih_numwords;
|
|
|
017226 |
- pdesc.header.pih_blocklen = pdesc64.header.pih_blocklen;
|
|
|
017226 |
- pdesc.header.pih_pad = pdesc64.header.pih_pad;
|
|
|
017226 |
+ pdesc->header.pih_magic = pdesc64.header.pih_magic;
|
|
|
017226 |
+ pdesc->header.pih_numwords = pdesc64.header.pih_numwords;
|
|
|
017226 |
+ pdesc->header.pih_blocklen = pdesc64.header.pih_blocklen;
|
|
|
017226 |
+ pdesc->header.pih_pad = pdesc64.header.pih_pad;
|
|
|
017226 |
use64 = 1;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if (pdesc.header.pih_magic != PIH_MAGIC)
|
|
|
017226 |
+ if (pdesc->header.pih_magic != PIH_MAGIC)
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "%s: magic mismatch\n", prefix);
|
|
|
017226 |
|
|
|
017226 |
- pdesc.header.pih_magic = 0;
|
|
|
017226 |
fclose(ifp);
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
+ if (pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
gzclose(dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
@@ -239,17 +240,17 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fclose(wfp);
|
|
|
017226 |
}
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if (pdesc.header.pih_numwords < 1)
|
|
|
017226 |
+ if (pdesc->header.pih_numwords < 1)
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "%s: invalid word count\n", prefix);
|
|
|
017226 |
|
|
|
017226 |
- pdesc.header.pih_magic = 0;
|
|
|
017226 |
fclose(ifp);
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
+ if (pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
gzclose(dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
@@ -258,17 +259,17 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fclose(wfp);
|
|
|
017226 |
}
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if (pdesc.header.pih_blocklen != NUMWORDS)
|
|
|
017226 |
+ if (pdesc->header.pih_blocklen != NUMWORDS)
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "%s: size mismatch\n", prefix);
|
|
|
017226 |
|
|
|
017226 |
- pdesc.header.pih_magic = 0;
|
|
|
017226 |
fclose(ifp);
|
|
|
017226 |
#ifdef HAVE_ZLIB_H
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEZLIB)
|
|
|
017226 |
+ if (pdesc->flags & PFOR_USEZLIB)
|
|
|
017226 |
gzclose(dfp);
|
|
|
017226 |
else
|
|
|
017226 |
#endif
|
|
|
017226 |
@@ -277,10 +278,11 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
fclose(wfp);
|
|
|
017226 |
}
|
|
|
017226 |
+ free(pdesc);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- if (pdesc.flags & PFOR_USEHWMS)
|
|
|
017226 |
+ if (pdesc->flags & PFOR_USEHWMS)
|
|
|
017226 |
{
|
|
|
017226 |
int i;
|
|
|
017226 |
|
|
|
017226 |
@@ -288,27 +290,27 @@ PWOpen(prefix, mode)
|
|
|
017226 |
{
|
|
|
017226 |
if (fread(pdesc64.hwms, 1, sizeof(pdesc64.hwms), wfp) != sizeof(pdesc64.hwms))
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags &= ~PFOR_USEHWMS;
|
|
|
017226 |
+ pdesc->flags &= ~PFOR_USEHWMS;
|
|
|
017226 |
}
|
|
|
017226 |
- for (i = 0; i < sizeof(pdesc.hwms) / sizeof(pdesc.hwms[0]); i++)
|
|
|
017226 |
+ for (i = 0; i < sizeof(pdesc->hwms) / sizeof(pdesc->hwms[0]); i++)
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.hwms[i] = pdesc64.hwms[i];
|
|
|
017226 |
+ pdesc->hwms[i] = pdesc64.hwms[i];
|
|
|
017226 |
}
|
|
|
017226 |
- }
|
|
|
017226 |
- else if (fread(pdesc.hwms, 1, sizeof(pdesc.hwms), wfp) != sizeof(pdesc.hwms))
|
|
|
017226 |
+ }
|
|
|
017226 |
+ else if (fread(pdesc->hwms, 1, sizeof(pdesc->hwms), wfp) != sizeof(pdesc->hwms))
|
|
|
017226 |
{
|
|
|
017226 |
- pdesc.flags &= ~PFOR_USEHWMS;
|
|
|
017226 |
+ pdesc->flags &= ~PFOR_USEHWMS;
|
|
|
017226 |
}
|
|
|
017226 |
#if DEBUG
|
|
|
017226 |
for (i=1; i<=0xff; i++)
|
|
|
017226 |
{
|
|
|
017226 |
- printf("hwm[%02x] = %d\n", i, pdesc.hwms[i]);
|
|
|
017226 |
+ printf("hwm[%02x] = %d\n", i, pdesc->hwms[i]);
|
|
|
017226 |
}
|
|
|
017226 |
#endif
|
|
|
017226 |
}
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
- return (&pdesc);
|
|
|
017226 |
+ return (pdesc);
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
int
|
|
|
017226 |
@@ -318,6 +320,7 @@ PWClose(pwp)
|
|
|
017226 |
if (pwp->header.pih_magic != PIH_MAGIC)
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "PWClose: close magic mismatch\n");
|
|
|
017226 |
+ /* we do not try to free memory that is probably corrupted */
|
|
|
017226 |
return (-1);
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
@@ -329,12 +332,14 @@ PWClose(pwp)
|
|
|
017226 |
if (fseek(pwp->ifp, 0L, 0))
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "index magic fseek failed\n");
|
|
|
017226 |
+ free(pwp);
|
|
|
017226 |
return (-1);
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
if (!fwrite((char *) &pwp->header, sizeof(pwp->header), 1, pwp->ifp))
|
|
|
017226 |
{
|
|
|
017226 |
fprintf(stderr, "index magic fwrite failed\n");
|
|
|
017226 |
+ free(pwp);
|
|
|
017226 |
return (-1);
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
@@ -368,6 +373,7 @@ PWClose(pwp)
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
pwp->header.pih_magic = 0;
|
|
|
017226 |
+ free(pwp);
|
|
|
017226 |
|
|
|
017226 |
return (0);
|
|
|
017226 |
}
|
|
|
017226 |
diff -up cracklib-2.9.6/lib/rules.c.reentrant cracklib-2.9.6/lib/rules.c
|
|
|
017226 |
--- cracklib-2.9.6/lib/rules.c.reentrant 2015-08-18 20:41:16.000000000 +0200
|
|
|
017226 |
+++ cracklib-2.9.6/lib/rules.c 2015-10-22 18:17:20.339290998 +0200
|
|
|
017226 |
@@ -82,12 +82,12 @@ Suffix(myword, suffix)
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Reverse(str) /* return a pointer to a reversal */
|
|
|
017226 |
+Reverse(str, area) /* return a pointer to a reversal */
|
|
|
017226 |
register char *str;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register int i;
|
|
|
017226 |
register int j;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
j = i = strlen(str);
|
|
|
017226 |
while (*str)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -98,11 +98,11 @@ Reverse(str) /* return a pointer to a
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Uppercase(str) /* return a pointer to an uppercase */
|
|
|
017226 |
+Uppercase(str, area) /* return a pointer to an uppercase */
|
|
|
017226 |
register char *str;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
while (*str)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -115,11 +115,11 @@ Uppercase(str) /* return a pointer to
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Lowercase(str) /* return a pointer to an lowercase */
|
|
|
017226 |
+Lowercase(str, area) /* return a pointer to an lowercase */
|
|
|
017226 |
register char *str;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
while (*str)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -132,11 +132,11 @@ Lowercase(str) /* return a pointer to
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Capitalise(str) /* return a pointer to an capitalised */
|
|
|
017226 |
+Capitalise(str, area) /* return a pointer to an capitalised */
|
|
|
017226 |
register char *str;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
|
|
|
017226 |
while (*str)
|
|
|
017226 |
@@ -151,11 +151,11 @@ Capitalise(str) /* return a pointer to
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Pluralise(string) /* returns a pointer to a plural */
|
|
|
017226 |
+Pluralise(string, area) /* returns a pointer to a plural */
|
|
|
017226 |
register char *string;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register int length;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
length = strlen(string);
|
|
|
017226 |
strcpy(area, string);
|
|
|
017226 |
|
|
|
017226 |
@@ -192,13 +192,13 @@ Pluralise(string) /* returns a pointer
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Substitute(string, old, new) /* returns pointer to a swapped about copy */
|
|
|
017226 |
+Substitute(string, old, new, area) /* returns pointer to a swapped about copy */
|
|
|
017226 |
register char *string;
|
|
|
017226 |
register char old;
|
|
|
017226 |
register char new;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
while (*string)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -210,12 +210,12 @@ Substitute(string, old, new) /* returns
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Purge(string, target) /* returns pointer to a purged copy */
|
|
|
017226 |
+Purge(string, target, area) /* returns pointer to a purged copy */
|
|
|
017226 |
register char *string;
|
|
|
017226 |
register char target;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
while (*string)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -372,13 +372,13 @@ PolyStrchr(string, class)
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-PolySubst(string, class, new) /* returns pointer to a swapped about copy */
|
|
|
017226 |
+PolySubst(string, class, new, area) /* returns pointer to a swapped about copy */
|
|
|
017226 |
register char *string;
|
|
|
017226 |
register char class;
|
|
|
017226 |
register char new;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
while (*string)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -390,12 +390,12 @@ PolySubst(string, class, new) /* returns
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-PolyPurge(string, class) /* returns pointer to a purged copy */
|
|
|
017226 |
+PolyPurge(string, class, area) /* returns pointer to a purged copy */
|
|
|
017226 |
register char *string;
|
|
|
017226 |
register char class;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
ptr = area;
|
|
|
017226 |
while (*string)
|
|
|
017226 |
{
|
|
|
017226 |
@@ -428,40 +428,41 @@ Char2Int(character)
|
|
|
017226 |
}
|
|
|
017226 |
|
|
|
017226 |
char *
|
|
|
017226 |
-Mangle(input, control) /* returns a pointer to a controlled Mangle */
|
|
|
017226 |
+Mangle(input, control, area) /* returns a pointer to a controlled Mangle */
|
|
|
017226 |
char *input;
|
|
|
017226 |
char *control;
|
|
|
017226 |
+ char *area;
|
|
|
017226 |
{
|
|
|
017226 |
int limit;
|
|
|
017226 |
register char *ptr;
|
|
|
017226 |
- static char area[STRINGSIZE];
|
|
|
017226 |
char area2[STRINGSIZE];
|
|
|
017226 |
area[0] = '\0';
|
|
|
017226 |
strcpy(area, input);
|
|
|
017226 |
|
|
|
017226 |
for (ptr = control; *ptr; ptr++)
|
|
|
017226 |
{
|
|
|
017226 |
+ strcpy(area2, area);
|
|
|
017226 |
switch (*ptr)
|
|
|
017226 |
{
|
|
|
017226 |
case RULE_NOOP:
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_REVERSE:
|
|
|
017226 |
- strcpy(area, Reverse(area));
|
|
|
017226 |
+ Reverse(area2, area);
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_UPPERCASE:
|
|
|
017226 |
- strcpy(area, Uppercase(area));
|
|
|
017226 |
+ Uppercase(area2, area);
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_LOWERCASE:
|
|
|
017226 |
- strcpy(area, Lowercase(area));
|
|
|
017226 |
+ Lowercase(area2, area);
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_CAPITALISE:
|
|
|
017226 |
- strcpy(area, Capitalise(area));
|
|
|
017226 |
+ Capitalise(area2, area);
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_PLURALISE:
|
|
|
017226 |
- strcpy(area, Pluralise(area));
|
|
|
017226 |
+ Pluralise(area2, area);
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_REFLECT:
|
|
|
017226 |
- strcat(area, Reverse(area));
|
|
|
017226 |
+ strcat(area, Reverse(area, area2));
|
|
|
017226 |
break;
|
|
|
017226 |
case RULE_DUPLICATE:
|
|
|
017226 |
strcpy(area2, area);
|
|
|
017226 |
@@ -548,7 +549,6 @@ Mangle(input, control) /* returns a poi
|
|
|
017226 |
Debug(1, "Mangle: extract: weird argument in '%s'\n", control);
|
|
|
017226 |
return NULL;
|
|
|
017226 |
}
|
|
|
017226 |
- strcpy(area2, area);
|
|
|
017226 |
for (i = 0; length-- && area2[start + i]; i++)
|
|
|
017226 |
{
|
|
|
017226 |
area[i] = area2[start + i];
|
|
|
017226 |
@@ -619,10 +619,10 @@ Mangle(input, control) /* returns a poi
|
|
|
017226 |
return NULL;
|
|
|
017226 |
} else if (ptr[1] != RULE_CLASS)
|
|
|
017226 |
{
|
|
|
017226 |
- strcpy(area, Purge(area, *(++ptr)));
|
|
|
017226 |
+ Purge(area2, *(++ptr), area);
|
|
|
017226 |
} else
|
|
|
017226 |
{
|
|
|
017226 |
- strcpy(area, PolyPurge(area, ptr[2]));
|
|
|
017226 |
+ PolyPurge(area2, ptr[2], area);
|
|
|
017226 |
ptr += 2;
|
|
|
017226 |
}
|
|
|
017226 |
break;
|
|
|
017226 |
@@ -633,11 +633,11 @@ Mangle(input, control) /* returns a poi
|
|
|
017226 |
return NULL;
|
|
|
017226 |
} else if (ptr[1] != RULE_CLASS)
|
|
|
017226 |
{
|
|
|
017226 |
- strcpy(area, Substitute(area, ptr[1], ptr[2]));
|
|
|
017226 |
+ Substitute(area2, ptr[1], ptr[2], area);
|
|
|
017226 |
ptr += 2;
|
|
|
017226 |
} else
|
|
|
017226 |
{
|
|
|
017226 |
- strcpy(area, PolySubst(area, ptr[2], ptr[3]));
|
|
|
017226 |
+ PolySubst(area2, ptr[2], ptr[3], area);
|
|
|
017226 |
ptr += 3;
|
|
|
017226 |
}
|
|
|
017226 |
break;
|