diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-03-02 21:47:32 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-03-02 21:47:32 +0000 |
commit | f50e11dfd29234615b437d46aa50817b658a60dc (patch) | |
tree | c9e67cdfbb441ce177a9786e9039539ad5f76ec2 /usr.sbin/bind/bin | |
parent | 2175bb9ea492abe9fb7fa36e74ac85f59205bd85 (diff) |
Fix an obviously wrong memset. Found by djm@, lots and lots and lots and
lots and lots of discussion over a week period about a simple one-line fix
in a unit test program that we don't even compile by default, yet nobody
commits it.
Diffstat (limited to 'usr.sbin/bind/bin')
-rw-r--r-- | usr.sbin/bind/bin/tests/rdata_test.c | 116 |
1 files changed, 100 insertions, 16 deletions
diff --git a/usr.sbin/bind/bin/tests/rdata_test.c b/usr.sbin/bind/bin/tests/rdata_test.c index 8916d7d840c..e9305822f3e 100644 --- a/usr.sbin/bind/bin/tests/rdata_test.c +++ b/usr.sbin/bind/bin/tests/rdata_test.c @@ -1,21 +1,21 @@ /* - * Copyright (C) 1998-2001 Internet Software Consortium. + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: rdata_test.c,v 1.35 2001/01/09 21:41:34 bwelling Exp $ */ +/* $ISC: rdata_test.c,v 1.35.12.7 2004/03/08 04:04:27 marka Exp $ */ #include <config.h> @@ -91,6 +91,19 @@ viastruct(dns_rdata_t *rdata, isc_mem_t *mctx, result = ISC_R_NOTIMPLEMENTED; break; } + case dns_rdatatype_apl: { + switch (rdata->rdclass) { + case dns_rdataclass_in: { + dns_rdata_in_apl_t in_apl; + result = dns_rdata_tostruct(rdata, sp = &in_apl, NULL); + break; + } + default: + result = ISC_R_NOTIMPLEMENTED; + break; + } + break; + } case dns_rdatatype_cert: { dns_rdata_cert_t cert; result = dns_rdata_tostruct(rdata, sp = &cert, NULL); @@ -271,6 +284,21 @@ viastruct(dns_rdata_t *rdata, isc_mem_t *mctx, result = dns_rdata_tostruct(rdata, sp = &x25, NULL); break; } + case dns_rdatatype_nsec: { + dns_rdata_nsec_t nsec; + result = dns_rdata_tostruct(rdata, sp = &nsec, NULL); + break; + } + case dns_rdatatype_rrsig: { + dns_rdata_rrsig_t rrsig; + result = dns_rdata_tostruct(rdata, sp = &rrsig, NULL); + break; + } + case dns_rdatatype_dnskey: { + dns_rdata_dnskey_t dnskey; + result = dns_rdata_tostruct(rdata, sp = &dnskey, NULL); + break; + } default: result = ISC_R_NOTIMPLEMENTED; break; @@ -320,6 +348,19 @@ viastruct(dns_rdata_t *rdata, isc_mem_t *mctx, result = ISC_R_NOTIMPLEMENTED; break; } + case dns_rdatatype_apl: { + switch (rdata->rdclass) { + case dns_rdataclass_in: { + dns_rdata_in_apl_t in_apl; + result = dns_rdata_tostruct(rdata, sp = &in_apl, mctx); + break; + } + default: + result = ISC_R_NOTIMPLEMENTED; + break; + } + break; + } case dns_rdatatype_cert: { dns_rdata_cert_t cert; result = dns_rdata_tostruct(rdata, sp = &cert, mctx); @@ -500,6 +541,21 @@ viastruct(dns_rdata_t *rdata, isc_mem_t *mctx, result = dns_rdata_tostruct(rdata, sp = &x25, mctx); break; } + case dns_rdatatype_nsec: { + dns_rdata_nsec_t nsec; + result = dns_rdata_tostruct(rdata, sp = &nsec, mctx); + break; + } + case dns_rdatatype_rrsig: { + dns_rdata_rrsig_t rrsig; + result = dns_rdata_tostruct(rdata, sp = &rrsig, mctx); + break; + } + case dns_rdatatype_dnskey: { + dns_rdata_dnskey_t dnskey; + result = dns_rdata_tostruct(rdata, sp = &dnskey, mctx); + break; + } default: result = ISC_R_NOTIMPLEMENTED; break; @@ -578,6 +634,19 @@ viastruct(dns_rdata_t *rdata, isc_mem_t *mctx, result = ISC_R_NOTIMPLEMENTED; break; } + case dns_rdatatype_apl: { + switch (rdata->rdclass) { + case dns_rdataclass_in: { + dns_rdata_in_apl_t in_apl; + result = dns_rdata_fromstruct(rdata, rdc, rdt, &in_apl, b); + break; + } + default: + result = ISC_R_NOTIMPLEMENTED; + break; + } + break; + } case dns_rdatatype_cert: { dns_rdata_cert_t cert; result = dns_rdata_fromstruct(rdata2, rdc, rdt, &cert, b); @@ -759,6 +828,21 @@ viastruct(dns_rdata_t *rdata, isc_mem_t *mctx, result = dns_rdata_fromstruct(rdata2, rdc, rdt, &x25, b); break; } + case dns_rdatatype_nsec: { + dns_rdata_nsec_t nsec; + result = dns_rdata_fromstruct(rdata2, rdc, rdt, &nsec, b); + break; + } + case dns_rdatatype_rrsig: { + dns_rdata_rrsig_t rrsig; + result = dns_rdata_fromstruct(rdata2, rdc, rdt, &rrsig, b); + break; + } + case dns_rdatatype_dnskey: { + dns_rdata_dnskey_t dnskey; + result = dns_rdata_fromstruct(rdata2, rdc, rdt, &dnskey, b); + break; + } default: result = ISC_R_NOTIMPLEMENTED; break; @@ -836,7 +920,7 @@ main(int argc, char *argv[]) { } } - memset(&dctx, '0', sizeof dctx); + memset(&dctx, 0, sizeof(dctx)); dctx.allowed = DNS_COMPRESS_ALL; RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); @@ -929,7 +1013,7 @@ main(int argc, char *argv[]) { dns_rdata_init(&rdata); isc_buffer_init(&dbuf, inbuf, sizeof(inbuf)); result = dns_rdata_fromtext(&rdata, class, type, lex, - NULL, ISC_FALSE, mctx, &dbuf, + NULL, 0, mctx, &dbuf, NULL); if (result != ISC_R_SUCCESS) { fprintf(stdout, @@ -940,7 +1024,7 @@ main(int argc, char *argv[]) { } if (raw) { unsigned int i; - for (i = 0 ; i < rdata.length ; /* */ ) { + for (i = 0; i < rdata.length; /* */ ) { fprintf(stdout, "%02x", rdata.data[i]); if ((++i % 20) == 0) fputs("\n", stdout); @@ -976,7 +1060,7 @@ main(int argc, char *argv[]) { if (raw > 2) { unsigned int i; fputs("\n", stdout); - for (i = 0 ; i < (unsigned int)len ; /* */ ) { + for (i = 0; i < (unsigned int)len; /* */ ) { fprintf(stdout, "%02x", ((unsigned char*)wbuf.base)[i + wbuf.current]); if ((++i % 20) == 0) @@ -1002,7 +1086,7 @@ main(int argc, char *argv[]) { isc_buffer_init(&dbuf, inbuf, sizeof(inbuf)); dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_ANY); result = dns_rdata_fromwire(&rdata, class, type, &wbuf, - &dctx, ISC_FALSE, &dbuf); + &dctx, 0, &dbuf); dns_decompress_invalidate(&dctx); if (result != ISC_R_SUCCESS) { fprintf(stdout, @@ -1015,7 +1099,7 @@ main(int argc, char *argv[]) { if (raw > 1) { unsigned int i; fputs("\n", stdout); - for (i = 0 ; i < rdata.length ; /* */ ) { + for (i = 0; i < rdata.length; /* */ ) { fprintf(stdout, "%02x", rdata.data[i]); if ((++i % 20) == 0) fputs("\n", stdout); |