summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/wb_lookupsids.c52
1 files changed, 48 insertions, 4 deletions
diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c
index f3fac6c630..8f431ab4fc 100644
--- a/source3/winbindd/wb_lookupsids.c
+++ b/source3/winbindd/wb_lookupsids.c
@@ -428,6 +428,7 @@ static void wb_lookupsids_done(struct tevent_req *subreq)
req, struct wb_lookupsids_state);
struct wb_lookupsids_domain *d;
uint32_t i;
+ bool fallback = false;
NTSTATUS status, result;
@@ -437,13 +438,31 @@ static void wb_lookupsids_done(struct tevent_req *subreq)
return;
}
+ d = &state->domains[state->domains_done];
+
+ if (NT_STATUS_IS_ERR(result)) {
+ fallback = true;
+ } else if (state->tmp_names.count != d->sids.num_sids) {
+ fallback = true;
+ }
+
+ if (fallback) {
+ for (i=0; i < d->sids.num_sids; i++) {
+ uint32_t res_sid_index = d->sid_indexes[i];
+
+ state->single_sids[state->num_single_sids] =
+ res_sid_index;
+ state->num_single_sids += 1;
+ }
+ state->domains_done += 1;
+ wb_lookupsids_next(req, state);
+ return;
+ }
+
/*
- * Ignore "result" here. We depend on the individual states in
- * the translated names.
+ * Look at the individual states in the translated names.
*/
- d = &state->domains[state->domains_done];
-
for (i=0; i<state->tmp_names.count; i++) {
uint32_t res_sid_index = d->sid_indexes[i];
@@ -544,6 +563,7 @@ static void wb_lookupsids_lookuprids_done(struct tevent_req *subreq)
NTSTATUS status, result;
struct wb_lookupsids_domain *d;
uint32_t i;
+ bool fallback = false;
status = dcerpc_wbint_LookupRids_recv(subreq, state, &result);
TALLOC_FREE(subreq);
@@ -552,6 +572,30 @@ static void wb_lookupsids_lookuprids_done(struct tevent_req *subreq)
}
d = &state->domains[state->domains_done];
+
+ if (NT_STATUS_IS_ERR(result)) {
+ fallback = true;
+ } else if (state->rid_names.num_principals != d->sids.num_sids) {
+ fallback = true;
+ }
+
+ if (fallback) {
+ for (i=0; i < d->sids.num_sids; i++) {
+ uint32_t res_sid_index = d->sid_indexes[i];
+
+ state->single_sids[state->num_single_sids] =
+ res_sid_index;
+ state->num_single_sids += 1;
+ }
+ state->domains_done += 1;
+ wb_lookupsids_next(req, state);
+ return;
+ }
+
+ /*
+ * Look at the individual states in the translated names.
+ */
+
sid_copy(&src_domain_sid, get_global_sam_sid());
src_domain.name.string = get_global_sam_name();
src_domain.sid = &src_domain_sid;