summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2012-05-04 17:27:36 -0400
committerAlexander Bokovoy <ab@samba.org>2012-05-23 17:51:48 +0300
commita7e94fce3f86b99c328669d45dd685fc70026378 (patch)
tree3e0f989c0c43a41d38eafa80e07805556d069793 /source3/utils
parent4a335e9632282d92c8d9c5fdae59114540ed0803 (diff)
downloadsamba-a7e94fce3f86b99c328669d45dd685fc70026378.tar.gz
samba-a7e94fce3f86b99c328669d45dd685fc70026378.tar.bz2
samba-a7e94fce3f86b99c328669d45dd685fc70026378.zip
s3-ads-dns: Break dependency on lp_parm
In preparation of making this code common to s3 and s4
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c8
-rw-r--r--source3/utils/net_lookup.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 0ccb328527..22f235f059 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1137,6 +1137,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 +1149,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 +1189,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 "
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index 7b2a214575..7f204745b1 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -106,6 +106,7 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
NTSTATUS status;
int ret;
char h_name[MAX_DNS_NAME_LENGTH];
+ const char *dns_hosts_file;
if (argc > 0)
domain = argv[0];
@@ -123,7 +124,9 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
DEBUG(9, ("Lookup up ldap for domain %s\n", domain));
- status = ads_dns_query_dcs( ctx, domain, sitename, &dcs, &numdcs );
+ dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL);
+ status = ads_dns_query_dcs(ctx, dns_hosts_file, domain, sitename,
+ &dcs, &numdcs);
if ( NT_STATUS_IS_OK(status) && numdcs ) {
print_ldap_srvlist(dcs, numdcs);
TALLOC_FREE( ctx );
@@ -161,7 +164,8 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
DEBUG(9, ("Looking up ldap for domain %s\n", domain));
- status = ads_dns_query_dcs( ctx, domain, sitename, &dcs, &numdcs );
+ status = ads_dns_query_dcs(ctx, dns_hosts_file, domain, sitename,
+ &dcs, &numdcs);
if ( NT_STATUS_IS_OK(status) && numdcs ) {
print_ldap_srvlist(dcs, numdcs);
TALLOC_FREE( ctx );