1 diff -ur orig/cracklib26_small/cracklib/fascist.c cracklib26_small/cracklib/fascist.c
2 --- orig/cracklib26_small/cracklib/fascist.c Mon Dec 15 02:56:55 1997
3 +++ cracklib26_small/cracklib/fascist.c Sat Apr 4 22:14:45 1998
10 #define ISSKIP(x) (isspace(x) || ispunct(x))
16 -FascistGecos(password, uid)
17 +FascistGecosPw(password, pwd)
27 char gbuffer[STRINGSIZE];
28 char tbuffer[STRINGSIZE];
29 char *uwords[STRINGSIZE];
30 char longbuffer[STRINGSIZE * 2];
32 - if (!(pwp = getpwuid(uid)))
35 return ("you are not registered in the password file");
38 /* lets get really paranoid and assume a dangerously long gecos entry */
40 - strncpy(tbuffer, pwp->pw_name, STRINGSIZE);
41 + strncpy(tbuffer, pwd->pw_name, STRINGSIZE);
42 tbuffer[STRINGSIZE-1] = '\0';
43 if (GTry(tbuffer, password))
47 /* it never used to be that you got passwd strings > 1024 chars, but now... */
49 - strncpy(tbuffer, pwp->pw_gecos, STRINGSIZE);
50 + strncpy(tbuffer, pwd->pw_gecos, STRINGSIZE);
51 tbuffer[STRINGSIZE-1] = '\0';
52 strcpy(gbuffer, Lowercase(tbuffer));
56 + uwords[0] = (char *) 0;
65 + return ((char *) 0); /* empty gecos */
67 for (i = 0; uwords[i]; i++)
73 -FascistLook(pwp, instring)
74 +FascistLookPw(pwp, instring, pwd)
82 return ("it looks like a National Insurance number.");
85 - if (ptr = FascistGecos(password, getuid()))
86 + if (ptr = FascistGecosPw(password, pwd ? pwd : getpwuid(getuid())))
94 -FascistCheck(password, path)
95 +FascistCheckPw(password, path, pwd)
100 static char lastpath[STRINGSIZE];
103 strncpy(lastpath, path, STRINGSIZE);
106 - return (FascistLook(pwp, pwtrunced));
107 + return (FascistLookPw(pwp, pwtrunced, pwd));
111 +FascistGecos(password, uid)
115 + return (FascistGecosPw(password, getpwuid(uid)));
119 +FascistLook(pwp, instring)
123 + return (FascistLookPw(pwp, instring, (char *) 0));
127 +FascistCheck(password, path)
131 + return (FascistCheckPw(password, path, (char *) 0));
133 diff -ur orig/cracklib26_small/cracklib/packer.h cracklib26_small/cracklib/packer.h
134 --- orig/cracklib26_small/cracklib/packer.h Mon Dec 15 00:09:30 1997
135 +++ cracklib26_small/cracklib/packer.h Sat Jan 10 22:13:46 1998
142 #define PFOR_WRITE 0x0001
143 #define PFOR_FLUSH 0x0002
144 diff -ur orig/cracklib26_small/cracklib/packlib.c cracklib26_small/cracklib/packlib.c
145 --- orig/cracklib26_small/cracklib/packlib.c Fri Jul 9 22:22:58 1993
146 +++ cracklib26_small/cracklib/packlib.c Sat Jan 10 22:28:49 1998
151 - static PWDICT pdesc;
153 char iname[STRINGSIZE];
154 char dname[STRINGSIZE];
155 char wname[STRINGSIZE];
160 - if (pdesc.header.pih_magic == PIH_MAGIC)
162 - fprintf(stderr, "%s: another dictionary already open\n", prefix);
163 + if ((pdesc = (PWDICT *) malloc(sizeof(PWDICT))) == 0)
164 return ((PWDICT *) 0);
167 - memset(&pdesc, '\0', sizeof(pdesc));
168 + memset(pdesc, '\0', sizeof(*pdesc));
170 sprintf(iname, "%s.pwi", prefix);
171 sprintf(dname, "%s.pwd", prefix);
172 sprintf(wname, "%s.hwm", prefix);
174 - if (!(pdesc.dfp = fopen(dname, mode)))
175 + if (!(pdesc->dfp = fopen(dname, mode)))
179 return ((PWDICT *) 0);
182 - if (!(pdesc.ifp = fopen(iname, mode)))
183 + if (!(pdesc->ifp = fopen(iname, mode)))
186 + fclose(pdesc->dfp);
189 return ((PWDICT *) 0);
192 - if (pdesc.wfp = fopen(wname, mode))
193 + if (pdesc->wfp = fopen(wname, mode))
195 - pdesc.flags |= PFOR_USEHWMS;
196 + pdesc->flags |= PFOR_USEHWMS;
208 - pdesc.flags |= PFOR_WRITE;
209 - pdesc.header.pih_magic = PIH_MAGIC;
210 - pdesc.header.pih_blocklen = NUMWORDS;
211 - pdesc.header.pih_numwords = 0;
212 + pdesc->flags |= PFOR_WRITE;
213 + pdesc->header.pih_magic = PIH_MAGIC;
214 + pdesc->header.pih_blocklen = NUMWORDS;
215 + pdesc->header.pih_numwords = 0;
217 - fwrite((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp);
218 + fwrite((char *) &pdesc->header, sizeof(pdesc->header), 1, ifp);
221 - pdesc.flags &= ~PFOR_WRITE;
222 + pdesc->flags &= ~PFOR_WRITE;
224 - if (!fread((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp))
225 + if (!fread((char *) &pdesc->header, sizeof(pdesc->header), 1, ifp))
227 fprintf(stderr, "%s: error reading header\n", prefix);
229 - pdesc.header.pih_magic = 0;
230 + pdesc->header.pih_magic = 0;
234 return ((PWDICT *) 0);
237 - if (pdesc.header.pih_magic != PIH_MAGIC)
238 + if (pdesc->header.pih_magic != PIH_MAGIC)
240 fprintf(stderr, "%s: magic mismatch\n", prefix);
242 - pdesc.header.pih_magic = 0;
243 + pdesc->header.pih_magic = 0;
247 return ((PWDICT *) 0);
250 - if (pdesc.header.pih_blocklen != NUMWORDS)
251 + if (pdesc->header.pih_blocklen != NUMWORDS)
253 fprintf(stderr, "%s: size mismatch\n", prefix);
255 - pdesc.header.pih_magic = 0;
256 + pdesc->header.pih_magic = 0;
260 return ((PWDICT *) 0);
263 - if (pdesc.flags & PFOR_USEHWMS)
264 + if (pdesc->flags & PFOR_USEHWMS)
266 - if (fread(pdesc.hwms, 1, sizeof(pdesc.hwms), wfp) != sizeof(pdesc.hwms))
267 + if (fread(pdesc->hwms, 1, sizeof(pdesc->hwms), wfp) != sizeof(pdesc->hwms))
269 - pdesc.flags &= ~PFOR_USEHWMS;
270 + pdesc->flags &= ~PFOR_USEHWMS;
276 + pdesc->canfree = 1;
288 - pwp->header.pih_magic = 0;
292 + pwp->header.pih_magic = 0;
301 + * comment in npasswd-2.0beta4 says this:
302 + * This does not work under all circumstances, so don't bother
305 if (pwp->flags & PFOR_USEHWMS)
307 idx = string[0] & 0xff;
310 hwm = PW_WORDS(pwp) - 1;
314 + hwm = PW_WORDS(pwp);
318 printf("---- %lu, %lu ----\n", lwm, hwm);
319 diff -ur orig/cracklib26_small/util/mkdict cracklib26_small/util/mkdict
320 --- orig/cracklib26_small/util/mkdict Fri Jul 9 22:23:03 1993
321 +++ cracklib26_small/util/mkdict Sat Apr 4 22:31:45 1998
324 ###SORT="sort -T /tmp"
327 +### Use zcat to read compressed (as well as uncompressed) dictionaries.
328 +### Compressed dictionaries can save quite a lot of disk space.
336 - tr -cd '[\012a-z0-9]' |
337 + tr -cd '\012[a-z][0-9]' |