diff options
| -rw-r--r-- | meta/recipes-extended/cracklib/cracklib/0001-packlib.c-support-dictionary-byte-order-dependent.patch | 67 |
1 files changed, 37 insertions, 30 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 8e0f40642a..adbe7dfff4 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 @@ | |||
| 1 | From dae29a98c066bc67bb5ba12219d5fd68a8675514 Mon Sep 17 00:00:00 2001 | 1 | From 8a6e43726ad0ae41bd1cc2c248d91deb31459357 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> | 2 | From: Lei Maohui <leimaohui@cn.fujitsu.com> |
| 3 | Date: Fri, 26 Apr 2013 20:44:10 +0800 | 3 | Date: Tue, 9 Jun 2015 11:11:48 +0900 |
| 4 | Subject: [PATCH] packlib.c: support dictionary byte-order dependent | 4 | Subject: [PATCH] packlib.c: support dictionary byte order dependent |
| 5 | 5 | ||
| 6 | The previous dict files are NOT byte-order independent, in fact they are | 6 | The previous dict files are NOT byte-order independent, in fact they are |
| 7 | probably ARCHITECTURE SPECIFIC. | 7 | probably ARCHITECTURE SPECIFIC. |
| @@ -12,7 +12,7 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | |||
| 12 | Upstream-Status: Pending | 12 | Upstream-Status: Pending |
| 13 | 13 | ||
| 14 | We can't use the endian.h, htobe* and be*toh functions because they are | 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 | 15 | not available on older versions of glibc, such as that found in RHEL |
| 16 | 5.9. | 16 | 5.9. |
| 17 | 17 | ||
| 18 | Change to checking endian and directly calling bswap_* as defined in | 18 | Change to checking endian and directly calling bswap_* as defined in |
| @@ -20,14 +20,15 @@ byteswap.h. | |||
| 20 | 20 | ||
| 21 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | 21 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
| 22 | 22 | ||
| 23 | Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com> | ||
| 23 | --- | 24 | --- |
| 24 | lib/packlib.c | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | 25 | lib/packlib.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- |
| 25 | 1 file changed, 204 insertions(+), 4 deletions(-) | 26 | 1 file changed, 210 insertions(+), 4 deletions(-) |
| 26 | 27 | ||
| 27 | Index: cracklib-2.8.22/lib/packlib.c | 28 | diff --git a/lib/packlib.c b/lib/packlib.c |
| 28 | =================================================================== | 29 | index f851424..3aac805 100644 |
| 29 | --- cracklib-2.8.22.orig/lib/packlib.c | 30 | --- a/lib/packlib.c |
| 30 | +++ cracklib-2.8.22/lib/packlib.c | 31 | +++ b/lib/packlib.c |
| 31 | @@ -16,6 +16,12 @@ | 32 | @@ -16,6 +16,12 @@ |
| 32 | #ifdef HAVE_STDINT_H | 33 | #ifdef HAVE_STDINT_H |
| 33 | #include <stdint.h> | 34 | #include <stdint.h> |
| @@ -41,7 +42,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 41 | #include "packer.h" | 42 | #include "packer.h" |
| 42 | 43 | ||
| 43 | static const char vers_id[] = "packlib.c : v2.3p2 Alec Muffett 18 May 1993"; | 44 | static const char vers_id[] = "packlib.c : v2.3p2 Alec Muffett 18 May 1993"; |
| 44 | @@ -45,6 +51,182 @@ typedef struct | 45 | @@ -45,6 +51,185 @@ typedef struct |
| 45 | char data_get[NUMWORDS][MAXWORDLEN]; | 46 | char data_get[NUMWORDS][MAXWORDLEN]; |
| 46 | } PWDICT64; | 47 | } PWDICT64; |
| 47 | 48 | ||
| @@ -145,7 +146,8 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 145 | + | 146 | + |
| 146 | + for (i = 0; i < nLen / sizeof(uint64_t); i++) | 147 | + for (i = 0; i < nLen / sizeof(uint64_t); i++) |
| 147 | + { | 148 | + { |
| 148 | + *pHwms64++ = bswap_64(*pHwms64); | 149 | + *pHwms64 = bswap_64(*pHwms64); |
| 150 | + *pHwms64++; | ||
| 149 | + } | 151 | + } |
| 150 | + | 152 | + |
| 151 | + } | 153 | + } |
| @@ -155,7 +157,8 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 155 | + | 157 | + |
| 156 | + for (i = 0; i < nLen / sizeof(uint32_t); i++) | 158 | + for (i = 0; i < nLen / sizeof(uint32_t); i++) |
| 157 | + { | 159 | + { |
| 158 | + *pHwms32++ = bswap_32(*pHwms32); | 160 | + *pHwms32 = bswap_32(*pHwms32); |
| 161 | + *pHwms32++; | ||
| 159 | + } | 162 | + } |
| 160 | + | 163 | + |
| 161 | + } | 164 | + } |
| @@ -199,7 +202,8 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 199 | + | 202 | + |
| 200 | + for (i = 0; i < nLen / sizeof(uint32_t); i++) | 203 | + for (i = 0; i < nLen / sizeof(uint32_t); i++) |
| 201 | + { | 204 | + { |
| 202 | + *pHwms32++ = bswap_32(*pHwms32); | 205 | + *pHwms32 = bswap_32(*pHwms32); |
| 206 | + *pHwms32++; | ||
| 203 | + } | 207 | + } |
| 204 | + | 208 | + |
| 205 | + } | 209 | + } |
| @@ -224,7 +228,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 224 | 228 | ||
| 225 | static int | 229 | static int |
| 226 | _PWIsBroken64(FILE *ifp) | 230 | _PWIsBroken64(FILE *ifp) |
| 227 | @@ -57,6 +239,7 @@ _PWIsBroken64(FILE *ifp) | 231 | @@ -57,6 +242,7 @@ _PWIsBroken64(FILE *ifp) |
| 228 | return 0; | 232 | return 0; |
| 229 | } | 233 | } |
| 230 | 234 | ||
| @@ -232,7 +236,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 232 | return (pdesc64.header.pih_magic == PIH_MAGIC); | 236 | return (pdesc64.header.pih_magic == PIH_MAGIC); |
| 233 | } | 237 | } |
| 234 | 238 | ||
| 235 | @@ -149,7 +332,11 @@ PWOpen(prefix, mode) | 239 | @@ -149,7 +335,11 @@ PWOpen(prefix, mode) |
| 236 | pdesc.header.pih_blocklen = NUMWORDS; | 240 | pdesc.header.pih_blocklen = NUMWORDS; |
| 237 | pdesc.header.pih_numwords = 0; | 241 | pdesc.header.pih_numwords = 0; |
| 238 | 242 | ||
| @@ -245,23 +249,23 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 245 | } else | 249 | } else |
| 246 | { | 250 | { |
| 247 | pdesc.flags &= ~PFOR_WRITE; | 251 | pdesc.flags &= ~PFOR_WRITE; |
| 248 | @@ -173,6 +360,7 @@ PWOpen(prefix, mode) | 252 | @@ -173,6 +363,7 @@ PWOpen(prefix, mode) |
| 249 | return ((PWDICT *) 0); | 253 | return NULL; |
| 250 | } | 254 | } |
| 251 | 255 | ||
| 252 | + IheaderBigEndianToHost((char *) &pdesc.header, en_is32); | 256 | + IheaderBigEndianToHost((char *) &pdesc.header, en_is32); |
| 253 | if ((pdesc.header.pih_magic == 0) || (pdesc.header.pih_numwords == 0)) | 257 | if ((pdesc.header.pih_magic == 0) || (pdesc.header.pih_numwords == 0)) |
| 254 | { | 258 | { |
| 255 | /* 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. */ |
| 256 | @@ -195,6 +383,7 @@ PWOpen(prefix, mode) | 260 | @@ -195,6 +386,7 @@ PWOpen(prefix, mode) |
| 257 | } | 261 | } |
| 258 | return ((PWDICT *) 0); | 262 | return NULL; |
| 259 | } | 263 | } |
| 260 | + IheaderBigEndianToHost((char *) &pdesc64.header, en_is64); | 264 | + IheaderBigEndianToHost((char *) &pdesc64.header, en_is64); |
| 261 | if (pdesc64.header.pih_magic != PIH_MAGIC) | 265 | if (pdesc64.header.pih_magic != PIH_MAGIC) |
| 262 | { | 266 | { |
| 263 | /* nope, not "64-bit" after all */ | 267 | /* nope, not "64-bit" after all */ |
| 264 | @@ -290,6 +479,7 @@ PWOpen(prefix, mode) | 268 | @@ -290,6 +482,7 @@ PWOpen(prefix, mode) |
| 265 | { | 269 | { |
| 266 | pdesc.flags &= ~PFOR_USEHWMS; | 270 | pdesc.flags &= ~PFOR_USEHWMS; |
| 267 | } | 271 | } |
| @@ -269,7 +273,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 269 | 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++) |
| 270 | { | 274 | { |
| 271 | pdesc.hwms[i] = pdesc64.hwms[i]; | 275 | pdesc.hwms[i] = pdesc64.hwms[i]; |
| 272 | @@ -299,6 +489,7 @@ PWOpen(prefix, mode) | 276 | @@ -299,6 +492,7 @@ PWOpen(prefix, mode) |
| 273 | { | 277 | { |
| 274 | pdesc.flags &= ~PFOR_USEHWMS; | 278 | pdesc.flags &= ~PFOR_USEHWMS; |
| 275 | } | 279 | } |
| @@ -277,7 +281,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 277 | #if DEBUG | 281 | #if DEBUG |
| 278 | for (i=1; i<=0xff; i++) | 282 | for (i=1; i<=0xff; i++) |
| 279 | { | 283 | { |
| 280 | @@ -332,7 +523,11 @@ PWClose(pwp) | 284 | @@ -332,7 +526,11 @@ PWClose(pwp) |
| 281 | return (-1); | 285 | return (-1); |
| 282 | } | 286 | } |
| 283 | 287 | ||
| @@ -290,7 +294,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 290 | { | 294 | { |
| 291 | fprintf(stderr, "index magic fwrite failed\n"); | 295 | fprintf(stderr, "index magic fwrite failed\n"); |
| 292 | return (-1); | 296 | return (-1); |
| 293 | @@ -351,7 +546,12 @@ PWClose(pwp) | 297 | @@ -351,7 +549,12 @@ PWClose(pwp) |
| 294 | printf("hwm[%02x] = %d\n", i, pwp->hwms[i]); | 298 | printf("hwm[%02x] = %d\n", i, pwp->hwms[i]); |
| 295 | #endif | 299 | #endif |
| 296 | } | 300 | } |
| @@ -304,7 +308,7 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 304 | } | 308 | } |
| 305 | } | 309 | } |
| 306 | 310 | ||
| 307 | @@ -405,7 +605,8 @@ PutPW(pwp, string) | 311 | @@ -405,7 +608,8 @@ PutPW(pwp, string) |
| 308 | 312 | ||
| 309 | datum = (uint32_t) ftell(pwp->dfp); | 313 | datum = (uint32_t) ftell(pwp->dfp); |
| 310 | 314 | ||
| @@ -314,19 +318,22 @@ Index: cracklib-2.8.22/lib/packlib.c | |||
| 314 | 318 | ||
| 315 | fputs(pwp->data_put[0], pwp->dfp); | 319 | fputs(pwp->data_put[0], pwp->dfp); |
| 316 | putc(0, pwp->dfp); | 320 | putc(0, pwp->dfp); |
| 317 | @@ -473,6 +674,7 @@ GetPW(pwp, number) | 321 | @@ -464,6 +668,7 @@ GetPW(pwp, number) |
| 318 | perror("(index fread failed)"); | 322 | perror("(index fread failed)"); |
| 319 | return ((char *) 0); | 323 | return NULL; |
| 320 | } | 324 | } |
| 321 | + datum64 = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_64(datum64) : datum64; | 325 | + datum64 = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_64(datum64) : datum64; |
| 322 | datum = datum64; | 326 | datum = datum64; |
| 323 | } else { | 327 | } else { |
| 324 | 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)) |
| 325 | @@ -486,6 +688,7 @@ GetPW(pwp, number) | 329 | @@ -477,6 +682,7 @@ GetPW(pwp, number) |
| 326 | perror("(index fread failed)"); | 330 | perror("(index fread failed)"); |
| 327 | return ((char *) 0); | 331 | return NULL; |
| 328 | } | 332 | } |
| 329 | + datum = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_32(datum) : datum; | 333 | + datum = (__BYTE_ORDER == __LITTLE_ENDIAN) ? bswap_32(datum) : datum; |
| 330 | } | 334 | } |
| 331 | 335 | ||
| 332 | int r = 1; | 336 | int r = 1; |
| 337 | -- | ||
| 338 | 1.8.4.2 | ||
| 339 | |||
