Commit 6e49e91b authored by David Lawrence's avatar David Lawrence
Browse files

103. [func] libisc buffer API changes for <isc/buffer.h>:

                        Added:
                                isc_buffer_base(b)          (pointer)
                                isc_buffer_current(b)       (pointer)
                                isc_buffer_active(b)        (pointer)
                                isc_buffer_used(b)          (pointer)
                                isc_buffer_length(b)            (int)
                                isc_buffer_usedlength(b)        (int)
                                isc_buffer_consumedlength(b)    (int)
                                isc_buffer_remaininglength(b)   (int)
                                isc_buffer_activelength(b)      (int)
                                isc_buffer_availablelength(b)   (int)
                        Removed:
                                ISC_BUFFER_USEDCOUNT(b)
                                ISC_BUFFER_AVAILABLECOUNT(b)
                                isc_buffer_type(b)
                        Changed names:
                                isc_buffer_used(b, r) ->
                                        isc_buffer_usedregion(b, r)
                                isc_buffer_available(b, r) ->
                                        isc_buffer_available_region(b, r)
                                isc_buffer_consumed(b, r) ->
                                        isc_buffer_consumedregion(b, r)
                                isc_buffer_active(b, r) ->
                                        isc_buffer_activeregion(b, r)
                                isc_buffer_remaining(b, r) ->
                                        isc_buffer_remainingregion(b, r)

                        Buffer types were removed, so the ISC_BUFFERTYPE_*
                        macros are no more, and the type argument to
                        isc_buffer_init and isc_buffer_allocate were removed.
                        isc_buffer_putstr is now void (instead of isc_result_t)
                        and requires that the caller ensure that there
                        is enough available buffer space for the string.
parent ace0c1b3
102. [bug] Correctly detect inet_aton, inet_pton and inet_ptop 103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
102. [port] Correctly detect inet_aton, inet_pton and inet_ptop
on BSD/OS 4.1. on BSD/OS 4.1.
101. [cleanup] Quieted EGCS warnings from lib/isc/print.c. 101. [cleanup] Quieted EGCS warnings from lib/isc/print.c.
......
...@@ -59,9 +59,7 @@ extern int h_errno; ...@@ -59,9 +59,7 @@ extern int h_errno;
extern ISC_LIST(dig_lookup_t) lookup_list; extern ISC_LIST(dig_lookup_t) lookup_list;
extern ISC_LIST(dig_server_t) server_list; extern ISC_LIST(dig_server_t) server_list;
extern isc_boolean_t tcp_mode, extern isc_boolean_t tcp_mode, recurse, have_ipv6;
recurse,
have_ipv6;
extern in_port_t port; extern in_port_t port;
extern unsigned int timeout; extern unsigned int timeout;
extern isc_mem_t *mctx; extern isc_mem_t *mctx;
...@@ -118,7 +116,7 @@ static char *rcodetext[] = { ...@@ -118,7 +116,7 @@ static char *rcodetext[] = {
static void static void
show_usage() { show_usage() {
fatal ("Usage."); fatal("Usage.");
} }
void void
...@@ -128,14 +126,14 @@ check_next_lookup(dig_lookup_t *lookup) { ...@@ -128,14 +126,14 @@ check_next_lookup(dig_lookup_t *lookup) {
isc_boolean_t still_working=ISC_FALSE; isc_boolean_t still_working=ISC_FALSE;
#ifdef DEBUG #ifdef DEBUG
fputs ("In check_next_lookup",stderr); fputs("In check_next_lookup",stderr);
#endif #endif
for (query = ISC_LIST_HEAD(lookup->q); for (query = ISC_LIST_HEAD(lookup->q);
query != NULL; query != NULL;
query = ISC_LIST_NEXT(query, link)) { query = ISC_LIST_NEXT(query, link)) {
if (query->working) { if (query->working) {
#ifdef DEBUG #ifdef DEBUG
fputs ("Still have a worker.",stderr); fputs("Still have a worker.",stderr);
#endif #endif
still_working=ISC_TRUE; still_working=ISC_TRUE;
} }
...@@ -143,10 +141,10 @@ check_next_lookup(dig_lookup_t *lookup) { ...@@ -143,10 +141,10 @@ check_next_lookup(dig_lookup_t *lookup) {
if (still_working) if (still_working)
return; return;
next = ISC_LIST_NEXT (lookup, link); next = ISC_LIST_NEXT(lookup, link);
if (next == NULL) { if (next == NULL) {
#ifdef DEBUG #ifdef DEBUG
fputs ("Shutting Down.",stderr); fputs("Shutting Down.",stderr);
#endif #endif
isc_app_shutdown(); isc_app_shutdown();
return; return;
...@@ -196,7 +194,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name, ...@@ -196,7 +194,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
name = NULL; name = NULL;
dns_message_currentname(msg, sectionid, &name); dns_message_currentname(msg, sectionid, &name);
isc_buffer_init(&target, t, sizeof t, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&target, t, sizeof(t));
first = ISC_TRUE; first = ISC_TRUE;
print_name = name; print_name = name;
...@@ -217,7 +215,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name, ...@@ -217,7 +215,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
} }
#endif #endif
} }
isc_buffer_used(&target, &r); isc_buffer_usedregion(&target, &r);
if (no_rdata) if (no_rdata)
printf(";%.*s", (int)r.length, (char *)r.base); printf(";%.*s", (int)r.length, (char *)r.base);
else else
...@@ -246,13 +244,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner, ...@@ -246,13 +244,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
if (headers) if (headers)
printf(";; %s SECTION:\n", set_name); printf(";; %s SECTION:\n", set_name);
isc_buffer_init(&target, t, sizeof t, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&target, t, sizeof(t));
result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE,
&target); &target);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
isc_buffer_used(&target, &r); isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base); printf("%.*s", (int)r.length, (char *)r.base);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
...@@ -262,7 +260,7 @@ isc_result_t ...@@ -262,7 +260,7 @@ isc_result_t
printmessage(dns_message_t *msg, isc_boolean_t headers) { printmessage(dns_message_t *msg, isc_boolean_t headers) {
isc_boolean_t did_flag = ISC_FALSE; isc_boolean_t did_flag = ISC_FALSE;
isc_result_t result; isc_result_t result;
dns_rdataset_t *opt, *tsig; dns_rdataset_t *opt, *tsig = NULL;
dns_name_t *tsigname; dns_name_t *tsigname;
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;
...@@ -300,7 +298,8 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) { ...@@ -300,7 +298,8 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) {
printf("%scd", did_flag ? " " : ""); printf("%scd", did_flag ? " " : "");
did_flag = ISC_TRUE; did_flag = ISC_TRUE;
} }
printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n", printf("; QUERY: %u, ANSWER: %u, "
"AUTHORITY: %u, ADDITIONAL: %u\n",
msg->counts[DNS_SECTION_QUESTION], msg->counts[DNS_SECTION_QUESTION],
msg->counts[DNS_SECTION_ANSWER], msg->counts[DNS_SECTION_ANSWER],
msg->counts[DNS_SECTION_AUTHORITY], msg->counts[DNS_SECTION_AUTHORITY],
...@@ -367,15 +366,14 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) { ...@@ -367,15 +366,14 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) {
*/ */
void void
parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
isc_boolean_t have_host=ISC_FALSE; isc_boolean_t have_host = ISC_FALSE;
dig_server_t *srv=NULL; dig_server_t *srv = NULL;
dig_lookup_t *lookup=NULL; dig_lookup_t *lookup = NULL;
char *batchname=NULL; char *batchname = NULL;
char batchline[MXNAME]; char batchline[MXNAME];
FILE *fp=NULL; FILE *fp = NULL;
int bargc; int bargc;
char *bargv[8]; char *bargv[8];
char *ptr;
int i,n; int i,n;
int adrs[4]; int adrs[4];
...@@ -384,7 +382,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { ...@@ -384,7 +382,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
&& (!is_batchfile)) { && (!is_batchfile)) {
srv=isc_mem_allocate(mctx, sizeof(struct dig_server)); srv=isc_mem_allocate(mctx, sizeof(struct dig_server));
if (srv == NULL) if (srv == NULL)
fatal ("Memory allocation failure."); fatal("Memory allocation failure.");
strncpy(srv->servername,&argv[0][1],MXNAME-1); strncpy(srv->servername,&argv[0][1],MXNAME-1);
ISC_LIST_APPEND(server_list, srv, link); ISC_LIST_APPEND(server_list, srv, link);
} else if ((strcmp(argv[0],"+vc") == 0) } else if ((strcmp(argv[0],"+vc") == 0)
...@@ -413,27 +411,27 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { ...@@ -413,27 +411,27 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
argc--; argc--;
} }
} else if (strncmp(argv[0],"-x",2) == 0) { } else if (strncmp(argv[0],"-x",2) == 0) {
n = sscanf (argv[1],"%d.%d.%d.%d", &adrs[0], &adrs[1], n = sscanf(argv[1],"%d.%d.%d.%d", &adrs[0], &adrs[1],
&adrs[2], &adrs[3]); &adrs[2], &adrs[3]);
if (n == 0) if (n == 0)
show_usage(); show_usage();
lookup = isc_mem_allocate (mctx, lookup = isc_mem_allocate(mctx,
sizeof(struct dig_lookup)); sizeof(struct dig_lookup));
if (lookup == NULL) if (lookup == NULL)
fatal ("Memory allocation failure."); fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE; lookup->pending = ISC_FALSE;
lookup->textname[0]=0; lookup->textname[0]=0;
for (i=n-1; i>=0; i--) { for (i = n - 1; i >= 0; i--) {
snprintf (batchline, MXNAME/8, "%d.", snprintf(batchline, MXNAME/8, "%d.",
adrs[i]); adrs[i]);
strncat (lookup->textname, batchline, MXNAME); strncat(lookup->textname, batchline, MXNAME);
} }
strncat (lookup->textname, "in-addr.arpa.", MXNAME); strncat(lookup->textname, "in-addr.arpa.", MXNAME);
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr,"Looking up %s\n",lookup->textname); fprintf(stderr,"Looking up %s\n",lookup->textname);
#endif #endif
strcpy (lookup->rttext, "ptr"); strcpy(lookup->rttext, "ptr");
strcpy (lookup->rctext, "in"); strcpy(lookup->rctext, "in");
lookup->namespace[0]=0; lookup->namespace[0]=0;
lookup->sendspace[0]=0; lookup->sendspace[0]=0;
lookup->sendmsg=NULL; lookup->sendmsg=NULL;
...@@ -448,23 +446,22 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { ...@@ -448,23 +446,22 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
argc--; argc--;
} else { } else {
if (have_host) { if (have_host) {
ENSURE ( lookup != NULL ); ENSURE(lookup != NULL);
if (isclass(argv[0])) { if (isclass(argv[0])) {
strncpy (lookup->rctext,argv[0], strncpy(lookup->rctext,argv[0],
MXRD); MXRD);
continue; continue;
} else if (istype(argv[0])) { } else if (istype(argv[0])) {
strncpy (lookup->rttext,argv[0], strncpy(lookup->rttext,argv[0], MXRD);
MXRD);
continue; continue;
} }
} }
lookup = isc_mem_allocate (mctx, lookup = isc_mem_allocate(mctx,
sizeof(struct dig_lookup)); sizeof(struct dig_lookup));
if (lookup == NULL) if (lookup == NULL)
fatal ("Memory allocation failure."); fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE; lookup->pending = ISC_FALSE;
strncpy (lookup->textname,argv[0], MXNAME-1); strncpy(lookup->textname,argv[0], MXNAME-1);
lookup->rttext[0]=0; lookup->rttext[0]=0;
lookup->rctext[0]=0; lookup->rctext[0]=0;
lookup->namespace[0]=0; lookup->namespace[0]=0;
...@@ -478,17 +475,17 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { ...@@ -478,17 +475,17 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
ISC_LIST_APPEND(lookup_list, lookup, link); ISC_LIST_APPEND(lookup_list, lookup, link);
have_host = ISC_TRUE; have_host = ISC_TRUE;
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr,"Looking up %s\n",lookup->textname); fprintf(stderr, "Looking up %s\n", lookup->textname);
#endif #endif
} }
} }
if (batchname != NULL) { if (batchname != NULL) {
fp = fopen (batchname, "r"); fp = fopen(batchname, "r");
if (fp == NULL) { if (fp == NULL) {
perror (batchname); perror(batchname);
fatal ("Couldn't open specified batch file."); fatal("Couldn't open specified batch file.");
} }
while (fgets (batchline, MXNAME, fp) != 0) { while (fgets(batchline, MXNAME, fp) != 0) {
bargc=1; bargc=1;
bargv[bargc]=strtok(batchline, " \t"); bargv[bargc]=strtok(batchline, " \t");
while (bargv[bargc] != NULL) { while (bargv[bargc] != NULL) {
...@@ -498,16 +495,15 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { ...@@ -498,16 +495,15 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
bargc--; bargc--;
bargv[0]="dig"; bargv[0]="dig";
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr,"Parsing %d:%s\n",bargc,bargv[1]); fprintf(stderr,"Parsing %d:%s\n",bargc,bargv[1]);
#endif #endif
parse_args(ISC_TRUE, bargc, (char**)bargv); parse_args(ISC_TRUE, bargc, (char**)bargv);
} }
} }
if (lookup_list.head == NULL) { if (lookup_list.head == NULL) {
lookup = isc_mem_allocate (mctx, lookup = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
sizeof(struct dig_lookup));
if (lookup == NULL) if (lookup == NULL)
fatal ("Memory allocation failure."); fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE; lookup->pending = ISC_FALSE;
lookup->rctext[0]=0; lookup->rctext[0]=0;
lookup->namespace[0]=0; lookup->namespace[0]=0;
...@@ -518,10 +514,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { ...@@ -518,10 +514,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->xfr_q = NULL; lookup->xfr_q = NULL;
lookup->doing_xfr = ISC_FALSE; lookup->doing_xfr = ISC_FALSE;
ISC_LIST_INIT(lookup->q); ISC_LIST_INIT(lookup->q);
strcpy (lookup->textname,"."); strcpy(lookup->textname,".");
strcpy (lookup->rttext, "NS"); strcpy(lookup->rttext, "NS");
lookup->rctext[0]=0; lookup->rctext[0]=0;
ISC_LIST_APPEND(lookup_list, lookup, link); ISC_LIST_APPEND(lookup_list, lookup, link);
} }
} }
This diff is collapsed.
...@@ -171,7 +171,7 @@ say_message(char *host, char *msg, dns_rdata_t *rdata, isc_buffer_t *target) { ...@@ -171,7 +171,7 @@ say_message(char *host, char *msg, dns_rdata_t *rdata, isc_buffer_t *target) {
result = dns_rdata_totext( rdata, NULL, target); result = dns_rdata_totext( rdata, NULL, target);
check_result(result, "dns_rdata_totext"); check_result(result, "dns_rdata_totext");
isc_buffer_used(target, &r); isc_buffer_usedregion(target, &r);
printf ( "%s %s %.*s\n", host, msg, (int)r.length, printf ( "%s %s %.*s\n", host, msg, (int)r.length,
(char *)r.base); (char *)r.base);
} }
...@@ -212,7 +212,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name, ...@@ -212,7 +212,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
name = NULL; name = NULL;
dns_message_currentname(msg, sectionid, &name); dns_message_currentname(msg, sectionid, &name);
isc_buffer_init(&target, t, sizeof t, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&target, t, sizeof(t));
first = ISC_TRUE; first = ISC_TRUE;
print_name = name; print_name = name;
...@@ -261,7 +261,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name, ...@@ -261,7 +261,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
} }
} }
if (!short_form) { if (!short_form) {
isc_buffer_used(&target, &r); isc_buffer_usedregion(&target, &r);
if (no_rdata) if (no_rdata)
printf(";%.*s", (int)r.length, printf(";%.*s", (int)r.length,
(char *)r.base); (char *)r.base);
...@@ -292,13 +292,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner, ...@@ -292,13 +292,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
if (headers) if (headers)
printf(";; %s SECTION:\n", set_name); printf(";; %s SECTION:\n", set_name);
isc_buffer_init(&target, t, sizeof t, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&target, t, sizeof(t));
result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE,
&target); &target);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
isc_buffer_used(&target, &r); isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base); printf("%.*s", (int)r.length, (char *)r.base);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
...@@ -307,11 +307,9 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner, ...@@ -307,11 +307,9 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
isc_result_t isc_result_t
printmessage(dns_message_t *msg, isc_boolean_t headers) { printmessage(dns_message_t *msg, isc_boolean_t headers) {
isc_boolean_t did_flag = ISC_FALSE; isc_boolean_t did_flag = ISC_FALSE;
dns_rdataset_t *opt, *tsig; dns_rdataset_t *opt, *tsig = NULL;
dns_name_t *tsigname; dns_name_t *tsigname;
isc_result_t result; isc_result_t result = ISC_R_SUCCESS;
result = ISC_R_SUCCESS;
if (!short_form) { if (!short_form) {
printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n", printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
...@@ -346,7 +344,8 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) { ...@@ -346,7 +344,8 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) {
printf("%scd", did_flag ? " " : ""); printf("%scd", did_flag ? " " : "");
did_flag = ISC_TRUE; did_flag = ISC_TRUE;
} }
printf("; QUERY: %u, ANSWER: %u, AUTHORITY: %u, ADDITIONAL: %u\n", printf("; QUERY: %u, ANSWER: %u, "
"AUTHORITY: %u, ADDITIONAL: %u\n",
msg->counts[DNS_SECTION_QUESTION], msg->counts[DNS_SECTION_QUESTION],
msg->counts[DNS_SECTION_ANSWER], msg->counts[DNS_SECTION_ANSWER],
msg->counts[DNS_SECTION_AUTHORITY], msg->counts[DNS_SECTION_AUTHORITY],
......
...@@ -91,6 +91,8 @@ struct dig_server { ...@@ -91,6 +91,8 @@ struct dig_server {
/* Routines in dighost.c */ /* Routines in dighost.c */
void void
fatal(char *format, ...) ; fatal(char *format, ...) ;
inline void
check_result(isc_result_t result, char *msg);
isc_boolean_t isc_boolean_t
isclass(char *text) ; isclass(char *text) ;
isc_boolean_t isc_boolean_t
......
...@@ -111,9 +111,9 @@ nametostr(dns_name_t *name) { ...@@ -111,9 +111,9 @@ nametostr(dns_name_t *name) {
isc_region_t r; isc_region_t r;
static char data[1025]; static char data[1025];
isc_buffer_init(&b, data, sizeof(data), ISC_BUFFERTYPE_TEXT); isc_buffer_init(&b, data, sizeof(data));
dns_name_totext(name, ISC_FALSE, &b); dns_name_totext(name, ISC_FALSE, &b);
isc_buffer_used(&b, &r); isc_buffer_usedregion(&b, &r);
r.base[r.length] = 0; r.base[r.length] = 0;
return (char *) r.base; return (char *) r.base;
} }
...@@ -125,9 +125,9 @@ typetostr(const dns_rdatatype_t type) { ...@@ -125,9 +125,9 @@ typetostr(const dns_rdatatype_t type) {
isc_region_t r; isc_region_t r;
static char data[10]; static char data[10];
isc_buffer_init(&b, data, sizeof(data), ISC_BUFFERTYPE_TEXT); isc_buffer_init(&b, data, sizeof(data));
dns_rdatatype_totext(type, &b); dns_rdatatype_totext(type, &b);
isc_buffer_used(&b, &r); isc_buffer_usedregion(&b, &r);
r.base[r.length] = 0; r.base[r.length] = 0;
return (char *) r.base; return (char *) r.base;
} }
...@@ -139,9 +139,9 @@ algtostr(const dns_secalg_t alg) { ...@@ -139,9 +139,9 @@ algtostr(const dns_secalg_t alg) {
isc_region_t r; isc_region_t r;
static char data[10]; static char data[10];
isc_buffer_init(&b, data, sizeof(data), ISC_BUFFERTYPE_TEXT); isc_buffer_init(&b, data, sizeof(data));
dns_secalg_totext(alg, &b); dns_secalg_totext(alg, &b);
isc_buffer_used(&b, &r); isc_buffer_usedregion(&b, &r);
r.base[r.length] = 0; r.base[r.length] = 0;
return (char *) r.base; return (char *) r.base;
} }
...@@ -198,7 +198,7 @@ iszonekey(signer_key_t *key, dns_db_t *db) { ...@@ -198,7 +198,7 @@ iszonekey(signer_key_t *key, dns_db_t *db) {
isc_buffer_t b; isc_buffer_t b;
isc_result_t result; isc_result_t result;
isc_buffer_init(&b, origin, sizeof(origin), ISC_BUFFERTYPE_TEXT); isc_buffer_init(&b, origin, sizeof(origin));
result = dns_name_totext(dns_db_origin(db), ISC_FALSE, &b); result = dns_name_totext(dns_db_origin(db), ISC_FALSE, &b);
check_result(result, "dns_name_totext()"); check_result(result, "dns_name_totext()");
...@@ -295,8 +295,7 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, signer_key_t *key, ...@@ -295,8 +295,7 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, signer_key_t *key,
ISC_LIST_APPEND(arraylist, tdata, link); \ ISC_LIST_APPEND(arraylist, tdata, link); \
if (trdata == NULL || tdata == NULL) \ if (trdata == NULL || tdata == NULL) \
check_result(ISC_R_FAILURE, "isc_mem_get"); \ check_result(ISC_R_FAILURE, "isc_mem_get"); \
isc_buffer_init(&b, tdata->array, sizeof(tdata->array), \ isc_buffer_init(&b, tdata->array, sizeof(tdata->array));
ISC_BUFFERTYPE_BINARY);
/* /*
* Signs a set. Goes through contortions to decide if each SIG should * Signs a set. Goes through contortions to decide if each SIG should
...@@ -882,10 +881,10 @@ loadzone(char *file, char *origin, dns_zone_t **zone) { ...@@ -882,10 +881,10 @@ loadzone(char *file, char *origin, dns_zone_t **zone) {
isc_result_t result; isc_result_t result;
len = strlen(origin); len = strlen(origin);
isc_buffer_init(&b, origin, len, ISC_BUFFERTYPE_TEXT); isc_buffer_init(&b, origin, len);
isc_buffer_add(&b, len); isc_buffer_add(&b, len);
isc_buffer_init(&b2, namedata, sizeof(namedata), ISC_BUFFERTYPE_BINARY); isc_buffer_init(&b2, namedata, sizeof(namedata));