2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

fix a bug introduced with today's changes.

This commit is contained in:
Michael Graff 2000-01-25 02:16:00 +00:00
parent a7512aefd8
commit 1a70537f01
3 changed files with 18 additions and 10 deletions

View File

@ -186,7 +186,8 @@ context_connect(lwres_context_t *ctx)
int
lwres_context_sendrecv(lwres_context_t *ctx,
void *sendbase, int sendlen,
void *recvbase, int recvlen)
void *recvbase, int recvlen,
int *recvd_len)
{
int ret;
struct sockaddr_in sin;
@ -214,5 +215,8 @@ lwres_context_sendrecv(lwres_context_t *ctx,
|| sin.sin_port != htons(LWRES_UDP_PORT))
goto again;
return (ret);
if (recvd_len != NULL)
*recvd_len = ret;
return (LWRES_R_SUCCESS);
}

View File

@ -80,7 +80,8 @@ lwres_context_allocmem(lwres_context_t *ctx, size_t len);
int
lwres_context_sendrecv(lwres_context_t *ctx,
void *sendbase, int sendlen,
void *recvbase, int recvlen);
void *recvbase, int recvlen,
int *recvd_len);
ISC_LANG_ENDDECLS

View File

@ -100,6 +100,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
lwres_gabnrequest_t request;
lwres_gabnresponse_t *response;
int ret;
int recvlen;
lwres_buffer_t b_in, b_out;
lwres_lwpacket_t pkt;
isc_uint32_t serial;
@ -127,6 +128,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
*/
request.addrtypes = addrtypes;
request.name = (char *)name;
request.namelen = strlen(name);
pkt.flags = 0;
pkt.serial = serial;
pkt.result = 0;
@ -134,15 +136,15 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name,
again:
ret = lwres_gabnrequest_render(ctx, &request, &pkt, &b_out);
if (ret != 0)
if (ret != LWRES_R_SUCCESS)
goto out;
ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
LWRES_RECVLENGTH);
if (ret < 0)
LWRES_RECVLENGTH, &recvlen);
if (ret != LWRES_R_SUCCESS)
goto out;
lwres_buffer_init(&b_in, buffer, ret);
lwres_buffer_init(&b_in, buffer, recvlen);
/*
* Parse the packet header.
@ -199,6 +201,7 @@ lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype,
lwres_gnbarequest_t request;
lwres_gnbaresponse_t *response;
int ret;
int recvlen;
lwres_buffer_t b_in, b_out;
lwres_lwpacket_t pkt;
isc_uint32_t serial;
@ -239,11 +242,11 @@ lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype,
goto out;
ret = lwres_context_sendrecv(ctx, b_out.base, b_out.length, buffer,
LWRES_RECVLENGTH);
if (ret < 0)
LWRES_RECVLENGTH, &recvlen);
if (ret != LWRES_R_SUCCESS)
goto out;
lwres_buffer_init(&b_in, buffer, ret);
lwres_buffer_init(&b_in, buffer, recvlen);
/*
* Parse the packet header.