mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Return better errors (TRAILINGDATA, not UNEXPECTEDEND), and style changes.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: lwres_gabn.c,v 1.21 2000/06/22 21:59:34 tale Exp $ */
|
/* $Id: lwres_gabn.c,v 1.22 2000/06/27 18:03:21 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -248,7 +248,6 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req,
|
|||||||
/* encode the addresses */
|
/* encode the addresses */
|
||||||
addr = LWRES_LIST_HEAD(req->addrs);
|
addr = LWRES_LIST_HEAD(req->addrs);
|
||||||
while (addr != NULL) {
|
while (addr != NULL) {
|
||||||
datalen = addr->length + 2 + 4;
|
|
||||||
lwres_buffer_putuint32(b, addr->family);
|
lwres_buffer_putuint32(b, addr->family);
|
||||||
lwres_buffer_putuint16(b, addr->length);
|
lwres_buffer_putuint16(b, addr->length);
|
||||||
lwres_buffer_putmem(b, addr->address, addr->length);
|
lwres_buffer_putmem(b, addr->address, addr->length);
|
||||||
@@ -256,7 +255,7 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
|
INSIST(LWRES_BUFFER_AVAILABLECOUNT(b) == 0);
|
||||||
INSIST(b->used == pkt->length);
|
INSIST(LWRES_BUFFER_USEDCOUNT(b) == pkt->length);
|
||||||
|
|
||||||
return (LWRES_R_SUCCESS);
|
return (LWRES_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -294,7 +293,7 @@ lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
|||||||
return (ret);
|
return (ret);
|
||||||
|
|
||||||
if (LWRES_BUFFER_REMAINING(b) != 0)
|
if (LWRES_BUFFER_REMAINING(b) != 0)
|
||||||
return (LWRES_R_UNEXPECTEDEND);
|
return (LWRES_R_TRAILINGDATA);
|
||||||
|
|
||||||
gabn = CTXMALLOC(sizeof(lwres_gabnrequest_t));
|
gabn = CTXMALLOC(sizeof(lwres_gabnrequest_t));
|
||||||
if (gabn == NULL)
|
if (gabn == NULL)
|
||||||
@@ -313,14 +312,14 @@ lwres_result_t
|
|||||||
lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
||||||
lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp)
|
lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp)
|
||||||
{
|
{
|
||||||
lwres_result_t ret;
|
lwres_result_t ret;
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
lwres_uint32_t flags;
|
lwres_uint32_t flags;
|
||||||
lwres_uint16_t naliases;
|
lwres_uint16_t naliases;
|
||||||
lwres_uint16_t naddrs;
|
lwres_uint16_t naddrs;
|
||||||
lwres_gabnresponse_t *gabn;
|
lwres_gabnresponse_t *gabn;
|
||||||
lwres_addrlist_t addrlist;
|
lwres_addrlist_t addrlist;
|
||||||
lwres_addr_t *addr;
|
lwres_addr_t *addr;
|
||||||
|
|
||||||
REQUIRE(ctx != NULL);
|
REQUIRE(ctx != NULL);
|
||||||
REQUIRE(pkt != NULL);
|
REQUIRE(pkt != NULL);
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: lwres_gnba.c,v 1.16 2000/06/22 21:59:35 tale Exp $ */
|
/* $Id: lwres_gnba.c,v 1.17 2000/06/27 18:03:22 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ lwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (LWRES_BUFFER_REMAINING(b) != 0) {
|
if (LWRES_BUFFER_REMAINING(b) != 0) {
|
||||||
ret = LWRES_R_UNEXPECTEDEND;
|
ret = LWRES_R_TRAILINGDATA;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
|||||||
return (LWRES_R_FAILURE);
|
return (LWRES_R_FAILURE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pull off the name itself
|
* Pull off flags & naliases
|
||||||
*/
|
*/
|
||||||
if (!SPACE_REMAINING(b, 4 + 2))
|
if (!SPACE_REMAINING(b, 4 + 2))
|
||||||
return (LWRES_R_UNEXPECTEDEND);
|
return (LWRES_R_UNEXPECTEDEND);
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: lwres_noop.c,v 1.10 2000/06/22 21:59:37 tale Exp $ */
|
/* $Id: lwres_noop.c,v 1.11 2000/06/27 18:03:23 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
|||||||
lwres_buffer_forward(b, req->datalength);
|
lwres_buffer_forward(b, req->datalength);
|
||||||
|
|
||||||
if (LWRES_BUFFER_REMAINING(b) != 0) {
|
if (LWRES_BUFFER_REMAINING(b) != 0) {
|
||||||
ret = LWRES_R_UNEXPECTEDEND;
|
ret = LWRES_R_TRAILINGDATA;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
|
|||||||
|
|
||||||
lwres_buffer_forward(b, req->datalength);
|
lwres_buffer_forward(b, req->datalength);
|
||||||
if (LWRES_BUFFER_REMAINING(b) != 0) {
|
if (LWRES_BUFFER_REMAINING(b) != 0) {
|
||||||
ret = LWRES_R_UNEXPECTEDEND;
|
ret = LWRES_R_TRAILINGDATA;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user