1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-01 05:47:28 +03:00

idmap: return the correct id type to *id_to_sid methods

We have a pointer to a unixid which is sent down instead of a uid or
gid. We can use this as an in-out variable so that pdb_samba_dsdb can be
returned ID_TYPE_BOTH to cache correctly instead of leaving it as
ID_TYPE_UID or ID_TYPE_GID.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10720

Change-Id: I0cef2e419cbb337531244b7b41c708cf2ab883e3
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Garming Sam 2014-11-26 15:33:35 +13:00 committed by Garming Sam
parent 7979c6cc50
commit 58b343be47
2 changed files with 19 additions and 3 deletions

View File

@ -230,8 +230,6 @@
^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping? ^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping?
^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env ^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env
^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$ ^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$
^samba.wbinfo_sids2xids.\(plugin_s4_dc:local\)
^samba.wbinfo_sids2xids.\(s4member:local\)
# #
# The following tests fail against plugin_s4_dc (aka s3fs) currently. # The following tests fail against plugin_s4_dc (aka s3fs) currently.
# These need to be examined and either fixed or correctly categorised. # These need to be examined and either fixed or correctly categorised.

View File

@ -208,7 +208,7 @@ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx, static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const struct unixid *unixid, struct unixid *unixid,
struct dom_sid **sid) struct dom_sid **sid)
{ {
int ret; int ret;
@ -321,6 +321,9 @@ static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx,
} }
if (res->count == 1) { if (res->count == 1) {
const char *type = ldb_msg_find_attr_as_string(res->msgs[0],
"type", NULL);
*sid = idmap_msg_get_dom_sid(mem_ctx, res->msgs[0], *sid = idmap_msg_get_dom_sid(mem_ctx, res->msgs[0],
"objectSid"); "objectSid");
if (*sid == NULL) { if (*sid == NULL) {
@ -328,6 +331,21 @@ static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx,
status = NT_STATUS_NONE_MAPPED; status = NT_STATUS_NONE_MAPPED;
goto failed; goto failed;
} }
if (type == NULL) {
DEBUG(1, ("Invalid type for mapping entry.\n"));
talloc_free(tmp_ctx);
return NT_STATUS_NONE_MAPPED;
}
if (strcmp(type, "ID_TYPE_BOTH") == 0) {
unixid->type = ID_TYPE_BOTH;
} else if (strcmp(type, "ID_TYPE_UID") == 0) {
unixid->type = ID_TYPE_UID;
} else {
unixid->type = ID_TYPE_GID;
}
talloc_free(tmp_ctx); talloc_free(tmp_ctx);
return NT_STATUS_OK; return NT_STATUS_OK;
} }