summaryrefslogtreecommitdiffstats
path: root/source3/winbindd/idmap_util.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-05-14 16:18:16 +0200
committerMichael Adam <obnox@samba.org>2010-08-14 02:10:36 +0200
commitf301ea59773b174da9009dfd482a56d7e72a76dd (patch)
tree126e78725f5186f5e695bf6f9a1e6aca6af2bfb6 /source3/winbindd/idmap_util.c
parentccfe40c27f9be794d5ae6d4cb337d820b0a03718 (diff)
downloadsamba-f301ea59773b174da9009dfd482a56d7e72a76dd.tar.gz
samba-f301ea59773b174da9009dfd482a56d7e72a76dd.tar.xz
samba-f301ea59773b174da9009dfd482a56d7e72a76dd.zip
s3:idmap: don't call idmap_new_mapping idmap_sid_to_unixid.
The setting of a new mapping is moved into the backend code to achieve atomicity and greater flexibility. Michael
Diffstat (limited to 'source3/winbindd/idmap_util.c')
-rw-r--r--source3/winbindd/idmap_util.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c
index a8974a9024..68b3250e8d 100644
--- a/source3/winbindd/idmap_util.c
+++ b/source3/winbindd/idmap_util.c
@@ -178,45 +178,35 @@ backend:
ret = idmap_backends_sid_to_unixid(dom_name, &map);
- if (NT_STATUS_IS_OK(ret) && (map.status == ID_MAPPED)) {
- if (map.xid.type != ID_TYPE_UID) {
- DEBUG(10, ("sid [%s] not mapped to a uid "
- "[%u,%u,%u]\n",
- sid_string_dbg(sid),
- map.status,
- map.xid.type,
- map.xid.id));
- if (winbindd_use_idmap_cache()) {
- idmap_cache_set_sid2uid(sid, -1);
- }
- return NT_STATUS_NONE_MAPPED;
+ if (!NT_STATUS_IS_OK(ret)) {
+ DEBUG(10, ("idmap_backends_sid_to_unixid failed: %s\n",
+ nt_errstr(ret)));
+ if (winbindd_use_idmap_cache()) {
+ idmap_cache_set_sid2uid(sid, -1);
}
- goto done;
+ return ret;
}
- if (dom_name[0] != '\0') {
- /*
- * We had the task to go to a specific domain which
- * could not answer our request. Fail.
- */
+ if (map.status != ID_MAPPED) {
if (winbindd_use_idmap_cache()) {
idmap_cache_set_sid2uid(sid, -1);
}
return NT_STATUS_NONE_MAPPED;
}
- ret = idmap_new_mapping(sid, ID_TYPE_UID, &map.xid);
-
- if (!NT_STATUS_IS_OK(ret)) {
- DEBUG(10, ("idmap_new_mapping failed: %s\n",
- nt_errstr(ret)));
+ if (map.xid.type != ID_TYPE_UID) {
+ DEBUG(10, ("sid [%s] not mapped to a uid "
+ "[%u,%u,%u]\n",
+ sid_string_dbg(sid),
+ map.status,
+ map.xid.type,
+ map.xid.id));
if (winbindd_use_idmap_cache()) {
idmap_cache_set_sid2uid(sid, -1);
}
- return ret;
+ return NT_STATUS_NONE_MAPPED;
}
-done:
*uid = (uid_t)map.xid.id;
if (winbindd_use_idmap_cache()) {
idmap_cache_set_sid2uid(sid, *uid);