]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
added key2ds with a manual page and a stupid C program that
authorMiek Gieben <miekg@NLnetLabs.nl>
Mon, 5 Sep 2005 13:01:02 +0000 (13:01 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Mon, 5 Sep 2005 13:01:02 +0000 (13:01 +0000)
print the version of ldns.

Some tweaks to other programs were also made.

Makefile.in
TODO
doc/key2ds.1 [new file with mode: 0644]
doc/keygen.1
keygen.c
signzone.c
version.c [new file with mode: 0644]

index bd7267a2af8498d7ffe52141900dbde97e2c54fc..2389b68564bafa5bea66b06afe888d15372e1273 100644 (file)
@@ -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 257ccf8cc96d8a80e55c5ebbae17d30b00e6118c..873a6f143fd801dc6775c9cae8404f081849c0c3 100644 (file)
--- 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 (file)
index 0000000..4d00fac
--- /dev/null
@@ -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<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.
index 46a29a0c327a34463ebcee05848781204150ed95..5a95b52bd5b86d7c90d6513d644868720ca67641 100644 (file)
@@ -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<name>+<alg>+<id>
 
 .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.
 
index ba0aefbd163b29b6f3776c9c6a44e3f1c480fdeb..aeb38b8da3b0cb3a80e9f3bbf3d48a2695a6d941 100644 (file)
--- 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);
index 5e1324435b1d9d4fda845ccbe6d2feeb94b76c53..10205a4b21e7cf04a40eb93ad56a3e7982b6e04d 100644 (file)
@@ -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 (file)
index 0000000..5f929d5
--- /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 <ldns/config.h>
+#include <ldns/dns.h>
+
+int
+main(void)
+{
+       printf("%s\n", ldns_version());
+        return 0;
+}