summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch')
-rw-r--r--meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch42
1 files changed, 21 insertions, 21 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
index adbe7dfff4..35229ae890 100644
--- 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
@@ -1,7 +1,7 @@
1From 8a6e43726ad0ae41bd1cc2c248d91deb31459357 Mon Sep 17 00:00:00 2001 1From aae03b7e626d5f62ab929d51d11352a5a2ff6b2d Mon Sep 17 00:00:00 2001
2From: Lei Maohui <leimaohui@cn.fujitsu.com> 2From: Lei Maohui <leimaohui@cn.fujitsu.com>
3Date: Tue, 9 Jun 2015 11:11:48 +0900 3Date: Tue, 9 Jun 2015 11:11:48 +0900
4Subject: [PATCH] packlib.c: support dictionary byte order dependent 4Subject: [PATCH 1/2] packlib.c: support dictionary byte order dependent
5 5
6The previous dict files are NOT byte-order independent, in fact they are 6The previous dict files are NOT byte-order independent, in fact they are
7probably ARCHITECTURE SPECIFIC. 7probably ARCHITECTURE SPECIFIC.
@@ -9,7 +9,7 @@ Create the dict files in big endian, and convert to host endian while
9load them. This could fix the endian issue on multiple platform. 9load them. This could fix the endian issue on multiple platform.
10 10
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12Upstream-Status: Pending 12Upstream-Status: Submitted [https://github.com/cracklib/cracklib/pull/41]
13 13
14We can't use the endian.h, htobe* and be*toh functions because they are 14We can't use the endian.h, htobe* and be*toh functions because they are
15not available on older versions of glibc, such as that found in RHEL 15not available on older versions of glibc, such as that found in RHEL
@@ -22,11 +22,11 @@ Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
22 22
23Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com> 23Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
24--- 24---
25 lib/packlib.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 25 lib/packlib.c | 214 +++++++++++++++++++++++++++++++++++++++++++++-
26 1 file changed, 210 insertions(+), 4 deletions(-) 26 1 file changed, 210 insertions(+), 4 deletions(-)
27 27
28diff --git a/lib/packlib.c b/lib/packlib.c 28diff --git a/lib/packlib.c b/lib/packlib.c
29index f851424..3aac805 100644 29index 9396e1d..d0bb181 100644
30--- a/lib/packlib.c 30--- a/lib/packlib.c
31+++ b/lib/packlib.c 31+++ b/lib/packlib.c
32@@ -16,6 +16,12 @@ 32@@ -16,6 +16,12 @@
@@ -41,8 +41,8 @@ index f851424..3aac805 100644
41+#include <byteswap.h> 41+#include <byteswap.h>
42 #include "packer.h" 42 #include "packer.h"
43 43
44 static const char vers_id[] = "packlib.c : v2.3p2 Alec Muffett 18 May 1993"; 44 #define DEBUG 0
45@@ -45,6 +51,185 @@ typedef struct 45@@ -43,6 +49,185 @@ typedef struct
46 char data_get[NUMWORDS][MAXWORDLEN]; 46 char data_get[NUMWORDS][MAXWORDLEN];
47 } PWDICT64; 47 } PWDICT64;
48 48
@@ -228,7 +228,7 @@ index f851424..3aac805 100644
228 228
229 static int 229 static int
230 _PWIsBroken64(FILE *ifp) 230 _PWIsBroken64(FILE *ifp)
231@@ -57,6 +242,7 @@ _PWIsBroken64(FILE *ifp) 231@@ -55,6 +240,7 @@ _PWIsBroken64(FILE *ifp)
232 return 0; 232 return 0;
233 } 233 }
234 234
@@ -236,7 +236,7 @@ index f851424..3aac805 100644
236 return (pdesc64.header.pih_magic == PIH_MAGIC); 236 return (pdesc64.header.pih_magic == PIH_MAGIC);
237 } 237 }
238 238
239@@ -149,7 +335,11 @@ PWOpen(prefix, mode) 239@@ -147,7 +333,11 @@ PWOpen(prefix, mode)
240 pdesc.header.pih_blocklen = NUMWORDS; 240 pdesc.header.pih_blocklen = NUMWORDS;
241 pdesc.header.pih_numwords = 0; 241 pdesc.header.pih_numwords = 0;
242 242
@@ -249,7 +249,7 @@ index f851424..3aac805 100644
249 } else 249 } else
250 { 250 {
251 pdesc.flags &= ~PFOR_WRITE; 251 pdesc.flags &= ~PFOR_WRITE;
252@@ -173,6 +363,7 @@ PWOpen(prefix, mode) 252@@ -171,6 +361,7 @@ PWOpen(prefix, mode)
253 return NULL; 253 return NULL;
254 } 254 }
255 255
@@ -257,7 +257,7 @@ index f851424..3aac805 100644
257 if ((pdesc.header.pih_magic == 0) || (pdesc.header.pih_numwords == 0)) 257 if ((pdesc.header.pih_magic == 0) || (pdesc.header.pih_numwords == 0))
258 { 258 {
259 /* uh-oh. either a broken "64-bit" file or a garbage file. */ 259 /* uh-oh. either a broken "64-bit" file or a garbage file. */
260@@ -195,6 +386,7 @@ PWOpen(prefix, mode) 260@@ -193,6 +384,7 @@ PWOpen(prefix, mode)
261 } 261 }
262 return NULL; 262 return NULL;
263 } 263 }
@@ -265,7 +265,7 @@ index f851424..3aac805 100644
265 if (pdesc64.header.pih_magic != PIH_MAGIC) 265 if (pdesc64.header.pih_magic != PIH_MAGIC)
266 { 266 {
267 /* nope, not "64-bit" after all */ 267 /* nope, not "64-bit" after all */
268@@ -290,6 +482,7 @@ PWOpen(prefix, mode) 268@@ -288,6 +480,7 @@ PWOpen(prefix, mode)
269 { 269 {
270 pdesc.flags &= ~PFOR_USEHWMS; 270 pdesc.flags &= ~PFOR_USEHWMS;
271 } 271 }
@@ -273,7 +273,7 @@ index f851424..3aac805 100644
273 for (i = 0; i < sizeof(pdesc.hwms) / sizeof(pdesc.hwms[0]); i++) 273 for (i = 0; i < sizeof(pdesc.hwms) / sizeof(pdesc.hwms[0]); i++)
274 { 274 {
275 pdesc.hwms[i] = pdesc64.hwms[i]; 275 pdesc.hwms[i] = pdesc64.hwms[i];
276@@ -299,6 +492,7 @@ PWOpen(prefix, mode) 276@@ -297,6 +490,7 @@ PWOpen(prefix, mode)
277 { 277 {
278 pdesc.flags &= ~PFOR_USEHWMS; 278 pdesc.flags &= ~PFOR_USEHWMS;
279 } 279 }
@@ -281,7 +281,7 @@ index f851424..3aac805 100644
281 #if DEBUG 281 #if DEBUG
282 for (i=1; i<=0xff; i++) 282 for (i=1; i<=0xff; i++)
283 { 283 {
284@@ -332,7 +526,11 @@ PWClose(pwp) 284@@ -330,7 +524,11 @@ PWClose(pwp)
285 return (-1); 285 return (-1);
286 } 286 }
287 287
@@ -294,7 +294,7 @@ index f851424..3aac805 100644
294 { 294 {
295 fprintf(stderr, "index magic fwrite failed\n"); 295 fprintf(stderr, "index magic fwrite failed\n");
296 return (-1); 296 return (-1);
297@@ -351,7 +549,12 @@ PWClose(pwp) 297@@ -349,7 +547,12 @@ PWClose(pwp)
298 printf("hwm[%02x] = %d\n", i, pwp->hwms[i]); 298 printf("hwm[%02x] = %d\n", i, pwp->hwms[i]);
299 #endif 299 #endif
300 } 300 }
@@ -303,12 +303,12 @@ index f851424..3aac805 100644
303+ PWDICT tmp_pwp; 303+ PWDICT tmp_pwp;
304+ 304+
305+ memcpy(&tmp_pwp, pwp, sizeof(PWDICT)); 305+ memcpy(&tmp_pwp, pwp, sizeof(PWDICT));
306+ HwmsHostToBigEndian(tmp_pwp.hwms, sizeof(tmp_pwp.hwms), en_is32); 306+ HwmsHostToBigEndian((char *)tmp_pwp.hwms, sizeof(tmp_pwp.hwms), en_is32);
307+ fwrite(tmp_pwp.hwms, 1, sizeof(tmp_pwp.hwms), pwp->wfp); 307+ fwrite(tmp_pwp.hwms, 1, sizeof(tmp_pwp.hwms), pwp->wfp);
308 } 308 }
309 } 309 }
310 310
311@@ -405,7 +608,8 @@ PutPW(pwp, string) 311@@ -403,7 +606,8 @@ PutPW(pwp, string)
312 312
313 datum = (uint32_t) ftell(pwp->dfp); 313 datum = (uint32_t) ftell(pwp->dfp);
314 314
@@ -317,8 +317,8 @@ index f851424..3aac805 100644
317+ fwrite((char *) &tmpdatum, sizeof(tmpdatum), 1, pwp->ifp); 317+ fwrite((char *) &tmpdatum, sizeof(tmpdatum), 1, pwp->ifp);
318 318
319 fputs(pwp->data_put[0], pwp->dfp); 319 fputs(pwp->data_put[0], pwp->dfp);
320 putc(0, pwp->dfp); 320 putc(0, (FILE*) pwp->dfp);
321@@ -464,6 +668,7 @@ GetPW(pwp, number) 321@@ -462,6 +666,7 @@ GetPW(pwp, number)
322 perror("(index fread failed)"); 322 perror("(index fread failed)");
323 return NULL; 323 return NULL;
324 } 324 }
@@ -326,7 +326,7 @@ index f851424..3aac805 100644
326 datum = datum64; 326 datum = datum64;
327 } else { 327 } else {
328 if (fseek(pwp->ifp, sizeof(struct pi_header) + (thisblock * sizeof(uint32_t)), 0)) 328 if (fseek(pwp->ifp, sizeof(struct pi_header) + (thisblock * sizeof(uint32_t)), 0))
329@@ -477,6 +682,7 @@ GetPW(pwp, number) 329@@ -475,6 +680,7 @@ GetPW(pwp, number)
330 perror("(index fread failed)"); 330 perror("(index fread failed)");
331 return NULL; 331 return NULL;
332 } 332 }
@@ -335,5 +335,5 @@ index f851424..3aac805 100644
335 335
336 int r = 1; 336 int r = 1;
337-- 337--
3381.8.4.2 3382.20.1
339 339