talloc: use the system pytalloc-util for python3 as well
[sfrench/samba-autobuild/.git] / lib / addns / dnsquery.c
index 57ef8d92f4ac7b9dff4b170c860bc88d50cbc00b..4e2aaf4f3be5f1b1bc7bdc17015e1abfc4e5977a 100644 (file)
@@ -390,7 +390,6 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
 *********************************************************************/
 
 NTSTATUS ads_dns_lookup_srv(TALLOC_CTX *ctx,
-                               const char *dns_hosts_file,
                                const char *name,
                                struct dns_rr_srv **dclist,
                                int *numdcs)
@@ -408,12 +407,6 @@ NTSTATUS ads_dns_lookup_srv(TALLOC_CTX *ctx,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       if (dns_hosts_file) {
-               return resolve_dns_hosts_file_as_dns_rr(dns_hosts_file,
-                                                       name, true, ctx,
-                                                       dclist, numdcs);
-       }
-
        /* Send the request.  May have to loop several times in case
           of large replies */
 
@@ -586,7 +579,6 @@ NTSTATUS ads_dns_lookup_srv(TALLOC_CTX *ctx,
 *********************************************************************/
 
 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
-                               const char *dns_hosts_file,
                                const char *dnsdomain,
                                struct dns_rr_ns **nslist,
                                int *numns)
@@ -604,11 +596,6 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       if (dns_hosts_file) {
-               DEBUG(1, ("NO 'NS' lookup available when using resolv:host file"));
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
        /* Send the request.  May have to loop several times in case
           of large replies */
 
@@ -747,7 +734,6 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
 ********************************************************************/
 
 static NTSTATUS ads_dns_query_internal(TALLOC_CTX *ctx,
-                                      const char *dns_hosts_file,
                                       const char *servicename,
                                       const char *dc_pdc_gc_domains,
                                       const char *realm,
@@ -767,7 +753,7 @@ static NTSTATUS ads_dns_query_internal(TALLOC_CTX *ctx,
        if (!name) {
                return NT_STATUS_NO_MEMORY;
        }
-       return ads_dns_lookup_srv(ctx, dns_hosts_file, name, dclist, numdcs);
+       return ads_dns_lookup_srv(ctx, name, dclist, numdcs);
 }
 
 /********************************************************************
@@ -775,7 +761,6 @@ static NTSTATUS ads_dns_query_internal(TALLOC_CTX *ctx,
 ********************************************************************/
 
 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
-                          const char *dns_hosts_file,
                           const char *realm,
                           const char *sitename,
                           struct dns_rr_srv **dclist,
@@ -783,8 +768,13 @@ NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
 {
        NTSTATUS status;
 
-       status = ads_dns_query_internal(ctx, dns_hosts_file, "_ldap", "dc",
-                                       realm, sitename, dclist, numdcs);
+       status = ads_dns_query_internal(ctx,
+                                       "_ldap",
+                                       "dc",
+                                       realm,
+                                       sitename,
+                                       dclist,
+                                       numdcs);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) ||
            NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_REFUSED)) {
@@ -795,9 +785,13 @@ NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
            ((!NT_STATUS_IS_OK(status)) ||
             (NT_STATUS_IS_OK(status) && (numdcs == 0)))) {
                /* Sitename DNS query may have failed. Try without. */
-               status = ads_dns_query_internal(ctx, dns_hosts_file,
-                                               "_ldap", "dc", realm,
-                                               NULL, dclist, numdcs);
+               status = ads_dns_query_internal(ctx,
+                                               "_ldap",
+                                               "dc",
+                                               realm,
+                                               NULL,
+                                               dclist,
+                                               numdcs);
        }
        return status;
 }
@@ -807,7 +801,6 @@ NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
 ********************************************************************/
 
 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
-                          const char *dns_hosts_file,
                           const char *realm,
                           const char *sitename,
                           struct dns_rr_srv **dclist,
@@ -815,8 +808,13 @@ NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
 {
        NTSTATUS status;
 
-       status = ads_dns_query_internal(ctx, dns_hosts_file, "_ldap", "gc",
-                                       realm, sitename, dclist, numdcs);
+       status = ads_dns_query_internal(ctx,
+                                       "_ldap",
+                                       "gc",
+                                       realm,
+                                       sitename,
+                                       dclist,
+                                       numdcs);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) ||
            NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_REFUSED)) {
@@ -827,9 +825,13 @@ NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
            ((!NT_STATUS_IS_OK(status)) ||
             (NT_STATUS_IS_OK(status) && (numdcs == 0)))) {
                /* Sitename DNS query may have failed. Try without. */
-               status = ads_dns_query_internal(ctx, dns_hosts_file,
-                                               "_ldap", "gc", realm,
-                                               NULL, dclist, numdcs);
+               status = ads_dns_query_internal(ctx,
+                                               "_ldap",
+                                               "gc",
+                                               realm,
+                                               NULL,
+                                               dclist,
+                                               numdcs);
        }
        return status;
 }
@@ -841,7 +843,6 @@ NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
 ********************************************************************/
 
 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
-                           const char *dns_hosts_file,
                            const char *dns_forest_name,
                            const char *sitename,
                            struct dns_rr_srv **dclist,
@@ -849,8 +850,12 @@ NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
 {
        NTSTATUS status;
 
-       status = ads_dns_query_internal(ctx, dns_hosts_file, "_kerberos", "dc",
-                                       dns_forest_name, sitename, dclist,
+       status = ads_dns_query_internal(ctx,
+                                       "_kerberos",
+                                       "dc",
+                                       dns_forest_name,
+                                       sitename,
+                                       dclist,
                                        numdcs);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT) ||
@@ -862,10 +867,13 @@ NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
            ((!NT_STATUS_IS_OK(status)) ||
             (NT_STATUS_IS_OK(status) && (numdcs == 0)))) {
                /* Sitename DNS query may have failed. Try without. */
-               status = ads_dns_query_internal(ctx, dns_hosts_file,
-                                               "_kerberos", "dc",
-                                               dns_forest_name, NULL,
-                                               dclist, numdcs);
+               status = ads_dns_query_internal(ctx,
+                                               "_kerberos",
+                                               "dc",
+                                               dns_forest_name,
+                                               NULL,
+                                               dclist,
+                                               numdcs);
        }
        return status;
 }
@@ -875,13 +883,17 @@ NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
 ********************************************************************/
 
 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
-                          const char *dns_hosts_file,
                           const char *dns_domain_name,
                           struct dns_rr_srv **dclist,
                           int *numdcs )
 {
-       return ads_dns_query_internal(ctx, dns_hosts_file, "_ldap", "pdc",
-                                     dns_domain_name, NULL, dclist, numdcs);
+       return ads_dns_query_internal(ctx,
+                                     "_ldap",
+                                     "pdc",
+                                     dns_domain_name,
+                                     NULL,
+                                     dclist,
+                                     numdcs);
 }
 
 /********************************************************************
@@ -889,7 +901,6 @@ 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 char *domain_guid,
                                struct dns_rr_srv **dclist,
@@ -905,6 +916,11 @@ NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       return ads_dns_query_internal(ctx, dns_hosts_file, "_ldap", domains,
-                                     dns_forest_name, NULL, dclist, numdcs);
+       return ads_dns_query_internal(ctx,
+                                     "_ldap",
+                                     domains,
+                                     dns_forest_name,
+                                     NULL,
+                                     dclist,
+                                     numdcs);
 }