summaryrefslogtreecommitdiff
path: root/source3/nsswitch
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/nsswitch
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/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_idmap.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/source3/nsswitch/winbindd_idmap.c b/source3/nsswitch/winbindd_idmap.c
index 60ea188b1d..0594f61680 100644
--- a/source3/nsswitch/winbindd_idmap.c
+++ b/source3/nsswitch/winbindd_idmap.c
@@ -364,6 +364,7 @@ fail:
static BOOL idmap_convert(const char *idmap_name)
{
int32 vers = tdb_fetch_int32(idmap_tdb, "IDMAP_VERSION");
+ BOOL bigendianheader = (idmap_tdb->flags & TDB_BIGENDIAN) ? True : False;
if (vers == IDMAP_VERSION)
return True;
@@ -374,23 +375,20 @@ static BOOL idmap_convert(const char *idmap_name)
return False;
#endif
- if ((vers == -1) || (IREV(vers) == IDMAP_VERSION)) {
- /* Arrggghh ! Bytereversed or missing - make order independent ! */
+ if (((vers == -1) && bigendianheader) || (IREV(vers) == IDMAP_VERSION)) {
+ /* Arrggghh ! Bytereversed or old big-endian - make order independent ! */
/*
- * If the header needed to be converted then the
- * high and low records may have been created on a
- * foreign endian machine and will need byte-reversing.
+ * high and low records were created on a
+ * big endian machine and will need byte-reversing.
*/
- BOOL bytereverse_needed = (idmap_tdb->flags & TDB_CONVERT);
int32 wm;
wm = tdb_fetch_int32(idmap_tdb, HWM_USER);
- if (wm != -1 && bytereverse_needed) {
- /* A record existed and it was from a foreign endian machine. */
+ if (wm != -1) {
wm = IREV(wm);
- } else if (wm == -1)
+ } else
wm = server_state.uid_low;
if (tdb_store_int32(idmap_tdb, HWM_USER, wm) == -1) {
@@ -399,10 +397,9 @@ static BOOL idmap_convert(const char *idmap_name)
}
wm = tdb_fetch_int32(idmap_tdb, HWM_GROUP);
- if (wm != -1 && bytereverse_needed) {
- /* A record existed and it was from a foreign endian machine. */
+ if (wm != -1) {
wm = IREV(wm);
- } else if (wm == -1)
+ } else
wm = server_state.gid_low;
if (tdb_store_int32(idmap_tdb, HWM_GROUP, wm) == -1) {