summaryrefslogtreecommitdiff
path: root/source4/winbind
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-11-26 15:33:35 +1300
committerGarming Sam <garming@samba.org>2014-12-03 04:21:09 +0100
commit58b343be4742b3ba1f447701a8254453c21af413 (patch)
tree35e31bf6ebce055636b87c2a2733e2485d4a9558 /source4/winbind
parent7979c6cc50eaa792e5094866878c63df36e715c3 (diff)
downloadsamba-58b343be4742b3ba1f447701a8254453c21af413.tar.gz
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>
Diffstat (limited to 'source4/winbind')
-rw-r--r--source4/winbind/idmap.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c
index 54fea18c7fe..26a4664a4d9 100644
--- a/source4/winbind/idmap.c
+++ b/source4/winbind/idmap.c
@@ -208,7 +208,7 @@ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx,
TALLOC_CTX *mem_ctx,
- const struct unixid *unixid,
+ struct unixid *unixid,
struct dom_sid **sid)
{
int ret;
@@ -321,6 +321,9 @@ static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx,
}
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],
"objectSid");
if (*sid == NULL) {
@@ -328,6 +331,21 @@ static NTSTATUS idmap_xid_to_sid(struct idmap_context *idmap_ctx,
status = NT_STATUS_NONE_MAPPED;
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);
return NT_STATUS_OK;
}