Skip to content

Commit

Permalink
Merge pull request #3 from pmconrad/r1.7
Browse files Browse the repository at this point in the history
Release 1.7
  • Loading branch information
pmconrad authored Jun 9, 2020
2 parents d48ddf1 + 8b3393b commit bb961ad
Show file tree
Hide file tree
Showing 61 changed files with 351 additions and 85 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Github Autobuild
on: [ push, pull_request ]
jobs:
doIt:
name: Build and run tests
runs-on: ubuntu-latest
steps:
- name: Prepare environment
run: |
sudo apt-get install -y cpanminus libcrypt-openssl-rsa-perl ucspi-tcp
sudo cpanm -i Digest::SHA1
- name: Check out sources
uses: actions/checkout@v2
- name: Make tinydnssec
run: |
make
- name: Download djbdns and dependencies
run: |
curl -sSO http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
curl -sSO http://www.fefe.de/dns/djbdns-1.05-test28.diff.xz
curl -sSO http://www.tinydnssec.org/djbdns-ipv6-make.patch
- name: Unpack and patch sources
run: |
mkdir -p _build
cd _build
tar xfz ../djbdns-1.05.tar.gz
cd djbdns-1.05
tar xfj ../../tinydnssec.tar.bz2
xzcat ../../djbdns-1.05-test28.diff.xz | patch -p1
patch -p0 <../../djbdns-ipv6-make.patch
patch -p1 <../../djbdns-1.05-dnssec.patch
- name: Configure
run: |
cd _build/djbdns-1.05
echo cc --include /usr/include/errno.h >conf-cc
- name: Build
run: |
cd _build/djbdns-1.05
make
- name: Run unit-tests
run: |
cd _build/djbdns-1.05
./run-tests.sh
- name: Run UDP tests
run: |
cd _build/djbdns-1.05
sudo IP=127.0.0.3 ROOT="`pwd`" UID=1 GID=1 ./tinydns &
SERVER=127.0.0.3 ./run-tests.sh -u
- name: Run TCP tests
run: |
cd _build/djbdns-1.05
sudo ROOT="`pwd`" UID=1 GID=1 tcpserver -HRl localhost 127.0.0.3 53 ./axfrdns &
SERVER=127.0.0.3 ./run-tests.sh -t
5 changes: 3 additions & 2 deletions INSTALL.tinydnssec
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ to install before the tinydnssec patch applies:
Unfortunately, fefe refuses to name a license for this patch, which means
that I cannot redistribute it.

2. My own fixes to the Makefile (IPv6-related): djbdns-ipv6-make.patch
2. My own fixes to the Makefile (IPv6-related):
http://www.tinydnssec.org/djbdns-ipv6-make.patch

Build
-----

1. Download and unpack the original djbdns sources from
http://cr.yp.to/djbdns/install.html .
2. Download and apply the patches listed above.
3. Download and unpack http://tinydnssec.org/tinydnssec-1.05-1.5.tar.bz2 in
3. Download and unpack http://tinydnssec.org/tinydnssec-1.05-1.7.tar.bz2 in
the top-level source directory.
4. Apply djbdns-1.05-dnssec.patch.
5. Install as per usual instructions (see http://cr.yp.to/djbdns/install.html ).
Expand Down
2 changes: 1 addition & 1 deletion README.tinydnssec
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ update:
LICENSE
-------

(C) 2012,2015,2017,2019 Peter Conrad <[email protected]>
(C) 2012,2015,2017,2019,2020 Peter Conrad <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
Expand Down
171 changes: 148 additions & 23 deletions djbdns-1.05-dnssec.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(C) 2012 Peter Conrad <[email protected]>
(C) 2012,2019,2020 Peter Conrad <[email protected]>

This patch is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
Expand Down Expand Up @@ -1223,8 +1223,8 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
+base32hex.o
+printtype.o
+edns0.o
--- djbdns-1.05-ipv6/tdlookup.c 2019-07-22 14:04:16.803064553 +0200
+++ djbdns-1.05-dnssec/tdlookup.c 2019-07-22 20:36:57.566950278 +0200
--- djbdns-1.05.orig/tdlookup.c 2020-05-31 12:26:32.153583322 +0200
+++ djbdns-1.05/tdlookup.c 2020-05-31 11:59:14.367285275 +0200
@@ -10,6 +10,9 @@
#include "response.h"
#include "ip6.h"
Expand Down Expand Up @@ -1253,7 +1253,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS

static int find(char *d,int flagwild)
{
@@ -105,6 +110,123 @@
@@ -105,6 +110,122 @@
return response_addname(d1);
}

Expand Down Expand Up @@ -1323,8 +1323,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
+ }
+
+ /* Find covering hash */
+ char nibble = ((digest[0] >> 4) & 0xf) + '0';
+ if (nibble > '9') { nibble += 'a' - '9' - 1; }
+ char nibble = ((digest[0] >> 4) & 0xf) + 'A';
+ salt[0] = 1;
+ salt[1] = nibble;
+ byte_copy(salt+2, dns_domain_length(control), control);
Expand Down Expand Up @@ -1377,7 +1376,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
static int doit(char *q,char qtype[2])
{
unsigned int bpos;
@@ -118,6 +240,8 @@
@@ -118,6 +239,8 @@
int r;
int flagns;
int flagauthoritative;
Expand All @@ -1386,7 +1385,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
char x[20];
uint16 u16;
char addr[8][4];
@@ -132,18 +256,28 @@
@@ -132,18 +255,28 @@
for (;;) {
flagns = 0;
flagauthoritative = 0;
Expand Down Expand Up @@ -1417,7 +1416,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
if (!flagauthoritative) {
response[2] &= ~4;
goto AUTHORITY; /* q is in a child zone */
@@ -152,7 +286,11 @@
@@ -152,7 +285,11 @@

flaggavesoa = 0;
flagfound = 0;
Expand All @@ -1430,7 +1429,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS

for (;;) {
addrnum = addr6num = 0;
@@ -162,8 +300,26 @@
@@ -162,8 +299,26 @@
if (r == -1) return 0;
flagfound = 1;
if (flaggavesoa && byte_equal(type,2,DNS_T_SOA)) continue;
Expand Down Expand Up @@ -1459,7 +1458,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
addrttl = ttl;
i = dns_random(addrnum + 1);
if (i < 8) {
@@ -174,7 +330,7 @@
@@ -174,7 +329,7 @@
if (addrnum < 1000000) ++addrnum;
continue;
}
Expand All @@ -1468,7 +1467,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
addr6ttl = ttl;
i = dns_random(addr6num + 1);
if (i < 8) {
@@ -188,6 +344,9 @@
@@ -188,6 +343,9 @@
if (!response_rstart(q,type,ttl)) return 0;
if (byte_equal(type,2,DNS_T_NS) || byte_equal(type,2,DNS_T_CNAME) || byte_equal(type,2,DNS_T_PTR)) {
if (!doname()) return 0;
Expand All @@ -1478,7 +1477,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
}
else if (byte_equal(type,2,DNS_T_MX)) {
if (!dobytes(2)) return 0;
@@ -199,6 +358,13 @@
@@ -199,6 +357,13 @@
if (!dobytes(20)) return 0;
flaggavesoa = 1;
}
Expand All @@ -1492,7 +1491,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
else
if (!response_addbytes(data + dpos,dlen - dpos)) return 0;
response_rfinish(RESPONSE_ANSWER);
@@ -219,10 +385,24 @@
@@ -219,10 +384,24 @@
if (flagfound) break;
if (wild == control) break;
if (!*wild) break; /* impossible */
Expand All @@ -1517,7 +1516,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
if (!flagfound)
response_nxdomain();

@@ -230,22 +410,49 @@
@@ -230,22 +409,49 @@
AUTHORITY:
aupos = response_len;

Expand Down Expand Up @@ -1579,7 +1578,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
cdb_findstart(&c);
while (r = find(control,0)) {
if (r == -1) return 0;
@@ -254,10 +461,33 @@
@@ -254,10 +460,33 @@
if (!doname()) return 0;
response_rfinish(RESPONSE_AUTHORITY);
}
Expand Down Expand Up @@ -1613,7 +1612,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS

bpos = anpos;
while (bpos < arpos) {
@@ -265,25 +495,33 @@
@@ -265,25 +494,33 @@
bpos = dns_packet_copy(response,arpos,bpos,x,10); if (!bpos) return 0;
if (byte_equal(x,2,DNS_T_NS) || byte_equal(x,2,DNS_T_MX)) {
if (byte_equal(x,2,DNS_T_NS)) {
Expand Down Expand Up @@ -1654,7 +1653,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
}
}
}
@@ -291,10 +529,10 @@
@@ -291,10 +528,10 @@
bpos += u16;
}

Expand All @@ -1667,7 +1666,7 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS
byte_zero(response + RESPONSE_AUTHORITY,2);
response_len = aupos;
}
@@ -316,6 +554,9 @@
@@ -316,6 +553,9 @@
cdb_init(&c,fd);

r = doit(q,qtype);
Expand All @@ -1677,10 +1676,119 @@ diff -rNU3 djbdns-1.05.tds-base/TARGETS djbdns-1.05.tinydnssec/TARGETS

cdb_free(&c);
close(fd);
diff -rNU3 djbdns-1.05.tds-base/tinydns-data.c djbdns-1.05.tinydnssec/tinydns-data.c
--- djbdns-1.05.tds-base/tinydns-data.c 2012-12-06 22:45:38.000000000 +0100
+++ djbdns-1.05.tinydnssec/tinydns-data.c 2012-12-06 22:39:13.000000000 +0100
@@ -436,7 +436,7 @@
--- djbdns-1.05.orig/tinydns-data.c 2020-05-31 12:26:32.153583322 +0200
+++ djbdns-1.05/tinydns-data.c 2020-05-31 11:49:26.624848116 +0200
@@ -155,14 +155,15 @@
rr_add(buf,4);
rr_add(ttd,8);
}
-void rr_finish(const char *owner)
+void rr_finish(const char *owner, int to_lower)
{
if (byte_equal(owner,2,"\1*")) {
owner += 2;
result.s[2] -= 19;
}
if (!stralloc_copyb(&key,owner,dns_domain_length(owner))) nomem();
- case_lowerb(key.s,key.len);
+ if (to_lower)
+ case_lowerb(key.s,key.len);
if (cdb_make_add(&cdb,key.s,key.len,result.s,result.len) == -1)
die_datatmp();
}
@@ -295,7 +296,7 @@
if (!dns_domain_fromdot(&d2,f[2].s,f[2].len)) nomem();
rr_addname(d2);
rr_add(soa,20);
- rr_finish(d1);
+ rr_finish(d1, 1);
break;

case '.': case '&':
@@ -319,17 +320,17 @@
rr_add("\12hostmaster",11);
rr_addname(d1);
rr_add(defaultsoa,20);
- rr_finish(d1);
+ rr_finish(d1, 1);
}

rr_start(DNS_T_NS,ttl,ttd,loc);
rr_addname(d2);
- rr_finish(d1);
+ rr_finish(d1, 1);

if (ip4_scan(f[1].s,ip)) {
rr_start(DNS_T_A,ttl,ttd,loc);
rr_add(ip,4);
- rr_finish(d2);
+ rr_finish(d2, 1);
}

break;
@@ -346,13 +347,13 @@
if (ip4_scan(f[1].s,ip)) {
rr_start(DNS_T_A,ttl,ttd,loc);
rr_add(ip,4);
- rr_finish(d1);
+ rr_finish(d1, 1);

if (line.s[0] == '=') {
dns_name4_domain(dptr,ip);
rr_start(DNS_T_PTR,ttl,ttd,loc);
rr_addname(d1);
- rr_finish(dptr);
+ rr_finish(dptr, 1);
}
}
break;
@@ -368,18 +369,18 @@
if (ip6_scan_flat(f[1].s,ip6)) {
rr_start(DNS_T_AAAA,ttl,ttd,loc);
rr_add(ip6,16);
- rr_finish(d1);
+ rr_finish(d1, 1);

if (line.s[0] == '6') { /* emit both .ip6.arpa and .ip6.int */
dns_name6_domain(d6ptr,ip6,DNS_IP6_ARPA);
rr_start(DNS_T_PTR,ttl,ttd,loc);
rr_addname(d1);
- rr_finish(d6ptr);
+ rr_finish(d6ptr, 1);

dns_name6_domain(d6ptr,ip6,DNS_IP6_INT);
rr_start(DNS_T_PTR,ttl,ttd,loc);
rr_addname(d1);
- rr_finish(d6ptr);
+ rr_finish(d6ptr, 1);
}
}
break;
@@ -406,12 +407,12 @@
uint16_pack_big(buf,u);
rr_add(buf,2);
rr_addname(d2);
- rr_finish(d1);
+ rr_finish(d1, 1);

if (ip4_scan(f[1].s,ip)) {
rr_start(DNS_T_A,ttl,ttd,loc);
rr_add(ip,4);
- rr_finish(d2);
+ rr_finish(d2, 1);
}
break;

@@ -428,7 +429,7 @@
else
rr_start(DNS_T_PTR,ttl,ttd,loc);
rr_addname(d2);
- rr_finish(d1);
+ rr_finish(d1, 1);
break;

case '\'':
@@ -444,14 +445,14 @@
i = 0;
while (i < f[1].len) {
k = f[1].len - i;
Expand All @@ -1689,6 +1797,23 @@ diff -rNU3 djbdns-1.05.tds-base/tinydns-data.c djbdns-1.05.tinydnssec/tinydns-da
ch = k;
rr_add(&ch,1);
rr_add(f[1].s + i,k);
i += k;
}

- rr_finish(d1);
+ rr_finish(d1, 1);
break;

case ':':
@@ -483,7 +484,7 @@

rr_start(type,ttl,ttd,loc);
rr_add(f[2].s,f[2].len);
- rr_finish(d1);
+ rr_finish(d1, u != 65282); /* preserve uppercase for hash database */
break;

default:
diff -rNU3 djbdns-1.05.tds-base/tinydns-get.c djbdns-1.05.tinydnssec/tinydns-get.c
--- djbdns-1.05.tds-base/tinydns-get.c 2001-02-11 22:11:45.000000000 +0100
+++ djbdns-1.05.tinydnssec/tinydns-get.c 2012-12-06 22:39:13.000000000 +0100
Expand Down
Loading

0 comments on commit bb961ad

Please sign in to comment.