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

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.
101. [cleanup] Quieted EGCS warnings from lib/isc/print.c.
......
......@@ -59,9 +59,7 @@ extern int h_errno;
extern ISC_LIST(dig_lookup_t) lookup_list;
extern ISC_LIST(dig_server_t) server_list;
extern isc_boolean_t tcp_mode,
recurse,
have_ipv6;
extern isc_boolean_t tcp_mode, recurse, have_ipv6;
extern in_port_t port;
extern unsigned int timeout;
extern isc_mem_t *mctx;
......@@ -118,7 +116,7 @@ static char *rcodetext[] = {
static void
show_usage() {
fatal ("Usage.");
fatal("Usage.");
}
void
......@@ -128,14 +126,14 @@ check_next_lookup(dig_lookup_t *lookup) {
isc_boolean_t still_working=ISC_FALSE;
#ifdef DEBUG
fputs ("In check_next_lookup",stderr);
fputs("In check_next_lookup",stderr);
#endif
for (query = ISC_LIST_HEAD(lookup->q);
query != NULL;
query = ISC_LIST_NEXT(query, link)) {
if (query->working) {
#ifdef DEBUG
fputs ("Still have a worker.",stderr);
fputs("Still have a worker.",stderr);
#endif
still_working=ISC_TRUE;
}
......@@ -143,10 +141,10 @@ check_next_lookup(dig_lookup_t *lookup) {
if (still_working)
return;
next = ISC_LIST_NEXT (lookup, link);
next = ISC_LIST_NEXT(lookup, link);
if (next == NULL) {
#ifdef DEBUG
fputs ("Shutting Down.",stderr);
fputs("Shutting Down.",stderr);
#endif
isc_app_shutdown();
return;
......@@ -196,7 +194,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
name = NULL;
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;
print_name = name;
......@@ -217,7 +215,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
}
#endif
}
isc_buffer_used(&target, &r);
isc_buffer_usedregion(&target, &r);
if (no_rdata)
printf(";%.*s", (int)r.length, (char *)r.base);
else
......@@ -246,13 +244,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
if (headers)
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,
&target);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_used(&target, &r);
isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base);
return (ISC_R_SUCCESS);
......@@ -262,7 +260,7 @@ isc_result_t
printmessage(dns_message_t *msg, isc_boolean_t headers) {
isc_boolean_t did_flag = ISC_FALSE;
isc_result_t result;
dns_rdataset_t *opt, *tsig;
dns_rdataset_t *opt, *tsig = NULL;
dns_name_t *tsigname;
result = ISC_R_SUCCESS;
......@@ -300,7 +298,8 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) {
printf("%scd", did_flag ? " " : "");
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_ANSWER],
msg->counts[DNS_SECTION_AUTHORITY],
......@@ -367,15 +366,14 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) {
*/
void
parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
isc_boolean_t have_host=ISC_FALSE;
dig_server_t *srv=NULL;
dig_lookup_t *lookup=NULL;
char *batchname=NULL;
isc_boolean_t have_host = ISC_FALSE;
dig_server_t *srv = NULL;
dig_lookup_t *lookup = NULL;
char *batchname = NULL;
char batchline[MXNAME];
FILE *fp=NULL;
FILE *fp = NULL;
int bargc;
char *bargv[8];
char *ptr;
int i,n;
int adrs[4];
......@@ -384,7 +382,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
&& (!is_batchfile)) {
srv=isc_mem_allocate(mctx, sizeof(struct dig_server));
if (srv == NULL)
fatal ("Memory allocation failure.");
fatal("Memory allocation failure.");
strncpy(srv->servername,&argv[0][1],MXNAME-1);
ISC_LIST_APPEND(server_list, srv, link);
} else if ((strcmp(argv[0],"+vc") == 0)
......@@ -413,27 +411,27 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
argc--;
}
} 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]);
if (n == 0)
show_usage();
lookup = isc_mem_allocate (mctx,
sizeof(struct dig_lookup));
lookup = isc_mem_allocate(mctx,
sizeof(struct dig_lookup));
if (lookup == NULL)
fatal ("Memory allocation failure.");
fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE;
lookup->textname[0]=0;
for (i=n-1; i>=0; i--) {
snprintf (batchline, MXNAME/8, "%d.",
for (i = n - 1; i >= 0; i--) {
snprintf(batchline, MXNAME/8, "%d.",
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
fprintf (stderr,"Looking up %s\n",lookup->textname);
fprintf(stderr,"Looking up %s\n",lookup->textname);
#endif
strcpy (lookup->rttext, "ptr");
strcpy (lookup->rctext, "in");
strcpy(lookup->rttext, "ptr");
strcpy(lookup->rctext, "in");
lookup->namespace[0]=0;
lookup->sendspace[0]=0;
lookup->sendmsg=NULL;
......@@ -448,23 +446,22 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
argc--;
} else {
if (have_host) {
ENSURE ( lookup != NULL );
ENSURE(lookup != NULL);
if (isclass(argv[0])) {
strncpy (lookup->rctext,argv[0],
strncpy(lookup->rctext,argv[0],
MXRD);
continue;
} else if (istype(argv[0])) {
strncpy (lookup->rttext,argv[0],
MXRD);
strncpy(lookup->rttext,argv[0], MXRD);
continue;
}
}
lookup = isc_mem_allocate (mctx,
sizeof(struct dig_lookup));
lookup = isc_mem_allocate(mctx,
sizeof(struct dig_lookup));
if (lookup == NULL)
fatal ("Memory allocation failure.");
fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE;
strncpy (lookup->textname,argv[0], MXNAME-1);
strncpy(lookup->textname,argv[0], MXNAME-1);
lookup->rttext[0]=0;
lookup->rctext[0]=0;
lookup->namespace[0]=0;
......@@ -478,17 +475,17 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
ISC_LIST_APPEND(lookup_list, lookup, link);
have_host = ISC_TRUE;
#ifdef DEBUG
fprintf (stderr,"Looking up %s\n",lookup->textname);
fprintf(stderr, "Looking up %s\n", lookup->textname);
#endif
}
}
if (batchname != NULL) {
fp = fopen (batchname, "r");
fp = fopen(batchname, "r");
if (fp == NULL) {
perror (batchname);
fatal ("Couldn't open specified batch file.");
perror(batchname);
fatal("Couldn't open specified batch file.");
}
while (fgets (batchline, MXNAME, fp) != 0) {
while (fgets(batchline, MXNAME, fp) != 0) {
bargc=1;
bargv[bargc]=strtok(batchline, " \t");
while (bargv[bargc] != NULL) {
......@@ -498,16 +495,15 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
bargc--;
bargv[0]="dig";
#ifdef DEBUG
fprintf (stderr,"Parsing %d:%s\n",bargc,bargv[1]);
fprintf(stderr,"Parsing %d:%s\n",bargc,bargv[1]);
#endif
parse_args(ISC_TRUE, bargc, (char**)bargv);
}
}
if (lookup_list.head == NULL) {
lookup = isc_mem_allocate (mctx,
sizeof(struct dig_lookup));
lookup = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
if (lookup == NULL)
fatal ("Memory allocation failure.");
fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE;
lookup->rctext[0]=0;
lookup->namespace[0]=0;
......@@ -518,10 +514,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->xfr_q = NULL;
lookup->doing_xfr = ISC_FALSE;
ISC_LIST_INIT(lookup->q);
strcpy (lookup->textname,".");
strcpy (lookup->rttext, "NS");
strcpy(lookup->textname,".");
strcpy(lookup->rttext, "NS");
lookup->rctext[0]=0;
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) {
result = dns_rdata_totext( rdata, NULL, target);
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,
(char *)r.base);
}
......@@ -212,7 +212,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
name = NULL;
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;
print_name = name;
......@@ -261,7 +261,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name,
}
}
if (!short_form) {
isc_buffer_used(&target, &r);
isc_buffer_usedregion(&target, &r);
if (no_rdata)
printf(";%.*s", (int)r.length,
(char *)r.base);
......@@ -292,13 +292,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
if (headers)
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,
&target);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_used(&target, &r);
isc_buffer_usedregion(&target, &r);
printf("%.*s", (int)r.length, (char *)r.base);
return (ISC_R_SUCCESS);
......@@ -307,11 +307,9 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
isc_result_t
printmessage(dns_message_t *msg, isc_boolean_t headers) {
isc_boolean_t did_flag = ISC_FALSE;
dns_rdataset_t *opt, *tsig;
dns_rdataset_t *opt, *tsig = NULL;
dns_name_t *tsigname;
isc_result_t result;
result = ISC_R_SUCCESS;
isc_result_t result = ISC_R_SUCCESS;
if (!short_form) {
printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
......@@ -346,7 +344,8 @@ printmessage(dns_message_t *msg, isc_boolean_t headers) {
printf("%scd", did_flag ? " " : "");
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_ANSWER],
msg->counts[DNS_SECTION_AUTHORITY],
......
......@@ -91,6 +91,8 @@ struct dig_server {
/* Routines in dighost.c */
void
fatal(char *format, ...) ;
inline void
check_result(isc_result_t result, char *msg);
isc_boolean_t
isclass(char *text) ;
isc_boolean_t
......
......@@ -111,9 +111,9 @@ nametostr(dns_name_t *name) {
isc_region_t r;
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);
isc_buffer_used(&b, &r);
isc_buffer_usedregion(&b, &r);
r.base[r.length] = 0;
return (char *) r.base;
}
......@@ -125,9 +125,9 @@ typetostr(const dns_rdatatype_t type) {
isc_region_t r;
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);
isc_buffer_used(&b, &r);
isc_buffer_usedregion(&b, &r);
r.base[r.length] = 0;
return (char *) r.base;
}
......@@ -139,9 +139,9 @@ algtostr(const dns_secalg_t alg) {
isc_region_t r;
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);
isc_buffer_used(&b, &r);
isc_buffer_usedregion(&b, &r);
r.base[r.length] = 0;
return (char *) r.base;
}
......@@ -198,7 +198,7 @@ iszonekey(signer_key_t *key, dns_db_t *db) {
isc_buffer_t b;
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);
check_result(result, "dns_name_totext()");
......@@ -295,8 +295,7 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, signer_key_t *key,
ISC_LIST_APPEND(arraylist, tdata, link); \
if (trdata == NULL || tdata == NULL) \
check_result(ISC_R_FAILURE, "isc_mem_get"); \
isc_buffer_init(&b, tdata->array, sizeof(tdata->array), \
ISC_BUFFERTYPE_BINARY);
isc_buffer_init(&b, tdata->array, sizeof(tdata->array));
/*
* 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) {
isc_result_t result;
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_init(&b2, namedata, sizeof(namedata), ISC_BUFFERTYPE_BINARY);
isc_buffer_init(&b2, namedata, sizeof(namedata));
dns_name_init(&name, NULL);
result = dns_name_fromtext(&name, &b, dns_rootname, ISC_FALSE, &b2);
......
......@@ -381,7 +381,7 @@ client_init_gabn(client_t *client)
* Set up the internal buffer to point to the receive region.
*/
isc_buffer_init(&client->recv_buffer, client->buffer,
LWRES_RECVLENGTH, ISC_BUFFERTYPE_TEXT);
LWRES_RECVLENGTH);
}
void
......@@ -401,5 +401,5 @@ client_init_gnba(client_t *client)
client->gnba.baselen = 0;
isc_buffer_init(&client->recv_buffer, client->buffer,
LWRES_RECVLENGTH, ISC_BUFFERTYPE_TEXT);
LWRES_RECVLENGTH);
}
......@@ -497,8 +497,7 @@ process_gabn(client_t *client, lwres_buffer_t *b)
if (result != LWRES_R_SUCCESS)
goto out;
isc_buffer_init(&namebuf, req->name, req->namelen,
ISC_BUFFERTYPE_TEXT);
isc_buffer_init(&namebuf, req->name, req->namelen);
isc_buffer_add(&namebuf, req->namelen);
dns_fixedname_init(&client->target_name);
......
......@@ -88,7 +88,7 @@ convert_keyname(char *txtname, isc_mem_t *mctx, dns_name_t *dnsname) {
unsigned int keylen;
keylen = strlen(txtname);
isc_buffer_init(&buf, txtname, keylen, ISC_BUFFERTYPE_TEXT);
isc_buffer_init(&buf, txtname, keylen);
isc_buffer_add(&buf, keylen);
dns_fixedname_init(&fixname);
result = dns_name_fromtext(dns_fixedname_name(&fixname), &buf,
......
......@@ -180,7 +180,7 @@ sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size)
{
isc_result_t result;
isc_buffer_t buf;
isc_buffer_init(&buf, array, size, ISC_BUFFERTYPE_TEXT);
isc_buffer_init(&buf, array, size);
result = isc_sockaddr_totext(sa, &buf);
if (result != ISC_R_SUCCESS) {
strncpy(array, "<unknown address>", size);
......@@ -626,16 +626,14 @@ ns_client_send(ns_client_t *client) {
/*
* XXXRTH "tcpbuffer" is a hack to get things working.
*/
isc_buffer_init(&tcpbuffer, data, SEND_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
isc_buffer_init(&buffer, data + 2, SEND_BUFFER_SIZE - 2,
ISC_BUFFERTYPE_BINARY);
isc_buffer_init(&tcpbuffer, data, SEND_BUFFER_SIZE);
isc_buffer_init(&buffer, data + 2, SEND_BUFFER_SIZE - 2);
} else {
if (client->udpsize < SEND_BUFFER_SIZE)
bufsize = client->udpsize;
else
bufsize = SEND_BUFFER_SIZE;
isc_buffer_init(&buffer, data, bufsize, ISC_BUFFERTYPE_BINARY);
isc_buffer_init(&buffer, data, bufsize);
}
result = dns_message_renderbegin(client->message, &buffer);
......@@ -682,14 +680,14 @@ ns_client_send(ns_client_t *client) {
if (TCP_CLIENT(client)) {
socket = client->tcpsocket;
address = NULL;
isc_buffer_used(&buffer, &r);
isc_buffer_usedregion(&buffer, &r);
isc_buffer_putuint16(&tcpbuffer, (isc_uint16_t) r.length);
isc_buffer_add(&tcpbuffer, r.length);
isc_buffer_used(&tcpbuffer, &r);
isc_buffer_usedregion(&tcpbuffer, &r);
} else {
socket = dns_dispatch_getsocket(client->dispatch);
address = &client->dispevent->addr;
isc_buffer_used(&buffer, &r);
isc_buffer_usedregion(&buffer, &r);
}
CTRACE("sendto");
if ((client->attributes & NS_CLIENTATTR_PKTINFO) != 0)
......
......@@ -74,7 +74,7 @@ sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size)
{
isc_result_t result;
isc_buffer_t buf;
isc_buffer_init(&buf, array, size, ISC_BUFFERTYPE_TEXT);
isc_buffer_init(&buf, array, size);
result = isc_sockaddr_totext(sa, &buf);
if (result != ISC_R_SUCCESS) {
strncpy(array, "<unknown address>", size);
......
......@@ -203,8 +203,7 @@ query_newnamebuf(ns_client_t *client) {
*/
dbuf = NULL;
result = isc_buffer_allocate(client->mctx, &dbuf, 1024,
ISC_BUFFERTYPE_BINARY);
result = isc_buffer_allocate(client->mctx, &dbuf, 1024);
if (result != ISC_R_SUCCESS) {
CTRACE("query_newnamebuf: isc_buffer_allocate failed: done");
return (result);
......@@ -237,7 +236,7 @@ query_getnamebuf(ns_client_t *client) {
dbuf = ISC_LIST_TAIL(client->query.namebufs);
INSIST(dbuf != NULL);
isc_buffer_available(dbuf, &r);
isc_buffer_availableregion(dbuf, &r);
if (r.length < 255) {
result = query_newnamebuf(client);
if (result != ISC_R_SUCCESS) {
......@@ -246,7 +245,7 @@ query_getnamebuf(ns_client_t *client) {
}
dbuf = ISC_LIST_TAIL(client->query.namebufs);
isc_buffer_available(dbuf, &r);
isc_buffer_availableregion(dbuf, &r);
INSIST(r.length >= 255);
}
CTRACE("query_getnamebuf: done");
......@@ -308,8 +307,8 @@ query_newname(ns_client_t *client, isc_buffer_t *dbuf,
CTRACE("query_newname: dns_message_gettempname failed: done");
return (NULL);
}
isc_buffer_available(dbuf, &r);
isc_buffer_init(nbuf, r.base, r.length, ISC_BUFFERTYPE_BINARY);
isc_buffer_availableregion(dbuf, &r);
isc_buffer_init(nbuf, r.base, r.length);
dns_name_init(name, NULL);
dns_name_setbuffer(name, nbuf);
client->query.attributes |= NS_QUERYATTR_NAMEBUFUSED;
......@@ -2792,12 +2791,11 @@ log_query(ns_client_t *client) {
dns_name_format(client->query.qname, namebuf, sizeof(namebuf));
isc_buffer_init(&b, (unsigned char *)text, sizeof text,
ISC_BUFFERTYPE_TEXT);
isc_buffer_init(&b, (unsigned char *)text, sizeof(text));
for (rdataset = ISC_LIST_HEAD(client->query.qname->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) {
isc_buffer_available(&b, &r);
isc_buffer_availableregion(&b, &r);
if (r.length < 1)
return;
*r.base = ' ';
......@@ -2805,7 +2803,7 @@ log_query(ns_client_t *client) {
if (dns_rdatatype_totext(rdataset->type, &b) != ISC_R_SUCCESS)
return;
}
isc_buffer_used(&b, &r);
isc_buffer_usedregion(&b, &r);
ns_client_log(client, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_QUERY,
ISC_LOG_DEBUG(1), "query: %s%.*s", namebuf,
(int)r.length, (char *)r.base);
......
......@@ -172,7 +172,7 @@ base64_cstring_tobuffer(isc_mem_t *mctx, char *cstr, isc_buffer_t *target)
isc_lex_t *lex = NULL;
isc_boolean_t isopen = ISC_FALSE;