From 49256925996ff5db509364c1c47d0ecd8d79d757 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 29 Nov 2020 20:21:21 +0100 Subject: [PATCH] libsmb: Remove unused ads_dns_query_* routines Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Dec 11 19:30:16 UTC 2020 on sn-devel-184 --- lib/addns/dnsquery.c | 165 ------------------------------------------- lib/addns/dnsquery.h | 24 ------- 2 files changed, 189 deletions(-) diff --git a/lib/addns/dnsquery.c b/lib/addns/dnsquery.c index c73ee7b50f1..869d4597ee4 100644 --- a/lib/addns/dnsquery.c +++ b/lib/addns/dnsquery.c @@ -780,168 +780,3 @@ fail: return status; } #endif - -/******************************************************************** - Query with optional sitename. -********************************************************************/ - -static NTSTATUS ads_dns_query_internal(TALLOC_CTX *ctx, - const char *servicename, - const char *dc_pdc_gc_domains, - const char *realm, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ) -{ - char *name; - NTSTATUS status; - size_t num_srvs = 0; - - if ((sitename != NULL) && (strlen(sitename) != 0)) { - name = talloc_asprintf(ctx, "%s._tcp.%s._sites.%s._msdcs.%s", - servicename, sitename, - dc_pdc_gc_domains, realm); - if (name == NULL) { - return NT_STATUS_NO_MEMORY; - } - - status = ads_dns_lookup_srv(ctx, name, dclist, &num_srvs); - - TALLOC_FREE(name); - - if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) || - NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_REFUSED)) { - return status; - } - - if (NT_STATUS_IS_OK(status) && (num_srvs != 0)) { - goto done; - } - } - - name = talloc_asprintf(ctx, "%s._tcp.%s._msdcs.%s", - servicename, dc_pdc_gc_domains, realm); - if (name == NULL) { - return NT_STATUS_NO_MEMORY; - } - status = ads_dns_lookup_srv(ctx, name, dclist, &num_srvs); - -done: - *numdcs = num_srvs; - return status; -} - -/******************************************************************** - Query for AD DC's. -********************************************************************/ - -NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx, - const char *realm, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ) -{ - NTSTATUS status; - - status = ads_dns_query_internal(ctx, - "_ldap", - "dc", - realm, - sitename, - dclist, - numdcs); - return status; -} - -/******************************************************************** - Query for AD GC's. -********************************************************************/ - -NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx, - const char *realm, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ) -{ - NTSTATUS status; - - status = ads_dns_query_internal(ctx, - "_ldap", - "gc", - realm, - sitename, - dclist, - numdcs); - return status; -} - -/******************************************************************** - Query for AD KDC's. - Even if our underlying kerberos libraries are UDP only, this - is pretty safe as it's unlikely that a KDC supports TCP and not UDP. -********************************************************************/ - -NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx, - const char *dns_forest_name, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ) -{ - NTSTATUS status; - - status = ads_dns_query_internal(ctx, - "_kerberos", - "dc", - dns_forest_name, - sitename, - dclist, - numdcs); - return status; -} - -/******************************************************************** - Query for AD PDC. Sitename is obsolete here. -********************************************************************/ - -NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx, - const char *dns_domain_name, - struct dns_rr_srv **dclist, - size_t *numdcs ) -{ - return ads_dns_query_internal(ctx, - "_ldap", - "pdc", - dns_domain_name, - NULL, - dclist, - numdcs); -} - -/******************************************************************** - Query for AD DC by guid. Sitename is obsolete here. -********************************************************************/ - -NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx, - const char *dns_forest_name, - const char *domain_guid, - struct dns_rr_srv **dclist, - size_t *numdcs ) -{ - /*_ldap._tcp.DomainGuid.domains._msdcs.DnsForestName */ - - const char *domains; - - /* little hack */ - domains = talloc_asprintf(ctx, "%s.domains", domain_guid); - if (!domains) { - return NT_STATUS_NO_MEMORY; - } - - return ads_dns_query_internal(ctx, - "_ldap", - domains, - dns_forest_name, - NULL, - dclist, - numdcs); -} diff --git a/lib/addns/dnsquery.h b/lib/addns/dnsquery.h index 768640af789..51f6b8ff87b 100644 --- a/lib/addns/dnsquery.h +++ b/lib/addns/dnsquery.h @@ -81,28 +81,4 @@ NTSTATUS ads_dns_lookup_aaaa(TALLOC_CTX *ctx, struct samba_sockaddr **addrs_out); #endif -NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx, - const char *realm, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ); -NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx, - const char *realm, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ); -NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx, - const char *dns_forest_name, - const char *sitename, - struct dns_rr_srv **dclist, - size_t *numdcs ); -NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx, - const char *dns_domain_name, - struct dns_rr_srv **dclist, - size_t *numdcs ); -NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx, - const char *dns_forest_name, - const char *domain_guid, - struct dns_rr_srv **dclist, - size_t *numdcs ); #endif /* __LIB_ADDNS_DNSQUERY_H__ */