diff options
Diffstat (limited to 'meta/recipes-extended/cracklib')
3 files changed, 410 insertions, 0 deletions
diff --git a/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch b/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch new file mode 100644 index 0000000000..8e0f40642a --- /dev/null +++ b/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch | |||
@@ -0,0 +1,332 @@ | |||
1 | From dae29a98c066bc67bb5ba12219d5fd68a8675514 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Fri, 26 Apr 2013 20:44:10 +0800 | ||
4 | Subject: [PATCH] packlib.c: support dictionary byte-order dependent | ||
5 | |||
6 | The previous dict files are NOT byte-order independent, in fact they are | ||
7 | probably ARCHITECTURE SPECIFIC. | ||
8 | Create the dict files in big endian, and convert to host endian while | ||
9 | load them. This could fix the endian issue on multiple platform. | ||
10 | |||
11 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
12 | Upstream-Status: Pending | ||
13 | |||
14 | We can't use the endian.h, htobe* and be*toh functions because they are | ||
15 | not available on older versions of glibc, such as that found in RHEL | ||
16 | 5.9. | ||
17 | |||
18 | Change to checking endian and directly calling bswap_* as defined in | ||
19 | byteswap.h. | ||
20 | |||
21 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
22 | |||
23 | --- | ||
24 | lib/packlib.c | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | ||
25 | 1 file changed, 204 insertions(+), 4 deletions(-) | ||
26 | |||
27 | Index: cracklib-2.8.22/lib/packlib.c | ||
28 | =================================================================== | ||
29 | --- cracklib-2.8.22.orig/lib/packlib.c | ||
30 | +++ cracklib-2.8.22/lib/packlib.c | ||
31 | @@ -16,6 +16,12 @@ | ||
32 | #ifdef HAVE_STDINT_H | ||
33 | #include <stdint.h> | ||
34 | #endif | ||
35 | + | ||
36 | +#ifndef _BSD_SOURCE | ||
37 | +#define _BSD_SOURCE /* See feature_test_macros(7) */ | ||
38 | +#endif | ||
39 | +#include <endian.h> | ||
40 | +#include <byteswap.h> | ||
41 | #include "packer.h" | ||
42 | |||
43 | static const char vers_id[] = "packlib.c : v2.3p2 Alec Muffett 18 May 1993"; | ||
44 | @@ -45,6 +51,182 @@ typedef struct | ||
45 | char data_get[NUMWORDS][MAXWORDLEN]; | ||
46 | } PWDICT64; | ||
47 | |||
48 | +enum{ | ||
49 | + en_is32, | ||
50 | + en_is64 | ||
51 | +}; | ||
52 | + | ||
53 | +static int | ||
54 | +IheaderHostToBigEndian(char *pHeader, int nBitType) | ||
55 | +{ | ||
56 | + if (nBitType == en_is64 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
57 | + { | ||
58 | + struct pi_header64 *pHeader64 = (struct pi_header64*)pHeader; | ||
59 | + | ||
60 | + pHeader64->pih_magic = bswap_64(pHeader64->pih_magic); | ||
61 | + pHeader64->pih_numwords = bswap_64(pHeader64->pih_numwords); | ||
62 | + pHeader64->pih_blocklen = bswap_16(pHeader64->pih_blocklen); | ||
63 | + pHeader64->pih_pad = bswap_16(pHeader64->pih_pad); | ||
64 | + | ||
65 | +#if DEBUG | ||
66 | + printf("Header64: magic %x, numwords %x, blocklen %x, pad %x\n", | ||
67 | + pHeader64->pih_magic, pHeader64->pih_numwords, | ||
68 | + pHeader64->pih_blocklen, pHeader64->pih_pad); | ||
69 | +#endif | ||
70 | + } | ||
71 | + else if (nBitType == en_is32 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
72 | + { | ||
73 | + struct pi_header *pHeader32 = (struct pi_header*)pHeader; | ||
74 | + | ||
75 | + pHeader32->pih_magic = bswap_32(pHeader32->pih_magic); | ||
76 | + pHeader32->pih_numwords = bswap_32(pHeader32->pih_numwords); | ||
77 | + pHeader32->pih_blocklen = bswap_16(pHeader32->pih_blocklen); | ||
78 | + pHeader32->pih_pad = bswap_16(pHeader32->pih_pad); | ||
79 | + | ||
80 | +#if DEBUG | ||
81 | + printf("Header32: magic %x, numwords %x, blocklen %x, pad %x\n", | ||
82 | + pHeader32->pih_magic, pHeader32->pih_numwords, | ||
83 | + pHeader32->pih_blocklen, pHeader32->pih_pad); | ||
84 | +#endif | ||
85 | + } | ||
86 | + else if (__BYTE_ORDER == __LITTLE_ENDIAN) | ||
87 | + { | ||
88 | + fprintf(stderr, "Neither 32 or 64: %d\n", nBitType); | ||
89 | + return (-1); | ||
90 | + } | ||
91 | + | ||
92 | + return 0; | ||
93 | +} | ||
94 | + | ||
95 | +static int | ||
96 | +IheaderBigEndianToHost(char *pHeader, int nBitType) | ||
97 | +{ | ||
98 | + if (nBitType == en_is64 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
99 | + { | ||
100 | + struct pi_header64 *pHeader64 = (struct pi_header64*)pHeader; | ||
101 | + | ||
102 | + pHeader64->pih_magic = bswap_64(pHeader64->pih_magic); | ||
103 | + pHeader64->pih_numwords = bswap_64(pHeader64->pih_numwords); | ||
104 | + pHeader64->pih_blocklen = bswap_16(pHeader64->pih_blocklen); | ||
105 | + pHeader64->pih_pad = bswap_16(pHeader64->pih_pad); | ||
106 | + | ||
107 | +#if DEBUG | ||
108 | + printf("Header64: magic %x, numwords %x, blocklen %x, pad %x\n", | ||
109 | + pHeader64->pih_magic, pHeader64->pih_numwords, | ||
110 | + pHeader64->pih_blocklen, pHeader64->pih_pad); | ||
111 | +#endif | ||
112 | + } | ||
113 | + else if (nBitType == en_is32 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
114 | + { | ||
115 | + struct pi_header *pHeader32 = (struct pi_header*)pHeader; | ||
116 | + | ||
117 | + pHeader32->pih_magic = bswap_32(pHeader32->pih_magic); | ||
118 | + pHeader32->pih_numwords = bswap_32(pHeader32->pih_numwords); | ||
119 | + pHeader32->pih_blocklen = bswap_16(pHeader32->pih_blocklen); | ||
120 | + pHeader32->pih_pad = bswap_16(pHeader32->pih_pad); | ||
121 | + | ||
122 | +#if DEBUG | ||
123 | + printf("Header32: magic %x, numwords %x, blocklen %x, pad %x\n", | ||
124 | + pHeader32->pih_magic, pHeader32->pih_numwords, | ||
125 | + pHeader32->pih_blocklen, pHeader32->pih_pad); | ||
126 | +#endif | ||
127 | + } | ||
128 | + else if (__BYTE_ORDER == __LITTLE_ENDIAN) | ||
129 | + { | ||
130 | + fprintf(stderr, "Neither 32 or 64: %d\n", nBitType); | ||
131 | + return (-1); | ||
132 | + } | ||
133 | + | ||
134 | + return 0; | ||
135 | +} | ||
136 | + | ||
137 | +static int | ||
138 | +HwmsHostToBigEndian(char *pHwms, int nLen,int nBitType) | ||
139 | +{ | ||
140 | + int i = 0; | ||
141 | + | ||
142 | + if (nBitType == en_is64 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
143 | + { | ||
144 | + uint64_t *pHwms64 = (uint64_t*)pHwms; | ||
145 | + | ||
146 | + for (i = 0; i < nLen / sizeof(uint64_t); i++) | ||
147 | + { | ||
148 | + *pHwms64++ = bswap_64(*pHwms64); | ||
149 | + } | ||
150 | + | ||
151 | + } | ||
152 | + else if (nBitType == en_is32 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
153 | + { | ||
154 | + uint32_t *pHwms32 = (uint32_t*)pHwms; | ||
155 | + | ||
156 | + for (i = 0; i < nLen / sizeof(uint32_t); i++) | ||
157 | + { | ||
158 | + *pHwms32++ = bswap_32(*pHwms32); | ||
159 | + } | ||
160 | + | ||
161 | + } | ||
162 | + else if (__BYTE_ORDER == __LITTLE_ENDIAN) | ||
163 | + { | ||
164 | + fprintf(stderr, "Neither 32 or 64: %d\n", nBitType); | ||
165 | + return (-1); | ||
166 | + } | ||
167 | + | ||
168 | +#if DEBUG | ||
169 | + for (i = 0; i < nLen; i+=8) | ||
170 | + { | ||
171 | + printf("hwms%s: %02X %02X %02X %02X %02X %02X %02X %02X\n", | ||
172 | + nBitType==en_is64?"64":"32", pHwms[i+0]&0xFF, pHwms[i+1]&0xFF, | ||
173 | + pHwms[i+2]&0xFF, pHwms[i+3]&0xFF, pHwms[i+4]&0xFF, | ||
174 | + pHwms[i+5]&0xFF, pHwms[i+6]&0xFF, pHwms[i+7]&0xFF); | ||
175 | + } | ||
176 | +#endif | ||
177 | + | ||
178 | + return 0; | ||
179 | +} | ||
180 | + | ||
181 | +static int | ||
182 | +HwmsBigEndianToHost(char *pHwms, int nLen, int nBitType) | ||
183 | +{ | ||
184 | + int i = 0; | ||
185 | + | ||
186 | + if (nBitType == en_is64 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
187 | + { | ||
188 | + uint64_t *pHwms64 = (uint64_t*)pHwms; | ||
189 | + | ||
190 | + for (i = 0; i < nLen / sizeof(uint64_t); i++) | ||
191 | + { | ||
192 | + *pHwms64++ = bswap_64(*pHwms64); | ||
193 | + } | ||
194 | + | ||
195 | + } | ||
196 | + else if (nBitType == en_is32 && __BYTE_ORDER == __LITTLE_ENDIAN) | ||
197 | + { | ||
198 | + uint32_t *pHwms32 = (uint32_t*)pHwms; | ||
199 | + | ||
200 | + for (i = 0; i < nLen / sizeof(uint32_t); i++) | ||
201 | + { | ||
202 | + *pHwms32++ = bswap_32(*pHwms32); | ||
203 | + } | ||
204 | + | ||
205 | + } | ||
206 | + else if (__BYTE_ORDER == __LITTLE_ENDIAN) | ||
207 | + { | ||
208 | + fprintf(stderr, "Neither 32 or 64: %d\n", nBitType); | ||
209 | + return (-1); | ||
210 | + } | ||
211 | + | ||
212 | +#if DEBUG | ||
213 | + for (i = 0; i < nLen; i+=8) | ||
214 | + { | ||
215 | + printf("hwms%s: %02X %02X %02X %02X %02X %02X %02X %02X\n", | ||
216 | + nBitType==en_is64?"64":"32", pHwms[i+0]&0xFF, pHwms[i+1]&0xFF, | ||
217 | + pHwms[i+2]&0xFF, pHwms[i+3]&0xFF, pHwms[i+4]&0xFF, | ||
218 | + pHwms[i+5]&0xFF, pHwms[i+6]&0xFF, pHwms[i+7]&0xFF); | ||
219 | + } | ||
220 | +#endif | ||
221 | + | ||
222 | + return 0; | ||
223 | +} | ||
224 | |||
225 | static int | ||
226 | _PWIsBroken64(FILE *ifp) | ||
227 | @@ -57,6 +239,7 @@ _PWIsBroken64(FILE *ifp) | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | + IheaderBigEndianToHost((char *) &pdesc64.header, en_is64); | ||
232 | return (pdesc64.header.pih_magic == PIH_MAGIC); | ||
233 | } | ||
234 | |||
235 | @@ -149,7 +332,11 @@ PWOpen(prefix, mode) | ||
236 | pdesc.header.pih_blocklen = NUMWORDS; | ||
237 | pdesc.header.pih_numwords = 0; | ||
238 | |||
239 | - fwrite((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp); | ||
240 | + struct pi_header tmpheader32; | ||
241 | + | ||
242 | + memcpy(&tmpheader32, &pdesc.header, sizeof(pdesc.header)); | ||
243 | + IheaderHostToBigEndian((char *) &tmpheader32, en_is32); | ||
244 | + fwrite((char *) &tmpheader32, sizeof(tmpheader32), 1, ifp); | ||
245 | } else | ||
246 | { | ||
247 | pdesc.flags &= ~PFOR_WRITE; | ||
248 | @@ -173,6 +360,7 @@ PWOpen(prefix, mode) | ||
249 | return ((PWDICT *) 0); | ||
250 | } | ||
251 | |||
252 | + IheaderBigEndianToHost((char *) &pdesc.header, en_is32); | ||
253 | if ((pdesc.header.pih_magic == 0) || (pdesc.header.pih_numwords == 0)) | ||
254 | { | ||
255 | /* uh-oh. either a broken "64-bit" file or a garbage file. */ | ||
256 | @@ -195,6 +383,7 @@ PWOpen(prefix, mode) | ||
257 | } | ||
258 | return ((PWDICT *) 0); | ||
259 | } | ||
260 | + IheaderBigEndianToHost((char *) &pdesc64.header, en_is64); | ||
261 | if (pdesc64.header.pih_magic != PIH_MAGIC) | ||
262 | { | ||
263 | /* nope, not "64-bit" after all */ | ||
264 | @@ -290,6 +479,7 @@ PWOpen(prefix, mode) | ||
265 | { | ||
266 | pdesc.flags &= ~PFOR_USEHWMS; | ||
267 | } | ||
268 | + HwmsBigEndianToHost((char*)pdesc64.hwms, sizeof(pdesc64.hwms), en_is64); | ||
269 | for (i = 0; i < sizeof(pdesc.hwms) / sizeof(pdesc.hwms[0]); i++) | ||
270 | { | ||
271 | pdesc.hwms[i] = pdesc64.hwms[i]; | ||
272 | @@ -299,6 +489,7 @@ PWOpen(prefix, mode) | ||
273 | { | ||
274 | pdesc.flags &= ~PFOR_USEHWMS; | ||
275 | } | ||
276 | + HwmsBigEndianToHost((char*)pdesc.hwms, sizeof(pdesc.hwms), en_is32); | ||
277 | #if DEBUG | ||
278 | for (i=1; i<=0xff; i++) | ||
279 | { | ||
280 | @@ -332,7 +523,11 @@ PWClose(pwp) | ||
281 | return (-1); | ||
282 | } | ||
283 | |||
284 | - if (!fwrite((char *) &pwp->header, sizeof(pwp->header), 1, pwp->ifp)) | ||
285 | + struct pi_header tmpheader32; | ||
286 | + | ||
287 | + memcpy(&tmpheader32, &pwp->header, sizeof(pwp->header)); | ||
288 | + IheaderHostToBigEndian((char *) &tmpheader32, en_is32); | ||
289 | + if (!fwrite((char *) &tmpheader32, sizeof(tmpheader32), 1, pwp->ifp)) | ||
290 | { | ||
291 | fprintf(stderr, "index magic fwrite failed\n"); | ||
292 | return (-1); | ||
293 | @@ -351,7 +546,12 @@ PWClose(pwp) | ||
294 | printf("hwm[%02x] = %d\n", i, pwp->hwms[i]); | ||
295 | #endif | ||
296 | } | ||
297 | - fwrite(pwp->hwms, 1, sizeof(pwp->hwms), pwp->wfp); | ||
298 | + | ||
299 | + PWDICT tmp_pwp; | ||
300 | + | ||
301 | + memcpy(&tmp_pwp, pwp, sizeof(PWDICT)); | ||
302 | + HwmsHostToBigEndian(tmp_pwp.hwms, sizeof(tmp_pwp.hwms), en_is32); | ||
303 | + fwrite(tmp_pwp.hwms, 1, sizeof(tmp_pwp.hwms), pwp->wfp); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | @@ -405,7 +605,8 @@ PutPW(pwp, string) | ||
308 | |||
309 | datum = (uint32_t) ftell(pwp->dfp); | ||
310 | |||
311 | - fwrite((char *) &datum, sizeof(datum), 1, pwp->ifp); | ||
312 | + uint32_t tmpdatum = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_32(datum) : datum; | ||
313 | + fwrite((char *) &tmpdatum, sizeof(tmpdatum), 1, pwp->ifp); | ||
314 | |||
315 | fputs(pwp->data_put[0], pwp->dfp); | ||
316 | putc(0, pwp->dfp); | ||
317 | @@ -473,6 +674,7 @@ GetPW(pwp, number) | ||
318 | perror("(index fread failed)"); | ||
319 | return ((char *) 0); | ||
320 | } | ||
321 | + datum64 = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_64(datum64) : datum64; | ||
322 | datum = datum64; | ||
323 | } else { | ||
324 | if (fseek(pwp->ifp, sizeof(struct pi_header) + (thisblock * sizeof(uint32_t)), 0)) | ||
325 | @@ -486,6 +688,7 @@ GetPW(pwp, number) | ||
326 | perror("(index fread failed)"); | ||
327 | return ((char *) 0); | ||
328 | } | ||
329 | + datum = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_32(datum) : datum; | ||
330 | } | ||
331 | |||
332 | int r = 1; | ||
diff --git a/meta/recipes-extended/cracklib/cracklib/0002-craklib-fix-testnum-and-teststr-failed.patch b/meta/recipes-extended/cracklib/cracklib/0002-craklib-fix-testnum-and-teststr-failed.patch new file mode 100644 index 0000000000..6210e82121 --- /dev/null +++ b/meta/recipes-extended/cracklib/cracklib/0002-craklib-fix-testnum-and-teststr-failed.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 06f9a88b5dd5597f9198ea0cb34f5e96f180e6e3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Sat, 27 Apr 2013 16:02:30 +0800 | ||
4 | Subject: [PATCH] craklib:fix testnum and teststr failed | ||
5 | |||
6 | Error log: | ||
7 | ... | ||
8 | $ ./testnum | ||
9 | (null).pwd.gz: No such file or directory | ||
10 | PWOpen: No such file or directory | ||
11 | |||
12 | $ ./util/teststr | ||
13 | (null).pwd.gz: No such file or directory | ||
14 | PWOpen: No such file or directory | ||
15 | ... | ||
16 | Set DEFAULT_CRACKLIB_DICT as the path of PWOpen | ||
17 | |||
18 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
19 | Upstream-Status: Pending | ||
20 | --- | ||
21 | util/testnum.c | 2 +- | ||
22 | util/teststr.c | 2 +- | ||
23 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/util/testnum.c b/util/testnum.c | ||
26 | index ae2246d..ca210ff 100644 | ||
27 | --- a/util/testnum.c | ||
28 | +++ b/util/testnum.c | ||
29 | @@ -20,7 +20,7 @@ main () | ||
30 | PWDICT *pwp; | ||
31 | char buffer[STRINGSIZE]; | ||
32 | |||
33 | - if (!(pwp = PWOpen (NULL, "r"))) | ||
34 | + if (!(pwp = PWOpen (DEFAULT_CRACKLIB_DICT, "r"))) | ||
35 | { | ||
36 | perror ("PWOpen"); | ||
37 | return (-1); | ||
38 | diff --git a/util/teststr.c b/util/teststr.c | ||
39 | index 2a31fa4..9fb9cda 100644 | ||
40 | --- a/util/teststr.c | ||
41 | +++ b/util/teststr.c | ||
42 | @@ -15,7 +15,7 @@ main () | ||
43 | PWDICT *pwp; | ||
44 | char buffer[STRINGSIZE]; | ||
45 | |||
46 | - if (!(pwp = PWOpen (NULL, "r"))) | ||
47 | + if (!(pwp = PWOpen (DEFAULT_CRACKLIB_DICT, "r"))) | ||
48 | { | ||
49 | perror ("PWOpen"); | ||
50 | return (-1); | ||
51 | -- | ||
52 | 1.7.10.4 | ||
53 | |||
diff --git a/meta/recipes-extended/cracklib/cracklib_2.9.1.bb b/meta/recipes-extended/cracklib/cracklib_2.9.1.bb new file mode 100644 index 0000000000..99ccde3ba3 --- /dev/null +++ b/meta/recipes-extended/cracklib/cracklib_2.9.1.bb | |||
@@ -0,0 +1,25 @@ | |||
1 | SUMMARY = "Password strength checker library" | ||
2 | HOMEPAGE = "http://sourceforge.net/projects/cracklib" | ||
3 | |||
4 | LICENSE = "LGPLv2.1+" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=e3eda01d9815f8d24aae2dbd89b68b06" | ||
6 | |||
7 | DEPENDS = "cracklib-native zlib" | ||
8 | DEPENDS_class-native = "zlib-native" | ||
9 | |||
10 | EXTRA_OECONF = "--without-python --libdir=${base_libdir}" | ||
11 | |||
12 | SRC_URI = "${SOURCEFORGE_MIRROR}/cracklib/cracklib-${PV}.tar.gz \ | ||
13 | file://0001-packlib.c-support-dictionary-byte-order-dependent.patch \ | ||
14 | file://0002-craklib-fix-testnum-and-teststr-failed.patch" | ||
15 | |||
16 | SRC_URI[md5sum] = "90536219c520add2ceb3c26f0d7da404" | ||
17 | SRC_URI[sha256sum] = "408905c2539a97dc8cbbb6d7cd2046cb5647a345b4bda399220d9471be16d156" | ||
18 | |||
19 | inherit autotools-brokensep gettext | ||
20 | |||
21 | do_install_append_class-target() { | ||
22 | create-cracklib-dict -o ${D}${datadir}/cracklib/pw_dict ${D}${datadir}/cracklib/cracklib-small | ||
23 | } | ||
24 | |||
25 | BBCLASSEXTEND = "native nativesdk" | ||