diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/libads/dns.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/libads/dns.c')
-rw-r--r-- | source3/libads/dns.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 113e63710b..5eae10ec28 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")); @@ -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 */ @@ -434,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", @@ -526,13 +534,13 @@ 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; } } 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)) @@ -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 */ @@ -623,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", |