lib/param: Move all enum declarations to lib/param
[samba.git] / source3 / utils / net_ads.c
index 381393ebad2d0d2a59a760b58f78150949921575..a4f1588e515800550b39c3177fdf82cdeaa10c41 100644 (file)
@@ -28,7 +28,7 @@
 #include "nsswitch/libwbclient/wbclient.h"
 #include "ads.h"
 #include "libads/cldap.h"
-#include "libads/dns.h"
+#include "../lib/addns/dnsquery.h"
 #include "../libds/common/flags.h"
 #include "librpc/gen_ndr/libnet_join.h"
 #include "libnet/libnet_join.h"
@@ -37,6 +37,7 @@
 #include "krb5_env.h"
 #include "../libcli/security/security.h"
 #include "libsmb/libsmb.h"
+#include "lib/param/loadparm.h"
 
 #ifdef HAVE_ADS
 
@@ -1018,7 +1019,7 @@ static int net_ads_leave(struct net_context *c, int argc, const char **argv)
                goto done;
        }
 
-       /* Based on what we requseted, we shouldn't get here, but if
+       /* Based on what we requested, we shouldn't get here, but if
           we did, it means the secrets were removed, and therefore
           we have left the domain */
        d_fprintf(stderr, _("Machine '%s' Left domain '%s'\n"),
@@ -1137,6 +1138,7 @@ static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        DNS_ERROR dns_err;
        fstring dns_server;
+       const char *dns_hosts_file;
        const char *dnsdomain = NULL;
        char *root_domain = NULL;
 
@@ -1148,7 +1150,9 @@ static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
        }
        dnsdomain++;
 
-       status = ads_dns_lookup_ns( ctx, dnsdomain, &nameservers, &ns_count );
+       dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL);
+       status = ads_dns_lookup_ns(ctx, dns_hosts_file,
+                                  dnsdomain, &nameservers, &ns_count);
        if ( !NT_STATUS_IS_OK(status) || (ns_count == 0)) {
                /* Child domains often do not have NS records.  Look
                   for the NS record for the forest root domain
@@ -1186,7 +1190,8 @@ static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
 
                /* try again for NS servers */
 
-               status = ads_dns_lookup_ns( ctx, root_domain, &nameservers, &ns_count );
+               status = ads_dns_lookup_ns(ctx, dns_hosts_file, root_domain,
+                                          &nameservers, &ns_count);
 
                if ( !NT_STATUS_IS_OK(status) || (ns_count == 0)) {
                        DEBUG(3,("net_ads_join: Failed to find name server for the %s "
@@ -2251,7 +2256,7 @@ static int net_ads_search(struct net_context *c, int argc, const char **argv)
        ldap_exp = argv[0];
        attrs = (argv + 1);
 
-       rc = ads_do_search_all(ads, ads->config.bind_path,
+       rc = ads_do_search_retry(ads, ads->config.bind_path,
                               LDAP_SCOPE_SUBTREE,
                               ldap_exp, attrs, &res);
        if (!ADS_ERR_OK(rc)) {