s3-ads-dns: Avoid unnecessary dependencies
authorSimo Sorce <idra@samba.org>
Sat, 5 May 2012 02:32:47 +0000 (22:32 -0400)
committerAlexander Bokovoy <ab@samba.org>
Wed, 23 May 2012 14:51:48 +0000 (17:51 +0300)
source3/libads/dns.c
source3/libads/dns.h
source3/libsmb/dsgetdcname.c

index f62837e0fece6fccfc2e04b8dcc07a4b8ea6684d..6f846fa7809b7a16d3c147eb889a135d7dde3456 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "includes.h"
 #include "libads/dns.h"
-#include "../librpc/ndr/libndr.h"
 
 /* AIX resolv.h uses 'class' in struct ns_rr */
 
@@ -890,26 +889,19 @@ NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
                                const char *dns_hosts_file,
                                const char *dns_forest_name,
-                               const struct GUID *domain_guid,
+                               const char *domain_guid,
                                struct dns_rr_srv **dclist,
                                int *numdcs )
 {
        /*_ldap._tcp.DomainGuid.domains._msdcs.DnsForestName */
 
        const char *domains;
-       char *guid_string;
-
-       guid_string = GUID_string(ctx, domain_guid);
-       if (!guid_string) {
-               return NT_STATUS_NO_MEMORY;
-       }
 
        /* little hack */
-       domains = talloc_asprintf(ctx, "%s.domains", guid_string);
+       domains = talloc_asprintf(ctx, "%s.domains", domain_guid);
        if (!domains) {
                return NT_STATUS_NO_MEMORY;
        }
-       TALLOC_FREE(guid_string);
 
        return ads_dns_query_internal(ctx, dns_hosts_file, "_ldap", domains,
                                      dns_forest_name, NULL, dclist, numdcs);
index d57239d20cb99a297bffc090b502edc55de9d5b0..a3ea47a04e3a6fca8094e984e346b89ea97ebd05 100644 (file)
@@ -55,7 +55,7 @@ NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
                                const char *dns_hosts_file,
                                const char *dns_forest_name,
-                               const struct GUID *domain_guid,
+                               const char *domain_guid,
                                struct dns_rr_srv **dclist,
                                int *numdcs );
 #endif /* _ADS_DNS_H */
index a690ab49c1bb856933cd4a07dee4d1a9a511df76..7b4b68195a0a4971f1342fef466d6829a85353a7 100644 (file)
@@ -547,6 +547,7 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
        struct ip_service_name *dclist = NULL;
        int count = 0;
        const char *dns_hosts_file;
+       char *guid_string;
 
        dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL);
        if (flags & DS_PDC_REQUIRED) {
@@ -565,9 +566,15 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
                                           domain_name, site_name,
                                           &dcs, &numdcs);
        } else if (domain_guid) {
+               guid_string = GUID_string(mem_ctx, domain_guid);
+               if (!guid_string) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+
                status = ads_dns_query_dcs_guid(mem_ctx, dns_hosts_file,
-                                               domain_name, domain_guid,
+                                               domain_name, guid_string,
                                                &dcs, &numdcs);
+               TALLOC_FREE(guid_string);
        } else {
                status = ads_dns_query_dcs(mem_ctx, dns_hosts_file,
                                           domain_name, site_name,