From: Stelian Pop Date: Wed, 8 Jun 2005 13:24:08 +0000 (+0000) Subject: Fix big endian issues with EA/ACL X-Git-Tag: release_0_4b41~6 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=cb6d3f79501e3c03637ca49f4b980288771eabd3;p=dump.git Fix big endian issues with EA/ACL --- diff --git a/CHANGES b/CHANGES index f2ce5fe..1c3488f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.276 2005/06/08 09:34:33 stelian Exp $ +$Id: CHANGES,v 1.277 2005/06/08 13:24:08 stelian Exp $ Changes between versions 0.4b40 and 0.4b41 (released ???????????) ================================================================= @@ -7,6 +7,9 @@ Changes between versions 0.4b40 and 0.4b41 (released ???????????) code for EA works fine, but ACLs needed conversion from the ext2/3 disk format to posix_acl format before restoring. +2. Fix some issues with restoration of EA on big endian + platforms. + Changes between versions 0.4b39 and 0.4b40 (released May 2, 2005) ================================================================= diff --git a/restore/tape.c b/restore/tape.c index e60921b..c74e390 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.89 2005/05/02 15:10:46 stelian Exp $"; + "$Id: tape.c,v 1.90 2005/06/08 13:24:11 stelian Exp $"; #endif /* not lint */ #include @@ -346,6 +346,7 @@ setup(void) #endif FLUSHTAPEBUF(); findtapeblksize(); + cvtflag = 0; if (gethead(&spcl) == FAIL) { blkcnt--; /* push back this block */ blksread--; @@ -2412,6 +2413,7 @@ findtapeblksize(void) errx(1, "Tape read error on first record"); memcpy(&spclpt, tapebuf, TP_BSIZE); + cvtflag = 0; if (converthead(&spclpt) == FAIL) { cvtflag++; if (converthead(&spclpt) == FAIL) { @@ -2622,7 +2624,7 @@ converthead(struct s_spcl *buf) if (checksum((int *)buf) == FAIL) return (FAIL); if (Bcvt) - swabst((u_char *)"8i4s31i528bi192b3i", (u_char *)buf); + swabst((u_char *)"8i4s1l29i528bi192b4i", (u_char *)buf); goto good; } memcpy(&u_ospcl.s_ospcl, buf, TP_BSIZE); diff --git a/restore/xattr.c b/restore/xattr.c index 1182d85..290f8b9 100644 --- a/restore/xattr.c +++ b/restore/xattr.c @@ -29,7 +29,7 @@ #ifndef lint static const char rcsid[] = - "$Id: xattr.c,v 1.2 2005/06/08 09:34:40 stelian Exp $"; + "$Id: xattr.c,v 1.3 2005/06/08 13:24:12 stelian Exp $"; #endif /* not lint */ #include @@ -308,15 +308,17 @@ posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size) { } ext_acl->a_version = POSIX_ACL_XATTR_VERSION; - if (Bcvt) - swabst("1i", (u_char *)ext_acl); +#if BYTE_ORDER == BIG_ENDIAN + swabst("1i", (u_char *)ext_acl); +#endif for (n=0; n < acl->a_count; n++, ext_entry++) { ext_entry->e_tag = acl->a_entries[n].e_tag; ext_entry->e_perm = acl->a_entries[n].e_perm; ext_entry->e_id = acl->a_entries[n].e_id; - if (Bcvt) - swabst("2s1i", (u_char *)ext_entry); +#if BYTE_ORDER == BIG_ENDIAN + swabst("2s1i", (u_char *)ext_entry); +#endif } return real_size; } @@ -334,8 +336,9 @@ ext3_acl_from_disk(const void *value, size_t size) fprintf(stderr, "ACL size too little\n"); return NULL; } - if (Bcvt) - swabst("1i", (u_char *)value); +#if BYTE_ORDER == BIG_ENDIAN + swabst("1i", (u_char *)value); +#endif if (((ext3_acl_header *)value)->a_version != EXT3_ACL_VERSION) { fprintf(stderr, "ACL version unknown\n"); return NULL; @@ -356,9 +359,10 @@ ext3_acl_from_disk(const void *value, size_t size) acl->a_count = count; for (n=0; n < count; n++) { - if (Bcvt) - swabst("2s1i", (u_char *)value); ext3_acl_entry *entry = (ext3_acl_entry *)value; +#if BYTE_ORDER == BIG_ENDIAN + swabst("2s", (u_char *)entry); +#endif if ((char *)value + sizeof(ext3_acl_entry_short) > end) goto fail; acl->a_entries[n].e_tag = entry->e_tag; @@ -374,6 +378,9 @@ ext3_acl_from_disk(const void *value, size_t size) case ACL_USER: case ACL_GROUP: +#if BYTE_ORDER == BIG_ENDIAN + swabst("4b1i", (u_char *)entry); +#endif value = (char *)value + sizeof(ext3_acl_entry); if ((char *)value > end) goto fail; @@ -453,8 +460,9 @@ xattr_verify(char *buffer) end = buffer + XATTR_MAXSIZE; - if (Bcvt) - swabst("4i", (u_char *)buffer); +#if BYTE_ORDER == BIG_ENDIAN + swabst("4i", (u_char *)buffer); +#endif if (HDR(buffer)->h_magic != EXT2_XATTR_MAGIC && HDR(buffer)->h_magic != EXT2_XATTR_MAGIC2) { @@ -466,8 +474,9 @@ xattr_verify(char *buffer) /* check the on-disk data structure */ entry = FIRST_ENTRY(buffer); - if (Bcvt) - swabst("2b1s3i", (u_char *)entry); +#if BYTE_ORDER == BIG_ENDIAN + swabst("2b1s3i", (u_char *)entry); +#endif while (!IS_LAST_ENTRY(entry)) { struct ext2_xattr_entry *next = EXT2_XATTR_NEXT(entry); @@ -476,8 +485,9 @@ xattr_verify(char *buffer) return FAIL; } entry = next; - if (Bcvt) - swabst("2b1s3i", (u_char *)entry); +#if BYTE_ORDER == BIG_ENDIAN + swabst("2b1s3i", (u_char *)entry); +#endif } return GOOD; }