+++ /dev/null
-Configure and compile it:
-./configure --with-ldns=../
-make
+++ /dev/null
-miek.nl. IN KEY 256 3 1 AQPaOlHrIWiCD/GvQuKWdZyRmnk/66EpTtjGJXKHAKQLY/A5dG8PKmYy xnKIQiBwCRL5DhNC1kufbkDoSs6Y9k6F
+++ /dev/null
-Private-key-format: v1.2
-Algorithm: 1 (RSA)
-Modulus: 2jpR6yFogg/xr0LilnWckZp5P+uhKU7YxiVyhwCkC2PwOXRvDypmMsZyiEIgcAkS+Q4TQtZLn25A6ErOmPZOhQ==
-PublicExponent: Aw==
-PrivateExponent: kXw2nMDwVrVLyiyXDvkTC7xQ1UfAxjSQhBj3BKsYB5a6NHAaPY+zAj35aL2xd+74UFK+uoQqpAWPcMJ45E2vsw==
-Prime1: 80QrIQMKkzmkrU7vLkRFvez9dBR9uvVK4QirvXf3qZ8=
-Prime2: 5aahJq/IRnXEzxw2Z/fc4JOUgRaSULQbCLZ7W8qKHVs=
-Exponent1: oi1yFgIHDNEYc4n0yYLZKUio+A2pJ04x61sdKPqlG78=
-Exponent2: mRnAxHUwLvkt32gkRU/olbe4Vg8MNc1nWyRSPTGxaOc=
-Coefficient: qCvRLHo6amRSJMErT+5wbhJNg36f4q4xM05SK01YPWg=
+++ /dev/null
-# Standard installation pathnames
-# See the file LICENSE for the license
-SHELL = @SHELL@
-VERSION = @PACKAGE_VERSION@
-basesrcdir = $(shell basename `pwd`)
-srcdir = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-mandir = @mandir@
-
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-
-COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS)
-LINK = $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS)
-
-HEADER = config.h
-TESTS = run-test0 run-test7 run-test18 run-test19 run-test20 \
- dname-label-test notify \
- rrsig-test serial server
-
-.PHONY: all clean realclean
-
-all: $(TESTS)
-
-run-test0: run-test0.o
- $(LINK) -o $@ $+
-
-run-test7: run-test7.o
- $(LINK) -o $@ $+
-
-run-test11: run-test11.o
- $(LINK) -o $@ $+
-
-run-test18: run-test18.o
- $(LINK) -lssl -o $@ $+
-
-run-test19: run-test19.o
- $(LINK) -lssl -o $@ $+
-
-run-test20: run-test20.o
- $(LINK) -lssl -o $@ $+
-
-rrsig-test: rrsig-test.o
- $(LINK) -lssl -o $@ $+
-
-dname-label-test: dname-label-test.o
- $(LINK) -o $@ $+
-
-notify: notify.o
- $(LINK) -o $@ $+
-
-serial: serial.o
- $(LINK) -o $@ $+
-
-server: server.o
- $(LINK) -o $@ $+
-
-## implicit rule
-#%.o: %.c $(HEADER)
-# $(COMPILE) -c $<
-%.o:
- $(COMPILE) -c $(srcdir)/$*.c
-
-clean:
- rm -f *.o
- rm -f $(TESTS)
- rm -f lua-rns
-
-realclean: clean
- rm -rf autom4te.cache/
- rm -f config.log config.status aclocal.m4 config.h.in configure Makefile
- rm -f config.h
-
-confclean: clean
- rm -rf config.log config.status config.h Makefile
+++ /dev/null
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.57)
-AC_INIT(drill, 1.0.1, drill@nlnetlabs.nl, drill)
-AC_CONFIG_SRCDIR([run-test0.c])
-
-AC_AIX
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_MAKE_SET
-
-# Checks for libraries.
-# Checks for header files.
-#AC_HEADER_STDC
-#AC_HEADER_SYS_WAIT
-# do the very minimum - we can always extend this
-AC_CHECK_HEADERS([getopt.h stdlib.h stdio.h assert.h netinet/in.hctype.h time.h])
-AC_CHECK_HEADERS(sys/param.h sys/mount.h,,,
-[
- [
- #if HAVE_SYS_PARAM_H
- # include <sys/param.h>
- #endif
- ]
-])
-
-# check for ldns
-AC_ARG_WITH(ldns,
- AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use])
- ,
- [
- specialldnsdir="$withval"
- CPPFLAGS="$CPPFLAGS -I$withval/include"
- LDFLAGS="$LDFLAGS -L$withval/lib"
- ]
-)
-
-AC_CHECK_LIB(ldns, ldns_rr_new,, [
- AC_MSG_ERROR([Can't find ldns library])
- ]
-)
-
-AC_CHECK_HEADER(ldns/dns.h,, [
- AC_MSG_ERROR([Can't find ldns headers])
- ]
-)
-
-AH_BOTTOM([
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <assert.h>
-
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-])
-
-
-#AC_CHECK_FUNCS([mkdir rmdir strchr strrchr strstr])
-
-#AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
-
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_HEADER([config.h])
-AC_OUTPUT
+++ /dev/null
-;
-; BIND data file for miek.nl for internal use
-;
-$TTL 2H
-@ IN SOA elektron.atoom.net. miekg.atoom.net. (
- 2005060700 ; Serial
- 6H ; Refresh
- 2H ; Retry
- 7D ; Expire
- 1H ) ; Negative Cache TTL
-
-@ IN NS elektron.atoom.net.
-@ IN MX 10 elektron.atoom.net.
-@ IN A 192.168.1.2
-
-god IN A 192.168.1.2
-
-
-sub.domain.miek.nl IN NS elektron.atoom.net.
- IN MX 10 elektron.atoom.net.
-
-www IN CNAME god
+++ /dev/null
-
-/* lowlevel test functions */
-#include "config.h"
-
-#include <ldns/dns.h>
-
-int
-main(int argc, char **argv)
-{
- ldns_rdf *test;
- ldns_rdf *test2;
- ldns_rdf *parent;
- ldns_rdf *child;
- ldns_rdf *newlabel;
-
- test = ldns_dname_new_frm_str("bla.miek.nl");
- test2 = ldns_dname_new_frm_str("www.bla.miek.nl");
-
- parent = ldns_dname_new_frm_str("yahoo.com");
- child = ldns_dname_new_frm_str("miek.nl");
-
- ldns_rdf_print(stdout, test);
- printf("\n");
-
- newlabel = ldns_dname_label(test, -1);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- newlabel = ldns_dname_label(test, 0);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- newlabel = ldns_dname_label(test, 1);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- newlabel = ldns_dname_label(test, 2);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- newlabel = ldns_dname_label(test, 3);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- newlabel = ldns_dname_label(test, 4);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- newlabel = ldns_dname_label(test, 5);
- ldns_rdf_print(stdout, newlabel);
- printf("\n");
- ldns_rdf_deep_free(newlabel);
-
- if (ldns_dname_is_subdomain(test2, test)) {
- printf("Yes, it's a subdomain\n");
- } else {
- printf("error\n");
- }
-
- if (ldns_dname_is_subdomain(child, parent)) {
- printf("Yes, it's a subdomain\n");
- } else {
- printf("error\n");
- }
-
- return 0;
-}
+++ /dev/null
-/*
- * send a notify packet to a server
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-int
-main(int argc, char **argv)
-{
- ldns_pkt *notify;
- ldns_rr *question;
- ldns_rdf *helper;
- ldns_resolver *res;
-
- notify = ldns_pkt_new();
- question = ldns_rr_new();
- res = ldns_resolver_new();
-
- if (!notify || !question || !res) {
- /* bail out */
- return EXIT_FAILURE;
- }
- /* get the port and nameserver ip from the config */
- ldns_resolver_set_port(res, LDNS_PORT);
- /* ldns_resolver_push_nameserver(res, ns); */
-
- /* create the rr */
- ldns_rr_set_class(question, LDNS_RR_CLASS_IN);
-
- helper = ldns_dname_new_frm_str("miek.nl");
- ldns_rr_set_owner(question, helper);
-
- ldns_rr_set_type(question, LDNS_RR_TYPE_SOA);
-
- ldns_pkt_set_opcode(notify, LDNS_PACKET_NOTIFY);
- ldns_pkt_push_rr(notify, LDNS_PACKET_QUESTION, question);
- ldns_pkt_set_aa(notify, true);
- ldns_pkt_set_id(notify, 42); /* from nsd-notify... */
-
- ldns_pkt_print(stdout, notify);
-
- /*ldns_resolver_send_pkt(NULL, res, notify)*/
- return EXIT_SUCCESS;
-}
+++ /dev/null
-/*
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-int main(void)
-{
- ldns_rr *sig;
- ldns_rdf *incep, *expir;
-
- time_t t_incep, t_expir, t_now;
- uint32_t tweemacht = 1;
-
- tweemacht = tweemacht << 31;
- tweemacht = tweemacht * 2 - 1;
-
- printf("tweemacht %u\n", tweemacht);
-
- sig = ldns_rr_new_frm_str("jelte.nlnetlabs.nl. 18000 IN RRSIG NSEC RSASHA1 3 18000 20050913235001 20050814235001 43791 nlnetlabs.nl. epWGR0WkhWQ1h0eXvU89W57xwI0xuUlWtvvUnABQVmUfZ2nGllIy2KLR5cfgpB5UH7beASrAo78AlPddPCnH50OYNjllesDy9HLderQtjQoi47SPPluLC6v3Fwqq64Zv0wf2fPzJqDSnOOrQPVzIuB3IDv5XD4M5t8Vze8QZ8lA=", 0, NULL, NULL);
-
- ldns_rr_print(stdout, sig);
-
- t_now = time(NULL);
- incep = ldns_rr_rrsig_inception(sig);
- t_incep = ldns_rdf2native_time_t(incep);
- expir = ldns_rr_rrsig_expiration(sig);
- t_expir = ldns_rdf2native_time_t(expir);
-
- printf("inception: [now %d] %d\n", t_now, t_incep);
- ldns_rdf_print(stdout, incep);
- printf("\n");
- printf("expiration: %d\n", t_expir);
- ldns_rdf_print(stdout, expir);
- printf("\n");
-
- if (t_expir - t_incep < 0) {
- printf("bad sig, expiration before inception?? Tsssg\n");
- }
- if (t_now - t_incep < 0) {
- printf("bad sig, inception date has passed\n");
- }
- if (t_expir - t_now < 0) {
- printf("bad sig, expiration date has passed\n");
- }
- printf("Sig dates are all correct\n");
-}
+++ /dev/null
-/*
- * test main.c
- *
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-/*
- 0xc2, 0xb4, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
- 0x00, 0x02, 0x00, 0x02, 0x03, 0x77, 0x77, 0x77,
- 0x0b, 0x6b, 0x61, 0x6e, 0x61, 0x72, 0x69, 0x65,
- 0x70, 0x69, 0x65, 0x74, 0x03, 0x63, 0x6f, 0x6d,
- 0x00, 0x00, 0x01, 0x00, 0x01
-};
-*/
-/*
-static const uint8_t wire[] = {
- 0xd0, 0x0e, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00,
- 0x02, 0x03, 0x77, 0x77, 0x77, 0x0b, 0x6b, 0x61, 0x6e, 0x61, 0x72,
- 0x69, 0x65, 0x70, 0x69, 0x65, 0x74, 0x03, 0x63, 0x6f, 0x6d, 0x00,
- 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x45, 0xf2, 0x00, 0x04, 0xd5, 0x85, 0x27, 0xcf, 0xc0, 0x10,
- 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x45, 0xf2, 0x00, 0x11, 0x03,
- 0x6e, 0x73, 0x32, 0x08, 0x68, 0x65, 0x78, 0x6f, 0x6e, 0x2d, 0x69,
- 0x73, 0x02, 0x6e, 0x6c, 0x00, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01,
- 0x00, 0x01, 0x45, 0xf2, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x31, 0xc0,
- 0x45, 0xc0, 0x5e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xfb, 0x2e,
- 0x00, 0x04, 0xd5, 0x85, 0x27, 0xcb, 0xc0, 0x41, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x00, 0xfb, 0x2c, 0x00, 0x04, 0xd4, 0xcc, 0xdb, 0x5b
-};
-*/
-static const uint8_t wire[] = {
-0x4c, 0xf2, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x05
-, 0x6a, 0x65, 0x6c, 0x74, 0x65, 0x09, 0x6e,
-0x6c, 0x6e, 0x65, 0x74, 0x6c, 0x61, 0x62, 0x73, 0x02, 0x6e, 0x6c, 0x00, 0x00, 0x0f, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0f,
-0x00, 0x01, 0x00, 0x00, 0x02, 0x54, 0x00, 0x08, 0x00, 0x0a, 0x03, 0x73, 0x6f, 0x6c, 0xc0, 0x12, 0xc0, 0x0c, 0x00, 0x02,
-0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x32, 0xc0, 0x0c, 0xc0, 0x0c, 0x00, 0x02, 0x00, 0x01,
-0x00, 0x00, 0x00, 0x73, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x31, 0xc0, 0x0c, 0xc0, 0x56, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
-0x00, 0x73, 0x00, 0x04, 0xc3, 0xa9, 0xd7, 0x9b, 0xc0, 0x44, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x04,
-0xc3, 0xa9, 0xd7, 0x9b
-};
-
-int
-main(void)
-{
- ldns_rdf *rd_f;
- ldns_rr *rr;
- ldns_pkt *packet;
- ldns_status status;
- char *rdfstr;
- uint8_t *rdf_data;
-
- rr = ldns_rr_new();
-
- rdf_data = (uint8_t *) LDNS_XMALLOC(char, LDNS_MAX_DOMAINLEN);
- rdf_data[0] = 3;
- memcpy(rdf_data+1, "www", 3);
- rdf_data[4] = 4;
- memcpy(rdf_data+5, "test", 4);
- rdf_data[9] = 3;
- memcpy(rdf_data+10, "net", 3);
- rdf_data[13] = 0;
- rd_f = ldns_rdf_new(LDNS_RDF_TYPE_DNAME, 20, rdf_data);
-
- ldns_rr_push_rdf(rr, rd_f);
- status = ldns_wire2pkt(&packet, wire, sizeof(wire));
- if (status == LDNS_STATUS_OK) {
- printf("packet id: %d\n", (int) ldns_pkt_id(packet));
- printf("qr bit: %d\n", (int) ldns_pkt_qr(packet));
- printf("opcode: %d\n",(int) ldns_pkt_get_opcode(packet));
- printf("aa bit: %d\n",(int) ldns_pkt_aa(packet));
- printf("tc bit: %d\n",(int) ldns_pkt_tc(packet));
- printf("rd bit: %d\n",(int) ldns_pkt_rd(packet));
- printf("cd bit: %d\n",(int) ldns_pkt_cd(packet));
- printf("ra bit: %d\n",(int) ldns_pkt_ra(packet));
- printf("ad bit: %d\n",(int) ldns_pkt_ad(packet));
- printf("rcode: %d\n",(int) ldns_pkt_rcode(packet));
- printf("qdcount: %d\n",(int) ldns_pkt_qdcount(packet));
- printf("ancount: %d\n",(int) ldns_pkt_ancount(packet));
- printf("nscount: %d\n",(int) ldns_pkt_nscount(packet));
- printf("arcount: %d\n",(int) ldns_pkt_arcount(packet));
- printf("pkt2str:\n");
- rdfstr = ldns_pkt2str(packet);
- if (rdfstr) {
- printf("%s\n", rdfstr);
- } else {
- printf("error\n");
- }
- ldns_pkt_free(packet);
- } else {
- printf("error in wire2packet: %d\n", status);
- }
-
-/*
- printf("host2str:\n");
- rdfstr = ldns_rdf2str(rr->_rdata_fields[0]);
- if (rdfstr) {
- printf("%s\n", rdfstr);
- } else {
- printf("error\n");
- }
-
- printf("rr2str:\n");
- rdfstr = ldns_rr2str(rr);
- if (rdfstr) {
- printf("%s\n", rdfstr);
- } else {
- printf("error\n");
- }
-
-
-*/
-
-
- return 0;
-}
-
+++ /dev/null
-/**
- * An example ldns program
- *
- * Setup a resolver
- * Query a nameserver
- * Print the result
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-
-void
-print_usage(char *file)
-{
- printf("AXFR example\n");
- printf("Usage: %s <domain> <server ip>\n", file);
- printf("ipv4 only atm\n");
- exit(0);
-}
-
-int
-main(int argc, char **argv)
-{
- ldns_rdf *nameserver;
- ldns_rdf *domain;
-
- ldns_resolver *resolver;
- ldns_rr *rr = NULL;
-
- char *server_ip = NULL;
- char *name = NULL;
- char *rr_str;
-
- /* Get the domain and the nameserver from the command line */
- if (argc < 3) {
- print_usage(argv[0]);
- } else {
- name = argv[1];
- server_ip = argv[2];
- }
-
- nameserver = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, server_ip);
- if (!nameserver) {
- printf("Bad server ip\n");
- return -1;
- }
-
- resolver = ldns_resolver_new();
- ldns_resolver_set_usevc(resolver, true);
- (void) ldns_resolver_push_nameserver(resolver, nameserver);
-
- domain = ldns_dname_new_frm_str(name);
- if (!domain) {
- printf("Bad domain\n");
- }
-
- (void) ldns_axfr_start(resolver, domain, LDNS_RR_CLASS_IN);
-
- while ((rr = ldns_axfr_next(resolver))) {
- rr_str = ldns_rr2str(rr);
- printf("%s\n", rr_str);
- ldns_rr_free(rr);
- LDNS_FREE(rr_str);
- }
-
-
- ldns_rdf_free(nameserver);
- ldns_rdf_free(domain);
- ldns_resolver_free(resolver);
-
- return 0;
-}
+++ /dev/null
-/*
- * mx is a small programs that prints out the mx records
- * for a particulary domain
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-
-
-int
-usage(FILE *fp, char *prog) {
- fprintf(fp, "%s keygen\n", prog);
- fprintf(fp, " generate a DNSKEY RR \n");
- return 0;
-}
-
-int
-main()
-{
- ldns_rr *dnskey;
- ldns_key *privkey;
- ldns_rr *dnskey_dsa;
- ldns_key *privkey_dsa;
- ldns_rdf *owner;
- ldns_rr *rr;
- ldns_key_list *keys;
- ldns_rr_list *rrs;
- ldns_rr_list *signatures;
- ldns_rr_list *dnskeys;
- const char *soa_string1;
- const char *soa_string2;
- const char *soa_string3;
-
- keys = ldns_key_list_new();
- rrs = ldns_rr_list_new();
- dnskeys = ldns_rr_list_new();
-
- /* well formed */
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN A 195.169.222.38\na.miek.nl. 1800 IN A 195.169.222.38", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN A 195.169.222.38 ", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- soa_string1 = "miek.nl. 3600 IN SOA elektron.atoom.net. miekg.atoom.net. ( \
-2002120700 ; hallo ik ben miek\n\
-21600 \n\
-7200 \n\
-604800 \n\
-3600 \n\
-)";
- soa_string2 = "miek.nl. 3600 IN SOA elektron.atoom.net. miekg.atoom.net. (\
-2002120700 ; serial \n\
-21600 ; more shit\n\
-7200 ; ahh retry \n\
-604800 ; meaningless number to annoy me\n\
-3600 ; negative caching\n\
-)";
-
- rr = ldns_rr_new_frm_str(soa_string1, 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
- rr = ldns_rr_new_frm_str(soa_string2, 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN MX 10 www.atoom.net", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN MX 10 w\\065.atoom.net", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN MX 10 w\\65.atoom.net", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN MX 10 www\\.www.atoom.net", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN MX 10 \\.", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- printf("rr sig with inception as epoch number\n");
- rr = ldns_rr_new_frm_str("nlnetlabs.nl. 86400 IN RRSIG DNSKEY RSASHA1 2 86400 1114695776 1112103776 43791 nlnetlabs.nl. FE//RZ0Z1sMzea0ioOLFpUIcM3wnxLGndtKUXJSM3SQ3BlYok2fUTiI+zegNoB1YdylWsfohZJfjkODrOJO9PSbN7hMHmzFEsDFAbCU75TySBuxv2UQlQVuTznxtRdvLGIRGxRhPmjlc/gtJPMB4XJKUWmtkzlTVKqZU7oNCsLA=", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- printf("rr sig with inception as date\n");
- rr = ldns_rr_new_frm_str("nlnetlabs.nl. 86400 IN RRSIG DNSKEY RSASHA1 2 86400 20050105121300 1112103776 43791 nlnetlabs.nl. FE//RZ0Z1sMzea0ioOLFpUIcM3wnxLGndtKUXJSM3SQ3BlYok2fUTiI+zegNoB1YdylWsfohZJfjkODrOJO9PSbN7hMHmzFEsDFAbCU75TySBuxv2UQlQVuTznxtRdvLGIRGxRhPmjlc/gtJPMB4XJKUWmtkzlTVKqZU7oNCsLA=", 0, NULL, NULL);
-
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- /* miss formed */
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN MX 10", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN A 267.271.122.1t", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- printf("this must work again\n");
- rr = ldns_rr_new_frm_str("a.miek.nl. IN A 127.0.0.1", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
- rr = ldns_rr_new_frm_str("a.miek.nl. 1D IN A 127.0.0.1", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- rr = ldns_rr_new_frm_str("a.miek.nl. 1800 IN A 195.169.222.38", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
- printf("\n");
-
- privkey = ldns_key_new_frm_algorithm(LDNS_SIGN_RSASHA1, 512);
- if (!privkey) {
- printf("Ah, keygen failed");
- exit(1);
- }
-
- owner = ldns_dname_new_frm_str("miek.nl");
- ldns_key_set_pubkey_owner(privkey, owner);
-
- ldns_key_set_origttl(privkey, 1800);
- /* SSL_load_error_strings();*/
-
- ldns_key_list_push_key(keys, privkey);
-
- ldns_rr_list_push_rr(rrs, rr);
-
- dnskey = ldns_key2rr(privkey);
- if (dnskey) {
- ldns_rr_print(stdout, dnskey);
- printf("; {%d}\n",
- (int) ldns_calc_keytag(dnskey));
- printf("\n");
- ldns_key_set_keytag(privkey, ldns_calc_keytag(dnskey));
- } else {
- exit(1);
- }
- ldns_rr_list_push_rr(dnskeys, dnskey);
-
- signatures = ldns_sign_public(rrs, keys);
-
- ldns_rr_list_print(stdout, signatures);
-
- printf("Now we are going to verify\n");
-
- printf("\n[%d]\n", ldns_verify(rrs, signatures, dnskeys, NULL));
-
- return 0;
-}
+++ /dev/null
-/*
- * mx is a small programs that prints out the mx records
- * for a particulary domain
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-int
-usage(FILE *fp, char *prog) {
- fprintf(fp, "%s keygen\n", prog);
- fprintf(fp, " generate a DNSKEY RR \n");
- return 0;
-}
-
-int
-main()
-{
- ldns_resolver *r;
- ldns_rdf *aaaa;
- ldns_rr_list *hosts;
-
- r = ldns_resolver_new_frm_file(NULL);
- if (!r) {
- printf("something wrong?\n");
- }
-
- printf("::0\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "::0");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("0::1\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "0::1");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("0::0\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "0::0");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("ff:192.168.1.1\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "ff:192.168.1.1");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("::A0\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "::A0");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("FF:0:0:0:0::1\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "FF:0:0:0:0::1");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("FF:0:0:0:1::0\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "FF:0:0:0:1::0");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
- printf("FF:0:0:0:1::0:1\n");
- aaaa = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, "FF:0:0:0:1::0:1");
- ldns_rdf_print(stdout, aaaa);
- printf("\n\n");
-
- /*
- hosts = ldns_get_rr_list_hosts_frm_file(NULL);
- ldns_rr_list_print(stdout, hosts);
- */
-
- return 0;
-}
+++ /dev/null
-/*
- * mx is a small programs that prints out the mx records
- * for a particulary domain
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-int
-usage(FILE *fp, char *prog) {
- fprintf(fp, "%s keygen\n", prog);
- fprintf(fp, " generate a DNSKEY RR \n");
- return 0;
-}
-
-int
-main(void)
-{
- ldns_rr *dnskey;
- ldns_key *privkey;
- ldns_rr *dnskey_dsa;
- ldns_key *privkey_dsa;
- ldns_rdf *owner;
- ldns_rr *rr;
- ldns_key_list *keys;
- ldns_rr_list *rrs;
- ldns_rr_list *signatures;
- ldns_rr_list *dnskeys;
- ldns_rr_list *result_keys;
- ldns_status result;
-
- /* ----- */
- FILE *f;
- char *d;
- char *keyfilename;
-
- d = LDNS_XMALLOC(char, 1000);
-
- keys = ldns_key_list_new();
- rrs = ldns_rr_list_new();
- dnskeys = ldns_rr_list_new();
-
- privkey = ldns_key_new_frm_algorithm(LDNS_SIGN_RSASHA1, 512);
- if (!privkey) {
- printf("Ah, keygen failed");
- exit(1);
- }
-
- owner = ldns_dname_new_frm_str("jelte.nlnetlabs.nl");
- ldns_key_set_pubkey_owner(privkey, owner);
-
- ldns_key_set_origttl(privkey, 1800);
- SSL_load_error_strings();
-
- ldns_key_list_push_key(keys, privkey);
-
- rr = ldns_rr_new_frm_str("www.jelte.nlnetlabs.nl. IN A 127.0.0.1", 0, NULL, NULL);
- ldns_rr_print(stdout, rr);
-
- ldns_rr_list_push_rr(rrs, rr);
-
- dnskey = ldns_key2rr(privkey);
- if (dnskey) {
- ldns_rr_print(stdout, dnskey);
- printf("; {%d}\n",
- (int) ldns_calc_keytag(dnskey));
- printf("\n");
- ldns_key_set_keytag(privkey, ldns_calc_keytag(dnskey));
- } else {
- exit(1);
- }
- ldns_rr_list_push_rr(dnskeys, dnskey);
-
- ldns_rr_list_print(stdout, dnskeys);
- printf("\n Trying to sign\n");
-
- signatures = ldns_sign_public(rrs, keys);
-
- printf("DATA:\n");
- ldns_rr_list_print(stdout, rrs);
-
- printf("SIGS:\n");
-
- ldns_rr_list_print(stdout, signatures);
-
- printf("KEYS:\n");
- ldns_rr_list_print(stdout, dnskeys);
-
- printf("Now we are going to verify\n");
-
- result_keys = ldns_rr_list_new();
- result = ldns_verify(rrs, signatures, dnskeys, result_keys);
-
- printf("RESULT:\n");
-/* ldns_rr_list_print(stdout, result_keys);*/
-
- if (result == LDNS_STATUS_OK) {
- printf("SUCCESS\n\n");
- } else {
- printf("FAILURE\n\n");
- }
-
- return 0;
-}
+++ /dev/null
-/**
- * An example ldns program
- *
- * Setup a resolver
- * Query a nameserver
- * Print the result
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-void
-print_usage(char *file)
-{
- printf("Usage: %s <type> <name> <server ip>\n", file);
- printf("ipv4 only atm\n");
- exit(0);
-}
-
-int
-main(int argc, char **argv)
-{
- ldns_resolver *res;
- ldns_rdf *qname;
- ldns_rdf *nameserver;
- /*ldns_rdf *default_dom;*/
- ldns_pkt *pkt;
- char *server_ip = NULL;
- char *name = NULL;
- char *type = NULL;
-
- if (argc < 4) {
- print_usage(argv[0]);
- } else {
- type = argv[1];
- name = argv[2];
- server_ip = argv[3];
- }
-
- /* init */
- res = ldns_resolver_new();
- if (!res)
- return 1;
-
- /* create a default domain and add it */
-
-#if 0
- default_dom = ldns_dname_new_frm_str("miek.nl.");
- ldns_resolver_set_domain(res, default_dom);
- ldns_resolver_set_defnames(res, true); /* use the suffix */
-#endif
-
- nameserver = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, server_ip);
- if (!nameserver) {
- printf("Bad server ip\n");
- return 1;
- }
-
-
-
- if (ldns_resolver_push_nameserver(res, nameserver) != LDNS_STATUS_OK) {
- printf("error push nameserver\n");
- return 1;
- }
- /* setup the question */
- qname = ldns_dname_new_frm_str(name);
- if (!qname) {
- printf("error making qname\n");
- return 1;
- }
-
- pkt = ldns_resolver_query(res, qname, ldns_get_rr_type_by_name(type), 0, LDNS_RD);
-
- if (!pkt) {
- printf("error pkt sending\n");
- return 1;
- }
-
- /* print the resulting pkt to stdout */
- ldns_pkt_print(stdout, pkt);
-
- ldns_rdf_free(nameserver);
- ldns_rdf_free(qname);
- ldns_pkt_free(pkt);
- ldns_resolver_deep_free(res);
- return 0;
-}
+++ /dev/null
-#include "config.h"
-
-#include <ldns/dns.h>
-
-void
-test_serial(uint32_t a, uint32_t b)
-{
- printf("%d : %d\n", a, b);
-
- printf("%d\n",
- ldns_serial(a,b));
-}
-
-int
-main(void)
-{
- /* serial tests */
- test_serial(1, 1);
- test_serial(1, 2);
- test_serial(2, 1);
- test_serial(0, 0);
-
-
-}
-
+++ /dev/null
-/*
- * Small server implementation
- * that prints out everything it receives
- */
-
-#include "config.h"
-
-#include <ldns/dns.h>
-
-int
-usage(FILE *fp, char *prog) {
- fprintf(fp, "%s\n", prog);
- fprintf(fp, " run a small mirroring server\n");
- return 0;
-}
-
-int
-main(void)
-{
- /* setup a socket, listen for incomings, print them out */
- int sockfd;
-
-
-
-
-
-
-}