winbindd: remove unused WINBINDD_LIST_TRUSTDOM child implementation
authorStefan Metzmacher <metze@samba.org>
Fri, 1 Dec 2017 07:49:34 +0000 (08:49 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Oct 2019 12:20:49 +0000 (14:20 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_domain.c
source3/winbindd/winbindd_misc.c
source3/winbindd/winbindd_proto.h

index 394b0c774a9ef2358155088a1984e15b6d715542..ad2f9052346792d26b0c8baf242ac9c7e5e36863 100644 (file)
@@ -2747,115 +2747,6 @@ NTSTATUS wb_cache_sequence_number(struct winbindd_domain *domain,
        return NT_STATUS_OK;
 }
 
-/* enumerate trusted domains 
- * (we need to have the list of trustdoms in the cache when we go offline) -
- * Guenther */
-NTSTATUS wb_cache_trusted_domains(struct winbindd_domain *domain,
-                                 TALLOC_CTX *mem_ctx,
-                                 struct netr_DomainTrustList *trusts)
-{
-       NTSTATUS status;
-       struct winbind_cache *cache;
-       struct winbindd_tdc_domain *dom_list = NULL;
-       size_t num_domains = 0;
-       bool retval = false;
-       size_t i;
-       bool old_status;
-
-       old_status = domain->online;
-       trusts->count = 0;
-       trusts->array = NULL;
-
-       cache = get_cache(domain);
-       if (!cache || !cache->tdb) {
-               goto do_query;
-       }
-
-       if (domain->online) {
-               goto do_query;
-       }
-
-       retval = wcache_tdc_fetch_list(&dom_list, &num_domains);
-       if (!retval || !num_domains || !dom_list) {
-               TALLOC_FREE(dom_list);
-               goto do_query;
-       }
-
-do_fetch_cache:
-       trusts->array = talloc_zero_array(mem_ctx, struct netr_DomainTrust, num_domains);
-       if (!trusts->array) {
-               TALLOC_FREE(dom_list);
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       for (i = 0; i < num_domains; i++) {
-               struct netr_DomainTrust *trust;
-               struct dom_sid *sid;
-               struct winbindd_domain *dom;
-
-               dom = find_domain_from_name_noinit(dom_list[i].domain_name);
-               if (dom && dom->internal) {
-                       continue;
-               }
-
-               trust = &trusts->array[trusts->count];
-               trust->netbios_name = talloc_strdup(trusts->array, dom_list[i].domain_name);
-               trust->dns_name = talloc_strdup(trusts->array, dom_list[i].dns_name);
-               sid = talloc(trusts->array, struct dom_sid);
-               if (!trust->netbios_name || !trust->dns_name ||
-                       !sid) {
-                       TALLOC_FREE(dom_list);
-                       TALLOC_FREE(trusts->array);
-                       return NT_STATUS_NO_MEMORY;
-               }
-
-               trust->trust_flags = dom_list[i].trust_flags;
-               trust->trust_attributes = dom_list[i].trust_attribs;
-               trust->trust_type = dom_list[i].trust_type;
-               sid_copy(sid, &dom_list[i].sid);
-               trust->sid = sid;
-               trusts->count++;
-       }
-
-       TALLOC_FREE(dom_list);
-       return NT_STATUS_OK;
-
-do_query:
-       /* Return status value returned by seq number check */
-
-       if (!NT_STATUS_IS_OK(domain->last_status))
-               return domain->last_status;
-
-       DEBUG(10,("trusted_domains: [Cached] - doing backend query for info for domain %s\n",
-               domain->name ));
-
-       status = domain->backend->trusted_domains(domain, mem_ctx, trusts);
-
-       if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) ||
-               NT_STATUS_EQUAL(status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) {
-               if (!domain->internal && old_status) {
-                       set_domain_offline(domain);
-               }
-               if (!domain->internal &&
-                       !domain->online &&
-                       old_status) {
-                       retval = wcache_tdc_fetch_list(&dom_list, &num_domains);
-                       if (retval && num_domains && dom_list) {
-                               TALLOC_FREE(trusts->array);
-                               trusts->count = 0;
-                               goto do_fetch_cache;
-                       }
-               }
-       }
-       /* no trusts gives NT_STATUS_NO_MORE_ENTRIES resetting to NT_STATUS_OK
-        * so that the generic centry handling still applies correctly -
-        * Guenther*/
-
-       if (!NT_STATUS_IS_ERR(status)) {
-               status = NT_STATUS_OK;
-       }
-       return status;
-}      
 
 /* get lockout policy */
 NTSTATUS wb_cache_lockout_policy(struct winbindd_domain *domain,
index e998275c8e2a7f78489127f60f83fe778fcb3819..fdf5768c5263f1035be11d583bdb71299411b939 100644 (file)
@@ -30,10 +30,6 @@ static const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
                .name           = "PING",
                .struct_cmd     = WINBINDD_PING,
                .struct_fn      = winbindd_dual_ping,
-       },{
-               .name           = "LIST_TRUSTDOM",
-               .struct_cmd     = WINBINDD_LIST_TRUSTDOM,
-               .struct_fn      = winbindd_dual_list_trusted_domains,
        },{
                .name           = "INIT_CONNECTION",
                .struct_cmd     = WINBINDD_INIT_CONNECTION,
index cc0701e597ad1a93a3f3dd4dcb1c86e587c49354..cf341a1364735613a74eba0d986cbd7ecd02bef2 100644 (file)
@@ -276,81 +276,6 @@ done:
        return ret;
 }
 
-enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
-                                                       struct winbindd_cli_state *state)
-{
-       uint32_t i;
-       int extra_data_len = 0;
-       char *extra_data;
-       NTSTATUS result;
-       bool have_own_domain = False;
-       struct netr_DomainTrustList trusts;
-
-       DBG_NOTICE("[%s %u]: list trusted domains\n",
-                  state->client_name,
-                  (unsigned int)state->pid);
-
-       result = wb_cache_trusted_domains(domain, state->mem_ctx, &trusts);
-
-       if (!NT_STATUS_IS_OK(result)) {
-               DEBUG(3, ("winbindd_dual_list_trusted_domains: trusted_domains returned %s\n",
-                       nt_errstr(result) ));
-               return WINBINDD_ERROR;
-       }
-
-       extra_data = talloc_strdup(state->mem_ctx, "");
-
-       for (i=0; i<trusts.count; i++) {
-               struct dom_sid_buf buf;
-
-               if (trusts.array[i].sid == NULL) {
-                       continue;
-               }
-               if (dom_sid_equal(trusts.array[i].sid, &global_sid_NULL)) {
-                       continue;
-               }
-
-               extra_data = talloc_asprintf_append_buffer(
-                   extra_data, "%s\\%s\\%s\\%u\\%u\\%u\n",
-                   trusts.array[i].netbios_name, trusts.array[i].dns_name,
-                   dom_sid_str_buf(trusts.array[i].sid, &buf),
-                   trusts.array[i].trust_flags,
-                   (uint32_t)trusts.array[i].trust_type,
-                   trusts.array[i].trust_attributes);
-       }
-
-       /* add our primary domain */
-
-       for (i=0; i<trusts.count; i++) {
-               if (strequal(trusts.array[i].netbios_name, domain->name)) {
-                       have_own_domain = True;
-                       break;
-               }
-       }
-
-       if (state->request->data.list_all_domains && !have_own_domain) {
-               struct dom_sid_buf buf;
-               extra_data = talloc_asprintf_append_buffer(
-                       extra_data, "%s\\%s\\%s\n", domain->name,
-                       domain->alt_name != NULL ?
-                               domain->alt_name :
-                               domain->name,
-                       dom_sid_str_buf(&domain->sid, &buf));
-       }
-
-       extra_data_len = strlen(extra_data);
-       if (extra_data_len > 0) {
-
-               /* Strip the last \n */
-               extra_data[extra_data_len-1] = '\0';
-
-               state->response->extra_data.data = extra_data;
-               state->response->length += extra_data_len;
-       }
-
-       return WINBINDD_OK;
-}
-
 bool winbindd_dc_info(struct winbindd_cli_state *cli)
 {
        struct winbindd_domain *domain;
index d48493e821746c15ee47e7a7f7c180184b2d6d08..e04533a786fea0ef1e6a051faa46c13b9840ef98 100644 (file)
@@ -380,8 +380,6 @@ struct dcerpc_binding_handle *locator_child_handle(void);
 /* The following definitions come from winbindd/winbindd_misc.c  */
 
 bool winbindd_list_trusted_domains(struct winbindd_cli_state *state);
-enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *domain,
-                                                       struct winbindd_cli_state *state);
 bool winbindd_dc_info(struct winbindd_cli_state *state);
 bool winbindd_ping(struct winbindd_cli_state *state);
 bool winbindd_info(struct winbindd_cli_state *state);