s3-winbind: Fix chached user group lookup of trusted domains.
authorMichael Adam <obnox@samba.org>
Mon, 9 Mar 2015 14:15:37 +0000 (15:15 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 9 Mar 2015 18:23:25 +0000 (19:23 +0100)
If a user group lookup has aleady been done before with a machine
account we did always return the incomplete information from the cache.
This patch makes sure we return the correct group information from the
netsamlogon cache.

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

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Mar  9 19:23:25 CET 2015 on sn-devel-104

source3/winbindd/wb_lookupusergroups.c

index b91de78c7641c01cd0d52067c19faa1e3e3adac2..f74a20693b516e13d9c490ce988f4cb7a2dbb93f 100644 (file)
@@ -37,6 +37,7 @@ struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
 {
        struct tevent_req *req, *subreq;
        struct wb_lookupusergroups_state *state;
+       NTSTATUS status;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct wb_lookupusergroups_state);
@@ -45,6 +46,16 @@ struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx,
        }
        sid_copy(&state->sid, sid);
 
+       status = lookup_usergroups_cached(NULL,
+                                         state,
+                                         &state->sid,
+                                         &state->sids.num_sids,
+                                         &state->sids.sids);
+       if (NT_STATUS_IS_OK(status)) {
+               tevent_req_done(req);
+               return tevent_req_post(req, ev);
+       }
+
        subreq = dcerpc_wbint_LookupUserGroups_send(
                state, ev, dom_child_handle(domain), &state->sid, &state->sids);
        if (tevent_req_nomem(subreq, req)) {