print the version of ldns.
Some tweaks to other programs were also made.
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)
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 $@ $+
keygen: keygen.o $(LIBDNS_OBJECTS) $(LIBOBJS)
$(LINK) ${LIBS} -o $@ $+
+key2ds: key2ds.o $(LIBDNS_OBJECTS) $(LIBOBJS)
+ $(LINK) ${LIBS} -o $@ $+
+
# tests
tests:
(cd tests ; make)
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:
---------------
--- /dev/null
+.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<name>+<alg>+<id>
+
+.SH AUTHOR
+Written by the ldns team as an example for ldns usage.
+
+.SH REPORTING BUGS
+Report bugs to <ldns-team@nlnetlabs.nl>.
+
+.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.
.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<name>+<alg>+<id>
.SH OPTIONS
.TP
\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.
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");
}
(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]);
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);
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);
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);
/*
- * 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
int line_nr = 0;
char c;
- const char *prog = argv[0];
+ const char *prog = strdup(argv[0]);
inception = 0;
expiration = 0;
--- /dev/null
+/*
+ * version. Show ldns's version
+ * for a particulary domain
+ * (c) NLnet Labs, 2005
+ * Licensed under the GPL version 2
+ */
+
+#include <ldns/config.h>
+#include <ldns/dns.h>
+
+int
+main(void)
+{
+ printf("%s\n", ldns_version());
+ return 0;
+}