mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 05:57:52 +00:00
fix a bug introduced with today's changes.
This commit is contained in:
parent
a7512aefd8
commit
1a70537f01
@ -186,7 +186,8 @@ context_connect(lwres_context_t *ctx)
|
|||||||
int
|
int
|
||||||
lwres_context_sendrecv(lwres_context_t *ctx,
|
lwres_context_sendrecv(lwres_context_t *ctx,
|
||||||
void *sendbase, int sendlen,
|
void *sendbase, int sendlen,
|
||||||
void *recvbase, int recvlen)
|
void *recvbase, int recvlen,
|
||||||
|
int *recvd_len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
@ -214,5 +215,8 @@ lwres_context_sendrecv(lwres_context_t *ctx,
|
|||||||
|| sin.sin_port != htons(LWRES_UDP_PORT))
|
|| sin.sin_port != htons(LWRES_UDP_PORT))
|
||||||
goto again;
|
goto again;
|
||||||
|
|
||||||
return (ret);
|
if (recvd_len != NULL)
|
||||||
|
*recvd_len = ret;
|
||||||
|
|
||||||
|
return (LWRES_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,8 @@ lwres_context_allocmem(lwres_context_t *ctx, size_t len);
|
|||||||
int
|
int
|
||||||
lwres_context_sendrecv(lwres_context_t *ctx,
|
lwres_context_sendrecv(lwres_context_t *ctx,
|
||||||
void *sendbase, int sendlen,
|
void *sendbase, int sendlen,
|
||||||
void *recvbase, int recvlen);
|
void *recvbase, int recvlen,
|
||||||
|
int *recvd_len);
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
|
|||||||
lwres_gabnrequest_t request;
|
lwres_gabnrequest_t request;
|
||||||
lwres_gabnresponse_t *response;
|
lwres_gabnresponse_t *response;
|
||||||
int ret;
|
int ret;
|
||||||
|
int recvlen;
|
||||||
lwres_buffer_t b_in, b_out;
|
lwres_buffer_t b_in, b_out;
|
||||||
lwres_lwpacket_t pkt;
|
lwres_lwpacket_t pkt;
|
||||||
isc_uint32_t serial;
|
isc_uint32_t serial;
|
||||||
@ -127,6 +128,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
|
|||||||
*/
|
*/
|
||||||
request.addrtypes = addrtypes;
|
request.addrtypes = addrtypes;
|
||||||
request.name = (char *)name;
|
request.name = (char *)name;
|
||||||
|
request.namelen = strlen(name);
|
||||||
pkt.flags = 0;
|
pkt.flags = 0;
|
||||||
pkt.serial = serial;
|
pkt.serial = serial;
|
||||||
pkt.result = 0;
|
pkt.result = 0;
|
||||||
@ -134,15 +136,15 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
ret = lwres_gabnrequest_render(ctx, &request, &pkt, &b_out);
|
ret = lwres_gabnrequest_render(ctx, &request, &pkt, &b_out);
|
||||||
if (ret != 0)
|
if (ret != LWRES_R_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
|
ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
|
||||||
LWRES_RECVLENGTH);
|
LWRES_RECVLENGTH, &recvlen);
|
||||||
if (ret < 0)
|
if (ret != LWRES_R_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
lwres_buffer_init(&b_in, buffer, ret);
|
lwres_buffer_init(&b_in, buffer, recvlen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the packet header.
|
* Parse the packet header.
|
||||||
@ -199,6 +201,7 @@ lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype,
|
|||||||
lwres_gnbarequest_t request;
|
lwres_gnbarequest_t request;
|
||||||
lwres_gnbaresponse_t *response;
|
lwres_gnbaresponse_t *response;
|
||||||
int ret;
|
int ret;
|
||||||
|
int recvlen;
|
||||||
lwres_buffer_t b_in, b_out;
|
lwres_buffer_t b_in, b_out;
|
||||||
lwres_lwpacket_t pkt;
|
lwres_lwpacket_t pkt;
|
||||||
isc_uint32_t serial;
|
isc_uint32_t serial;
|
||||||
@ -239,11 +242,11 @@ lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
|
ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
|
||||||
LWRES_RECVLENGTH);
|
LWRES_RECVLENGTH, &recvlen);
|
||||||
if (ret < 0)
|
if (ret != LWRES_R_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
lwres_buffer_init(&b_in, buffer, ret);
|
lwres_buffer_init(&b_in, buffer, recvlen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the packet header.
|
* Parse the packet header.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user