2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

Megacommit of dozens of files.

Cleanup of redundant/useless header file inclusion.

ISC style lint, primarily for function declarations and standalone
comments -- ie, those that appear on a line without any code, which
should be written as follows:
   /*
    * This is a comment.
    */
This commit is contained in:
David Lawrence 2000-05-08 14:38:29 +00:00
parent 595babf627
commit 1a69a1a78c
318 changed files with 3525 additions and 5094 deletions

View File

@ -17,42 +17,18 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
extern int h_errno;
#include <isc/types.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/time.h>
#include <isc/buffer.h>
#include <isc/list.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dig/dig.h>

View File

@ -17,39 +17,22 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
extern int h_errno;
#include <isc/types.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/time.h>
#include <isc/buffer.h>
#include <isc/list.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatatype.h>
#include <dns/result.h>

View File

@ -17,42 +17,18 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
extern int h_errno;
#include <isc/types.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/time.h>
#include <isc/buffer.h>
#include <isc/list.h>
#include <isc/util.h>
#include <isc/commandline.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dig/dig.h>

View File

@ -15,21 +15,16 @@
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
*/
/* $Id: dnssec-keygen.c,v 1.14 2000/05/05 19:55:56 gson Exp $ */
/* $Id: dnssec-keygen.c,v 1.15 2000/05/08 14:33:32 tale Exp $ */
#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/region.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/keyvalues.h>
@ -45,17 +40,17 @@ static int verbose;
int
main(int argc, char **argv) {
char *algname = NULL, *nametype = NULL, *type = NULL;
char *prog, *endp;
dst_key_t *key;
char *name = NULL;
isc_uint16_t flags = 0;
dns_secalg_t alg;
isc_mem_t *mctx = NULL;
int ch, rsa_exp = 0, generator = 0, param = 0;
int protocol = -1, size = -1, signatory = 0;
isc_textregion_t r;
isc_result_t ret;
char *algname = NULL, *nametype = NULL, *type = NULL;
char *prog, *endp;
dst_key_t *key;
char *name = NULL;
isc_uint16_t flags = 0;
dns_secalg_t alg;
isc_mem_t *mctx = NULL;
int ch, rsa_exp = 0, generator = 0, param = 0;
int protocol = -1, size = -1, signatory = 0;
isc_result_t ret;
isc_textregion_t r;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
@ -106,10 +101,12 @@ main(int argc, char **argv) {
case 'p':
protocol = strtol(isc_commandline_argument, &endp, 10);
if (*endp != '\0' || protocol < 0 || protocol > 255)
die("-p must be followed by a number [0..255]");
die("-p must be followed by "
"a number [0..255]");
break;
case 's':
signatory = strtol(isc_commandline_argument, &endp, 10);
signatory = strtol(isc_commandline_argument,
&endp, 10);
if (*endp != '\0' || signatory < 0 || signatory > 15)
die("-s must be followed by a number [0..15]");
break;
@ -284,7 +281,7 @@ die(char *str) {
static void
usage(char *prog) {
printf("Usage:\n");
printf (" %s [options] name\n\n", prog);
printf(" %s [options] name\n\n", prog);
printf("Required options:\n");
printf(" -a algorithm: RSA | RSAMD5 | DH | DSA | HMAC-MD5\n");
printf(" -b key size, in bits:\n");
@ -300,7 +297,8 @@ usage(char *prog) {
printf(" -t type: AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF\n");
printf(" default: AUTHCONF\n");
printf(" -p protocol value\n");
printf(" default: 2 (email) for User keys, 3 (dnssec) for all others\n");
printf(" default: 2 (email) for User keys, "
"3 (dnssec) for all others\n");
printf(" -s strength value this key signs DNS records with\n");
printf(" default: 0\n");
printf(" -v verbose level\n");

View File

@ -17,41 +17,22 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/types.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/stdtime.h>
#include <isc/list.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/dnssec.h>
#include <dns/keyvalues.h>
#include <dns/secalg.h>
#include <dns/nxt.h>
#include <dns/time.h>
#include <dns/log.h>
#include <dst/dst.h>
#define BUFSIZE 2048
@ -69,6 +50,7 @@ static int verbose;
static isc_mem_t *mctx = NULL;
static keylist_t keylist;
static inline void
fatal(char *message) {
fprintf(stderr, "%s\n", message);
@ -119,7 +101,8 @@ usage() {
fprintf(stderr, "\t-s YYYYMMDDHHMMSS|+offset:\n");
fprintf(stderr, "\t\tSIG start time - absolute|offset (now)\n");
fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n");
fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n");
fprintf(stderr, "\t\tSIG end time - "
"absolute|from start|from now (now + 30 days)\n");
fprintf(stderr, "\t-t ttl\n");
fprintf(stderr, "\t-v level:\n");
fprintf(stderr, "\t\tverbose level (0)\n");
@ -170,14 +153,16 @@ main(int argc, char *argv[]) {
startstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (startstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'e':
endstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (endstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 't':
@ -249,7 +234,8 @@ main(int argc, char *argv[]) {
isc_buffer_usedregion(&b, &r);
tdomain[r.length] = 0;
output = isc_mem_allocate(mctx, strlen(tdomain) + strlen("keyset") + 1);
output = isc_mem_allocate(mctx,
strlen(tdomain) + strlen("keyset") + 1);
if (output == NULL)
check_result(ISC_R_FAILURE, "isc_mem_allocate()");
strcpy(output, tdomain);
@ -344,7 +330,8 @@ main(int argc, char *argv[]) {
check_result(ISC_R_NOMEMORY, "isc_mem_get()");
isc_buffer_init(&b, data, BUFSIZE);
result = dns_dnssec_sign(domain, &rdataset, keynode->key,
&starttime, &endtime, mctx, &b, rdata);
&starttime, &endtime, mctx, &b,
rdata);
check_result(result, "dst_key_todns()");
ISC_LIST_APPEND(sigrdatalist.rdata, rdata, link);
dns_rdataset_init(&sigrdataset);
@ -366,7 +353,8 @@ main(int argc, char *argv[]) {
dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL);
if (!ISC_LIST_EMPTY(keylist))
dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0, NULL);
dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0,
NULL);
dns_db_detachnode(db, &node);
dns_db_closeversion(db, &version, ISC_TRUE);

View File

@ -17,40 +17,21 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/types.h>
#include <isc/assertions.h>
#include <isc/string.h>
#include <isc/commandline.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/stdtime.h>
#include <isc/list.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/dnssec.h>
#include <dns/keyvalues.h>
#include <dns/secalg.h>
#include <dns/time.h>
#include <dns/log.h>
#include <dst/dst.h>
#define BUFSIZE 2048
@ -68,7 +49,6 @@ static int verbose;
static isc_mem_t *mctx = NULL;
static keylist_t keylist;
static inline void
fatal(char *message) {
fprintf(stderr, "%s\n", message);

View File

@ -17,23 +17,18 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/commandline.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/nxt.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
@ -44,10 +39,8 @@
#include <dns/result.h>
#include <dns/secalg.h>
#include <dns/time.h>
#include <dns/types.h>
#include <dns/zone.h>
#include <dst/dst.h>
#include <dst/result.h>
/*#define USE_ZONESTATUS*/
@ -377,7 +370,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
setverifies(name, set, key, &oldsigrdata))
{
vbprintf(2,
"\tsig by %s/%s/%d retained\n",
"\tsig by %s/%s/%d retained\n",
nametostr(&sig.signer),
algtostr(sig.algorithm),
sig.keyid);
@ -402,7 +395,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
setverifies(name, set, key, &oldsigrdata))
{
vbprintf(2,
"\tsig by %s/%s/%d retained\n",
"\tsig by %s/%s/%d retained\n",
nametostr(&sig.signer),
algtostr(sig.algorithm),
sig.keyid);
@ -412,8 +405,8 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
}
else {
vbprintf(2,
"\tsig by %s/%s/%d dropped - ",
"%s\n",
"\tsig by %s/%s/%d "
"dropped - %s\n",
nametostr(&sig.signer),
algtostr(sig.algorithm),
sig.keyid,
@ -442,7 +435,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
allocbufferandrdata;
result = dns_rdata_fromstruct(trdata,
set->rdclass,
dns_rdatatype_sig,
dns_rdatatype_sig,
&sig, &b);
nowsignedby[sig.algorithm] = ISC_TRUE;
ISC_LIST_APPEND(siglist.rdata, trdata, link);
@ -602,8 +595,8 @@ importparentsig(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
goto failure;
dns_rdataset_init(&newset);
dns_rdataset_init(&sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0,
0, &newset, &sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key,
0, 0, &newset, &sigset);
if (result != ISC_R_SUCCESS)
goto failure;
@ -681,8 +674,8 @@ haschildkey(dns_db_t *db, dns_name_t *name) {
goto failure;
dns_rdataset_init(&set);
dns_rdataset_init(&sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0,
0, &set, &sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key,
0, 0, &set, &sigset);
if (result != ISC_R_SUCCESS)
goto failure;
@ -884,8 +877,9 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
keyrdatalist.type = dns_rdatatype_key;
keyrdatalist.covers = 0;
keyrdatalist.ttl = rdataset.ttl;
result = dns_rdatalist_tordataset(&keyrdatalist,
&keyset);
result =
dns_rdatalist_tordataset(&keyrdatalist,
&keyset);
check_result(result,
"dns_rdatalist_tordataset");
dns_db_addrdataset(db, node, version, 0,
@ -1252,7 +1246,8 @@ usage() {
fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n");
fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n");
fprintf(stderr, "\t-c ttl:\n");
fprintf(stderr, "\t\tcycle period - regenerate if < cycle from end ( (end-start)/4 )\n");
fprintf(stderr, "\t\tcycle period - regenerate "
"if < cycle from end ( (end-start)/4 )\n");
fprintf(stderr, "\t-v level:\n");
fprintf(stderr, "\t\tverbose level (0)\n");
fprintf(stderr, "\t-o origin:\n");
@ -1261,7 +1256,8 @@ usage() {
fprintf(stderr, "\t\tfile the signed zone is written in " \
"(zonefile + .signed)\n");
fprintf(stderr, "\t-a:\n");
fprintf(stderr, "\t\tverify generated signatures (if currently valid)\n");
fprintf(stderr, "\t\tverify generated signatures "
"(if currently valid)\n");
fprintf(stderr, "\n");
@ -1331,21 +1327,23 @@ main(int argc, char *argv[]) {
result = isc_mem_create(0, 0, &mctx);
check_result(result, "isc_mem_create()");
while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah")) != -1)
{
while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah"))
!= -1) {
switch (ch) {
case 's':
startstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (startstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'e':
endstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (endstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'c':
@ -1366,14 +1364,16 @@ main(int argc, char *argv[]) {
origin = isc_mem_strdup(mctx,
isc_commandline_argument);
if (origin == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'f':
output = isc_mem_strdup(mctx,
isc_commandline_argument);
if (output == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'a':
@ -1439,7 +1439,7 @@ main(int argc, char *argv[]) {
if (output == NULL) {
output = isc_mem_allocate(mctx,
strlen(file) + strlen(".signed") + 1);
strlen(file) + strlen(".signed") + 1);
if (output == NULL)
check_result(ISC_R_FAILURE, "isc_mem_allocate()");
sprintf(output, "%s.signed", file);
@ -1546,7 +1546,9 @@ main(int argc, char *argv[]) {
signzone(db, version);
/* should we update the SOA serial? */
/*
* Should we update the SOA serial?
*/
dns_db_closeversion(db, &version, ISC_TRUE);
dumpzone(zone, output);
dns_db_detach(&db);

View File

@ -17,27 +17,18 @@
#include <config.h>
#include <string.h>
#include <sys/types.h>
#include <isc/assertions.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/view.h>
#include <dns/log.h>
#include <lwres/lwres.h>
#include "client.h"
void
DP(int level, char *format, ...)
{
DP(int level, char *format, ...) {
va_list args;
va_start(args, format);
@ -48,8 +39,7 @@ DP(int level, char *format, ...)
}
void
hexdump(char *msg, void *base, size_t len)
{
hexdump(char *msg, void *base, size_t len) {
unsigned char *p;
unsigned int cnt;
char buffer[180];
@ -89,8 +79,7 @@ hexdump(char *msg, void *base, size_t len)
}
static void
clientmgr_can_die(clientmgr_t *cm)
{
clientmgr_can_die(clientmgr_t *cm) {
if ((cm->flags & CLIENTMGR_FLAG_SHUTTINGDOWN) == 0)
return;
@ -103,8 +92,7 @@ clientmgr_can_die(clientmgr_t *cm)
}
static void
process_request(client_t *client)
{
process_request(client_t *client) {
lwres_buffer_t b;
isc_result_t result;
@ -143,8 +131,7 @@ process_request(client_t *client)
}
void
client_recv(isc_task_t *task, isc_event_t *ev)
{
client_recv(isc_task_t *task, isc_event_t *ev) {
client_t *client = ev->ev_arg;
clientmgr_t *cm = client->clientmgr;
isc_socketevent_t *dev = (isc_socketevent_t *)ev;
@ -190,8 +177,7 @@ client_recv(isc_task_t *task, isc_event_t *ev)
* This function will start a new recv() on a socket for this client manager.
*/
isc_result_t
client_start_recv(clientmgr_t *cm)
{
client_start_recv(clientmgr_t *cm) {
client_t *client;
isc_result_t result;
isc_region_t r;
@ -240,8 +226,7 @@ client_start_recv(clientmgr_t *cm)
}
void
client_shutdown(isc_task_t *task, isc_event_t *ev)
{
client_shutdown(isc_task_t *task, isc_event_t *ev) {
clientmgr_t *cm = ev->ev_arg;
REQUIRE(task == cm->task);
@ -270,8 +255,7 @@ client_shutdown(isc_task_t *task, isc_event_t *ev)
* queue.
*/
void
client_state_idle(client_t *client)
{
client_state_idle(client_t *client) {
clientmgr_t *cm;
cm = client->clientmgr;
@ -293,8 +277,7 @@ client_state_idle(client_t *client)
}
void
client_send(isc_task_t *task, isc_event_t *ev)
{
client_send(isc_task_t *task, isc_event_t *ev) {
client_t *client = ev->ev_arg;
clientmgr_t *cm = client->clientmgr;
isc_socketevent_t *dev = (isc_socketevent_t *)ev;
@ -319,8 +302,7 @@ client_send(isc_task_t *task, isc_event_t *ev)
}
void
client_initialize(client_t *client, clientmgr_t *cmgr)
{
client_initialize(client_t *client, clientmgr_t *cmgr) {
client->clientmgr = cmgr;
ISC_LINK_INIT(client, link);
CLIENT_SETIDLE(client);
@ -344,8 +326,7 @@ client_initialize(client_t *client, clientmgr_t *cmgr)
}
void
client_init_aliases(client_t *client)
{
client_init_aliases(client_t *client) {
int i;
for (i = 0 ; i < LWRES_MAX_ALIASES ; i++) {
@ -361,8 +342,7 @@ client_init_aliases(client_t *client)
}
void
client_init_gabn(client_t *client)
{
client_init_gabn(client_t *client) {
/*
* Initialize the real name and alias arrays in the reply we're
* going to build up.
@ -386,8 +366,7 @@ client_init_gabn(client_t *client)
}
void
client_init_gnba(client_t *client)
{
client_init_gnba(client_t *client) {
/*
* Initialize the real name and alias arrays in the reply we're
* going to build up.

View File

@ -17,21 +17,9 @@
#include <config.h>
#include <sys/types.h>
#include <isc/assertions.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/fixedname.h>
#include <lwres/lwres.h>
#include <lwres/result.h>
#include "client.h"
/*
@ -47,8 +35,7 @@
* size we use, set the reply bit, and recompute any security information.
*/
void
error_pkt_send(client_t *client, isc_uint32_t _result)
{
error_pkt_send(client_t *client, isc_uint32_t _result) {
isc_result_t result;
int lwres;
isc_region_t r;
@ -90,7 +77,3 @@ error_pkt_send(client_t *client, isc_uint32_t _result)
CLIENT_SETSEND(client);
}

View File

@ -17,16 +17,10 @@
#include <config.h>
#include <sys/types.h>
#include <isc/app.h>
#include <isc/event.h>
#include <isc/mem.h>
#include <isc/log.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/cache.h>
@ -37,9 +31,6 @@
#include <dns/rootns.h>
#include <dns/view.h>
#include <lwres/lwres.h>
#include <lwres/result.h>
#include "client.h"
/*

View File

@ -17,22 +17,13 @@
#include <config.h>
#include <sys/types.h>
#include <isc/mem.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/fixedname.h>
#include <dns/events.h>
#include <dns/result.h>
#include <lwres/lwres.h>
#include <lwres/result.h>
#include "client.h"
#define NEED_V4(c) ((((c)->find_wanted & LWRES_ADDRTYPE_V4) != 0) \
@ -47,8 +38,7 @@ static void start_find(client_t *);
* should only be called when events are _not_ being generated by the finds.
*/
static void
cleanup_gabn(client_t *client)
{
cleanup_gabn(client_t *client) {
dns_adbfind_t *v4;
DP(50, "Cleaning up client %p", client);
@ -66,8 +56,7 @@ cleanup_gabn(client_t *client)
}
static void
setup_addresses(client_t *client, dns_adbfind_t *find, unsigned int at)
{
setup_addresses(client_t *client, dns_adbfind_t *find, unsigned int at) {
dns_adbaddrinfo_t *ai;
lwres_addr_t *addr;
int af;
@ -118,8 +107,7 @@ setup_addresses(client_t *client, dns_adbfind_t *find, unsigned int at)
}
static void
generate_reply(client_t *client)
{
generate_reply(client_t *client) {
isc_result_t result;
int lwres;
isc_region_t r;
@ -214,8 +202,7 @@ generate_reply(client_t *client)
* not having enough alias slots open is NOT a failure.
*/
static isc_result_t
add_alias(client_t *client)
{
add_alias(client_t *client) {
isc_buffer_t b;
isc_result_t result;
isc_uint16_t naliases;
@ -250,8 +237,7 @@ add_alias(client_t *client)
}
static isc_result_t
store_realname(client_t *client)
{
store_realname(client_t *client) {
isc_buffer_t b;
isc_result_t result;
@ -275,8 +261,7 @@ store_realname(client_t *client)
}
static void
process_gabn_finddone(isc_task_t *task, isc_event_t *ev)
{
process_gabn_finddone(isc_task_t *task, isc_event_t *ev) {
client_t *client = ev->ev_arg;
isc_eventtype_t evtype;
isc_boolean_t claimed;
@ -340,8 +325,7 @@ process_gabn_finddone(isc_task_t *task, isc_event_t *ev)
}
static void
start_find(client_t *client)
{
start_find(client_t *client) {
unsigned int options;
isc_result_t result;
isc_boolean_t claimed;
@ -481,8 +465,7 @@ start_find(client_t *client)
* FINDWAIT state if we need to look things up.
*/
void
process_gabn(client_t *client, lwres_buffer_t *b)
{
process_gabn(client_t *client, lwres_buffer_t *b) {
isc_result_t result;
lwres_gabnrequest_t *req;
isc_buffer_t namebuf;

View File

@ -17,32 +17,19 @@
#include <config.h>
#include <string.h>
#include <sys/types.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/stdtime.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/byaddr.h>
#include <dns/result.h>
#include <lwres/lwres.h>
#include <lwres/result.h>
#include "client.h"
static void start_byaddr(client_t *);
static void
byaddr_done(isc_task_t *task, isc_event_t *event)
{
byaddr_done(isc_task_t *task, isc_event_t *event) {
client_t *client;
clientmgr_t *cm;
dns_byaddrevent_t *bevent;
@ -175,8 +162,7 @@ byaddr_done(isc_task_t *task, isc_event_t *event)
}
static void
start_byaddr(client_t *client)
{
start_byaddr(client_t *client) {
isc_result_t result;
clientmgr_t *cm;
@ -195,8 +181,7 @@ start_byaddr(client_t *client)
}
void
process_gnba(client_t *client, lwres_buffer_t *b)
{
process_gnba(client_t *client, lwres_buffer_t *b) {
lwres_gnbarequest_t *req;
isc_result_t result;
isc_sockaddr_t sa;

View File

@ -17,26 +17,13 @@
#include <config.h>
#include <sys/types.h>
#include <isc/assertions.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/fixedname.h>
#include <lwres/lwres.h>
#include <lwres/result.h>
#include "client.h"
void
process_noop(client_t *client, lwres_buffer_t *b)
{
process_noop(client_t *client, lwres_buffer_t *b) {
lwres_nooprequest_t *req;
lwres_noopresponse_t resp;
isc_result_t result;

View File

@ -17,23 +17,20 @@
#include <config.h>
#include <isc/assertions.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/aclconf.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/types.h>
void dns_aclconfctx_init(dns_aclconfctx_t *ctx)
{
void
dns_aclconfctx_init(dns_aclconfctx_t *ctx) {
ISC_LIST_INIT(ctx->named_acl_cache);
}
void dns_aclconfctx_destroy(dns_aclconfctx_t *ctx)
{
void
dns_aclconfctx_destroy(dns_aclconfctx_t *ctx) {
dns_acl_t *dacl, *next;
for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache);
dacl != NULL;
@ -146,14 +143,16 @@ dns_acl_fromconfig(dns_c_ipmatchlist_t *caml,
case dns_c_ipmatch_key:
de->type = dns_aclelementtype_keyname;
dns_name_init(&de->u.keyname, NULL);
result = convert_keyname(ce->u.key, mctx, &de->u.keyname);
result = convert_keyname(ce->u.key, mctx,
&de->u.keyname);
if (result != ISC_R_SUCCESS)
goto cleanup;
break;
case dns_c_ipmatch_indirect:
de->type = dns_aclelementtype_nestedacl;
result = dns_acl_fromconfig(ce->u.indirect.list, cctx,
ctx, mctx, &de->u.nestedacl);
result = dns_acl_fromconfig(ce->u.indirect.list,
cctx, ctx, mctx,
&de->u.nestedacl);
if (result != ISC_R_SUCCESS)
goto cleanup;
break;
@ -170,8 +169,9 @@ dns_acl_fromconfig(dns_c_ipmatchlist_t *caml,
break;
case dns_c_ipmatch_acl:
de->type = dns_aclelementtype_nestedacl;
result = convert_named_acl(ce->u.aclname, cctx,
ctx, mctx, &de->u.nestedacl);
result = convert_named_acl(ce->u.aclname,
cctx, ctx, mctx,
&de->u.nestedacl);
if (result != ISC_R_SUCCESS)
goto cleanup;
break;

View File

@ -17,19 +17,12 @@
#include <config.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/result.h>
#include <isc/task.h>
#include <isc/print.h>
#include <isc/task.h>
#include <isc/string.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/message.h>
@ -39,12 +32,9 @@
#include <dns/view.h>
#include <dns/zone.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/interfacemgr.h>
#include <named/log.h>
#include <named/notify.h>
#include <named/query.h>
#include <named/server.h>
#include <named/update.h>

View File

@ -20,12 +20,10 @@
#include <isc/lang.h>
#include <dns/acl.h>
#include <dns/confacl.h>
#include <dns/confctx.h>
#include <dns/confip.h>
#include <dns/types.h>
typedef struct {
typedef struct dns_aclconfctx {
ISC_LIST(dns_acl_t) named_acl_cache;
} dns_aclconfctx_t;

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_CLIENT_H
#define NS_CLIENT_H 1
#ifndef NAMED_CLIENT_H
#define NAMED_CLIENT_H 1
/*****
***** Module Info
@ -60,9 +60,8 @@
*** Imports
***/
#include <isc/types.h>
#include <isc/stdtime.h>
#include <isc/buffer.h>
#include <isc/stdtime.h>
#include <isc/quota.h>
#include <dns/name.h>
@ -79,55 +78,56 @@
typedef ISC_LIST(ns_client_t) client_list_t;
struct ns_client {
unsigned int magic;
isc_mem_t * mctx;
ns_clientmgr_t * manager;
int state;
int newstate;
isc_boolean_t disconnect;
int naccepts;
int nreads;
int nsends;
int references;
unsigned int attributes;
isc_task_t * task;
dns_view_t * view;
dns_view_t * lockview;
dns_dispatch_t * dispatch;
dns_dispentry_t * dispentry;
dns_dispatchevent_t * dispevent;
isc_socket_t * tcplistener;
isc_socket_t * tcpsocket;
dns_tcpmsg_t tcpmsg;
isc_boolean_t tcpmsg_valid;
isc_timer_t * timer;
dns_message_t * message;
unsigned char * sendbuf;
dns_rdataset_t * opt;
isc_uint16_t udpsize;
void (*next)(ns_client_t *);
void (*shutdown)(void *arg, isc_result_t result);
void *shutdown_arg;
ns_query_t query;
isc_stdtime_t requesttime;
isc_stdtime_t now;
dns_name_t signername; /* [T]SIG key name */
dns_name_t * signer; /* NULL if not valid sig */
isc_boolean_t mortal; /* Die after handling request. */
isc_quota_t *tcpquota;
isc_quota_t *recursionquota;
ns_interface_t *interface;
isc_sockaddr_t peeraddr;
isc_boolean_t peeraddr_valid;
struct in6_pktinfo pktinfo;
ISC_LINK(ns_client_t) link;
client_list_t *list; /* The list 'link' is part of,
or NULL if not on any list. */
unsigned int magic;
isc_mem_t * mctx;
ns_clientmgr_t * manager;
int state;
int newstate;
isc_boolean_t disconnect;
int naccepts;
int nreads;
int nsends;
int references;
unsigned int attributes;
isc_task_t * task;
dns_view_t * view;
dns_view_t * lockview;
dns_dispatch_t * dispatch;
dns_dispentry_t * dispentry;
dns_dispatchevent_t * dispevent;
isc_socket_t * tcplistener;
isc_socket_t * tcpsocket;
dns_tcpmsg_t tcpmsg;
isc_boolean_t tcpmsg_valid;
isc_timer_t * timer;
dns_message_t * message;
unsigned char * sendbuf;
dns_rdataset_t * opt;
isc_uint16_t udpsize;
void (*next)(ns_client_t *);
void (*shutdown)(void *arg, isc_result_t result);
void *shutdown_arg;
ns_query_t query;
isc_stdtime_t requesttime;
isc_stdtime_t now;
dns_name_t signername; /* [T]SIG key name */
dns_name_t * signer; /* NULL if not valid sig */
isc_boolean_t mortal; /* Die after handling request */
isc_quota_t *tcpquota;
isc_quota_t *recursionquota;
ns_interface_t *interface;
isc_sockaddr_t peeraddr;
isc_boolean_t peeraddr_valid;
struct in6_pktinfo pktinfo;
ISC_LINK(ns_client_t) link;
/*
* The list 'link' is part of, or NULL if not on any list.
*/
client_list_t *list;
};
#define NS_CLIENT_MAGIC 0x4E534363U /* NSCc */
#define NS_CLIENT_VALID(c) ((c) != NULL && \
(c)->magic == NS_CLIENT_MAGIC)
#define NS_CLIENT_VALID(c) ISC_MAGIC_VALID(c, NS_CLIENT_MAGIC)
#define NS_CLIENTATTR_TCP 0x01
#define NS_CLIENTATTR_RA 0x02 /* Client gets recusive service */
@ -255,4 +255,4 @@ ns_client_log(ns_client_t *client, isc_logcategory_t *category,
isc_logmodule_t *module, int level,
const char *fmt, ...);
#endif /* NS_CLIENT_H */
#endif /* NAMED_CLIENT_H */

View File

@ -15,16 +15,13 @@
* SOFTWARE.
*/
#ifndef NS_GLOBALS_H
#define NS_GLOBALS_H 1
#ifndef NAMED_GLOBALS_H
#define NAMED_GLOBALS_H 1
#include <isc/types.h>
#include <isc/rwlock.h>
#include <isc/log.h>
#include <isc/net.h>
#include <dns/types.h>
#include <omapi/types.h>
#include <named/types.h>
@ -89,4 +86,4 @@ EXTERN const char * ns_g_cachefile INIT(NULL);
#undef EXTERN
#undef INIT
#endif /* NS_GLOBALS_H */
#endif /* NAMED_GLOBALS_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_INTERFACEMGR_H
#define NS_INTERFACEMGR_H 1
#ifndef NAMED_INTERFACEMGR_H
#define NAMED_INTERFACEMGR_H 1
/*****
***** Module Info
@ -47,8 +47,7 @@
*** Imports
***/
#include <isc/types.h>
#include <isc/result.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/socket.h>
@ -62,7 +61,7 @@
***/
#define IFACE_MAGIC 0x493A2D29U /* I:-). */
#define NS_INTERFACE_VALID(t) ((t) != NULL && (t)->magic == IFACE_MAGIC)
#define NS_INTERFACE_VALID(t) ISC_MAGIC_VALID(t, IFACE_MAGIC)
struct ns_interface {
unsigned int magic; /* Magic number. */
@ -86,15 +85,13 @@ struct ns_interface {
*** Functions
***/
isc_result_t
ns_interfacemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
isc_socketmgr_t *socketmgr, ns_clientmgr_t *clientmgr,
ns_interfacemgr_t **mgrp);
void
ns_interfacemgr_attach(ns_interfacemgr_t *source,
ns_interfacemgr_t **target);
ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target);
void
ns_interfacemgr_detach(ns_interfacemgr_t **targetp);
@ -115,8 +112,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr);
*/
void
ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr,
ns_listenlist_t *value);
ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, ns_listenlist_t *value);
/*
* Set the "listen-on" list of 'mgr' to 'value'.
* The previous listen-on list is freed.
@ -134,10 +130,9 @@ dns_aclenv_t *
ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr);
void
ns_interface_attach(ns_interface_t *source,
ns_interface_t **target);
ns_interface_attach(ns_interface_t *source, ns_interface_t **target);
void
ns_interface_detach(ns_interface_t **targetp);
#endif /* NS_INTERFACEMGR_H */
#endif /* NAMED_INTERFACEMGR_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_LISTENLIST_H
#define NS_LISTENLIST_H 1
#ifndef NAMED_LISTENLIST_H
#define NAMED_LISTENLIST_H 1
/*****
***** Module Info
@ -29,6 +29,7 @@
/***
*** Imports
***/
#include <isc/net.h>
#include <dns/types.h>
@ -80,6 +81,6 @@ ns_listenlist_default(isc_mem_t *mctx, in_port_t port,
* all addresses with port 'port'.
*/
#endif /* NS_LISTENLIST_H */
#endif /* NAMED_LISTENLIST_H */

View File

@ -15,22 +15,24 @@
* SOFTWARE.
*/
#ifndef NS_LOG_H
#define NS_LOG_H 1
#ifndef NAMED_LOG_H
#define NAMED_LOG_H 1
#include <isc/types.h>
#include <isc/log.h>
#include <isc/types.h>
#include <dns/log.h>
#include <named/globals.h>
#include <named/globals.h> /* Required for ns_g_(categories|modules). */
/* Unused slot */
/* Unused slot 0. */
#define NS_LOGCATEGORY_CLIENT (&ns_g_categories[1])
#define NS_LOGCATEGORY_NETWORK (&ns_g_categories[2])
#define NS_LOGCATEGORY_UPDATE (&ns_g_categories[3])
/* Backwards compatibility. */
/*
* Backwards compatibility.
*/
#define NS_LOGCATEGORY_GENERAL ISC_LOGCATEGORY_GENERAL
#define NS_LOGMODULE_MAIN (&ns_g_modules[0])
@ -67,8 +69,7 @@ ns_log_setdefaultchannels(isc_logconfig_t *lcfg);
isc_result_t
ns_log_setsafechannels(isc_logconfig_t *lcfg);
/*
* Like ns_log_setdefaultchannels(), but omits any logging
* to files.
* Like ns_log_setdefaultchannels(), but omits any logging to files.
*/
isc_result_t
@ -80,4 +81,4 @@ ns_log_setdefaultcategory(isc_logconfig_t *lcfg);
void
ns_log_shutdown(void);
#endif /* NS_LOG_H */
#endif /* NAMED_LOG_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_LOGCONF_H
#define NS_LOGCONF_H 1
#ifndef NAMED_LOGCONF_H
#define NAMED_LOGCONF_H 1
#include <isc/log.h>
@ -29,4 +29,4 @@ ns_log_configure(isc_logconfig_t *logconf, dns_c_logginglist_t *clog);
* the named.conf data in 'clog'.
*/
#endif /* NS_LOGCONF_H */
#endif /* NAMED_LOGCONF_H */

View File

@ -15,10 +15,10 @@
* SOFTWARE.
*/
#ifndef NS_MAIN_H
#define NS_MAIN_H 1
#ifndef NAMED_MAIN_H
#define NAMED_MAIN_H 1
void
ns_main_earlyfatal(const char *format, ...);
#endif /* NS_MAIN_H */
#endif /* NAMED_MAIN_H */

View File

@ -48,4 +48,5 @@ ns_notify_start(ns_client_t *client);
* client to be valid.
*/
#endif
#endif /* NAMED_NOTIFY_H */

View File

@ -15,6 +15,9 @@
* SOFTWARE.
*/
#ifndef NAMED_OMAPI_H
#define NAMED_OMAPI_H 1
#include <omapi/omapi.h>
#define NS_OMAPI_PORT 953
@ -34,3 +37,4 @@ ns_omapi_init(void);
isc_result_t
ns_omapi_listen(omapi_object_t **managerp);
#endif /* NAMED_OMAPI_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_QUERY_H
#define NS_QUERY_H 1
#ifndef NAMED_QUERY_H
#define NAMED_QUERY_H 1
#include <isc/types.h>
#include <isc/buffer.h>
@ -66,4 +66,4 @@ ns_query_free(ns_client_t *client);
void
ns_query_start(ns_client_t *client);
#endif /* NS_QUERY_H */
#endif /* NAMED_QUERY_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_SERVER_H
#define NS_SERVER_H 1
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
#include <isc/log.h>
#include <isc/sockaddr.h>
@ -94,4 +94,4 @@ ns_server_reloadwanted(ns_server_t *server);
*/
#endif /* NS_SERVER_H */
#endif /* NAMED_SERVER_H */

View File

@ -21,13 +21,13 @@
#include <isc/types.h>
#include <isc/lang.h>
#include <dns/tkey.h>
#include <dns/confctx.h>
ISC_LANG_BEGINDECLS
isc_result_t
dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx, dns_tkey_ctx_t **tctxp);
dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx,
dns_tkey_ctx_t **tctxp);
/*
* Create a TKEY context and configure it, including the default DH key
* and default domain, according to 'cfg'.

View File

@ -21,7 +21,6 @@
#include <isc/types.h>
#include <isc/lang.h>
#include <dns/tsig.h>
#include <dns/confctx.h>
ISC_LANG_BEGINDECLS

View File

@ -15,10 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_TYPES_H
#define NS_TYPES_H 1
#include <isc/list.h>
#ifndef NAMED_TYPES_H
#define NAMED_TYPES_H 1
#include <dns/types.h>
@ -29,4 +27,4 @@ typedef struct ns_server ns_server_t;
typedef struct ns_interface ns_interface_t;
typedef struct ns_interfacemgr ns_interfacemgr_t;
#endif /* NS_TYPES_H */
#endif /* NAMED_TYPES_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_UPDATE_H
#define NS_UPDATE_H 1
#ifndef NAMED_UPDATE_H
#define NAMED_UPDATE_H 1
/*****
***** Module Info
@ -30,7 +30,6 @@
*** Imports
***/
#include <isc/types.h>
#include <dns/types.h>
#include <dns/result.h>
@ -42,6 +41,7 @@
*** Functions
***/
void ns_update_start(ns_client_t *client);
void
ns_update_start(ns_client_t *client);
#endif /* NS_UPDATE_H */
#endif /* NAMED_UPDATE_H */

View File

@ -15,8 +15,8 @@
* SOFTWARE.
*/
#ifndef NS_XFROUT_H
#define NS_XFROUT_H 1
#ifndef NAMED_XFROUT_H
#define NAMED_XFROUT_H 1
/*****
***** Module Info
@ -30,6 +30,7 @@
*** Functions
***/
void ns_xfr_start(ns_client_t *client, dns_rdatatype_t xfrtype);
void
ns_xfr_start(ns_client_t *client, dns_rdatatype_t xfrtype);
#endif /* NS_XFROUT_H */
#endif /* NAMED_XFROUT_H */

View File

@ -18,19 +18,16 @@
#ifndef DNS_ZONECONF_H
#define DNS_ZONECONF_H 1
#include <isc/log.h>
#include <isc/lang.h>
#include <isc/types.h>
#include <dns/acl.h>
#include <dns/aclconf.h>
#include <dns/confctx.h>
#include <dns/confacl.h>
#include <dns/confip.h>
#include <dns/confzone.h>
isc_result_t dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
dns_c_zone_t *czone, dns_aclconfctx_t *ac,
dns_zone_t *zone);
ISC_LANG_BEGINDECLS
isc_result_t
dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview, dns_c_zone_t *czone,
dns_aclconfctx_t *ac, dns_zone_t *zone);
/*
* Configure or reconfigure a zone according to the named.conf
* data in 'cctx' and 'czone'.

View File

@ -17,34 +17,20 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/interfaceiter.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/result.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/dispatch.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/listenlist.h>
#include <named/log.h>
#include <named/interfacemgr.h>
#define IFMGR_MAGIC 0x49464D47U /* IFMG. */
#define NS_INTERFACEMGR_VALID(t) ((t) != NULL && (t)->magic == IFMGR_MAGIC)
#define NS_INTERFACEMGR_VALID(t) ISC_MAGIC_VALID(t, IFMGR_MAGIC)
#define IFMGR_COMMON_LOGARGS \
ns_g_lctx, NS_LOGCATEGORY_NETWORK, NS_LOGMODULE_INTERFACEMGR
@ -63,7 +49,8 @@ struct ns_interfacemgr {
ISC_LIST(ns_interface_t) interfaces; /* List of interfaces. */
};
static void purge_old_interfaces(ns_interfacemgr_t *mgr);
static void
purge_old_interfaces(ns_interfacemgr_t *mgr);
/*
* Format a human-readable representation of the socket address '*sa'
@ -71,8 +58,7 @@ static void purge_old_interfaces(ns_interfacemgr_t *mgr);
* The resulting string is guaranteed to be null-terminated.
*/
static void
sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size)
{
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);
@ -133,8 +119,7 @@ ns_interfacemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
}
static void
ns_interfacemgr_destroy(ns_interfacemgr_t *mgr)
{
ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) {
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
dns_aclenv_destroy(&mgr->aclenv);
ns_listenlist_detach(&mgr->listenon);
@ -144,15 +129,12 @@ ns_interfacemgr_destroy(ns_interfacemgr_t *mgr)
}
dns_aclenv_t *
ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr)
{
ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr) {
return (&mgr->aclenv);
}
void
ns_interfacemgr_attach(ns_interfacemgr_t *source,
ns_interfacemgr_t **target)
{
ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target) {
REQUIRE(NS_INTERFACEMGR_VALID(source));
LOCK(&source->lock);
INSIST(source->references > 0);
@ -162,8 +144,7 @@ ns_interfacemgr_attach(ns_interfacemgr_t *source,
}
void
ns_interfacemgr_detach(ns_interfacemgr_t **targetp)
{
ns_interfacemgr_detach(ns_interfacemgr_t **targetp) {
isc_result_t need_destroy = ISC_FALSE;
ns_interfacemgr_t *target = *targetp;
REQUIRE(target != NULL);
@ -180,8 +161,7 @@ ns_interfacemgr_detach(ns_interfacemgr_t **targetp)
}
void
ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr)
{
ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr) {
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
LOCK(&mgr->lock);
@ -385,10 +365,10 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
result = ns_interface_accepttcp(ifp);
if (result != ISC_R_SUCCESS) {
/*
* XXXRTH We don't currently have a way to easily stop dispatch
* service, so we return currently return ISC_R_SUCCESS (the UDP
* stuff will work even if TCP creation failed). This will be fixed
* later.
* XXXRTH We don't currently have a way to easily stop dispatch
* service, so we return currently return ISC_R_SUCCESS (the
* UDP stuff will work even if TCP creation failed). This will
* be fixed later.
*/
result = ISC_R_SUCCESS;
}
@ -427,9 +407,7 @@ ns_interface_destroy(ns_interface_t *ifp) {
}
void
ns_interface_attach(ns_interface_t *source,
ns_interface_t **target)
{
ns_interface_attach(ns_interface_t *source, ns_interface_t **target) {
REQUIRE(NS_INTERFACE_VALID(source));
LOCK(&source->lock);
INSIST(source->references > 0);
@ -439,8 +417,7 @@ ns_interface_attach(ns_interface_t *source,
}
void
ns_interface_detach(ns_interface_t **targetp)
{
ns_interface_detach(ns_interface_t **targetp) {
isc_result_t need_destroy = ISC_FALSE;
ns_interface_t *target = *targetp;
REQUIRE(target != NULL);
@ -693,9 +670,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr) {
}
void
ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr,
ns_listenlist_t *value)
{
ns_interfacemgr_setlistenon(ns_interfacemgr_t *mgr, ns_listenlist_t *value) {
LOCK(&mgr->lock);
ns_listenlist_detach(&mgr->listenon);
ns_listenlist_attach(value, &mgr->listenon);

View File

@ -17,16 +17,15 @@
#include <config.h>
#include <isc/assertions.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <named/listenlist.h>
static void destroy(ns_listenlist_t *list);
static void
destroy(ns_listenlist_t *list);
isc_result_t
ns_listenelt_create(isc_mem_t *mctx, in_port_t port,
@ -80,16 +79,14 @@ destroy(ns_listenlist_t *list) {
}
void
ns_listenlist_attach(ns_listenlist_t *source, ns_listenlist_t **target)
{
ns_listenlist_attach(ns_listenlist_t *source, ns_listenlist_t **target) {
INSIST(source->refcount > 0);
source->refcount++;
*target = source;
}
void
ns_listenlist_detach(ns_listenlist_t **listp)
{
ns_listenlist_detach(ns_listenlist_t **listp) {
ns_listenlist_t *list = *listp;
INSIST(list->refcount > 0);
list->refcount--;

View File

@ -17,13 +17,6 @@
#include <config.h>
#include <isc/assertions.h>
#include <isc/log.h>
#include <isc/result.h>
#include <dns/log.h>
#include <named/globals.h>
#include <named/log.h>
/*

View File

@ -17,9 +17,6 @@
#include <config.h>
#include <isc/result.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/logconf.h>

View File

@ -17,31 +17,23 @@
#include <config.h>
#include <errno.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stddef.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/commandline.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/dbtable.h>
#include <dns/tsig.h>
#include <dns/tkey.h>
#include <dns/result.h>
#include <dst/result.h>
#define NS_MAIN 1
/*
* Defining NS_MAIN provides storage declaratons (rather than extern)
* for variables in named/globals.h.
*/
#define NS_MAIN 1
#include <named/globals.h>
#include <named/globals.h> /* Explicit, though named/log.h includes it. */
#include <named/interfacemgr.h>
#include <named/log.h>
#include <named/omapi.h>

View File

@ -17,40 +17,13 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/taskpool.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dbtable.h>
#include <dns/dnssec.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/nxt.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/result.h>
#include <dns/types.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zt.h>
#include <named/globals.h>
#include <named/client.h>
#include <named/log.h>
#include <named/notify.h>

View File

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: omapi.c,v 1.12 2000/04/28 02:07:57 tale Exp $ */
/* $Id: omapi.c,v 1.13 2000/05/08 14:32:57 tale Exp $ */
/*
* Principal Author: DCL
@ -23,14 +23,9 @@
#include <config.h>
#include <stdlib.h>
#include <stdarg.h>
#include <isc/assertions.h>
#include <isc/event.h>
#include <isc/util.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/omapi.h>
#include <named/server.h>

View File

@ -17,24 +17,12 @@
#include <config.h>
#include <isc/buffer.h>
#include <isc/event.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/a6.h>
#include <dns/acl.h>
#include <dns/db.h>
#include <dns/dbtable.h>
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
@ -48,9 +36,7 @@
#include <dns/zt.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/query.h>
#include <named/server.h>
#include <named/xfrout.h>

View File

@ -17,64 +17,39 @@
#include <config.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/base64.h>
#include <isc/dir.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/rwlock.h>
#include <isc/socket.h>
#include <isc/lex.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/aclconf.h>
#include <dns/cache.h>
#include <dns/confacl.h>
#include <dns/confctx.h>
#include <dns/confip.h>
#include <dns/confparser.h>
#include <dns/db.h>
#include <dns/dispatch.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/keytable.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/peer.h>
#include <dns/rdatastruct.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/rootns.h>
#include <dns/tkey.h>
#include <dns/tkeyconf.h>
#include <dns/tsigconf.h>
#include <dns/types.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zoneconf.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/interfacemgr.h>
#include <named/listenlist.h>
#include <named/log.h>
#include <named/logconf.h>
#include <named/os.h>
#include <named/server.h>
#include <named/types.h>
/*
* Check an operation for failure. Assumes that the function
@ -261,7 +236,8 @@ configure_view_dnsseckeys(dns_c_ctx_t *cctx,
keystruct.datalen = r.length;
keystruct.data = r.base;
CHECK(dns_rdata_fromstruct(NULL, keystruct.common.rdclass,
CHECK(dns_rdata_fromstruct(NULL,
keystruct.common.rdclass,
keystruct.common.rdtype,
&keystruct, &rrdatabuf));
CHECK(dst_key_fromdns(ckey->domain, &rrdatabuf, mctx,
@ -351,7 +327,8 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = ISC_R_NOTFOUND;
if (cview != NULL)
result = dns_c_view_getcleaninterval(cview, &cleaning_interval);
result = dns_c_view_getcleaninterval(cview,
&cleaning_interval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getcleaninterval(cctx, &cleaning_interval);
if (result != ISC_R_SUCCESS)
@ -410,7 +387,7 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
* elminated.
*/
if ((cview != NULL &&
dns_c_view_getforward(cview, &forward) == ISC_R_SUCCESS) ||
dns_c_view_getforward(cview, &forward) == ISC_R_SUCCESS) ||
(dns_c_ctx_getforward(cctx, &forward) == ISC_R_SUCCESS)) {
INSIST(forward == dns_c_forw_first ||
forward == dns_c_forw_only);

View File

@ -17,13 +17,12 @@
#include <config.h>
#include <isc/base64.h>
#include <isc/lex.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <dns/confctx.h>
#include <dns/confkeys.h>
#include <dns/keyvalues.h>
#include <dns/name.h>
#include <dns/tkey.h>
#include <dns/tkeyconf.h>
#define RETERR(x) do { \

View File

@ -18,12 +18,12 @@
#include <config.h>
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/lex.h>
#include <isc/stdtime.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <dns/confctx.h>
#include <dns/confkeys.h>
#include <dns/name.h>
#include <dns/tsig.h>
#include <dns/tsigconf.h>
static isc_result_t
@ -49,7 +49,9 @@ add_initial_keys(dns_c_kdeflist_t *list, dns_tsig_keyring_t *ring,
dns_name_init(&keyname, NULL);
dns_name_init(&alg, NULL);
/* Create the key name */
/*
* Create the key name.
*/
isc_buffer_init(&keynamesrc, key->keyid, strlen(key->keyid));
isc_buffer_add(&keynamesrc, strlen(key->keyid));
isc_buffer_init(&keynamebuf, keynamedata, sizeof(keynamedata));
@ -58,7 +60,9 @@ add_initial_keys(dns_c_kdeflist_t *list, dns_tsig_keyring_t *ring,
if (ret != ISC_R_SUCCESS)
goto failure;
/* Create the algorithm */
/*
* Create the algorithm.
*/
if (strcasecmp(key->algorithm, "hmac-md5") == 0)
alg = *dns_tsig_hmacmd5_name;
else {

View File

@ -17,22 +17,18 @@
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
#include <isc/result.h>
#include <isc/boolean.h>
#include <isc/string.h>
#include <named/main.h>
#include <named/os.h>
@ -53,11 +49,11 @@ static isc_boolean_t non_root_caps = ISC_FALSE;
*/
#define _LINUX_FS_H
#include <sys/syscall.h>
#include <linux/capability.h>
#include <sys/syscall.h> /* Required for syscall(). */
#include <linux/capability.h> /* Required for _LINUX_CAPABILITY_VERSION. */
#ifdef HAVE_LINUX_PRCTL_H
#include <sys/prctl.h>
#include <sys/prctl.h> /* Required for prctl(). */
#endif
#ifndef SYS_capset

View File

@ -17,45 +17,25 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/taskpool.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dbtable.h>
#include <dns/dnssec.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/nxt.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/result.h>
#include <dns/ssu.h>
#include <dns/types.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zt.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/server.h>
#include <named/update.h>
/*

View File

@ -15,45 +15,29 @@
* SOFTWARE.
*/
/* $Id: xfrout.c,v 1.59 2000/04/27 00:00:40 tale Exp $ */
/* $Id: xfrout.c,v 1.60 2000/05/08 14:33:01 tale Exp $ */
#include <config.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/print.h>
#include <isc/timer.h>
#include <isc/print.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/journal.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/peer.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/result.h>
#include <dns/types.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zt.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/server.h>
#include <named/xfrout.h>
@ -115,17 +99,22 @@ struct db_rr_iterator {
dns_rdata_t rdata;
};
isc_result_t db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db,
dns_dbversion_t *ver, isc_stdtime_t now);
isc_result_t
db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, dns_dbversion_t *ver,
isc_stdtime_t now);
isc_result_t db_rr_iterator_first(db_rr_iterator_t *it);
isc_result_t
db_rr_iterator_first(db_rr_iterator_t *it);
isc_result_t db_rr_iterator_next(db_rr_iterator_t *it);
isc_result_t
db_rr_iterator_next(db_rr_iterator_t *it);
void db_rr_iterator_current(db_rr_iterator_t *it, dns_name_t **name,
isc_uint32_t *ttl, dns_rdata_t **rdata);
void
db_rr_iterator_current(db_rr_iterator_t *it, dns_name_t **name,
isc_uint32_t *ttl, dns_rdata_t **rdata);
void db_rr_iterator_destroy(db_rr_iterator_t *it);
void
db_rr_iterator_destroy(db_rr_iterator_t *it);
isc_result_t
db_rr_iterator_init(db_rr_iterator_t *it, dns_db_t *db, dns_dbversion_t *ver,
@ -326,7 +315,9 @@ typedef struct ixfr_rrstream {
} ixfr_rrstream_t;
/* Forward declarations. */
static void ixfr_rrstream_destroy(rrstream_t **sp);
static void
ixfr_rrstream_destroy(rrstream_t **sp);
static rrstream_methods_t ixfr_rrstream_methods;
/*
@ -366,20 +357,17 @@ ixfr_rrstream_create(isc_mem_t *mctx,
}
static isc_result_t
ixfr_rrstream_first(rrstream_t *rs)
{
ixfr_rrstream_first(rrstream_t *rs) {
ixfr_rrstream_t *s = (ixfr_rrstream_t *) rs;
return (dns_journal_first_rr(s->journal));
}
static isc_result_t
ixfr_rrstream_next(rrstream_t *rs)
{
ixfr_rrstream_next(rrstream_t *rs) {
ixfr_rrstream_t *s = (ixfr_rrstream_t *) rs;
return (dns_journal_next_rr(s->journal));
}
static void
ixfr_rrstream_current(rrstream_t *rs,
dns_name_t **name, isc_uint32_t *ttl,
@ -397,8 +385,7 @@ ixfr_rrstream_destroy(rrstream_t **rsp) {
isc_mem_put(s->common.mctx, s, sizeof(*s));
}
static rrstream_methods_t ixfr_rrstream_methods =
{
static rrstream_methods_t ixfr_rrstream_methods = {
ixfr_rrstream_first,
ixfr_rrstream_next,
ixfr_rrstream_current,
@ -421,15 +408,17 @@ typedef struct axfr_rrstream {
isc_boolean_t it_valid;
} axfr_rrstream_t;
/* Forward declarations. */
static void axfr_rrstream_destroy(rrstream_t **rsp);
/*
* Forward declarations.
*/
static void
axfr_rrstream_destroy(rrstream_t **rsp);
static rrstream_methods_t axfr_rrstream_methods;
static isc_result_t
axfr_rrstream_create(isc_mem_t *mctx,
dns_db_t *db,
dns_dbversion_t *ver,
rrstream_t **sp)
axfr_rrstream_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *ver,
rrstream_t **sp)
{
axfr_rrstream_t *s;
isc_result_t result;
@ -455,8 +444,7 @@ axfr_rrstream_create(isc_mem_t *mctx,
}
static isc_result_t
axfr_rrstream_first(rrstream_t *rs)
{
axfr_rrstream_first(rrstream_t *rs) {
axfr_rrstream_t *s = (axfr_rrstream_t *) rs;
isc_result_t result;
result = db_rr_iterator_first(&s->it);
@ -479,8 +467,7 @@ axfr_rrstream_first(rrstream_t *rs)
}
static isc_result_t
axfr_rrstream_next(rrstream_t *rs)
{
axfr_rrstream_next(rrstream_t *rs) {
axfr_rrstream_t *s = (axfr_rrstream_t *) rs;
isc_result_t result;
@ -501,9 +488,8 @@ axfr_rrstream_next(rrstream_t *rs)
}
static void
axfr_rrstream_current(rrstream_t *rs,
dns_name_t **name, isc_uint32_t *ttl,
dns_rdata_t **rdata)
axfr_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl,
dns_rdata_t **rdata)
{
axfr_rrstream_t *s = (axfr_rrstream_t *) rs;
db_rr_iterator_current(&s->it, name, ttl, rdata);
@ -517,8 +503,7 @@ axfr_rrstream_destroy(rrstream_t **rsp) {
isc_mem_put(s->common.mctx, s, sizeof(*s));
}
static rrstream_methods_t axfr_rrstream_methods =
{
static rrstream_methods_t axfr_rrstream_methods = {
axfr_rrstream_first,
axfr_rrstream_next,
axfr_rrstream_current,
@ -536,14 +521,16 @@ typedef struct soa_rrstream {
dns_difftuple_t *soa_tuple;
} soa_rrstream_t;
/* Forward declarations. */
static void soa_rrstream_destroy(rrstream_t **rsp);
/*
* Forward declarations.
*/
static void
soa_rrstream_destroy(rrstream_t **rsp);
static rrstream_methods_t soa_rrstream_methods;
static isc_result_t
soa_rrstream_create(isc_mem_t *mctx,
dns_db_t *db,
dns_dbversion_t *ver,
soa_rrstream_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *ver,
rrstream_t **sp)
{
soa_rrstream_t *s;
@ -582,8 +569,7 @@ soa_rrstream_next(rrstream_t *rs) {
}
static void
soa_rrstream_current(rrstream_t *rs,
dns_name_t **name, isc_uint32_t *ttl,
soa_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl,
dns_rdata_t **rdata)
{
soa_rrstream_t *s = (soa_rrstream_t *) rs;
@ -600,8 +586,7 @@ soa_rrstream_destroy(rrstream_t **rsp) {
isc_mem_put(s->common.mctx, s, sizeof(*s));
}
static rrstream_methods_t soa_rrstream_methods =
{
static rrstream_methods_t soa_rrstream_methods = {
soa_rrstream_first,
soa_rrstream_next,
soa_rrstream_current,
@ -626,9 +611,15 @@ typedef struct compound_rrstream {
isc_result_t result;
} compound_rrstream_t;
/* Forward declarations. */
static void compound_rrstream_destroy(rrstream_t **rsp);
static isc_result_t compound_rrstream_next(rrstream_t *rs);
/*
* Forward declarations.
*/
static void
compound_rrstream_destroy(rrstream_t **rsp);
static isc_result_t
compound_rrstream_next(rrstream_t *rs);
static rrstream_methods_t compound_rrstream_methods;
/*
@ -645,10 +636,8 @@ static rrstream_methods_t compound_rrstream_methods;
* when the compound_rrstream_t is destroyed.
*/
static isc_result_t
compound_rrstream_create(isc_mem_t *mctx,
rrstream_t **soa_stream,
rrstream_t **data_stream,
rrstream_t **sp)
compound_rrstream_create(isc_mem_t *mctx, rrstream_t **soa_stream,
rrstream_t **data_stream, rrstream_t **sp)
{
compound_rrstream_t *s;
@ -698,9 +687,8 @@ compound_rrstream_next(rrstream_t *rs) {
}
static void
compound_rrstream_current(rrstream_t *rs,
dns_name_t **name, isc_uint32_t *ttl,
dns_rdata_t **rdata)
compound_rrstream_current(rrstream_t *rs, dns_name_t **name, isc_uint32_t *ttl,
dns_rdata_t **rdata)
{
compound_rrstream_t *s = (compound_rrstream_t *) rs;
rrstream_t *curstream;
@ -719,8 +707,7 @@ compound_rrstream_destroy(rrstream_t **rsp) {
isc_mem_put(s->common.mctx, s, sizeof(*s));
}
static rrstream_methods_t compound_rrstream_methods =
{
static rrstream_methods_t compound_rrstream_methods = {
compound_rrstream_first,
compound_rrstream_next,
compound_rrstream_current,
@ -769,23 +756,35 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client,
isc_boolean_t many_answers,
xfrout_ctx_t **xfrp);
static void sendstream(xfrout_ctx_t *xfr);
static void
sendstream(xfrout_ctx_t *xfr);
static void xfrout_senddone(isc_task_t *task, isc_event_t *event);
static void xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg);
static void xfrout_maybe_destroy(xfrout_ctx_t *xfr);
static void xfrout_ctx_destroy(xfrout_ctx_t **xfrp);
static void xfrout_client_shutdown(void *arg, isc_result_t result);
static void xfrout_log1(ns_client_t *client, dns_name_t *zonename,
int level, const char *fmt, ...);
static void xfrout_log(xfrout_ctx_t *xfr, unsigned int level,
const char *fmt, ...);
static void
xfrout_senddone(isc_task_t *task, isc_event_t *event);
static void
xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg);
static void
xfrout_maybe_destroy(xfrout_ctx_t *xfr);
static void
xfrout_ctx_destroy(xfrout_ctx_t **xfrp);
static void
xfrout_client_shutdown(void *arg, isc_result_t result);
static void
xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level,
const char *fmt, ...);
static void
xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...);
/**************************************************************************/
void
ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
{
ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
isc_result_t result;
dns_name_t *question_name;
dns_rdataset_t *question_rdataset;
@ -823,8 +822,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
}
ns_client_log(client,
DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT, ISC_LOG_DEBUG(6),
"%s request", mnemonic);
DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT,
ISC_LOG_DEBUG(6), "%s request", mnemonic);
/*
* Apply quota.
*/
@ -886,7 +885,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
dns_message_currentname(request, DNS_SECTION_AUTHORITY,
&soa_name);
/* Ignore data whose owner name is not the zone apex. */
/*
* Ignore data whose owner name is not the zone apex.
*/
if (! dns_name_equal(soa_name, question_name))
continue;
@ -894,7 +895,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
soa_rdataset != NULL;
soa_rdataset = ISC_LIST_NEXT(soa_rdataset, link))
{
/* Ignore non-SOA data. */
/*
* Ignore non-SOA data.
*/
if (soa_rdataset->type != dns_rdatatype_soa)
continue;
if (soa_rdataset->rdclass != question_class)
@ -918,30 +921,38 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
xfrout_log1(client, question_name, ISC_LOG_DEBUG(6),
"%s authority section OK", mnemonic);
/* Decide whether to allow this transfer. */
CHECK(ns_client_checkacl(client, "zone transfer",
dns_zone_getxfracl(zone),
ISC_TRUE));
/*
* Decide whether to allow this transfer.
*/
CHECK(ns_client_checkacl(client, "zone transfer",
dns_zone_getxfracl(zone), ISC_TRUE));
/* AXFR over UDP is not possible. */
/*
* AXFR over UDP is not possible.
*/
if (reqtype == dns_rdatatype_axfr &&
(client->attributes & NS_CLIENTATTR_TCP) == 0) {
FAILC(DNS_R_FORMERR, "attempted AXFR over UDP");
}
/* Look up the requesting server in the peer table. */
/*
* Look up the requesting server in the peer table.
*/
isc_netaddr_fromsockaddr(&na, &client->peeraddr);
(void) dns_peerlist_peerbyaddr(client->view->peers,
&na, &peer);
(void)dns_peerlist_peerbyaddr(client->view->peers, &na, &peer);
/* Decide on the transfer format (one-answer or many-answers). */
/*
* Decide on the transfer format (one-answer or many-answers).
*/
if (peer != NULL)
(void) dns_peer_gettransferformat(peer, &format);
(void)dns_peer_gettransferformat(peer, &format);
/* Get a dynamically allocated copy of the current SOA. */
/*
* Get a dynamically allocated copy of the current SOA.
*/
CHECK(dns_db_createsoatuple(db, ver, mctx, DNS_DIFFOP_EXISTS,
&current_soa_tuple));
if (reqtype == dns_rdatatype_ixfr) {
isc_uint32_t begin_serial, current_serial;
isc_boolean_t provide_ixfr;
@ -999,7 +1010,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
&data_stream));
}
/* Bracket the the data stream with SOAs. */
/*
* Bracket the the data stream with SOAs.
*/
CHECK(soa_rrstream_create(mctx, db, ver, &soa_stream));
CHECK(compound_rrstream_create(mctx, &soa_stream, &data_stream,
&stream));
@ -1057,7 +1070,8 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype)
if (xfr != NULL) {
xfrout_fail(xfr, result, "setting up zone transfer");
} else if (result != ISC_R_SUCCESS) {
ns_client_log(client, DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT,
ns_client_log(client, DNS_LOGCATEGORY_XFER_OUT,
NS_LOGMODULE_XFER_OUT,
ISC_LOG_DEBUG(3), "zone transfer setup failed");
ns_client_error(client, result);
}
@ -1171,8 +1185,7 @@ failure:
* _first method of the iterator has been called).
*/
static void
sendstream(xfrout_ctx_t *xfr)
{
sendstream(xfrout_ctx_t *xfr) {
dns_message_t *msg = NULL;
isc_result_t result;
isc_region_t used;
@ -1460,8 +1473,7 @@ xfrout_senddone(isc_task_t *task, isc_event_t *event) {
}
static void
xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg)
{
xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, char *msg) {
xfr->shuttingdown = ISC_TRUE;
xfrout_log(xfr, ISC_LOG_ERROR, "%s: %s",
msg, isc_result_totext(result));
@ -1485,8 +1497,7 @@ xfrout_maybe_destroy(xfrout_ctx_t *xfr) {
}
static void
xfrout_client_shutdown(void *arg, isc_result_t result)
{
xfrout_client_shutdown(void *arg, isc_result_t result) {
xfrout_ctx_t *xfr = (xfrout_ctx_t *) arg;
xfrout_fail(xfr, result, "aborted");
}
@ -1509,10 +1520,12 @@ xfrout_logv(ns_client_t *client, dns_name_t *zonename, int level,
"transfer of '%s': %s", namebuf, msgbuf);
}
/* Logging function for use when a xfrout_ctx_t has not yet been created. */
/*
* Logging function for use when a xfrout_ctx_t has not yet been created.
*/
static void
xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level, const char *fmt, ...)
xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level,
const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@ -1520,11 +1533,11 @@ xfrout_log1(ns_client_t *client, dns_name_t *zonename, int level, const char *fm
va_end(ap);
}
/* Logging function for use when there is a xfrout_ctx_t. */
/*
* Logging function for use when there is a xfrout_ctx_t.
*/
static void
xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...)
{
xfrout_log(xfrout_ctx_t *xfr, unsigned int level, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
xfrout_logv(xfr->client, xfr->qname, level, fmt, ap);

View File

@ -17,14 +17,9 @@
#include <config.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/aclconf.h>
#include <dns/types.h>
#include <dns/acl.h>
#include <dns/zone.h>
#include <dns/zoneconf.h>
#include <dns/ssu.h>
@ -40,9 +35,12 @@
static isc_result_t
configure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview,
dns_aclconfctx_t *aclconfctx, dns_zone_t *zone,
isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **),
isc_result_t (*getviewcacl)(dns_c_view_t *, dns_c_ipmatchlist_t **),
isc_result_t (*getglobalcacl)(dns_c_ctx_t *, dns_c_ipmatchlist_t **),
isc_result_t (*getcacl)(dns_c_zone_t *,
dns_c_ipmatchlist_t **),
isc_result_t (*getviewcacl)(dns_c_view_t *
, dns_c_ipmatchlist_t **),
isc_result_t (*getglobalcacl)(dns_c_ctx_t *,
dns_c_ipmatchlist_t **),
void (*setzacl)(dns_zone_t *, dns_acl_t *),
void (*clearzacl)(dns_zone_t *))
{
@ -195,18 +193,22 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
result = dns_c_view_getmaxtransfertimeout(cview,
&maxxfr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
result = dns_c_ctx_getmaxtransfertimeout(cctx,
&maxxfr);
if (result != ISC_R_SUCCESS)
maxxfr = MAX_XFER_TIME;
dns_zone_setmaxxfrout(zone, maxxfr);
result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
result = dns_c_view_getmaxtransferidleout(cview,
&maxxfr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
result = dns_c_ctx_getmaxtransferidleout(cctx,
&maxxfr);
if (result != ISC_R_SUCCESS)
maxxfr = DNS_DEFAULT_IDLEOUT;
dns_zone_setidleout(zone, maxxfr);
@ -224,7 +226,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
case dns_c_zone_forward:
#ifdef notyet
/*
* forward zones are still in a state of flux
* Forward zones are still in a state of flux.
*/
czone->u.fzone.check_names; /* XXX unused in BIND 8 */
czone->u.fzone.forward; /* XXX*/
@ -249,8 +251,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
#endif
result = configure_zone_acl(czone, cctx, cview, ac, zone,
dns_c_zone_getallowquery,
dns_c_view_getallowquery,
dns_c_ctx_getallowquery,
dns_c_view_getallowquery,
dns_c_ctx_getallowquery,
dns_zone_setqueryacl,
dns_zone_clearqueryacl);
if (result != ISC_R_SUCCESS)
@ -281,7 +283,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = dns_c_zone_gettransfersource(czone, &sockaddr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_gettransfersource(cview, &sockaddr);
result = dns_c_view_gettransfersource(cview,
&sockaddr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
if (result != ISC_R_SUCCESS)
@ -290,27 +293,33 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
result = dns_c_view_gettransfersourcev6(cview,
&sockaddr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
result = dns_c_ctx_gettransfersourcev6(cctx,
&sockaddr);
if (result != ISC_R_SUCCESS)
sockaddr = sockaddr_any6;
dns_zone_setxfrsource6(zone, &sockaddr);
result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
result = dns_c_view_getmaxtransfertimeout(cview,
&maxxfr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
result = dns_c_ctx_getmaxtransfertimeout(cctx,
&maxxfr);
if (result != ISC_R_SUCCESS)
maxxfr = MAX_XFER_TIME;
dns_zone_setmaxxfrout(zone, maxxfr);
result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
result = dns_c_view_getmaxtransferidleout(cview,
&maxxfr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
result = dns_c_ctx_getmaxtransferidleout(cctx,
&maxxfr);
if (result != ISC_R_SUCCESS)
maxxfr = DNS_DEFAULT_IDLEOUT;
dns_zone_setidleout(zone, maxxfr);
@ -395,7 +404,8 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = dns_c_zone_gettransfersource(czone, &sockaddr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_gettransfersource(cview, &sockaddr);
result = dns_c_view_gettransfersource(cview,
&sockaddr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
if (result != ISC_R_SUCCESS)
@ -404,9 +414,11 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
result = dns_c_view_gettransfersourcev6(cview,
&sockaddr);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
result = dns_c_ctx_gettransfersourcev6(cctx,
&sockaddr);
if (result != ISC_R_SUCCESS)
sockaddr = sockaddr_any6;
dns_zone_setxfrsource6(zone, &sockaddr);
@ -434,8 +446,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
}
isc_boolean_t
dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
{
dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) {
const char *cfilename;
const char *zfilename;
@ -455,8 +466,7 @@ dns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
}
isc_result_t
dns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr)
{
dns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr) {
isc_int32_t val;
isc_result_t result;

View File

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: rndc.c,v 1.10 2000/04/28 02:07:58 tale Exp $ */
/* $Id: rndc.c,v 1.11 2000/05/08 14:33:19 tale Exp $ */
/*
* Principal Author: DCL
@ -23,15 +23,12 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/mem.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>

View File

@ -17,31 +17,20 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/timer.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/net.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/cache.h>
#include <dns/db.h>
#include <dns/master.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/rootns.h>
#include <dns/result.h>
@ -67,20 +56,8 @@ isc_mutex_t client_lock;
isc_stdtime_t now;
dns_adb_t *adb;
static void check_result(isc_result_t, char *, ...);
isc_result_t ns_rootns_init(void);
void create_managers(void);
static void lookup_callback(isc_task_t *, isc_event_t *);
void create_view(void);
client_t *new_client(void);
void free_client(client_t **);
static inline void CLOCK(void);
static inline void CUNLOCK(void);
void lookup(char *);
static void
check_result(isc_result_t result, char *format, ...)
{
check_result(isc_result_t result, char *format, ...) {
va_list args;
if (result == ISC_R_SUCCESS)
@ -93,9 +70,8 @@ check_result(isc_result_t result, char *format, ...)
exit(1);
}
client_t *
new_client(void)
{
static client_t *
new_client(void) {
client_t *client;
client = isc_mempool_get(cmp);
@ -107,9 +83,8 @@ new_client(void)
return (client);
}
void
free_client(client_t **c)
{
static void
free_client(client_t **c) {
client_t *client;
INSIST(c != NULL);
@ -124,20 +99,17 @@ free_client(client_t **c)
}
static inline void
CLOCK(void)
{
CLOCK(void) {
RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS);
}
static inline void
CUNLOCK(void)
{
CUNLOCK(void) {
RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS);
}
static void
lookup_callback(isc_task_t *task, isc_event_t *ev)
{
lookup_callback(isc_task_t *task, isc_event_t *ev) {
client_t *client;
client = ev->ev_arg;
@ -159,9 +131,8 @@ lookup_callback(isc_task_t *task, isc_event_t *ev)
CUNLOCK();
}
void
create_managers(void)
{
static void
create_managers(void) {
isc_result_t result;
taskmgr = NULL;
@ -177,9 +148,8 @@ create_managers(void)
check_result(result, "isc_socketmgr_create");
}
void
create_view(void)
{
static void
create_view(void) {
dns_cache_t *cache;
isc_result_t result;
@ -219,9 +189,8 @@ create_view(void)
dns_view_freeze(view);
}
void
lookup(char *target)
{
static void
lookup(char *target) {
dns_name_t name;
unsigned char namedata[256];
client_t *client;
@ -264,13 +233,12 @@ lookup(char *target)
}
int
main(int argc, char **argv)
{
main(int argc, char **argv) {
isc_result_t result;
isc_logdestination_t destination;
(void)argc;
(void)argv;
UNUSED(argc);
UNUSED(argv);
dns_result_register();
result = isc_app_start();

View File

@ -21,33 +21,21 @@
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/mutex.h>
#include <isc/net.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <dns/cache.h>
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/types.h>
#include <dns/view.h>
static void

View File

@ -24,39 +24,20 @@
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/buffer.h>
#include <isc/app.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/app.h>
#include <isc/mutex.h>
#include <isc/boolean.h>
#include <isc/net.h>
#include <isc/region.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/util.h>
#include <isc/netaddr.h>
#include <isc/log.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/adb.h>
#include <dns/cache.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/resolver.h>
#include <dns/events.h>
#include <dns/dispatch.h>
#include <dns/byaddr.h>
#include <dns/view.h>
#include <dns/log.h>
#include <dns/resolver.h>
#include <dns/result.h>
static isc_mem_t *mctx = NULL;
static dns_view_t *view = NULL;

View File

@ -17,13 +17,11 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <isc/assertions.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/util.h>
#include <dns/compress.h>
@ -32,11 +30,12 @@
unsigned char plain1[] = "\003yyy\003foo";
unsigned char plain2[] = "\003bar\003yyy\003foo";
unsigned char plain3[] = "\003xxx\003bar\003foo";
unsigned char plain[] =
"\003yyy\003foo\0\003bar\003yyy\003foo\0\003bar\003yyy\003foo\0\003xxx\003bar\003foo";
/* result concatenate (plain1, plain2, plain2, plain3) */
unsigned char plain[] = "\003yyy\003foo\0\003bar\003yyy\003foo\0\003"
"bar\003yyy\003foo\0\003xxx\003bar\003foo";
/*
* Result concatenate (plain1, plain2, plain2, plain3).
*/
unsigned char bit1[] = "\101\010b";
unsigned char bit2[] = "\101\014b\260";
unsigned char bit3[] = "\101\020b\264";
@ -45,8 +44,9 @@ unsigned char bit[] = "\101\010b\0\101\014b\260\0\101\014b\260\0\101\020b\264";
int raw = 0;
int verbose = 0;
void test(unsigned int, dns_name_t *, dns_name_t *, dns_name_t *,
unsigned char *, unsigned int);
void
test(unsigned int, dns_name_t *, dns_name_t *, dns_name_t *,
unsigned char *, unsigned int);
int
main(int argc, char *argv[]) {

View File

@ -18,34 +18,18 @@
#include <config.h>
#include <ctype.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/name.h>
#include <dns/db.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/compress.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dbtable.h>
#include <tests/t_api.h>
@ -97,7 +81,6 @@ t_create(char *db_type, char *origin, char *class, char *cache,
}
static int
t_dns_db_load(char **av) {
@ -254,12 +237,9 @@ static char *a2 =
"dns_db_iscache(db) returns ISC_TRUE.";
static int
t_dns_db_zc_x(char *filename,
char *db_type, char *origin, char *class,
isc_boolean_t cache,
isc_boolean_t(*cf)(dns_db_t *),
isc_boolean_t exp_result) {
t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class,
isc_boolean_t cache, isc_boolean_t(*cf)(dns_db_t *),
isc_boolean_t exp_result) {
int result;
int len;
dns_db_t *db;
@ -651,7 +631,6 @@ static char *a8 =
static int
t_dns_db_currentversion(char **av) {
char *filename;
char *db_type;
char *origin;
@ -819,7 +798,8 @@ t_dns_db_currentversion(char **av) {
&rdataset, NULL);
if ((dns_result != ISC_R_NOTFOUND) && (dns_result != DNS_R_NXDOMAIN)) {
t_info("unexpectedly found %s using current version\n", findname);
t_info("unexpectedly found %s using current version\n",
findname);
dns_db_closeversion(db, &cversionp, ISC_FALSE);
dns_db_closeversion(db, &nversionp, ISC_FALSE);
dns_db_detach(&db);
@ -868,16 +848,15 @@ t8() {
int result;
t_assert("dns_db_currentversion", 8, T_REQUIRED, a8);
result = t_eval("dns_db_currentversion_data", t_dns_db_currentversion, 7);
result = t_eval("dns_db_currentversion_data",
t_dns_db_currentversion, 7);
t_result(result);
}
static char *a9 =
"A call to dns_db_newversion() opens a new version for "
"reading and writing.";
static int
t_dns_db_newversion(char **av) {
@ -1132,6 +1111,7 @@ t_dns_db_newversion(char **av) {
return(result);
}
static void
t9() {
int result;
@ -1141,7 +1121,6 @@ t9() {
t_result(result);
}
static char *a10 =
"When versionp points to a read-write version and commit is "
"ISC_TRUE, a call to dns_db_closeversion(db, versionp, commit) "
@ -1150,7 +1129,6 @@ static char *a10 =
static int
t_dns_db_closeversion_1(char **av) {
char *filename;
char *db_type;
char *origin;
@ -1495,11 +1473,11 @@ t10() {
int result;
t_assert("dns_db_closeversion", 10, T_REQUIRED, a10);
result = t_eval("dns_db_closeversion_1_data", t_dns_db_closeversion_1, 9);
result = t_eval("dns_db_closeversion_1_data",
t_dns_db_closeversion_1, 9);
t_result(result);
}
static char *a11 =
"When versionp points to a read-write version and commit is "
"ISC_FALSE, a call to dns_db_closeversion(db, versionp, commit) "
@ -1508,7 +1486,6 @@ static char *a11 =
static int
t_dns_db_closeversion_2(char **av) {
char *filename;
char *db_type;
char *origin;
@ -1909,11 +1886,11 @@ t11() {
int result;
t_assert("dns_db_closeversion", 11, T_REQUIRED, a11);
result = t_eval("dns_db_closeversion_2_data", t_dns_db_closeversion_2, 9);
result = t_eval("dns_db_closeversion_2_data",
t_dns_db_closeversion_2, 9);
t_result(result);
}
static char *a12 =
"A call to dns_db_expirenode() marks as stale all records at node "
"which expire at or before 'now'. If 'now' is zero, then the current "
@ -1921,7 +1898,6 @@ static char *a12 =
static int
t_dns_db_expirenode(char **av) {
char *filename;
char *db_type;
char *origin;
@ -2088,17 +2064,14 @@ t12() {
t_result(result);
}
static char *a13 =
"If the node name exists, then a call to "
"dns_db_findnode(db, name, ISC_FALSE, nodep) initializes nodep "
"to point to the node and returns ISC_R_SUCCESS, otherwise "
"it returns ISC_R_NOTFOUND.";
static int
t_dns_db_findnode_1(char **av) {
char *filename;
char *db_type;
char *origin;
@ -2247,7 +2220,6 @@ static char *a14 =
static int
t_dns_db_findnode_2(char **av) {
char *filename;
char *db_type;
char *origin;
@ -2405,7 +2377,6 @@ t14() {
static int
t_dns_db_find_x(char **av) {
char *dbfile;
char *dbtype;
char *dborigin;
@ -2533,9 +2504,10 @@ t_dns_db_find_x(char **av) {
&rdataset, NULL);
if (dns_result != exp_result) {
t_info("dns_db_find %s %s unexpectedly returned %s, expected %s\n",
findname, findtype, dns_result_totext(dns_result),
dns_result_totext(exp_result));
t_info("dns_db_find %s %s unexpectedly returned %s, "
"expected %s\n",
findname, findtype, dns_result_totext(dns_result),
dns_result_totext(exp_result));
result = T_FAIL;
}
else {
@ -2544,7 +2516,8 @@ t_dns_db_find_x(char **av) {
if ((dns_result != ISC_R_NOTFOUND) && (dns_result != DNS_R_NXDOMAIN)) {
if ((dns_result != DNS_R_NXRRSET) && (dns_result != DNS_R_ZONECUT))
if ((dns_result != DNS_R_NXRRSET) &&
(dns_result != DNS_R_ZONECUT))
if (dns_rdataset_isassociated(&rdataset))
dns_rdataset_disassociate(&rdataset);
dns_db_detachnode(db, &nodep);
@ -2560,8 +2533,8 @@ t_dns_db_find_x(char **av) {
static char *a15 =
"A call to dns_db_find(db, name, version, type, options, now, ...) "
"finds the best match for 'name' and 'type' in version 'version' of 'db'.";
"finds the best match for 'name' and 'type' in version 'version' "
"of 'db'.";
static void
t15() {
@ -2579,7 +2552,6 @@ static char *a16 =
"dns_db_find(db, name, version, type, options, now, ...) "
"returns DNS_R_GLUE.";
static void
t16() {
int result;
@ -2589,12 +2561,10 @@ t16() {
t_result(result);
}
static char *a17 =
"A call to dns_db_find() returns DNS_R_DELEGATION when the data "
"requested is beneath a zone cut.";
static void
t17() {
int result;
@ -2604,12 +2574,10 @@ t17() {
t_result(result);
}
static char *a18 =
"A call to dns_db_find() returns DNS_R_ZONECUT when type is "
"dns_rdatatype_any and the desired node is a zone cut.";
static void
t18() {
int result;
@ -2619,7 +2587,6 @@ t18() {
t_result(result);
}
static char *a19 =
"A call to dns_db_find() returns DNS_R_DNAME when the data "
"requested is beneath a DNAME.";
@ -2633,7 +2600,6 @@ t19() {
t_result(result);
}
static char *a20 =
"A call to dns_db_find() returns DNS_R_CNAME when the requested "
"rdataset was not found but there is a CNAME at the desired name.";
@ -2673,7 +2639,6 @@ t22() {
t_result(result);
}
static char *a23 =
"When db is a cache database, a call to dns_db_find() "
"returns ISC_R_NOTFOUND when the desired name does not exist, "
@ -2701,7 +2666,6 @@ t24() {
t_result(result);
}
testspec_t T_testlist[] = {
{ t1, "dns_db_load" },
{ t2, "dns_db_iscache" },
@ -2729,4 +2693,3 @@ testspec_t T_testlist[] = {
{ t24, "dns_db_find" },
{ NULL, NULL }
};

View File

@ -21,35 +21,21 @@
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/time.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/compress.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dbtable.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/result.h>
#define MAXHOLD 100
#define MAXVERSIONS 100

View File

@ -17,32 +17,18 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/socket.h>
#include <isc/timer.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/dispatch.h>
#include <dns/message.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include "printmsg.h"

View File

@ -17,33 +17,18 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/net.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/socket.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/dispatch.h>
#include <dns/message.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include "printmsg.h"
@ -62,20 +47,18 @@ isc_taskmgr_t *manager;
isc_socketmgr_t *socketmgr;
dns_dispatch_t *disp;
isc_task_t *t0, *t1, *t2;
clictx_t clients[16]; /* lots of things might want to use this */
clictx_t clients[16]; /* Lots of things might want to use this. */
unsigned int client_count = 0;
isc_mutex_t client_lock;
void got_request(isc_task_t *, isc_event_t *);
void got_response(isc_task_t *, isc_event_t *);
void start_response(clictx_t *, char *, isc_task_t *);
static inline void CHECKRESULT(isc_result_t, char *);
void send_done(isc_task_t *, isc_event_t *);
void hex_dump(isc_buffer_t *);
/*
* Forward declarations.
*/
void
hex_dump(isc_buffer_t *b)
{
got_response(isc_task_t *, isc_event_t *);
static void
hex_dump(isc_buffer_t *b) {
unsigned int len;
isc_region_t r;
@ -92,8 +75,7 @@ hex_dump(isc_buffer_t *b)
}
static inline void
CHECKRESULT(isc_result_t result, char *msg)
{
CHECKRESULT(isc_result_t result, char *msg) {
if (result != ISC_R_SUCCESS) {
printf("%s: %s\n", msg, isc_result_totext(result));
@ -101,9 +83,8 @@ CHECKRESULT(isc_result_t result, char *msg)
}
}
void
send_done(isc_task_t *task, isc_event_t *ev_in)
{
static void
send_done(isc_task_t *task, isc_event_t *ev_in) {
isc_socketevent_t *ev = (isc_socketevent_t *)ev_in;
clictx_t *cli = (clictx_t *)ev_in->ev_arg;
@ -124,10 +105,8 @@ send_done(isc_task_t *task, isc_event_t *ev_in)
isc_app_shutdown();
}
void
start_response(clictx_t *cli, char *query, isc_task_t *task)
{
static void
start_response(clictx_t *cli, char *query, isc_task_t *task) {
dns_messageid_t id;
isc_sockaddr_t from;
dns_message_t *msg;
@ -229,8 +208,7 @@ start_response(clictx_t *cli, char *query, isc_task_t *task)
}
void
got_response(isc_task_t *task, isc_event_t *ev_in)
{
got_response(isc_task_t *task, isc_event_t *ev_in) {
dns_dispatchevent_t *ev = (dns_dispatchevent_t *)ev_in;
dns_dispentry_t *resp = ev->ev_sender;
dns_message_t *msg;
@ -283,9 +261,8 @@ got_response(isc_task_t *task, isc_event_t *ev_in)
isc_app_shutdown();
}
void
got_request(isc_task_t *task, isc_event_t *ev_in)
{
static void
got_request(isc_task_t *task, isc_event_t *ev_in) {
dns_dispatchevent_t *ev = (dns_dispatchevent_t *)ev_in;
clictx_t *cli = (clictx_t *)ev_in->ev_arg;
dns_message_t *msg;
@ -352,8 +329,7 @@ got_request(isc_task_t *task, isc_event_t *ev_in)
}
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
isc_socket_t *s0;
isc_sockaddr_t sockaddr;
unsigned int i;
@ -372,7 +348,7 @@ main(int argc, char *argv[])
dns_result_register();
/*
* The task manager is independent (other than memory context)
* The task manager is independent (other than memory context).
*/
manager = NULL;
RUNTIME_CHECK(isc_taskmgr_create(mctx, 5, 0, &manager) ==
@ -402,7 +378,7 @@ main(int argc, char *argv[])
RUNTIME_CHECK(isc_socket_bind(s0, &sockaddr) == ISC_R_SUCCESS);
/*
* Create a dispatch context
* Create a dispatch context.
*/
disp = NULL;
RUNTIME_CHECK(dns_dispatch_create(mctx, s0, t0, 512, 6, 1024,

View File

@ -17,19 +17,13 @@
#include <config.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> /* XXX */
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/region.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <dns/result.h>

View File

@ -17,37 +17,29 @@
#include <config.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/types.h> /* Required for dirent.h */
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h> /* XXX */
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/region.h>
#include <isc/string.h>
#include <dst/dst.h>
#include <dst/result.h>
#include <tests/t_api.h>
static void t1(void);
static void t2(void);
/*
* adapted from the original dst_test.c program
* Adapted from the original dst_test.c program.
*/
static void
@ -81,7 +73,6 @@ cleandir(char *path) {
return;
}
static void
use(dst_key_t *key, isc_result_t exp_result, int *nfails) {
@ -236,8 +227,9 @@ dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx,
}
static void
io(char *name, int id, int alg, int type, isc_mem_t *mctx, isc_result_t exp_result,
int *nfails, int *nprobs) {
io(char *name, int id, int alg, int type, isc_mem_t *mctx,
isc_result_t exp_result, int *nfails, int *nprobs)
{
dst_key_t *key;
isc_result_t ret;
int rval;
@ -309,7 +301,8 @@ generate(int alg, isc_mem_t *mctx, int size, int *nfails) {
ret = dst_key_generate("test.", alg, size, 0, 0, 0, mctx, &key);
if (ret != ISC_R_SUCCESS) {
t_info("dst_key_generate(%d) returned: %s\n", alg, dst_result_totext(ret));
t_info("dst_key_generate(%d) returned: %s\n", alg,
dst_result_totext(ret));
++*nfails;
return;
}
@ -367,7 +360,7 @@ static char *a1 =
"compute Diffie-Hellman shared secrets, "
"and generate random number sequences.";
static void
t1() {
t1(void) {
isc_mem_t *mctx;
int nfails;
int nprobs;
@ -381,7 +374,8 @@ t1() {
mctx = NULL;
isc_result = isc_mem_create(0, 0, &mctx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %d\n", isc_result_totext(isc_result));
t_info("isc_mem_create failed %d\n",
isc_result_totext(isc_result));
t_result(T_UNRESOLVED);
return;
}
@ -429,7 +423,9 @@ t1() {
#ifdef NEWSIG
/* write a sig in buf to file at path */
/*
* Write a sig in buf to file at path.
*/
static int
sig_tofile(char *path, isc_buffer_t *buf) {
int rval;
@ -444,7 +440,8 @@ sig_tofile(char *path, isc_buffer_t *buf) {
nprobs = 0;
len = buf->used - buf->current;
t_info("buf: current %d used %d len %d\n", buf->current, buf->used, len);
t_info("buf: current %d used %d len %d\n",
buf->current, buf->used, len);
fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRWXU|S_IRWXO|S_IRWXG);
if (fd < 0) {
@ -500,7 +497,9 @@ sig_tofile(char *path, isc_buffer_t *buf) {
#endif /* NEWSIG */
/* read sig in file at path to buf */
/*
* Read sig in file at path to buf.
*/
static int
sig_fromfile(char *path, isc_buffer_t *iscbuf) {
int rval;
@ -574,13 +573,12 @@ sig_fromfile(char *path, isc_buffer_t *iscbuf) {
return(0);
}
static void
t2_sigchk(char *datapath, char *sigpath, char *keyname,
int id, int alg, int type,
isc_mem_t *mctx, char *expected_result,
int *nfails, int *nprobs) {
int *nfails, int *nprobs)
{
int rval;
int len;
int fd;
@ -596,7 +594,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
isc_region_t datareg;
isc_region_t sigreg;
/* read data from file in a form usable by dst_verify */
/*
* Read data from file in a form usable by dst_verify.
*/
rval = stat(datapath, &sb);
if (rval != 0) {
t_info("t2_sigchk: stat (%s) failed %d\n", datapath, errno);
@ -630,7 +630,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
} while (len);
(void) close(fd);
/* read key from file in a form usable by dst_verify */
/*
* Read key from file in a form usable by dst_verify.
*/
isc_result = dst_key_fromfile(keyname, id, alg, type, mctx, &key);
if (isc_result != ISC_R_SUCCESS) {
t_info("dst_key_fromfile failed %s\n",
@ -690,7 +692,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
return;
}
/* verify that the key signed the data */
/*
* Verify that the key signed the data.
*/
isc_buffer_remainingregion(&sigbuf, &sigreg);
exp_res = 0;
@ -713,17 +717,18 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
}
/*
* the astute observer will note that t1() signs then verifies data
* The astute observer will note that t1() signs then verifies data
* during the test but that t2() verifies data that has been
* signed at some earlier time, possibly with an entire different
* version or implementation of the DSA and RSA algorithms
*/
static char *a2 =
"the dst module provides the capability to "
"verify data signed with the RSA and DSA algorithms";
/* av == datafile, sigpath, keyname, keyid, alg, exp_result */
/*
* av == datafile, sigpath, keyname, keyid, alg, exp_result.
*/
static int
t2_vfy(char **av) {
char *datapath;
@ -762,7 +767,8 @@ t2_vfy(char **av) {
mctx = NULL;
isc_result = isc_mem_create(0, 0, &mctx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %d\n", isc_result_totext(isc_result));
t_info("isc_mem_create failed %d\n",
isc_result_totext(isc_result));
return(T_UNRESOLVED);
}
@ -780,12 +786,12 @@ t2_vfy(char **av) {
result = T_FAIL;
else if ((nfails == 0) && (nprobs == 0))
result = T_PASS;
return(result);
return(result);
}
static void
t2() {
t2(void) {
int result;
t_assert("dst", 2, T_REQUIRED, a2);
result = t_eval("dst_2_data", t2_vfy, 6);

View File

@ -14,10 +14,9 @@
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <isc/net.h>

View File

@ -15,9 +15,9 @@
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <isc/net.h>

View File

@ -15,12 +15,12 @@
* SOFTWARE.
*/
#include <config.h>
#include <stdlib.h>
#include <isc/assertions.h>
#include <isc/interfaceiter.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/util.h>
int
@ -50,16 +50,19 @@ main(int argc, char **argv) {
fprintf(stdout, "%s %d %x\n", ifdata.name, ifdata.af,
ifdata.flags);
INSIST(ifdata.af == AF_INET || ifdata.af == AF_INET6);
res = inet_ntop(ifdata.af, &ifdata.address.type, buf, sizeof buf);
res = inet_ntop(ifdata.af, &ifdata.address.type, buf,
sizeof(buf));
fprintf(stdout, "address = %s\n", res == NULL ? "BAD" : res);
INSIST(ifdata.address.family == ifdata.af);
res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf, sizeof buf);
res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf,
sizeof(buf));
fprintf(stdout, "netmask = %s\n", res == NULL ? "BAD" : res);
INSIST(ifdata.netmask.family == ifdata.af);
if ((ifdata.flags & INTERFACE_F_POINTTOPOINT) != 0) {
res = inet_ntop(ifdata.af, &ifdata.dstaddress.type,
buf, sizeof buf);
fprintf(stdout, "dstaddress = %s\n", res == NULL ? "BAD" : res);
buf, sizeof(buf));
fprintf(stdout, "dstaddress = %s\n",
res == NULL ? "BAD" : res);
INSIST(ifdata.dstaddress.family == ifdata.af);
}

View File

@ -15,21 +15,16 @@
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
*/
/* $Id: keygen.c,v 1.14 2000/05/05 19:55:56 gson Exp $ */
/* $Id: keygen.c,v 1.15 2000/05/08 14:33:32 tale Exp $ */
#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/region.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/keyvalues.h>
@ -45,17 +40,17 @@ static int verbose;
int
main(int argc, char **argv) {
char *algname = NULL, *nametype = NULL, *type = NULL;
char *prog, *endp;
dst_key_t *key;
char *name = NULL;
isc_uint16_t flags = 0;
dns_secalg_t alg;
isc_mem_t *mctx = NULL;
int ch, rsa_exp = 0, generator = 0, param = 0;
int protocol = -1, size = -1, signatory = 0;
isc_textregion_t r;
isc_result_t ret;
char *algname = NULL, *nametype = NULL, *type = NULL;
char *prog, *endp;
dst_key_t *key;
char *name = NULL;
isc_uint16_t flags = 0;
dns_secalg_t alg;
isc_mem_t *mctx = NULL;
int ch, rsa_exp = 0, generator = 0, param = 0;
int protocol = -1, size = -1, signatory = 0;
isc_result_t ret;
isc_textregion_t r;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
@ -106,10 +101,12 @@ main(int argc, char **argv) {
case 'p':
protocol = strtol(isc_commandline_argument, &endp, 10);
if (*endp != '\0' || protocol < 0 || protocol > 255)
die("-p must be followed by a number [0..255]");
die("-p must be followed by "
"a number [0..255]");
break;
case 's':
signatory = strtol(isc_commandline_argument, &endp, 10);
signatory = strtol(isc_commandline_argument,
&endp, 10);
if (*endp != '\0' || signatory < 0 || signatory > 15)
die("-s must be followed by a number [0..15]");
break;
@ -284,7 +281,7 @@ die(char *str) {
static void
usage(char *prog) {
printf("Usage:\n");
printf (" %s [options] name\n\n", prog);
printf(" %s [options] name\n\n", prog);
printf("Required options:\n");
printf(" -a algorithm: RSA | RSAMD5 | DH | DSA | HMAC-MD5\n");
printf(" -b key size, in bits:\n");
@ -300,7 +297,8 @@ usage(char *prog) {
printf(" -t type: AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF\n");
printf(" default: AUTHCONF\n");
printf(" -p protocol value\n");
printf(" default: 2 (email) for User keys, 3 (dnssec) for all others\n");
printf(" default: 2 (email) for User keys, "
"3 (dnssec) for all others\n");
printf(" -s strength value this key signs DNS records with\n");
printf(" default: 0\n");
printf(" -v verbose level\n");

View File

@ -17,41 +17,22 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/types.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/stdtime.h>
#include <isc/list.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/dnssec.h>
#include <dns/keyvalues.h>
#include <dns/secalg.h>
#include <dns/nxt.h>
#include <dns/time.h>
#include <dns/log.h>
#include <dst/dst.h>
#define BUFSIZE 2048
@ -69,6 +50,7 @@ static int verbose;
static isc_mem_t *mctx = NULL;
static keylist_t keylist;
static inline void
fatal(char *message) {
fprintf(stderr, "%s\n", message);
@ -119,7 +101,8 @@ usage() {
fprintf(stderr, "\t-s YYYYMMDDHHMMSS|+offset:\n");
fprintf(stderr, "\t\tSIG start time - absolute|offset (now)\n");
fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n");
fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n");
fprintf(stderr, "\t\tSIG end time - "
"absolute|from start|from now (now + 30 days)\n");
fprintf(stderr, "\t-t ttl\n");
fprintf(stderr, "\t-v level:\n");
fprintf(stderr, "\t\tverbose level (0)\n");
@ -170,14 +153,16 @@ main(int argc, char *argv[]) {
startstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (startstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'e':
endstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (endstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 't':
@ -249,7 +234,8 @@ main(int argc, char *argv[]) {
isc_buffer_usedregion(&b, &r);
tdomain[r.length] = 0;
output = isc_mem_allocate(mctx, strlen(tdomain) + strlen("keyset") + 1);
output = isc_mem_allocate(mctx,
strlen(tdomain) + strlen("keyset") + 1);
if (output == NULL)
check_result(ISC_R_FAILURE, "isc_mem_allocate()");
strcpy(output, tdomain);
@ -344,7 +330,8 @@ main(int argc, char *argv[]) {
check_result(ISC_R_NOMEMORY, "isc_mem_get()");
isc_buffer_init(&b, data, BUFSIZE);
result = dns_dnssec_sign(domain, &rdataset, keynode->key,
&starttime, &endtime, mctx, &b, rdata);
&starttime, &endtime, mctx, &b,
rdata);
check_result(result, "dst_key_todns()");
ISC_LIST_APPEND(sigrdatalist.rdata, rdata, link);
dns_rdataset_init(&sigrdataset);
@ -366,7 +353,8 @@ main(int argc, char *argv[]) {
dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL);
if (!ISC_LIST_EMPTY(keylist))
dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0, NULL);
dns_db_addrdataset(db, node, version, 0, &sigrdataset, 0,
NULL);
dns_db_detachnode(db, &node);
dns_db_closeversion(db, &version, ISC_TRUE);

View File

@ -17,40 +17,21 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/types.h>
#include <isc/assertions.h>
#include <isc/string.h>
#include <isc/commandline.h>
#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/stdtime.h>
#include <isc/list.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/dnssec.h>
#include <dns/keyvalues.h>
#include <dns/secalg.h>
#include <dns/time.h>
#include <dns/log.h>
#include <dst/dst.h>
#define BUFSIZE 2048
@ -68,7 +49,6 @@ static int verbose;
static isc_mem_t *mctx = NULL;
static keylist_t keylist;
static inline void
fatal(char *message) {
fprintf(stderr, "%s\n", message);

View File

@ -17,16 +17,9 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/lex.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/util.h>
isc_mem_t *mctx;

View File

@ -15,18 +15,17 @@
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <isc/assertions.h>
#include <isc/types.h>
#include <isc/lfsr.h>
#include <isc/util.h>
isc_uint32_t state[1024 * 64];
int
main(int argc, char **argv)
{
main(int argc, char **argv) {
isc_lfsr_t lfsr1, lfsr2;
int i;
isc_uint32_t temp;
@ -46,7 +45,8 @@ main(int argc, char **argv)
for (i = 0 ; i < 32 ; i++) {
isc_lfsr_generate(&lfsr1, &temp, 4);
if (state[i] != temp)
printf("lfsr1: state[%2d] = %08x, but new state is %08x\n",
printf("lfsr1: state[%2d] = %08x, "
"but new state is %08x\n",
i, state[i], temp);
}
@ -64,7 +64,8 @@ main(int argc, char **argv)
isc_lfsr_generate(&lfsr1, &temp, 4);
isc_lfsr_skip(&lfsr1, 32);
if (state[i] != temp)
printf("lfsr1: state[%2d] = %08x, but new state is %08x\n",
printf("lfsr1: state[%2d] = %08x, "
"but new state is %08x\n",
i, state[i], temp);
}
@ -82,10 +83,10 @@ main(int argc, char **argv)
for (i = 0 ; i < 32 ; i++) {
isc_lfsr_generate(&lfsr2, &temp, 4);
if (state[i] != temp)
printf("lfsr2: state[%2d] = %08x, but new state is %08x\n",
printf("lfsr2: state[%2d] = %08x, "
"but new state is %08x\n",
i, state[i], temp);
}
return (0);
}

View File

@ -15,22 +15,20 @@
* SOFTWARE.
*/
/* $Id: log_test.c,v 1.13 2000/05/03 21:11:26 explorer Exp $ */
/* $Id: log_test.c,v 1.14 2000/05/08 14:33:37 tale Exp $ */
/* Principal Authors: DCL */
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <isc/commandline.h>
#include <isc/mem.h>
#include <isc/log.h>
#include <isc/result.h>
#include <isc/string.h>
#include <dns/log.h>
#include <dns/result.h>
#define TEST_FILE "/tmp/test_log"
#define SYSLOG_FILE "/var/log/daemon.log"

View File

@ -18,27 +18,18 @@
#include <config.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/util.h>
#include <lwres/context.h>
#include <lwres/lwbuffer.h>
#include <lwres/lwres.h>
#include <lwres/lwpacket.h>
#define USE_ISC_MEM
static inline void
CHECK(int val, char *msg)
{
CHECK(int val, char *msg) {
if (val != 0) {
fprintf(stderr, "%s returned %d\n", msg, val);
exit(1);
@ -46,8 +37,7 @@ CHECK(int val, char *msg)
}
static void
hexdump(char *msg, void *base, size_t len)
{
hexdump(char *msg, void *base, size_t len) {
unsigned char *p;
unsigned int cnt;
@ -76,8 +66,7 @@ static char *TESTSTRING = "This is a test. This is only a test. !!!";
static lwres_context_t *ctx;
static void
test_noop(void)
{
test_noop(void) {
int ret;
lwres_lwpacket_t pkt, pkt2;
lwres_nooprequest_t nooprequest, *nooprequest2;
@ -156,8 +145,7 @@ test_noop(void)
}
static void
test_gabn(char *target)
{
test_gabn(char *target) {
lwres_gabnresponse_t *res;
lwres_addr_t *addr;
int ret;
@ -201,8 +189,7 @@ test_gabn(char *target)
}
static void
test_gnba(char *target, lwres_uint32_t af)
{
test_gnba(char *target, lwres_uint32_t af) {
lwres_gnbaresponse_t *res;
int ret;
unsigned int i;
@ -239,21 +226,18 @@ test_gnba(char *target, lwres_uint32_t af)
* Wrappers around our memory management stuff, for the lwres functions.
*/
static void *
mem_alloc(void *arg, size_t size)
{
mem_alloc(void *arg, size_t size) {
return (isc_mem_get(arg, size));
}
static void
mem_free(void *arg, void *mem, size_t size)
{
mem_free(void *arg, void *mem, size_t size) {
isc_mem_put(arg, mem, size);
}
#endif
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
int ret;
#ifdef USE_ISC_MEM
isc_mem_t *mem;

View File

@ -17,28 +17,17 @@
#include <config.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/util.h>
#include <lwres/context.h>
#include <lwres/lwbuffer.h>
#include <lwres/lwres.h>
#include <lwres/lwpacket.h>
#define USE_ISC_MEM
static inline void
CHECK(int val, char *msg)
{
CHECK(int val, char *msg) {
if (val != 0) {
fprintf(stderr, "%s returned %d\n", msg, val);
exit(1);
@ -50,21 +39,18 @@ CHECK(int val, char *msg)
* Wrappers around our memory management stuff, for the lwres functions.
*/
static void *
mem_alloc(void *arg, size_t size)
{
mem_alloc(void *arg, size_t size) {
return (isc_mem_get(arg, size));
}
static void
mem_free(void *arg, void *mem, size_t size)
{
mem_free(void *arg, void *mem, size_t size) {
isc_mem_put(arg, mem, size);
}
#endif
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
lwres_context_t *ctx;
const char *file = "/etc/resolv.conf";
int ret;

View File

@ -15,31 +15,29 @@
* SOFTWARE.
*/
#include <config.h>
#include <config.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <isc/mem.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/util.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/util.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/result.h>
#include <dns/types.h>
#include <tests/t_api.h>
#include <dns/callbacks.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <tests/t_api.h>
#define BUFLEN 255
#define BIGBUFLEN (64 * 1024)
static isc_result_t
t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset);
static void
t1(void);
@ -64,8 +62,7 @@ t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) {
}
static int
test_master(char *testfile, char *origin, char *class,
isc_result_t exp_result)
test_master(char *testfile, char *origin, char *class, isc_result_t exp_result)
{
int result;
int len;
@ -157,29 +154,29 @@ test_master_x(char *filename) {
++line;
/* skip comment lines */
/*
* Skip comment lines.
*/
if ((isspace(*p & 0xff)) || (*p == '#'))
continue;
/* name of data file, origin, zclass, expected result */
/*
* Name of data file, origin, zclass, expected result.
*/
cnt = t_bustline(p, Tokens);
if (cnt == 4) {
result = test_master(
Tokens[0],
Tokens[1],
Tokens[2],
t_dns_result_fromtext(Tokens[3]));
}
else {
result = test_master(Tokens[0], Tokens[1],
Tokens[2],
t_dns_result_fromtext(Tokens[3]));
} else {
t_info("bad format in %s at line %d\n",
filename, line);
filename, line);
}
(void) free(p);
(void)free(p);
}
(void) fclose(fp);
}
else {
(void)fclose(fp);
} else {
t_info("Missing datafile %s\n", filename);
}
return(result);
@ -195,8 +192,9 @@ t1() {
t_result(result);
}
static char *a2 = "dns_master_loadfile returns ISC_R_UNEXPECTEDEND when the "
"masterfile input ends unexpectedly";
static char *a2 = "dns_master_loadfile returns ISC_R_UNEXPECTEDEND when the "
"masterfile input ends unexpectedly";
static void
t2() {
int result;
@ -240,8 +238,8 @@ t5() {
t_result(result);
}
static char *a6 = "dns_master_loadfile understands KEY RR specifications "
"containing key material";
static char *a6 = "dns_master_loadfile understands KEY RR specifications "
"containing key material";
static void
t6() {
@ -253,8 +251,8 @@ t6() {
t_result(result);
}
static char *a7 = "dns_master_loadfile understands KEY RR specifications "
"containing no key material";
static char *a7 = "dns_master_loadfile understands KEY RR specifications "
"containing no key material";
static void
t7() {

View File

@ -17,20 +17,17 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/mem.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/util.h>
#include <dns/callbacks.h>
#include <dns/master.h>
#include <dns/name.h>
#include <dns/rdataset.h>
#include <dns/result.h>
#include <dns/types.h>
isc_mem_t *mctx;

View File

@ -17,23 +17,13 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <tests/t_api.h>
static void
t1(void);
/*
* adapted from the original mempool_test.c program
* Adapted from the original mempool_test.c program.
*/
isc_mem_t *mctx;
#define MP1_FREEMAX 10
@ -194,7 +184,7 @@ static char *a1 =
"the memory module supports the creation of memory contexts "
"and the management of memory pools.";
static void
t1() {
t1(void) {
int rval;
int result;

View File

@ -17,22 +17,13 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/result.h>
#include <isc/util.h>
isc_mem_t *mctx;
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
void *items1[50];
void *items2[50];
void *tmp;
@ -40,9 +31,8 @@ main(int argc, char *argv[])
unsigned int i, j;
isc_mutex_t lock;
/* Silence annoying compiler warning. */
(void)argc;
(void)argv;
UNUSED(argc);
UNUSED(argv);
RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);

View File

@ -17,21 +17,14 @@
#include <config.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/result.h>
static void
print_wirename(isc_region_t *name) {

View File

@ -15,24 +15,18 @@
* SOFTWARE.
*/
#include <config.h>
#include <config.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include <isc/buffer.h>
#include <isc/region.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <dns/compress.h>
#include <dns/name.h>
#include <dns/result.h>
#include <dns/types.h>
#include <dns/name.h>
#include <tests/t_api.h>
#include <tests/t_api.h>
#define MAXTOKS 16
#define BUFLEN 256

View File

@ -17,33 +17,23 @@
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/log.h>
#include <dns/namedconf.h>
#include <isc/error.h>
isc_result_t zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone,
dns_c_view_t *view, void *uap);
isc_result_t optscbk(dns_c_ctx_t *ctx, void *uap);
isc_result_t
zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap)
{
static isc_result_t
zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) {
const char *zname;
const char *vname;
(void) ctx;
(void) uap;
UNUSED(ctx);
UNUSED(uap);
dns_c_zone_getname(zone, &zname);
@ -54,7 +44,7 @@ zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap)
vname = "no current view";
}
#else
(void) view;
UNUSED(view);
vname = "foo";
#endif
@ -63,20 +53,20 @@ zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap)
return (ISC_R_SUCCESS);
}
isc_result_t
optscbk(dns_c_ctx_t *ctx, void *uap)
{
(void) ctx;
(void) uap;
static isc_result_t
optscbk(dns_c_ctx_t *ctx, void *uap) {
UNUSED(ctx);
UNUSED(uap);
fprintf(stderr, "Processing options in callback.\n");
return (ISC_R_SUCCESS);
}
extern int dns__yydebug;
int main (int argc, char **argv) {
int
main (int argc, char **argv) {
dns_c_ctx_t *configctx = NULL;
const char *conffile;
FILE *outfp;
@ -85,16 +75,14 @@ int main (int argc, char **argv) {
isc_log_t *log = NULL;
isc_logconfig_t *logcfg = NULL;
callbacks.zonecbk = zonecbk;
callbacks.optscbk = optscbk;
callbacks.zonecbkuap = NULL;
callbacks.optscbkuap = NULL;
#if 1
callbacks.zonecbk = NULL;
callbacks.zonecbkuap = NULL;
callbacks.optscbk = NULL;
callbacks.optscbkuap = NULL;
#else
callbacks.zonecbk = zonecbk;
callbacks.zonecbkuap = NULL;
callbacks.optscbk = optscbk;
callbacks.optscbkuap = NULL;
#endif
if (argc > 1 && strcmp(argv[1],"-d") == 0) {
@ -170,7 +158,3 @@ int main (int argc, char **argv) {
return (0);
}

View File

@ -18,13 +18,9 @@
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <isc/mem.h>
#include <isc/error.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/log.h>

View File

@ -17,27 +17,18 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/types.h>
#include <isc/assertions.h>
#include <isc/buffer.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <dns/types.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/fixedname.h>
#include <dns/nxt.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/result.h>
#include <dns/nxt.h>
static isc_mem_t *mctx = NULL;

View File

@ -18,26 +18,18 @@
/*
* Test code for OMAPI.
*/
#include <config.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/condition.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/region.h>
#include <isc/result.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dst/result.h>
#include <omapi/omapi.h>

View File

@ -17,27 +17,9 @@
#include <config.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/compress.h>
#include <dns/message.h>
#include "printmsg.h"
@ -81,8 +63,7 @@ static char *rcodetext[] = {
};
static isc_result_t
printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name)
{
printsection(dns_message_t *msg, dns_section_t sectionid, char *section_name) {
dns_name_t *name, *print_name;
dns_rdataset_t *rdataset;
isc_buffer_t target;

View File

@ -17,17 +17,9 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/ratelimiter.h>
@ -65,8 +57,7 @@ schedule_t schedule[] = {
isc_timer_t *timers[NEVENTS];
static void
ltick(isc_task_t *task, isc_event_t *event)
{
ltick(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
printf("** ltick%s **\n",
(event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0 ?
@ -75,8 +66,7 @@ ltick(isc_task_t *task, isc_event_t *event)
}
static void
utick(isc_task_t *task, isc_event_t *event)
{
utick(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
UNUSED(task);
event->ev_action = ltick;

File diff suppressed because it is too large Load Diff

View File

@ -16,12 +16,12 @@
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <isc/commandline.h>
#include <isc/boolean.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <dns/rbt.h>
#include <dns/fixedname.h>

View File

@ -17,22 +17,20 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/lex.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/rdata.h>
#include <dns/result.h>
#include <dns/compress.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
isc_mem_t *mctx;
isc_lex_t *lex;

View File

@ -19,14 +19,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/rwlock.h>
#include <isc/string.h>
#include <isc/util.h>
isc_rwlock_t lock;

View File

@ -17,31 +17,18 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern int h_errno;
#include <isc/types.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <isc/socket.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
@ -195,7 +182,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
/*
* There will be one buffer (since that is what we put on the list)
* There will be one buffer (since that is what we put on the list).
*/
if (sevent->result == ISC_R_SUCCESS) {
b = ISC_LIST_HEAD(sevent->bufferlist);

View File

@ -15,8 +15,11 @@
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <isc/serial.h>
int
@ -25,7 +28,6 @@ main() {
char buf[1024];
char *s, *e;
while (fgets(buf, sizeof buf, stdin) != NULL) {
buf[sizeof buf - 1] = '\0';
s = buf;

View File

@ -17,24 +17,13 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/app.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/timer.h>
#include <isc/time.h>
#include <isc/mutex.h>
#include <isc/condition.h>
#include <isc/event.h>
#include <isc/eventclass.h>
#include <isc/app.h>
#include <isc/timer.h>
#include <isc/util.h>
typedef struct {

View File

@ -17,23 +17,18 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/commandline.h>
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/stdtime.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/dnssec.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/nxt.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
@ -44,10 +39,8 @@
#include <dns/result.h>
#include <dns/secalg.h>
#include <dns/time.h>
#include <dns/types.h>
#include <dns/zone.h>
#include <dst/dst.h>
#include <dst/result.h>
/*#define USE_ZONESTATUS*/
@ -377,7 +370,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
setverifies(name, set, key, &oldsigrdata))
{
vbprintf(2,
"\tsig by %s/%s/%d retained\n",
"\tsig by %s/%s/%d retained\n",
nametostr(&sig.signer),
algtostr(sig.algorithm),
sig.keyid);
@ -402,7 +395,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
setverifies(name, set, key, &oldsigrdata))
{
vbprintf(2,
"\tsig by %s/%s/%d retained\n",
"\tsig by %s/%s/%d retained\n",
nametostr(&sig.signer),
algtostr(sig.algorithm),
sig.keyid);
@ -412,8 +405,8 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
}
else {
vbprintf(2,
"\tsig by %s/%s/%d dropped - ",
"%s\n",
"\tsig by %s/%s/%d "
"dropped - %s\n",
nametostr(&sig.signer),
algtostr(sig.algorithm),
sig.keyid,
@ -442,7 +435,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
allocbufferandrdata;
result = dns_rdata_fromstruct(trdata,
set->rdclass,
dns_rdatatype_sig,
dns_rdatatype_sig,
&sig, &b);
nowsignedby[sig.algorithm] = ISC_TRUE;
ISC_LIST_APPEND(siglist.rdata, trdata, link);
@ -602,8 +595,8 @@ importparentsig(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
goto failure;
dns_rdataset_init(&newset);
dns_rdataset_init(&sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0,
0, &newset, &sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key,
0, 0, &newset, &sigset);
if (result != ISC_R_SUCCESS)
goto failure;
@ -681,8 +674,8 @@ haschildkey(dns_db_t *db, dns_name_t *name) {
goto failure;
dns_rdataset_init(&set);
dns_rdataset_init(&sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key, 0,
0, &set, &sigset);
result = dns_db_findrdataset(newdb, newnode, NULL, dns_rdatatype_key,
0, 0, &set, &sigset);
if (result != ISC_R_SUCCESS)
goto failure;
@ -884,8 +877,9 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
keyrdatalist.type = dns_rdatatype_key;
keyrdatalist.covers = 0;
keyrdatalist.ttl = rdataset.ttl;
result = dns_rdatalist_tordataset(&keyrdatalist,
&keyset);
result =
dns_rdatalist_tordataset(&keyrdatalist,
&keyset);
check_result(result,
"dns_rdatalist_tordataset");
dns_db_addrdataset(db, node, version, 0,
@ -1252,7 +1246,8 @@ usage() {
fprintf(stderr, "\t-e YYYYMMDDHHMMSS|+offset|\"now\"+offset]:\n");
fprintf(stderr, "\t\tSIG end time - absolute|from start|from now (now + 30 days)\n");
fprintf(stderr, "\t-c ttl:\n");
fprintf(stderr, "\t\tcycle period - regenerate if < cycle from end ( (end-start)/4 )\n");
fprintf(stderr, "\t\tcycle period - regenerate "
"if < cycle from end ( (end-start)/4 )\n");
fprintf(stderr, "\t-v level:\n");
fprintf(stderr, "\t\tverbose level (0)\n");
fprintf(stderr, "\t-o origin:\n");
@ -1261,7 +1256,8 @@ usage() {
fprintf(stderr, "\t\tfile the signed zone is written in " \
"(zonefile + .signed)\n");
fprintf(stderr, "\t-a:\n");
fprintf(stderr, "\t\tverify generated signatures (if currently valid)\n");
fprintf(stderr, "\t\tverify generated signatures "
"(if currently valid)\n");
fprintf(stderr, "\n");
@ -1331,21 +1327,23 @@ main(int argc, char *argv[]) {
result = isc_mem_create(0, 0, &mctx);
check_result(result, "isc_mem_create()");
while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah")) != -1)
{
while ((ch = isc_commandline_parse(argc, argv, "s:e:c:v:o:f:ah"))
!= -1) {
switch (ch) {
case 's':
startstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (startstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'e':
endstr = isc_mem_strdup(mctx,
isc_commandline_argument);
if (endstr == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'c':
@ -1366,14 +1364,16 @@ main(int argc, char *argv[]) {
origin = isc_mem_strdup(mctx,
isc_commandline_argument);
if (origin == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'f':
output = isc_mem_strdup(mctx,
isc_commandline_argument);
if (output == NULL)
check_result(ISC_R_FAILURE, "isc_mem_strdup()");
check_result(ISC_R_FAILURE,
"isc_mem_strdup()");
break;
case 'a':
@ -1439,7 +1439,7 @@ main(int argc, char *argv[]) {
if (output == NULL) {
output = isc_mem_allocate(mctx,
strlen(file) + strlen(".signed") + 1);
strlen(file) + strlen(".signed") + 1);
if (output == NULL)
check_result(ISC_R_FAILURE, "isc_mem_allocate()");
sprintf(output, "%s.signed", file);
@ -1546,7 +1546,9 @@ main(int argc, char *argv[]) {
signzone(db, version);
/* should we update the SOA serial? */
/*
* Should we update the SOA serial?
*/
dns_db_closeversion(db, &version, ISC_TRUE);
dumpzone(zone, output);
dns_db_detach(&db);

View File

@ -17,31 +17,20 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/socket.h>
#include <isc/timer.h>
#include <isc/net.h>
#include <isc/util.h>
isc_mem_t *mctx;
isc_taskmgr_t *manager;
static void my_send(isc_task_t *task, isc_event_t *event);
static void my_recv(isc_task_t *task, isc_event_t *event);
static void
my_shutdown(isc_task_t *task, isc_event_t *event)
{
my_shutdown(isc_task_t *task, isc_event_t *event) {
char *name = event->ev_arg;
printf("shutdown %s (%p)\n", name, task);
@ -50,8 +39,31 @@ my_shutdown(isc_task_t *task, isc_event_t *event)
}
static void
my_recv(isc_task_t *task, isc_event_t *event)
{
my_send(isc_task_t *task, isc_event_t *event) {
isc_socket_t *sock;
isc_socketevent_t *dev;
sock = event->ev_sender;
dev = (isc_socketevent_t *)event;
printf("my_send: %s task %p\n\t(sock %p, base %p, length %d, n %d, "
"result %d)\n",
(char *)(event->ev_arg), task, sock,
dev->region.base, dev->region.length,
dev->n, dev->result);
if (dev->result != ISC_R_SUCCESS) {
isc_socket_detach(&sock);
isc_task_shutdown(task);
}
isc_mem_put(mctx, dev->region.base, dev->region.length);
isc_event_free(&event);
}
static void
my_recv(isc_task_t *task, isc_event_t *event) {
isc_socket_t *sock;
isc_socketevent_t *dev;
isc_region_t region;
@ -89,7 +101,7 @@ my_recv(isc_task_t *task, isc_event_t *event)
}
/*
* Echo the data back
* Echo the data back.
*/
if (strcmp(event->ev_arg, "so2") != 0) {
region = dev->region;
@ -111,39 +123,15 @@ my_recv(isc_task_t *task, isc_event_t *event)
}
static void
my_send(isc_task_t *task, isc_event_t *event)
{
my_http_get(isc_task_t *task, isc_event_t *event) {
isc_socket_t *sock;
isc_socketevent_t *dev;
sock = event->ev_sender;
dev = (isc_socketevent_t *)event;
printf("my_send: %s task %p\n\t(sock %p, base %p, length %d, n %d, result %d)\n",
(char *)(event->ev_arg), task, sock,
dev->region.base, dev->region.length,
dev->n, dev->result);
if (dev->result != ISC_R_SUCCESS) {
isc_socket_detach(&sock);
isc_task_shutdown(task);
}
isc_mem_put(mctx, dev->region.base, dev->region.length);
isc_event_free(&event);
}
static void
my_http_get(isc_task_t *task, isc_event_t *event)
{
isc_socket_t *sock;
isc_socketevent_t *dev;
sock = event->ev_sender;
dev = (isc_socketevent_t *)event;
printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %d, n %d, result %d)\n",
printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %d, "
"n %d, result %d)\n",
(char *)(event->ev_arg), task, sock,
dev->region.base, dev->region.length,
dev->n, dev->result);
@ -161,8 +149,7 @@ my_http_get(isc_task_t *task, isc_event_t *event)
}
static void
my_connect(isc_task_t *task, isc_event_t *event)
{
my_connect(isc_task_t *task, isc_event_t *event) {
isc_socket_t *sock;
isc_socket_connev_t *dev;
isc_region_t region;
@ -185,10 +172,11 @@ my_connect(isc_task_t *task, isc_event_t *event)
* Send a GET string, and set up to receive (and just display)
* the result.
*/
strcpy(buf, "GET / HTTP/1.1\r\nHost: www.flame.org\r\nConnection: Close\r\n\r\n");
strcpy(buf, "GET / HTTP/1.1\r\nHost: www.flame.org\r\n"
"Connection: Close\r\n\r\n");
region.base = isc_mem_get(mctx, strlen(buf) + 1);
region.length = strlen(buf) + 1;
strcpy((char *)region.base, buf); /* strcpy is safe */
strcpy((char *)region.base, buf); /* This strcpy is safe. */
isc_socket_send(sock, &region, task, my_http_get, event->ev_arg);
@ -196,8 +184,7 @@ my_connect(isc_task_t *task, isc_event_t *event)
}
static void
my_listen(isc_task_t *task, isc_event_t *event)
{
my_listen(isc_task_t *task, isc_event_t *event) {
char *name = event->ev_arg;
isc_socket_newconnev_t *dev;
isc_region_t region;
@ -212,9 +199,10 @@ my_listen(isc_task_t *task, isc_event_t *event)
if (dev->result == ISC_R_SUCCESS) {
/*
* queue another listen on this socket
* Queue another listen on this socket.
*/
isc_socket_accept(event->ev_sender, task, my_listen, event->ev_arg);
isc_socket_accept(event->ev_sender, task, my_listen,
event->ev_arg);
region.base = isc_mem_get(mctx, 20);
region.length = 20;
@ -244,8 +232,7 @@ my_listen(isc_task_t *task, isc_event_t *event)
}
static void
timeout(isc_task_t *task, isc_event_t *event)
{
timeout(isc_task_t *task, isc_event_t *event) {
isc_socket_t *sock = event->ev_arg;
printf("Timeout, canceling IO on socket %p (task %p)\n", sock, task);
@ -256,8 +243,7 @@ timeout(isc_task_t *task, isc_event_t *event)
}
int
main(int argc, char *argv[])
{
main(int argc, char *argv[]) {
isc_task_t *t1, *t2;
isc_timermgr_t *timgr;
isc_time_t expires;
@ -318,7 +304,7 @@ main(int argc, char *argv[])
RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS);
/*
* open up a listener socket
* Open up a listener socket.
*/
so1 = NULL;
@ -336,7 +322,7 @@ main(int argc, char *argv[])
RUNTIME_CHECK(isc_socket_listen(so1, 0) == ISC_R_SUCCESS);
/*
* queue up the first accept event
* Queue up the first accept event.
*/
RUNTIME_CHECK(isc_socket_accept(so1, t1, my_listen,
"so1") == ISC_R_SUCCESS);
@ -348,7 +334,7 @@ main(int argc, char *argv[])
ISC_R_SUCCESS);
/*
* open up a socket that will connect to www.flame.org, port 80.
* Open up a socket that will connect to www.flame.org, port 80.
* Why not. :)
*/
so2 = NULL;
@ -372,7 +358,7 @@ main(int argc, char *argv[])
isc_task_detach(&t2);
/*
* wait a short while.
* Wait a short while.
*/
sleep(10);

View File

@ -17,15 +17,7 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/result.h>
#include <isc/sockaddr.h>
#include <tests/t_api.h>

View File

@ -17,26 +17,18 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/result.h>
#include <isc/mem.h>
#include <isc/symtab.h>
#include <isc/util.h>
#include <isc/mem.h>
isc_mem_t *mctx;
isc_symtab_t *st;
static void
undefine_action(char *key, unsigned int type, isc_symvalue_t value,
void *arg)
undefine_action(char *key, unsigned int type, isc_symvalue_t value, void *arg)
{
(void) arg;
UNUSED(arg);
INSIST(type == 1);
isc_mem_free(mctx, key);

View File

@ -17,18 +17,13 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/util.h>
isc_mem_t *mctx = NULL;

File diff suppressed because it is too large Load Diff

View File

@ -17,19 +17,13 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/result.h>
#include <isc/util.h>
isc_mem_t *mctx1, *mctx2, *mctx3;

View File

@ -17,24 +17,14 @@
#include <config.h>
#include <ctype.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <isc/boolean.h>
#include <isc/condition.h>
#include <isc/error.h>
#include <isc/event.h>
#include <isc/mem.h>
#include <isc/task.h>
#include <isc/thread.h>
#include <isc/result.h>
#include <isc/time.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <tests/t_api.h>
@ -56,31 +46,32 @@ static int Tx_nanoseconds;
static void
tx_sde(isc_task_t *task, isc_event_t *event) {
isc_result_t isc_result;
task = task;
event = event;
/* signal shutdown processing complete */
/*
* Signal shutdown processing complete.
*/
isc_result = isc_mutex_lock(&Tx_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_lock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
isc_result = isc_condition_signal(&Tx_cv);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_signal failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
isc_result = isc_mutex_unlock(&Tx_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_unlock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
@ -89,7 +80,6 @@ tx_sde(isc_task_t *task, isc_event_t *event) {
static void
tx_te(isc_task_t *task, isc_event_t *event) {
isc_result_t isc_result;
isc_time_t now;
isc_time_t base;
@ -128,8 +118,7 @@ tx_te(isc_task_t *task, isc_event_t *event) {
++Tx_nfails;
}
Tx_lasttime = now;
}
else {
} else {
t_info("isc_time_now failed %s\n",
isc_result_totext(isc_result));
++Tx_nprobs;
@ -151,9 +140,9 @@ tx_te(isc_task_t *task, isc_event_t *event) {
static void
t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_interval_t *interval,
void (*action)(isc_task_t *, isc_event_t *)) {
isc_interval_t *interval,
void (*action)(isc_task_t *, isc_event_t *))
{
char *p;
isc_mem_t *mctx;
isc_taskmgr_t *tmgr;
@ -175,7 +164,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_mem_create(0, 0, &mctx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
return;
}
@ -183,7 +172,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_mutex_init(&Tx_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_init failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_mem_destroy(&mctx);
++Tx_nprobs;
return;
@ -192,7 +181,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_condition_init(&Tx_cv);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_init failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_mutex_destroy(&Tx_mx);
isc_mem_destroy(&mctx);
++Tx_nprobs;
@ -203,7 +192,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_taskmgr_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_mutex_destroy(&Tx_mx);
isc_condition_destroy(&Tx_cv);
isc_mem_destroy(&mctx);
@ -215,7 +204,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_timermgr_create(mctx, &timermgr);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_timermgr_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_taskmgr_destroy(&tmgr);
isc_mutex_destroy(&Tx_mx);
isc_condition_destroy(&Tx_cv);
@ -227,7 +216,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_mutex_lock(&Tx_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_lock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_taskmgr_destroy(&tmgr);
isc_mutex_destroy(&Tx_mx);
@ -241,7 +230,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_task_create(tmgr, 0, &task);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_task_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_taskmgr_destroy(&tmgr);
isc_mutex_destroy(&Tx_mx);
@ -254,7 +243,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_task_onshutdown(task, tx_sde, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_task_onshutdown failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_task_destroy(&task);
isc_taskmgr_destroy(&tmgr);
@ -278,14 +267,9 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
}
Tx_timer = NULL;
isc_result = isc_timer_create( timermgr,
timertype,
expires,
interval,
task,
action,
(void *) timertype,
&Tx_timer);
isc_result = isc_timer_create(timermgr, timertype, expires, interval,
task, action, (void *)timertype,
&Tx_timer);
if (isc_result != ISC_R_SUCCESS) {
isc_timermgr_destroy(&timermgr);
@ -298,12 +282,14 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
return;
}
/* wait for shutdown processing to complete */
/*
* Wait for shutdown processing to complete.
*/
while (Tx_eventcnt != Tx_nevents) {
isc_result = isc_condition_wait(&Tx_cv, &Tx_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_waituntil failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
}
@ -311,7 +297,7 @@ t_timers_x(isc_timertype_t timertype, isc_time_t *expires,
isc_result = isc_mutex_unlock(&Tx_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_unlock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
@ -391,10 +377,9 @@ t2() {
isc_interval_set(&interval, 0, 0);
t_timers_x(isc_timertype_once, &expires, &interval, tx_te);
}
else {
} else {
t_info("isc_time_nowplusinterval failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
}
result = T_UNRESOLVED;
@ -409,7 +394,6 @@ t2() {
static void
t3_te(isc_task_t *task, isc_event_t *event) {
isc_result_t isc_result;
isc_time_t now;
isc_time_t base;
@ -437,16 +421,15 @@ t3_te(isc_task_t *task, isc_event_t *event) {
++Tx_nfails;
}
Tx_lasttime = now;
}
else {
} else {
t_info("isc_time_now failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
if (event->ev_type != ISC_TIMEREVENT_IDLE) {
t_info("received event type %d, expected type %d\n",
event->ev_type, ISC_TIMEREVENT_IDLE);
event->ev_type, ISC_TIMEREVENT_IDLE);
++Tx_nfails;
}
@ -487,7 +470,7 @@ t3() {
}
else {
t_info("isc_time_nowplusinterval failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
@ -519,7 +502,9 @@ t4_te(isc_task_t *task, isc_event_t *event) {
t_info("tick %d\n", Tx_eventcnt);
/* check expired time */
/*
* Check expired time.
*/
isc_result = isc_time_now(&now);
if (isc_result == ISC_R_SUCCESS) {
@ -540,14 +525,14 @@ t4_te(isc_task_t *task, isc_event_t *event) {
}
else {
t_info("isc_time_now failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++Tx_nprobs;
}
if (Tx_eventcnt < 3) {
if (event->ev_type != ISC_TIMEREVENT_TICK) {
t_info("received event type %d, expected type %d\n",
event->ev_type, ISC_TIMEREVENT_IDLE);
event->ev_type, ISC_TIMEREVENT_IDLE);
++Tx_nfails;
}
if (Tx_eventcnt == 2) {
@ -567,18 +552,16 @@ t4_te(isc_task_t *task, isc_event_t *event) {
isc_result_totext(isc_result));
++Tx_nfails;
}
}
else {
} else {
t_info("isc_time_nowplusinterval failed %s\n",
isc_result_totext(isc_result));
++Tx_nprobs;
}
}
}
else {
} else {
if (event->ev_type != ISC_TIMEREVENT_LIFE) {
t_info("received event type %d, expected type %d\n",
event->ev_type, ISC_TIMEREVENT_IDLE);
event->ev_type, ISC_TIMEREVENT_IDLE);
++Tx_nfails;
}
@ -637,22 +620,21 @@ static isc_task_t *T5_task2;
/*
* T5_task1 blocks on T5_mx while events accumulate
* in it's queue, until signaled by T5_task2
* in it's queue, until signaled by T5_task2.
*/
static void
t5_start_event(isc_task_t *task, isc_event_t *event) {
isc_result_t isc_result;
task = task;
UNUSED(task);
t_info("t5_start_event\n");
isc_result = isc_mutex_lock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_lock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
@ -663,7 +645,7 @@ t5_start_event(isc_task_t *task, isc_event_t *event) {
isc_result = isc_mutex_unlock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_unlock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
isc_event_free(&event);
@ -681,8 +663,8 @@ t5_tick_event(isc_task_t *task, isc_event_t *event) {
t_info("t5_tick_event %d\n", T5_eventcnt);
/*
* on the first tick, purge all remaining tick events
* and then shut down the task
* On the first tick, purge all remaining tick events
* and then shut down the task.
*/
if (T5_eventcnt == 1) {
isc_time_settoepoch(&expires);
@ -692,7 +674,7 @@ t5_tick_event(isc_task_t *task, isc_event_t *event) {
&interval, ISC_TRUE);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_timer_reset failed %d\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nfails;
}
isc_task_shutdown(task);
@ -708,12 +690,12 @@ t5_once_event(isc_task_t *task, isc_event_t *event) {
t_info("t5_once_event\n");
/*
* allow task1 to start processing events
* Allow task1 to start processing events.
*/
isc_result = isc_mutex_lock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_lock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
@ -722,14 +704,14 @@ t5_once_event(isc_task_t *task, isc_event_t *event) {
isc_result = isc_condition_broadcast(&T5_cv);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_broadcast failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
isc_result = isc_mutex_unlock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_unlock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
@ -742,18 +724,18 @@ t5_shutdown_event(isc_task_t *task, isc_event_t *event) {
isc_result_t isc_result;
task = task;
event = event;
UNUSED(task);
UNUSED(event);
t_info("t5_shutdown_event\n");
/*
* signal shutdown processing complete
* Signal shutdown processing complete.
*/
isc_result = isc_mutex_lock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_lock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
@ -762,14 +744,14 @@ t5_shutdown_event(isc_task_t *task, isc_event_t *event) {
isc_result = isc_condition_signal(&T5_cv);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_signal failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
isc_result = isc_mutex_unlock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_unlock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
isc_event_free(&event);
@ -802,14 +784,14 @@ t_timers5() {
isc_result = isc_mem_create(0, 0, &mctx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mem_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
return(T_UNRESOLVED);
}
isc_result = isc_mutex_init(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_init failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_mem_destroy(&mctx);
return(T_UNRESOLVED);
}
@ -817,7 +799,7 @@ t_timers5() {
isc_result = isc_condition_init(&T5_cv);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_init failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_mutex_destroy(&T5_mx);
isc_mem_destroy(&mctx);
return(T_UNRESOLVED);
@ -827,7 +809,7 @@ t_timers5() {
isc_result = isc_taskmgr_create(mctx, workers, 0, &tmgr);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_taskmgr_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_mutex_destroy(&T5_mx);
isc_condition_destroy(&T5_cv);
isc_mem_destroy(&mctx);
@ -838,7 +820,7 @@ t_timers5() {
isc_result = isc_timermgr_create(mctx, &timermgr);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_timermgr_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_taskmgr_destroy(&tmgr);
isc_mutex_destroy(&T5_mx);
isc_condition_destroy(&T5_cv);
@ -850,7 +832,7 @@ t_timers5() {
isc_result = isc_task_create(tmgr, 0, &T5_task1);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_task_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_taskmgr_destroy(&tmgr);
isc_mutex_destroy(&T5_mx);
@ -862,7 +844,7 @@ t_timers5() {
isc_result = isc_task_onshutdown(T5_task1, t5_shutdown_event, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_task_onshutdown failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_task_destroy(&T5_task1);
isc_taskmgr_destroy(&tmgr);
@ -876,7 +858,7 @@ t_timers5() {
isc_result = isc_task_create(tmgr, 0, &T5_task2);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_task_create failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_task_destroy(&T5_task1);
isc_taskmgr_destroy(&tmgr);
@ -889,7 +871,7 @@ t_timers5() {
isc_result = isc_mutex_lock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_lock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
isc_timermgr_destroy(&timermgr);
isc_taskmgr_destroy(&tmgr);
isc_mutex_destroy(&T5_mx);
@ -906,14 +888,9 @@ t_timers5() {
isc_interval_set(&interval, T5_SECONDS, 0);
T5_tickertimer = NULL;
isc_result = isc_timer_create( timermgr,
isc_timertype_ticker,
&expires,
&interval,
T5_task1,
t5_tick_event,
NULL,
&T5_tickertimer);
isc_result = isc_timer_create(timermgr, isc_timertype_ticker,
&expires, &interval, T5_task1,
t5_tick_event, NULL, &T5_tickertimer);
if (isc_result != ISC_R_SUCCESS) {
isc_timermgr_destroy(&timermgr);
@ -965,12 +942,14 @@ t_timers5() {
return(T_UNRESOLVED);
}
/* wait for shutdown processing to complete */
/*
* Wait for shutdown processing to complete.
*/
while (! T5_shutdownflag) {
isc_result = isc_condition_wait(&T5_cv, &T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_condition_waituntil failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}
}
@ -978,7 +957,7 @@ t_timers5() {
isc_result = isc_mutex_unlock(&T5_mx);
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_mutex_unlock failed %s\n",
isc_result_totext(isc_result));
isc_result_totext(isc_result));
++T5_nprobs;
}

View File

@ -21,35 +21,24 @@
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/app.h>
#include <isc/base64.h>
#include <isc/commandline.h>
#include <isc/error.h>
#include <isc/lex.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/socket.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/app.h>
#include <isc/mutex.h>
#include <isc/boolean.h>
#include <isc/net.h>
#include <isc/socket.h>
#include <isc/log.h>
#include <isc/util.h>
#include <isc/lex.h>
#include <isc/base64.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/message.h>
#include <dns/name.h>
#include <dns/fixedname.h>
#include <dns/resolver.h>
#include <dns/events.h>
#include <dns/tsig.h>
#include <dns/tkey.h>
#include <dns/keyvalues.h>
#include <dns/message.h>
#include <dns/result.h>
#include <dns/tkey.h>
#include <dns/tsig.h>
#include <dns/view.h>
#include <dst/result.h>

View File

@ -17,33 +17,18 @@
#include <config.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/boolean.h>
#include <isc/region.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/result.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatatype.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/compress.h>
#include <dns/message.h>
#include "printmsg.h"
static inline void
CHECKRESULT(isc_result_t result, char *msg)
{
CHECKRESULT(isc_result_t result, char *msg) {
if (result != ISC_R_SUCCESS) {
printf("%s: %s\n", msg, dns_result_totext(result));

View File

@ -15,25 +15,25 @@
* SOFTWARE.
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/app.h>
#include <isc/assertions.h>
#include <isc/error.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/confparser.h>
#include <dns/journal.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/result.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zoneconf.h>
#include <dns/zt.h>
#include <dns/result.h>
#define ERRRET(result, function) \
do { \

Some files were not shown because too many files have changed in this diff Show More