From 30f5e70f40bc73fa964ea5456bea154d72bfbbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Wed, 4 Feb 2015 15:40:30 +0100 Subject: [PATCH] s3-winbindd: make sure to enumerate local groups as well. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://bugzilla.samba.org/show_bug.cgi?id=7167 Guenther Signed-off-by: Günther Deschner --- source3/winbindd/winbindd_dual_srv.c | 47 ++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index 061de72..5650b95 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -380,8 +380,8 @@ NTSTATUS _wbint_QueryGroupList(struct pipes_struct *p, struct wbint_QueryGroupList *r) { struct winbindd_domain *domain = wb_child_domain(); - uint32_t i, num_groups; - struct wb_acct_info *groups; + uint32_t i, num_dom_groups, num_local_groups; + struct wb_acct_info *dom_groups, *local_groups; struct wbint_Principal *result; NTSTATUS status; @@ -390,33 +390,60 @@ NTSTATUS _wbint_QueryGroupList(struct pipes_struct *p, } status = domain->methods->enum_dom_groups(domain, talloc_tos(), - &num_groups, &groups); + &num_dom_groups, + &dom_groups); reset_cm_connection_on_error(domain, status); if (!NT_STATUS_IS_OK(status)) { return status; } + status = domain->methods->enum_local_groups(domain, talloc_tos(), + &num_local_groups, + &local_groups); + reset_cm_connection_on_error(domain, status); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(dom_groups); + return status; + } + result = talloc_array(r->out.groups, struct wbint_Principal, - num_groups); + num_dom_groups + num_local_groups); if (result == NULL) { + TALLOC_FREE(dom_groups); + TALLOC_FREE(local_groups); return NT_STATUS_NO_MEMORY; } - for (i=0; isid, groups[i].rid); + for (i=0; isid, dom_groups[i].rid); result[i].type = SID_NAME_DOM_GRP; - result[i].name = talloc_strdup(result, groups[i].acct_name); + result[i].name = talloc_strdup(result, dom_groups[i].acct_name); if (result[i].name == NULL) { TALLOC_FREE(result); - TALLOC_FREE(groups); + TALLOC_FREE(dom_groups); + TALLOC_FREE(local_groups); return NT_STATUS_NO_MEMORY; } } - r->out.groups->num_principals = num_groups; + for (i=0; isid, local_groups[i].rid); + result[i+num_dom_groups].type = SID_NAME_ALIAS; + result[i+num_dom_groups].name = talloc_strdup(result, local_groups[i].acct_name); + if (result[i+num_dom_groups].name == NULL) { + TALLOC_FREE(result); + TALLOC_FREE(dom_groups); + TALLOC_FREE(local_groups); + return NT_STATUS_NO_MEMORY; + } + } + + r->out.groups->num_principals = num_dom_groups + num_local_groups; r->out.groups->principals = result; - TALLOC_FREE(groups); + TALLOC_FREE(dom_groups); + TALLOC_FREE(local_groups); + return NT_STATUS_OK; } -- 1.9.3