Commit de832d13 authored by Brian Wellington's avatar Brian Wellington
Browse files

The changes to reduce allocations in the memory code exposed the sheer

brokenness of this program.
parent db68deda
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: tkey_test.c,v 1.35 2001/01/09 21:41:46 bwelling Exp $ */ /* $Id: tkey_test.c,v 1.36 2001/01/11 04:12:29 bwelling Exp $ */
/* /*
* Principal Author: Brian Wellington (core copied from res_test.c) * Principal Author: Brian Wellington (core copied from res_test.c)
...@@ -83,6 +83,7 @@ dns_view_t *view = NULL; ...@@ -83,6 +83,7 @@ dns_view_t *view = NULL;
char output[10 * 1024]; char output[10 * 1024];
isc_buffer_t outbuf; isc_buffer_t outbuf;
in_port_t port = 53; in_port_t port = 53;
unsigned char qdata1[2048], qdata2[2048], rdata1[2048], rdata2[2048];
static void static void
senddone(isc_task_t *task, isc_event_t *event) { senddone(isc_task_t *task, isc_event_t *event) {
...@@ -214,7 +215,6 @@ recvdone2(isc_task_t *task, isc_event_t *event) { ...@@ -214,7 +215,6 @@ recvdone2(isc_task_t *task, isc_event_t *event) {
static void static void
buildquery(void) { buildquery(void) {
unsigned char qdata[1024], rdata[2048];
isc_buffer_t qbuffer; isc_buffer_t qbuffer;
isc_region_t r, inr; isc_region_t r, inr;
isc_result_t result; isc_result_t result;
...@@ -273,7 +273,7 @@ buildquery(void) { ...@@ -273,7 +273,7 @@ buildquery(void) {
DNS_TSIG_HMACMD5_NAME, nonce, 3600); DNS_TSIG_HMACMD5_NAME, nonce, 3600);
CHECK("dns_tkey_builddhquery", result); CHECK("dns_tkey_builddhquery", result);
isc_buffer_init(&qbuffer, qdata, sizeof(qdata)); isc_buffer_init(&qbuffer, qdata1, sizeof(qdata1));
result = dns_message_renderbegin(query, &qbuffer); result = dns_message_renderbegin(query, &qbuffer);
CHECK("dns_message_renderbegin", result); CHECK("dns_message_renderbegin", result);
...@@ -301,15 +301,14 @@ buildquery(void) { ...@@ -301,15 +301,14 @@ buildquery(void) {
result = isc_socket_sendto(s, &r, task1, senddone, NULL, &address, result = isc_socket_sendto(s, &r, task1, senddone, NULL, &address,
NULL); NULL);
CHECK("isc_socket_sendto", result); CHECK("isc_socket_sendto", result);
inr.base = rdata; inr.base = rdata1;
inr.length = sizeof(rdata); inr.length = sizeof(rdata1);
result = isc_socket_recv(s, &inr, 1, task1, recvdone, NULL); result = isc_socket_recv(s, &inr, 1, task1, recvdone, NULL);
CHECK("isc_socket_recv", result); CHECK("isc_socket_recv", result);
} }
static void static void
buildquery2(void) { buildquery2(void) {
unsigned char qdata[1024], rdata[2048];
isc_buffer_t qbuffer; isc_buffer_t qbuffer;
isc_region_t r, inr; isc_region_t r, inr;
isc_result_t result; isc_result_t result;
...@@ -322,7 +321,7 @@ buildquery2(void) { ...@@ -322,7 +321,7 @@ buildquery2(void) {
result = dns_tkey_builddeletequery(query2, tsigkey); result = dns_tkey_builddeletequery(query2, tsigkey);
CHECK("dns_tkey_builddeletequery", result); CHECK("dns_tkey_builddeletequery", result);
isc_buffer_init(&qbuffer, qdata, sizeof(qdata)); isc_buffer_init(&qbuffer, qdata2, sizeof(qdata2));
result = dns_message_renderbegin(query2, &qbuffer); result = dns_message_renderbegin(query2, &qbuffer);
CHECK("dns_message_renderbegin", result); CHECK("dns_message_renderbegin", result);
...@@ -347,8 +346,8 @@ buildquery2(void) { ...@@ -347,8 +346,8 @@ buildquery2(void) {
result = isc_socket_sendto(s, &r, task1, senddone2, NULL, &address, result = isc_socket_sendto(s, &r, task1, senddone2, NULL, &address,
NULL); NULL);
CHECK("isc_socket_sendto", result); CHECK("isc_socket_sendto", result);
inr.base = rdata; inr.base = rdata2;
inr.length = sizeof(rdata); inr.length = sizeof(rdata2);
result = isc_socket_recv(s, &inr, 1, task1, recvdone2, NULL); result = isc_socket_recv(s, &inr, 1, task1, recvdone2, NULL);
CHECK("isc_socket_recv", result); CHECK("isc_socket_recv", result);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment