misc parsing and rendering nits

This commit is contained in:
Michael Graff
2000-01-28 00:33:14 +00:00
parent 02a0f2f083
commit 573be0bc6d
3 changed files with 28 additions and 14 deletions
+1
View File
@@ -27,5 +27,6 @@
#define LWRES_R_IOERROR -6
#define LWRES_R_NOTIMPLEMENTED -7
#define LWRES_R_UNEXPECTED -8
#define LWRES_R_TRAILINGDATA -9
#endif /* LWRES_RESULT_H */
+10 -10
View File
@@ -288,15 +288,6 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
if (ret != LWRES_R_SUCCESS)
goto out;
/*
* Pull off the addresses.
*/
for (x = 0 ; x < gabn->naddrs ; x++) {
ret = lwres_addr_parse(b, &gabn->addrs[x]);
if (ret != LWRES_R_SUCCESS)
goto out;
}
/*
* Parse off the aliases.
*/
@@ -307,8 +298,17 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,
goto out;
}
/*
* Pull off the addresses.
*/
for (x = 0 ; x < gabn->naddrs ; x++) {
ret = lwres_addr_parse(b, &gabn->addrs[x]);
if (ret != LWRES_R_SUCCESS)
goto out;
}
if (LWRES_BUFFER_REMAINING(b) != 0) {
ret = LWRES_R_UNEXPECTEDEND;
ret = LWRES_R_TRAILINGDATA;
goto out;
}
+17 -4
View File
@@ -57,19 +57,32 @@ lwres_string_parse(lwres_buffer_t *b, char **c, isc_uint16_t *len)
REQUIRE(b != NULL);
/*
* Pull off the length (2 bytes)
*/
if (!SPACE_REMAINING(b, sizeof(isc_uint16_t)))
return (LWRES_R_UNEXPECTEDEND);
datalen = lwres_buffer_getuint16(b);
datalen++;
/*
* Set the pointer to this string to the right place, then
* advance the buffer pointer.
*/
if (!SPACE_REMAINING(b, datalen))
return (LWRES_R_UNEXPECTEDEND);
string = b->base + b->current;
lwres_buffer_forward(b, datalen);
/*
* Skip the "must be zero" byte.
*/
if (!SPACE_REMAINING(b, 1))
return (LWRES_R_UNEXPECTEDEND);
if (0 != lwres_buffer_getuint8(b))
return (LWRES_R_FAILURE);
if (len != NULL)
*len = datalen - 1;
*len = datalen;
if (c != NULL)
*c = string;