| [617118d] | 1 | Submitted By: Jim Gifford (jim at linuxfromscratch dot org) | 
|---|
|  | 2 | Date: 2004-04-22 | 
|---|
|  | 3 | Initial Package Version: 2,7 | 
|---|
|  | 4 | Origin: Jim Gifford & DJ Lucas | 
|---|
|  | 5 | Description: Makes Cracklib a dynamic library installed at /lib | 
|---|
|  | 6 | Fixes buffer underruns | 
|---|
|  | 7 | Add's missing header | 
|---|
|  | 8 | Install's Missing Headers | 
|---|
|  | 9 |  | 
|---|
|  | 10 | diff -Naur cracklib,2.7-orig/Makefile cracklib,2.7/Makefile | 
|---|
|  | 11 | --- cracklib,2.7-orig/Makefile  1997-12-31 04:33:53.000000000 -0600 | 
|---|
|  | 12 | +++ cracklib,2.7/Makefile       2004-04-30 16:58:01.000000000 -0500 | 
|---|
|  | 13 | @@ -7,14 +7,21 @@ | 
|---|
|  | 14 | ### | 
|---|
|  | 15 |  | 
|---|
|  | 16 | ### | 
|---|
|  | 17 | +# cracklib version | 
|---|
|  | 18 | +MAJOR=2 | 
|---|
|  | 19 | +MINOR=7 | 
|---|
|  | 20 | +VERSION=$(MAJOR).$(MINOR) | 
|---|
|  | 21 | +export MAJOR MINOR VERSION | 
|---|
|  | 22 | + | 
|---|
|  | 23 | +### | 
|---|
|  | 24 | # set this to the absolute path (less extn) of compressed dict. | 
|---|
|  | 25 |  | 
|---|
|  | 26 | -DICTPATH="/usr/local/lib/pw_dict" | 
|---|
|  | 27 | +DICTPATH="/lib/cracklib_dict" | 
|---|
|  | 28 |  | 
|---|
|  | 29 | ### | 
|---|
|  | 30 | # Set this to the path of one or more files continaing wordlists. | 
|---|
|  | 31 |  | 
|---|
|  | 32 | -SRCDICTS=/usr/dict/words | 
|---|
|  | 33 | +SRCDICTS=/usr/share/dict/words /usr/share/dict/extra.words | 
|---|
|  | 34 |  | 
|---|
|  | 35 | ### | 
|---|
|  | 36 | # If you have installed the cracklib-dicts directory, use this | 
|---|
|  | 37 | @@ -36,7 +43,9 @@ | 
|---|
|  | 38 | -rm -f all installed Part* *.BAK *.bak *~ | 
|---|
|  | 39 |  | 
|---|
|  | 40 | install: all | 
|---|
|  | 41 | +       ( cd cracklib && make install && exit $$? ) | 
|---|
|  | 42 | +       ( cd util && make install && exit $$? ) | 
|---|
|  | 43 | @echo 'if "sort" dies from lack of space, see "util/mkdict"' | 
|---|
|  | 44 | -       util/mkdict $(SRCDICTS) | util/packer $(DICTPATH) | 
|---|
|  | 45 | +       util/mkdict $(SRCDICTS) | LD_LIBRARY_PATH=cracklib util/packer $(DESTDIR)$(DICTPATH) | 
|---|
|  | 46 | touch installed | 
|---|
|  | 47 | ###    @echo 'now go install passwd/passwd where you want it' | 
|---|
|  | 48 | diff -Naur cracklib,2.7-orig/cracklib/Makefile cracklib,2.7/cracklib/Makefile | 
|---|
|  | 49 | --- cracklib,2.7-orig/cracklib/Makefile 1997-12-14 16:49:21.000000000 -0600 | 
|---|
|  | 50 | +++ cracklib,2.7/cracklib/Makefile      2004-04-30 16:58:01.000000000 -0500 | 
|---|
|  | 51 | @@ -6,13 +6,24 @@ | 
|---|
|  | 52 | # and upwards. | 
|---|
|  | 53 | ### | 
|---|
|  | 54 |  | 
|---|
|  | 55 | -LIB=   libcrack.a | 
|---|
|  | 56 | -OBJ=   fascist.o packlib.o rules.o stringlib.o | 
|---|
|  | 57 | -CFLAGS= -O -I../cracklib -DIN_CRACKLIB | 
|---|
|  | 58 | +LIB    = libcrack.so | 
|---|
|  | 59 | +OBJ    = fascist.o packlib.o rules.o stringlib.o | 
|---|
|  | 60 | +CFLAGS += -g -I../cracklib -DIN_CRACKLIB -fPIC | 
|---|
|  | 61 | +LD     = ld | 
|---|
|  | 62 |  | 
|---|
|  | 63 | -$(LIB):        $(OBJ) | 
|---|
|  | 64 | -       ar rv $(LIB) $? | 
|---|
|  | 65 | -       -ranlib $(LIB) | 
|---|
|  | 66 | +$(LIB):        $(OBJ) Makefile | 
|---|
|  | 67 | +       $(LD) -shared -soname $(LIB).$(MAJOR) -o $(LIB).$(VERSION) $(OBJ) -lc | 
|---|
|  | 68 | +       rm -f $(LIB).$(MAJOR) $(LIB) | 
|---|
|  | 69 | +       ln -s $(LIB).$(VERSION) $(LIB).$(MAJOR) | 
|---|
|  | 70 | +       ln -s $(LIB).$(MAJOR) $(LIB) | 
|---|
|  | 71 |  | 
|---|
|  | 72 | clean: | 
|---|
|  | 73 | -       -rm -f $(OBJ) $(LIB) *~ | 
|---|
|  | 74 | +       -rm -f $(OBJ) $(LIB) $(LIB).$(VERSION) *~ | 
|---|
|  | 75 | + | 
|---|
|  | 76 | +install: $(LIB) crack.h | 
|---|
|  | 77 | +       install -m 755 $(LIB).$(VERSION) $(DESTDIR)/lib | 
|---|
|  | 78 | +       ln -sf $(LIB).$(VERSION) $(DESTDIR)/lib/$(LIB) | 
|---|
|  | 79 | +       ln -sf $(DESTDIR)/lib/$(LIB).$(VERSION) $(DESTDIR)/lib/$(LIB).$(MAJOR) | 
|---|
|  | 80 | + | 
|---|
|  | 81 | +       install -m 644 packer.h $(DESTDIR)/usr/include | 
|---|
|  | 82 | +       install -m 644 crack.h $(DESTDIR)/usr/include | 
|---|
|  | 83 | diff -Naur cracklib,2.7-orig/cracklib/crack.h cracklib,2.7/cracklib/crack.h | 
|---|
|  | 84 | --- cracklib,2.7-orig/cracklib/crack.h  1969-12-31 18:00:00.000000000 -0600 | 
|---|
|  | 85 | +++ cracklib,2.7/cracklib/crack.h       2004-04-30 17:11:03.000000000 -0500 | 
|---|
|  | 86 | @@ -0,0 +1,15 @@ | 
|---|
|  | 87 | + | 
|---|
|  | 88 | +#ifndef CRACKLIB_H | 
|---|
|  | 89 | +#define CRACKLIB_H | 
|---|
|  | 90 | + | 
|---|
|  | 91 | +/* Pass this function a password (pw) and a path to the | 
|---|
|  | 92 | + * dictionaries (/lib/cracklib_dict should be specified) | 
|---|
|  | 93 | + * and it will either return a NULL string, meaning that the | 
|---|
|  | 94 | + * password is good, or a pointer to a string that explains the | 
|---|
|  | 95 | + * problem with the password. | 
|---|
|  | 96 | + * You must link with -lcrack | 
|---|
|  | 97 | + */ | 
|---|
|  | 98 | + | 
|---|
|  | 99 | +extern char *FascistCheck(char *pw, char *dictpath); | 
|---|
|  | 100 | + | 
|---|
|  | 101 | +#endif | 
|---|
|  | 102 | diff -Naur cracklib,2.7-orig/cracklib/fascist.c cracklib,2.7/cracklib/fascist.c | 
|---|
|  | 103 | --- cracklib,2.7-orig/cracklib/fascist.c        1997-12-31 04:26:46.000000000 -0600 | 
|---|
|  | 104 | +++ cracklib,2.7/cracklib/fascist.c     2004-04-30 16:58:01.000000000 -0500 | 
|---|
|  | 105 | @@ -11,6 +11,7 @@ | 
|---|
|  | 106 | #include "packer.h" | 
|---|
|  | 107 | #include <sys/types.h> | 
|---|
|  | 108 | #include <pwd.h> | 
|---|
|  | 109 | +#include <string.h> | 
|---|
|  | 110 |  | 
|---|
|  | 111 | #define ISSKIP(x) (isspace(x) || ispunct(x)) | 
|---|
|  | 112 |  | 
|---|
|  | 113 | @@ -659,7 +660,7 @@ | 
|---|
|  | 114 | return ("it does not contain enough DIFFERENT characters"); | 
|---|
|  | 115 | } | 
|---|
|  | 116 |  | 
|---|
|  | 117 | -    strcpy(password, Lowercase(password)); | 
|---|
|  | 118 | +    strcpy(password, (char *)Lowercase(password)); | 
|---|
|  | 119 |  | 
|---|
|  | 120 | Trim(password); | 
|---|
|  | 121 |  | 
|---|
|  | 122 | @@ -722,7 +723,7 @@ | 
|---|
|  | 123 | } | 
|---|
|  | 124 | } | 
|---|
|  | 125 |  | 
|---|
|  | 126 | -    strcpy(password, Reverse(password)); | 
|---|
|  | 127 | +    strcpy(password, (char *)Reverse(password)); | 
|---|
|  | 128 |  | 
|---|
|  | 129 | for (i = 0; r_destructors[i]; i++) | 
|---|
|  | 130 | { | 
|---|
|  | 131 | diff -Naur cracklib,2.7-orig/util/Makefile cracklib,2.7/util/Makefile | 
|---|
|  | 132 | --- cracklib,2.7-orig/util/Makefile     1997-12-14 16:49:34.000000000 -0600 | 
|---|
|  | 133 | +++ cracklib,2.7/util/Makefile  2004-04-30 16:58:01.000000000 -0500 | 
|---|
|  | 134 | @@ -14,27 +14,31 @@ | 
|---|
|  | 135 | #SunOS users (and others?) should consider static linking of their passwd binary | 
|---|
|  | 136 | #CFLAGS= -O -I../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"' -Bstatic | 
|---|
|  | 137 |  | 
|---|
|  | 138 | -CFLAGS= -O -I../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"' | 
|---|
|  | 139 | -LIBS=  ../cracklib/libcrack.a | 
|---|
|  | 140 | +CFLAGS += -I../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"' | 
|---|
|  | 141 | +LDFLAGS        = -L../cracklib -lcrack | 
|---|
|  | 142 | +LIBS   = ../cracklib/libcrack.so | 
|---|
|  | 143 |  | 
|---|
|  | 144 | all:   packer unpacker testnum teststr testlib | 
|---|
|  | 145 | touch all | 
|---|
|  | 146 |  | 
|---|
|  | 147 | packer: packer.o $(LIBS) | 
|---|
|  | 148 | -       cc $(CFLAGS) -o $@ $@.o $(LIBS) | 
|---|
|  | 149 | +       $(CC) $(CFLAGS) -o $@ $@.o $(LDFLAGS) | 
|---|
|  | 150 |  | 
|---|
|  | 151 | unpacker: unpacker.o $(LIBS) | 
|---|
|  | 152 | -       cc $(CFLAGS) -o $@ $@.o $(LIBS) | 
|---|
|  | 153 | +       $(CC) $(CFLAGS) -o $@ $@.o $(LDFLAGS) | 
|---|
|  | 154 |  | 
|---|
|  | 155 | testnum: testnum.o $(LIBS) | 
|---|
|  | 156 | -       cc $(CFLAGS) -o $@ $@.o $(LIBS) | 
|---|
|  | 157 | +       $(CC) $(CFLAGS) -o $@ $@.o $(LDFLAGS) | 
|---|
|  | 158 |  | 
|---|
|  | 159 | teststr: teststr.o $(LIBS) | 
|---|
|  | 160 | -       cc $(CFLAGS) -o $@ $@.o $(LIBS) | 
|---|
|  | 161 | +       $(CC) $(CFLAGS) -o $@ $@.o $(LDFLAGS) | 
|---|
|  | 162 |  | 
|---|
|  | 163 | testlib: testlib.o $(LIBS) | 
|---|
|  | 164 | -       cc $(CFLAGS) -o $@ $@.o $(LIBS) | 
|---|
|  | 165 | +       $(CC) $(CFLAGS) -o $@ $@.o $(LDFLAGS) | 
|---|
|  | 166 |  | 
|---|
|  | 167 | clean: | 
|---|
|  | 168 | -rm *.o *~ all | 
|---|
|  | 169 | -rm teststr testnum testlib packer unpacker | 
|---|
|  | 170 | + | 
|---|
|  | 171 | +install: all create-cracklib-dict | 
|---|
|  | 172 | +       install -m 755 mkdict packer create-cracklib-dict $(DESTDIR)/usr/sbin | 
|---|
|  | 173 | diff -Naur cracklib,2.7-orig/util/create-cracklib-dict cracklib,2.7/util/create-cracklib-dict | 
|---|
|  | 174 | --- cracklib,2.7-orig/util/create-cracklib-dict 1969-12-31 18:00:00.000000000 -0600 | 
|---|
|  | 175 | +++ cracklib,2.7/util/create-cracklib-dict      2004-04-30 16:58:01.000000000 -0500 | 
|---|
|  | 176 | @@ -0,0 +1,15 @@ | 
|---|
|  | 177 | +#!/bin/sh | 
|---|
|  | 178 | +if [ -z "$*" ]; then | 
|---|
|  | 179 | +    echo "Usage:" | 
|---|
|  | 180 | +    echo "  /usr/sbin/create-cracklib-dict wordlist ..." | 
|---|
|  | 181 | +    echo | 
|---|
|  | 182 | +    echo "This script takes one or more word list files as arguments" | 
|---|
|  | 183 | +    echo "and converts them into cracklib dictionaries for use" | 
|---|
|  | 184 | +    echo "by password checking programs. The results are placed in" | 
|---|
|  | 185 | +    echo "/lib/cracklib_dict.*" | 
|---|
|  | 186 | +    echo | 
|---|
|  | 187 | +    echo "Example:" | 
|---|
|  | 188 | +    echo "/usr/sbin/create-cracklib-dict /usr/dict/words" | 
|---|
|  | 189 | +else | 
|---|
|  | 190 | +    /usr/sbin/mkdict $* | /usr/sbin/packer /usr/share/cracklib/pw_dict | 
|---|
|  | 191 | +fi | 
|---|