winbindd: use correct domain name for failed lookupsids
authorRalph Boehme <slow@samba.org>
Tue, 4 Apr 2017 12:21:25 +0000 (14:21 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 6 Apr 2017 18:08:19 +0000 (20:08 +0200)
What we want here is, for failed lookupsids, pass the domain name of the
SID we were trying to lookup to the idmap backend.

But as a domain member, using

  state->single_domains[state->single_sids_done]

for this purpose will always be use our primary domain name (for S-1-5-21
SIDs that are not in our local SAM).

So for now use find_domain_from_sid_noinit() to find the domain from the
domain list. This can be removed when we switch idmap backend
determination to be based on domain SIDs, not names.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11961

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/winbindd/wb_lookupsids.c

index 858616be182f38e4ae7880ecb6d4628b30a7297f..e690730b37d49214fc1a06d06ac3465517853032 100644 (file)
@@ -556,12 +556,13 @@ static void wb_lookupsids_single_done(struct tevent_req *subreq)
                                   &domain_name, &name);
        TALLOC_FREE(subreq);
        if (!NT_STATUS_IS_OK(status)) {
-               struct wb_lookupsids_domain *wb_domain;
+               struct winbindd_domain *wb_domain = NULL;
                const char *tmpname;
 
                type = SID_NAME_UNKNOWN;
 
-               wb_domain = state->single_domains[state->single_sids_done];
+               res_sid_index = state->single_sids[state->single_sids_done];
+               wb_domain = find_domain_from_sid_noinit(&state->sids[res_sid_index]);
                if (wb_domain != NULL) {
                        /*
                         * If the lookupsid failed because the rid not
@@ -573,7 +574,7 @@ static void wb_lookupsids_single_done(struct tevent_req *subreq)
                         * name in the idmap backend to figure out
                         * which domain to use in processing.
                         */
-                       tmpname = wb_domain->domain->name;
+                       tmpname = wb_domain->name;
                } else {
                        tmpname = "";
                }