mirror of
https://github.com/samba-team/samba.git
synced 2025-08-05 12:22:11 +03:00
dns: fix comments and make s4/libcli/resolve dns resolver working
After migrating to use libaddns, reply_to_addrs() needed to change the way answers are iterated through. Originally libroken implementation gave all answers as separate records with last one being explicitly NULL. libaddns unmarshalling code gives all non-NULL answers and should be iterated with explicit reply->num_answers in use.
This commit is contained in:
@ -316,7 +316,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
|
|||||||
NT_STATUS_EQUAL(last_dns_status,NT_STATUS_CONNECTION_REFUSED)) &&
|
NT_STATUS_EQUAL(last_dns_status,NT_STATUS_CONNECTION_REFUSED)) &&
|
||||||
(last_dns_check+DNS_FAILED_WAITTIME) > now )
|
(last_dns_check+DNS_FAILED_WAITTIME) > now )
|
||||||
{
|
{
|
||||||
DEBUG(10,("last_dns_check: Returning cached status (%s)\n",
|
DEBUG(10,("dns_send_req: last dns check returning cached status (%s)\n",
|
||||||
nt_errstr(last_dns_status) ));
|
nt_errstr(last_dns_status) ));
|
||||||
return last_dns_status;
|
return last_dns_status;
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
|
|||||||
if (buf_len) {
|
if (buf_len) {
|
||||||
if ((buffer = talloc_array(ctx, uint8_t, buf_len))
|
if ((buffer = talloc_array(ctx, uint8_t, buf_len))
|
||||||
== NULL ) {
|
== NULL ) {
|
||||||
DEBUG(0,("ads_dns_lookup_srv: "
|
DEBUG(0,("dns_send_req: "
|
||||||
"talloc() failed!\n"));
|
"talloc() failed!\n"));
|
||||||
last_dns_status = NT_STATUS_NO_MEMORY;
|
last_dns_status = NT_STATUS_NO_MEMORY;
|
||||||
last_dns_check = time_mono(NULL);
|
last_dns_check = time_mono(NULL);
|
||||||
@ -341,7 +341,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
|
|||||||
|
|
||||||
if ((resp_len = res_query(name, C_IN, q_type, buffer, buf_len))
|
if ((resp_len = res_query(name, C_IN, q_type, buffer, buf_len))
|
||||||
< 0 ) {
|
< 0 ) {
|
||||||
DEBUG(3,("ads_dns_lookup_srv: "
|
DEBUG(3,("dns_send_req: "
|
||||||
"Failed to resolve %s (%s)\n",
|
"Failed to resolve %s (%s)\n",
|
||||||
name, strerror(errno)));
|
name, strerror(errno)));
|
||||||
TALLOC_FREE( buffer );
|
TALLOC_FREE( buffer );
|
||||||
|
@ -98,7 +98,7 @@ static int reply_to_addrs(TALLOC_CTX *mem_ctx, uint32_t *a_num,
|
|||||||
}
|
}
|
||||||
*cur_addrs = addrs;
|
*cur_addrs = addrs;
|
||||||
|
|
||||||
for (i = 0; reply->answers[i]; i++) {
|
for (i = 0; i < reply->num_answers; i++) {
|
||||||
rr = reply->answers[i];
|
rr = reply->answers[i];
|
||||||
|
|
||||||
/* we are only interested in the IN class */
|
/* we are only interested in the IN class */
|
||||||
|
Reference in New Issue
Block a user