Commit 1a69a1a7 authored by David Lawrence's avatar David Lawrence

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.
    */
parent 595babf6
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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");
......
......@@ -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);
......
......@@ -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);
......
......@@ -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':