return WINBINDD_OK;
}
+static void ndr_child_trust_compat_list(struct winbindd_domain *domain,
+ struct winbindd_cli_state *state,
+ struct winbind_trust *r)
+{
+ uint32_t i, num_domains;
+ char **names, **alt_names;
+ DOM_SID *sids;
+ NTSTATUS result;
+ bool have_own_domain = False;
+ struct winbind_domain_info_compat *t;
+
+ DEBUG(3, ("list trusted domains\n"));
+
+ result = domain->methods->trusted_domains(domain, state->mem_ctx,
+ &num_domains, &names,
+ &alt_names, &sids);
+
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(3, ("winbindd_dual_list_trusted_domains: trusted_domains returned %s\n",
+ nt_errstr(result) ));
+ r->out.result = WINBIND_STATUS_FOOBAR;
+ return;
+ }
+
+ t = talloc_array(r->out.rep,
+ struct winbind_domain_info_compat,
+ num_domains + 1);
+ if (!t) {
+ r->out.result = WINBIND_STATUS_NO_MEMORY;
+ return;
+ }
+
+ for (i=0; i<num_domains; i++) {
+ t[i].netbios_name = names[i];
+ t[i].dns_name = alt_names[i] ?
+ alt_names[i] :
+ names[i];
+ t[i].sid = &sids[i];
+ /* TODO: fill this in */
+ t[i].is_native_mode = false;
+ t[i].is_active_directory= false;
+ t[i].is_primary = false;
+
+ if (strequal(names[i], domain->name)) {
+ have_own_domain = True;
+ t[i].is_native_mode = domain->native_mode;
+ t[i].is_active_directory= domain->active_directory;
+ t[i].is_primary = domain->primary;
+ }
+ }
+
+ /* add our primary domain */
+ if (!have_own_domain) {
+ t[i].netbios_name = domain->name;
+ t[i].dns_name = domain->alt_name ?
+ domain->alt_name :
+ domain->name;
+ t[i].sid = &domain->sid;
+ t[i].is_native_mode = domain->native_mode;
+ t[i].is_active_directory= domain->active_directory;
+ t[i].is_primary = domain->primary;
+ i++;
+ }
+
+ r->out.rep->compat_trusts.num_domains = i;
+ r->out.rep->compat_trusts.domains = t;
+ r->out.result = WINBIND_STATUS_OK;
+}
+
+void winbindd_ndr_domain_child_trust(struct winbindd_domain *domain,
+ struct winbindd_cli_state *state)
+{
+ struct winbind_trust *r;
+
+ r = talloc_get_type_abort(state->c.ndr.r,
+ struct winbind_trust);
+
+ switch (*r->in.level) {
+ case WINBIND_TRUST_LEVEL_COMPAT_LIST:
+ ndr_child_trust_compat_list(domain, state, r);
+ return;
+ }
+
+ r->out.result = WINBIND_STATUS_UNKNOWN_LEVEL;
+ return;
+}
+
static void winbindd_getdcname_recv(void *private_data,
bool success,
struct winbind_get_dc_info *r)