summaryrefslogtreecommitdiff
path: root/source3/tdb/tdb.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-04-27 18:56:47 +0000
committerJeremy Allison <jra@samba.org>2002-04-27 18:56:47 +0000
commitdec3433303cefed83e1a24ba23b79af99cb353e9 (patch)
tree8658e7692ae56aadb176cacf6a4706bacd83f04e /source3/tdb/tdb.c
parent56de6fa4705d8e43049e8c862c024301e3ef78d3 (diff)
downloadsamba-dec3433303cefed83e1a24ba23b79af99cb353e9.tar.gz
samba-dec3433303cefed83e1a24ba23b79af99cb353e9.tar.bz2
samba-dec3433303cefed83e1a24ba23b79af99cb353e9.zip
Merge Herb's idmap endian fix.
Jeremy. (This used to be commit 7ddad4061a1b7ed25e4d6471c7a1f8f97a98ed37)
Diffstat (limited to 'source3/tdb/tdb.c')
-rw-r--r--source3/tdb/tdb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 5c0fd436e3..c937090de4 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1471,6 +1471,8 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
TDB_CONTEXT *tdb;
struct stat st;
int rev = 0, locked;
+ unsigned char *vp;
+ u32 vertest;
if (!(tdb = calloc(1, sizeof *tdb))) {
/* Can't log this */
@@ -1548,6 +1550,10 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
}
rev = (tdb->flags & TDB_CONVERT);
}
+ vp = (unsigned char *)&tdb->header.version;
+ vertest = (((u32)vp[0]) << 24) | (((u32)vp[1]) << 16) |
+ (((u32)vp[2]) << 8) | (u32)vp[3];
+ tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0;
if (!rev)
tdb->flags &= ~TDB_CONVERT;
else {