winbind: Add "expand_local_aliases" to wb_gettoken
authorVolker Lendecke <vl@samba.org>
Tue, 3 Jan 2017 14:54:46 +0000 (14:54 +0000)
committerVolker Lendecke <vl@samba.org>
Wed, 4 Jan 2017 11:22:12 +0000 (12:22 +0100)
I hate passing down booleans, but we have the "domain_groups_only"
parameter in wbcLookupUserSids which we need to keep for API
compatibility. To make sure we use as few code paths as possible, this
basically passes down this flag.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/wb_gettoken.c
source3/winbindd/winbindd_getgroups.c
source3/winbindd/winbindd_getusersids.c
source3/winbindd/winbindd_proto.h

index 1c99121bb0906e6c5c2c31c7d14c5dc9caf0fb88..d8867c36b9dd1165c1391195804c06d3a436cbe7 100644 (file)
@@ -26,6 +26,7 @@
 struct wb_gettoken_state {
        struct tevent_context *ev;
        struct dom_sid usersid;
+       bool expand_local_aliases;
        int num_sids;
        struct dom_sid *sids;
 };
@@ -41,7 +42,8 @@ static void wb_gettoken_gotbuiltins(struct tevent_req *subreq);
 
 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
-                                   const struct dom_sid *sid)
+                                   const struct dom_sid *sid,
+                                   bool expand_local_aliases)
 {
        struct tevent_req *req, *subreq;
        struct wb_gettoken_state *state;
@@ -52,6 +54,7 @@ struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
        }
        sid_copy(&state->usersid, sid);
        state->ev = ev;
+       state->expand_local_aliases = expand_local_aliases;
 
        subreq = wb_queryuser_send(state, ev, &state->usersid);
        if (tevent_req_nomem(subreq, req)) {
@@ -115,6 +118,11 @@ static void wb_gettoken_gotuser(struct tevent_req *subreq)
               num_groups * sizeof(struct dom_sid));
        state->num_sids += num_groups;
 
+       if (!state->expand_local_aliases) {
+               tevent_req_done(req);
+               return;
+       }
+
        /*
         * Expand our domain's aliases
         */
index 8b9d0a3ecdf2fe66cb7d60af5408af715dd1673e..8bf670654e17755950186ecff859cb64a768fc33 100644 (file)
@@ -99,7 +99,7 @@ static void winbindd_getgroups_lookupname_done(struct tevent_req *subreq)
                return;
        }
 
-       subreq = wb_gettoken_send(state, state->ev, &state->sid);
+       subreq = wb_gettoken_send(state, state->ev, &state->sid, true);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
index 6b5510ad5a5cae6caed9f1785d5b4144a925889f..d6995c4390a4e2bfb9f78e90fb4a09435ae6c86a 100644 (file)
@@ -55,7 +55,7 @@ struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       subreq = wb_gettoken_send(state, ev, &state->sid);
+       subreq = wb_gettoken_send(state, ev, &state->sid, true);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
index a4e05187d32dc0e5e148403df42fdf5c5ebf8c86..2aed8dc25aa4eeac6f6e8d87f13d9be628f2878c 100644 (file)
@@ -687,7 +687,8 @@ NTSTATUS winbindd_getuserdomgroups_recv(struct tevent_req *req,
                                        struct winbindd_response *response);
 struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
-                                   const struct dom_sid *sid);
+                                   const struct dom_sid *sid,
+                                   bool expand_local_aliases);
 NTSTATUS wb_gettoken_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                          int *num_sids, struct dom_sid **sids);
 struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,