From e130dec97bb4e08b11f39c1c1382f0c8ad36ef67 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 26 Apr 2011 12:08:22 +1000 Subject: s3-libsmb Use 'resolv:hosts file' as a DNS emulation when specified. This allows make test to operate without making real DNS calls. Andrew Bartlett --- source3/libads/dns.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/libads/dns.c') diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 113e63710b..152003941b 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -401,11 +401,19 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, int rrnum; int idx = 0; NTSTATUS status; + const char *dns_hosts_file; if ( !ctx || !name || !dclist ) { return NT_STATUS_INVALID_PARAMETER; } + dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL); + 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 */ @@ -590,11 +598,18 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx, int rrnum; int idx = 0; NTSTATUS status; + const char *dns_hosts_file; if ( !ctx || !dnsdomain || !nslist ) { return NT_STATUS_INVALID_PARAMETER; } + dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL); + 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 */ -- cgit From 73b377432c5efb8451f09f6d25d8aa1b28c239c9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:10:15 +1000 Subject: s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc() Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett --- source3/libads/dns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libads/dns.c') diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 152003941b..08180a65c0 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -540,7 +540,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, return NT_STATUS_NO_MEMORY; } } else { - if ((tmp_ss_s = TALLOC_REALLOC_ARRAY(dcs, + if ((tmp_ss_s = talloc_realloc(dcs, dcs[i].ss_s, struct sockaddr_storage, dcs[i].num_ips+1)) -- cgit From 3d15137653a7d1b593a9af2eef12f6e5b9a04c4f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:30:12 +1000 Subject: s3-talloc Change TALLOC_ARRAY() to talloc_array() Using the standard macro makes it easier to move code into common, as TALLOC_ARRAY isn't standard talloc. --- source3/libads/dns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/libads/dns.c') diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 08180a65c0..c1332849bf 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -328,7 +328,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type, buf_len = resp_len * sizeof(uint8); if (buf_len) { - if ((buffer = TALLOC_ARRAY(ctx, uint8, buf_len)) + if ((buffer = talloc_array(ctx, uint8, buf_len)) == NULL ) { DEBUG(0,("ads_dns_lookup_srv: " "talloc() failed!\n")); @@ -534,7 +534,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, /* allocate new memory */ if (dcs[i].num_ips == 0) { - if ((dcs[i].ss_s = TALLOC_ARRAY(dcs, + if ((dcs[i].ss_s = talloc_array(dcs, struct sockaddr_storage, 1 )) == NULL ) { return NT_STATUS_NO_MEMORY; @@ -638,7 +638,7 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx, answer_count)); if (answer_count) { - if ((nsarray = TALLOC_ARRAY(ctx, struct dns_rr_ns, + if ((nsarray = talloc_array(ctx, struct dns_rr_ns, answer_count)) == NULL ) { DEBUG(0,("ads_dns_lookup_ns: " "talloc() failure for %d char*'s\n", -- cgit From 5e26e94092b56ee47e7ec7837f7cd0feb3fb0119 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:58:39 +1000 Subject: s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array() Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_ARRAY isn't standard talloc. --- source3/libads/dns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libads/dns.c') diff --git a/source3/libads/dns.c b/source3/libads/dns.c index c1332849bf..5eae10ec28 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -442,7 +442,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, answer_count)); if (answer_count) { - if ((dcs = TALLOC_ZERO_ARRAY(ctx, struct dns_rr_srv, + if ((dcs = talloc_zero_array(ctx, struct dns_rr_srv, answer_count)) == NULL ) { DEBUG(0,("ads_dns_lookup_srv: " "talloc() failure for %d char*'s\n", -- cgit