mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
s3:idmap: don't call idmap_new_mapping idmap_sid_to_gid
The setting of a new mapping is moved into the backend code to achieve atomicity and greater flexibility. Michael
This commit is contained in:
parent
f301ea5977
commit
9ee3134691
@ -249,45 +249,36 @@ backend:
|
|||||||
map.xid.type = ID_TYPE_GID;
|
map.xid.type = ID_TYPE_GID;
|
||||||
|
|
||||||
ret = idmap_backends_sid_to_unixid(domname, &map);
|
ret = idmap_backends_sid_to_unixid(domname, &map);
|
||||||
if (NT_STATUS_IS_OK(ret) && (map.status == ID_MAPPED)) {
|
|
||||||
if (map.xid.type != ID_TYPE_GID) {
|
if (!NT_STATUS_IS_OK(ret)) {
|
||||||
DEBUG(10, ("sid [%s] not mapped to a gid "
|
DEBUG(10, ("idmap_backends_sid_to_unixid failed: %s\n",
|
||||||
"[%u,%u,%u]\n",
|
nt_errstr(ret)));
|
||||||
sid_string_dbg(sid),
|
if (winbindd_use_idmap_cache()) {
|
||||||
map.status,
|
idmap_cache_set_sid2uid(sid, -1);
|
||||||
map.xid.type,
|
|
||||||
map.xid.id));
|
|
||||||
if (winbindd_use_idmap_cache()) {
|
|
||||||
idmap_cache_set_sid2gid(sid, -1);
|
|
||||||
}
|
|
||||||
return NT_STATUS_NONE_MAPPED;
|
|
||||||
}
|
}
|
||||||
goto done;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domname[0] != '\0') {
|
if (map.status != ID_MAPPED) {
|
||||||
/*
|
|
||||||
* We had the task to go to a specific domain which
|
|
||||||
* could not answer our request. Fail.
|
|
||||||
*/
|
|
||||||
if (winbindd_use_idmap_cache()) {
|
if (winbindd_use_idmap_cache()) {
|
||||||
idmap_cache_set_sid2uid(sid, -1);
|
idmap_cache_set_sid2uid(sid, -1);
|
||||||
}
|
}
|
||||||
return NT_STATUS_NONE_MAPPED;
|
return NT_STATUS_NONE_MAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = idmap_new_mapping(sid, ID_TYPE_GID, &map.xid);
|
if (map.xid.type != ID_TYPE_GID) {
|
||||||
|
DEBUG(10, ("sid [%s] not mapped to a gid "
|
||||||
if (!NT_STATUS_IS_OK(ret)) {
|
"[%u,%u,%u]\n",
|
||||||
DEBUG(10, ("idmap_new_mapping failed: %s\n",
|
sid_string_dbg(sid),
|
||||||
nt_errstr(ret)));
|
map.status,
|
||||||
|
map.xid.type,
|
||||||
|
map.xid.id));
|
||||||
if (winbindd_use_idmap_cache()) {
|
if (winbindd_use_idmap_cache()) {
|
||||||
idmap_cache_set_sid2gid(sid, -1);
|
idmap_cache_set_sid2gid(sid, -1);
|
||||||
}
|
}
|
||||||
return ret;
|
return NT_STATUS_NONE_MAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
|
||||||
*gid = map.xid.id;
|
*gid = map.xid.id;
|
||||||
if (winbindd_use_idmap_cache()) {
|
if (winbindd_use_idmap_cache()) {
|
||||||
idmap_cache_set_sid2gid(sid, *gid);
|
idmap_cache_set_sid2gid(sid, *gid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user