mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 12:32:04 -04:00
Fix initial towire/fromwire so they work.
This commit is contained in:
parent
3f28431177
commit
bfb2a81b65
8 changed files with 28 additions and 15 deletions
|
|
@ -298,6 +298,7 @@ main(int argc, char **argv) {
|
|||
struct tm *tm;
|
||||
time_t now;
|
||||
char year[11];
|
||||
int lasttype;
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
|
|
@ -355,11 +356,13 @@ main(int argc, char **argv) {
|
|||
|
||||
fprintf(stdout, "\n#define TYPENAMES%s\n",
|
||||
types != NULL ? " \\" : "");
|
||||
|
||||
lasttype = 0;
|
||||
for (tt = types; tt != NULL ; tt = tt->next)
|
||||
if (tt->class == 0)
|
||||
if (tt->type != lasttype)
|
||||
fprintf(stdout,
|
||||
"\t{ %d, \"%s\" },%s\n",
|
||||
tt->type, tt->typename,
|
||||
lasttype = tt->type, tt->typename,
|
||||
tt->next != NULL ? " \\" : "");
|
||||
|
||||
fputs("\n", stdout);
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ txt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
|
|||
return (DNS_R_UNKNOWN);
|
||||
|
||||
isc_buffer_available(target, &tregion);
|
||||
if (n < tregion.length)
|
||||
if (n > tregion.length)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
memcpy(tregion.base, sregion.base, n);
|
||||
|
|
|
|||
|
|
@ -84,13 +84,16 @@ fromwire_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
|
|||
|
||||
static dns_result_t
|
||||
towire_hinfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
cctx = cctx;
|
||||
|
||||
if (target->length < rdata->length)
|
||||
isc_buffer_available(target, ®ion);
|
||||
if (region.length < rdata->length)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
memcpy(target->base, rdata->data, rdata->length);
|
||||
memcpy(region.base, rdata->data, rdata->length);
|
||||
isc_buffer_add(target, rdata->length);
|
||||
|
||||
return (DNS_R_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,13 +84,16 @@ fromwire_hinfo(dns_rdataclass_t class, dns_rdatatype_t type,
|
|||
|
||||
static dns_result_t
|
||||
towire_hinfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
cctx = cctx;
|
||||
|
||||
if (target->length < rdata->length)
|
||||
isc_buffer_available(target, ®ion);
|
||||
if (region.length < rdata->length)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
memcpy(target->base, rdata->data, rdata->length);
|
||||
memcpy(region.base, rdata->data, rdata->length);
|
||||
isc_buffer_add(target, rdata->length);
|
||||
|
||||
return (DNS_R_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ towire_soa(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
|
|||
if (result != DNS_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
isc_buffer_remaining(target, &tregion);
|
||||
isc_buffer_available(target, &tregion);
|
||||
if (tregion.length < 20)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ towire_soa(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
|
|||
if (result != DNS_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
isc_buffer_remaining(target, &tregion);
|
||||
isc_buffer_available(target, &tregion);
|
||||
if (tregion.length < 20)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
|
|
|
|||
|
|
@ -86,14 +86,16 @@ fromwire_txt(dns_rdataclass_t class, dns_rdatatype_t type,
|
|||
|
||||
static dns_result_t
|
||||
towire_txt(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
cctx = cctx;
|
||||
|
||||
if (target->length < rdata->length)
|
||||
isc_buffer_available(target, ®ion);
|
||||
if (region.length < rdata->length)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
memcpy(target->base, rdata->data, rdata->length);
|
||||
/*XXX*/
|
||||
memcpy(region.base, rdata->data, rdata->length);
|
||||
isc_buffer_add(target, rdata->length);
|
||||
return (DNS_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,14 +86,16 @@ fromwire_txt(dns_rdataclass_t class, dns_rdatatype_t type,
|
|||
|
||||
static dns_result_t
|
||||
towire_txt(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
|
||||
isc_region_t region;
|
||||
|
||||
cctx = cctx;
|
||||
|
||||
if (target->length < rdata->length)
|
||||
isc_buffer_available(target, ®ion);
|
||||
if (region.length < rdata->length)
|
||||
return (DNS_R_NOSPACE);
|
||||
|
||||
memcpy(target->base, rdata->data, rdata->length);
|
||||
/*XXX*/
|
||||
memcpy(region.base, rdata->data, rdata->length);
|
||||
isc_buffer_add(target, rdata->length);
|
||||
return (DNS_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue