summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-12-14 15:30:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:28 -0500
commit35a3773a6df72fc4031b90fb94010193966dbdc0 (patch)
tree45af37ea31cad46e1cdc8c42e1630de90032d22b /source3/passdb
parent7f5fefb7bb65ef35916769988abbec8209889225 (diff)
downloadsamba-35a3773a6df72fc4031b90fb94010193966dbdc0.tar.gz
samba-35a3773a6df72fc4031b90fb94010193966dbdc0.tar.bz2
samba-35a3773a6df72fc4031b90fb94010193966dbdc0.zip
r20169: Support for fallback to legacy mapping code was not completely tested.
Add necessary fixes. (This used to be commit 4a81ee9608d45f95eaaccc78a080e717cb7d4682)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/lookup_sid.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index d1d0f425ad..1fc96be70d 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -1141,6 +1141,7 @@ void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
DEBUG(10,("LEGACY: uid %u -> sid %s\n", (unsigned int)uid,
sid_string_static(psid)));
+ store_uid_sid_cache(psid, uid);
return;
}
@@ -1171,6 +1172,7 @@ void legacy_gid_to_sid(DOM_SID *psid, gid_t gid)
DEBUG(10,("LEGACY: gid %u -> sid %s\n", (unsigned int)gid,
sid_string_static(psid)));
+ store_gid_sid_cache(psid, gid);
return;
}
@@ -1209,16 +1211,16 @@ BOOL legacy_sid_to_uid(const DOM_SID *psid, uid_t *puid)
}
/* This was ours, but it was not mapped. Fail */
-
- return False;
}
+ DEBUG(10,("LEGACY: mapping failed for sid %s\n", sid_string_static(psid)));
return False;
- done:
+done:
DEBUG(10,("LEGACY: sid %s -> uid %u\n", sid_string_static(psid),
(unsigned int)*puid ));
+ store_uid_sid_cache(psid, *puid);
return True;
}
@@ -1252,6 +1254,7 @@ BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
*pgid = map.gid;
goto done;
}
+ DEBUG(10,("LEGACY: mapping failed for sid %s\n", sid_string_static(psid)));
return False;
}
@@ -1265,7 +1268,7 @@ BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
if (ret) {
if ((type != SID_NAME_DOM_GRP) &&
(type != SID_NAME_ALIAS)) {
- DEBUG(5, ("sid %s is a %s, expected a group\n",
+ DEBUG(5, ("LEGACY: sid %s is a %s, expected a group\n",
sid_string_static(psid),
sid_type_lookup(type)));
return False;
@@ -1273,16 +1276,19 @@ BOOL legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
*pgid = id.gid;
goto done;
}
-
+
/* This was ours, but it was not mapped. Fail */
-
- return False;
}
+
+ DEBUG(10,("LEGACY: mapping failed for sid %s\n", sid_string_static(psid)));
+ return False;
done:
DEBUG(10,("LEGACY: sid %s -> gid %u\n", sid_string_static(psid),
(unsigned int)*pgid ));
+ store_gid_sid_cache(psid, *pgid);
+
return True;
}
@@ -1299,7 +1305,7 @@ void uid_to_sid(DOM_SID *psid, uid_t uid)
if (!winbind_uid_to_sid(psid, uid)) {
if (!winbind_ping()) {
- DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code"));
+ DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code\n"));
return legacy_uid_to_sid(psid, uid);
}
@@ -1328,7 +1334,7 @@ void gid_to_sid(DOM_SID *psid, gid_t gid)
if (!winbind_gid_to_sid(psid, gid)) {
if (!winbind_ping()) {
- DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code"));
+ DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code\n"));
return legacy_gid_to_sid(psid, gid);
}
@@ -1361,7 +1367,7 @@ BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid)
if (!winbind_sid_to_uid(puid, psid)) {
if (!winbind_ping()) {
- DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code"));
+ DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code\n"));
return legacy_sid_to_uid(psid, puid);
}
@@ -1400,8 +1406,8 @@ BOOL sid_to_gid(const DOM_SID *psid, gid_t *pgid)
if ( !winbind_sid_to_gid(pgid, psid) ) {
if (!winbind_ping()) {
- DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code"));
- return legacy_sid_to_uid(psid, pgid);
+ DEBUG(2, ("WARNING: Winbindd not running, mapping ids with legacy code\n"));
+ return legacy_sid_to_gid(psid, pgid);
}
DEBUG(10,("winbind failed to find a gid for sid %s\n",