From: Miek Gieben Date: Mon, 5 Sep 2005 13:01:02 +0000 (+0000) Subject: added key2ds with a manual page and a stupid C program that X-Git-Tag: release-1.0.0~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc2b905fa01edd6b8bd85f41c05179aa59379af4;p=thirdparty%2Fldns.git added key2ds with a manual page and a stupid C program that print the version of ldns. Some tweaks to other programs were also made. --- diff --git a/Makefile.in b/Makefile.in index bd7267a2..2389b685 100644 --- a/Makefile.in +++ b/Makefile.in @@ -48,7 +48,7 @@ LIBDNS_HEADERS = ldns/error.h \ ldns/dns.h \ ldns/zone.h \ ldns/util.h -PROG_SOURCES = mx.c chaos.c keygen.c signzone.c +PROG_SOURCES = mx.c chaos.c keygen.c signzone.c key2ds.c version.c PROG_TARGETS = $(PROG_SOURCES:.c=) LIBDNS_OBJECTS = $(LIBDNS_SOURCES:.c=.o) @@ -130,6 +130,9 @@ release: realclean mx: mx.o $(LIBDNS_OBJECTS) $(LIBOBJS) $(LINK) ${LIBS} -o $@ $+ +version: version.o $(LIBDNS_OBJECTS) $(LIBOBJS) + $(LINK) ${LIBS} -o $@ $+ + signzone: signzone.o $(LIBDNS_OBJECTS) $(LIBOBJS) $(LINK) ${LIBS} -o $@ $+ @@ -139,6 +142,9 @@ chaos: chaos.o $(LIBDNS_OBJECTS) $(LIBOBJS) keygen: keygen.o $(LIBDNS_OBJECTS) $(LIBOBJS) $(LINK) ${LIBS} -o $@ $+ +key2ds: key2ds.o $(LIBDNS_OBJECTS) $(LIBOBJS) + $(LINK) ${LIBS} -o $@ $+ + # tests tests: (cd tests ; make) diff --git a/TODO b/TODO index 257ccf8c..873a6f14 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,7 @@ o [dnssec] Different digests for DS o [dnssec] NSEC generation?? o [doc] const function are correct i think, but const values in struct not o Error handling needs to be improved +o manual page for signzone Implementation: --------------- diff --git a/doc/key2ds.1 b/doc/key2ds.1 new file mode 100644 index 00000000..4d00fac9 --- /dev/null +++ b/doc/key2ds.1 @@ -0,0 +1,24 @@ +.TH key2ds 1 "30 May 2005" +.SH NAME +key2ds \- transform a DNSKEY RR to a DS RR +.SH SYNOPSIS +.B key2ds +.IR file + +.SH DESCRIPTION +\fBkey2ds\fR is used to transform a public DNSKEY RR to a DS RR. +When run it will read \fIfile\fR with a DNSKEY RR in it and +it will create a .ds file with the DS RR in it. + +It prints out the basename for this file: (K++ + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/doc/keygen.1 b/doc/keygen.1 index 46a29a0c..5a95b52b 100644 --- a/doc/keygen.1 +++ b/doc/keygen.1 @@ -9,8 +9,12 @@ keygen \- generate a keypair and print out the public part as a DNSKEY RR .IR DOMAIN .SH DESCRIPTION -\fBkeygen\fR is used to generate a private/public keypair. It prints out -the public key as a DNSKEY RR to stdout. +\fBkeygen\fR is used to generate a private/public keypair. When run it +will create 3 files; a .key file with the public DNSKEY, a .private +file with the private keydata and a .ds with the DS record of the +DNSKEY record. + +It prints out the basename for all these files: (K++ .SH OPTIONS .TP @@ -30,6 +34,11 @@ When given generate a key signing key. This just sets the flag field to \fBb \fIbits\fR Use this many bits for the key length. +.TP +\fbr \fdevice\fR +Make keygen use this file for its random data. This will default +to /dev/random. + .SH AUTHOR Written by the ldns team as an example for ldns usage. diff --git a/keygen.c b/keygen.c index ba0aefbd..aeb38b8d 100644 --- a/keygen.c +++ b/keygen.c @@ -13,7 +13,7 @@ void usage(FILE *fp, char *prog) { - fprintf(fp, "%s keygen [-D|-R] [-b bits] [-r /dev/random] domain\n", prog); + fprintf(fp, "%s [-D|-R] [-b bits] [-r /dev/random] domain\n", prog); fprintf(fp, " generate a new key pair for domain\n"); fprintf(fp, " -D\tgenerate a DSA key\n"); fprintf(fp, " -R\tgenerate a RSA key\n"); @@ -104,6 +104,9 @@ main(int argc, char *argv[]) } (void)ldns_init_random(random, def_bits * 8 * 2); /* I hope this is enough? */ + if (random) { + fclose(random); + } /* create an rdf from the domain name */ domain = ldns_dname_new_frm_str(argv[0]); @@ -135,7 +138,6 @@ main(int argc, char *argv[]) file = fopen(filename, "w"); if (!file) { fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - fprintf(stderr, "Aborting\n"); exit(EXIT_FAILURE); } else { ldns_rr_print(file, pubkey); @@ -149,7 +151,6 @@ main(int argc, char *argv[]) file = fopen(filename, "w"); if (!file) { fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - fprintf(stderr, "Aborting\n"); exit(EXIT_FAILURE); } else { ldns_key_print(file, key); @@ -163,7 +164,6 @@ main(int argc, char *argv[]) file = fopen(filename, "w"); if (!file) { fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - fprintf(stderr, "Aborting\n"); exit(EXIT_FAILURE); } else { ldns_rr_print(file, ds); diff --git a/signzone.c b/signzone.c index 5e132443..10205a4b 100644 --- a/signzone.c +++ b/signzone.c @@ -1,5 +1,5 @@ /* - * mx is a small programs that prints out the mx records + * signzone signs a zone file * for a particulary domain * (c) NLnet Labs, 2005 * Licensed under the GPL version 2 @@ -68,7 +68,7 @@ main(int argc, char *argv[]) int line_nr = 0; char c; - const char *prog = argv[0]; + const char *prog = strdup(argv[0]); inception = 0; expiration = 0; diff --git a/version.c b/version.c new file mode 100644 index 00000000..5f929d54 --- /dev/null +++ b/version.c @@ -0,0 +1,16 @@ +/* + * version. Show ldns's version + * for a particulary domain + * (c) NLnet Labs, 2005 + * Licensed under the GPL version 2 + */ + +#include +#include + +int +main(void) +{ + printf("%s\n", ldns_version()); + return 0; +}