commit:     1c9a0cc20a21ceefcca106c01c53b2a5cbafb7c5
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  5 16:27:06 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec  5 16:27:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c9a0cc2

net-dns/valtz: new revision with two more bugfix patches.

In Gentoo, we patch djbdns to support SRV records, and SRV records
involve underscores. The release version of valtz supports neither the
SRV record type nor the underscores used in them. This commit adds two
more patches to correct that.

Package-Manager: Portage-2.3.76, Repoman-2.3.16
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../valtz/files/add-support-for-srv-records.patch  | 83 ++++++++++++++++++++++
 .../valtz/files/allow-underscores-in-records.patch | 48 +++++++++++++
 .../{valtz-0.7-r2.ebuild => valtz-0.7-r3.ebuild}   |  4 +-
 3 files changed, 134 insertions(+), 1 deletion(-)

diff --git a/net-dns/valtz/files/add-support-for-srv-records.patch 
b/net-dns/valtz/files/add-support-for-srv-records.patch
new file mode 100644
index 00000000000..f8b9435c2ba
--- /dev/null
+++ b/net-dns/valtz/files/add-support-for-srv-records.patch
@@ -0,0 +1,83 @@
+From 9d29c28941ca629e223d0d4f20a833f10375d331 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Thu, 5 Dec 2019 10:28:40 -0500
+Subject: [PATCH 2/3] Add support for SRV records.
+
+There is a patch for djbdns that adds support for SRV records to both
+tinydns-data and axfr-get:
+
+  From: Michael Handler <hand...@sub-rosa.com>
+  To: d...@list.cr.yp.to
+  Subject: tinydns-data SRV & axfr-get SRV/PTR patches
+  Date: Thu, 14 Sep 2000 20:37:50 -040
+
+Many distributions carry the patch, but valtz rejects the SRV records
+because it doesn't recognize the "S" indicator or know how to validate
+the port, weight, or priority fields.
+
+This commit adds support for the new record type, and adds validation
+routines for the three new fields. All of them are the same: ports,
+weights, and priorities are all integers between 0 and 65536.
+---
+ valtz | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+ mode change 100644 => 100755 valtz
+
+diff --git a/valtz b/valtz
+old mode 100644
+new mode 100755
+index eebda76..92aaa40
+--- a/valtz
++++ b/valtz
+@@ -100,6 +100,9 @@ my %token_name = (
+     'min' => 'Minimum time',
+     'n' => 'Record type number',
+     'rdata' => 'Resource data',
++    'port' => 'Port',
++    'priority' => 'Priority',
++    'weight' => 'Weight'
+ );
+ 
+ my %record_type = (
+@@ -114,6 +117,7 @@ my %record_type = (
+     "'" => 'TXT',
+     '^' => 'PTR',
+     'C' => 'CNAME',
++    'S' => 'SRV',
+     'Z' => 'SOA',
+     ':' => 'GENERIC'
+ );
+@@ -131,6 +135,8 @@ my %line_type = (
+     "'" => [ 'TXT', 'fqdn:s:ttl:timestamp:lo', 'fqdn:s' ],
+     '^' => [ 'PTR', 'fqdn:p:ttl:timestamp:lo', 'fqdn:p' ],
+     'C' => [ 'CNAME', 'fqdn:p:ttl:timestamp:lo', 'fqdn:p' ],
++    'S' => [ 'SRV', 'fqdn:ip:x:port:weight:priority:ttl:timestamp:lo',
++           'fqdn:x:port' ],
+     'Z' => [ 'SOA', 'fqdn:mname:rname:ser:ref:ret:exp:min:ttl:timestamp:lo',
+             'fqdn:mname:rname' ],
+     ':' => [ 'GENERIC', 'fqdn:n:rdata:ttl:timestamp:lo', 'fqdn:n:rdata' ]
+@@ -340,6 +346,21 @@ my %token_validator = (
+         # TODO : Validation needed? 
+         my $result = 0;
+         return $result;
++     }],
++    'port' => [ 21, sub {
++        my ($type, $s) = @_;
++        my $result = validate_integer($s, 65536);
++        return $result;
++    }],
++    'priority' => [ 22, sub {
++        my ($type, $s) = @_;
++        my $result = validate_integer($s, 65536);
++        return $result;
++    }],
++    'weight' => [ 23, sub {
++        my ($type, $s) = @_;
++        my $result = validate_integer($s, 65536);
++        return $result;
+     }],
+ 
+ 
+-- 
+2.23.0
+

diff --git a/net-dns/valtz/files/allow-underscores-in-records.patch 
b/net-dns/valtz/files/allow-underscores-in-records.patch
new file mode 100644
index 00000000000..b76b231e6f1
--- /dev/null
+++ b/net-dns/valtz/files/allow-underscores-in-records.patch
@@ -0,0 +1,48 @@
+From 7c5df8ad5c18a9f8b9440dbd1ae4faacf55b452a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Thu, 5 Dec 2019 10:34:54 -0500
+Subject: [PATCH 1/3] Allow underscore characters in FQDNs and pointers.
+
+Modern DNS records can contain underscores for a number of reasons. In
+particular, DKIM records involve a "_domainkey" part,
+
+  https://tools.ietf.org/html/rfc6376
+
+that is rejected by the current "fqdn" and "p" validation routines.
+Moreover, any SRV records will have a service name prefixed with an
+underscore:
+
+  https://tools.ietf.org/html/rfc2782
+
+To recognize these tokens as valid, this commit expands the "fqdn" and
+"p" regular expressions to allow underscores as the first character in
+each component of an FQDN.
+---
+ valtz | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/valtz b/valtz
+index c68c120..eebda76 100644
+--- a/valtz
++++ b/valtz
+@@ -202,7 +202,7 @@ my %token_validator = (
+         # check all parts
+         for my $hostpart (split /\./, $s)
+         {
+-            return 1005 unless $hostpart =~ /^[-a-z0-9]+$/i;
++            return 1005 unless $hostpart =~ /^_?[-a-z0-9]+$/i;
+             return 1006 if $hostpart =~ /^-/;
+             return 1007 if $hostpart =~ /-$/;
+         }
+@@ -268,7 +268,7 @@ my %token_validator = (
+         # check all parts
+         for (split /\./, $s)
+         {
+-            return 1005 unless /^[-[a-z0-9]+$/i;
++            return 1005 unless /^_?[-[a-z0-9]+$/i;
+             return 1006 if /^-/;
+             return 1007 if /-$/;
+         }
+-- 
+2.23.0
+

diff --git a/net-dns/valtz/valtz-0.7-r2.ebuild 
b/net-dns/valtz/valtz-0.7-r3.ebuild
similarity index 71%
rename from net-dns/valtz/valtz-0.7-r2.ebuild
rename to net-dns/valtz/valtz-0.7-r3.ebuild
index 9c8e982dd0f..002d679c03a 100644
--- a/net-dns/valtz/valtz-0.7-r2.ebuild
+++ b/net-dns/valtz/valtz-0.7-r3.ebuild
@@ -14,7 +14,9 @@ IUSE=""
 
 RDEPEND="dev-lang/perl"
 
-PATCHES=( "${FILESDIR}/fix-generic-records-support.patch" )
+PATCHES=( "${FILESDIR}/fix-generic-records-support.patch"
+                 "${FILESDIR}/allow-underscores-in-records.patch"
+                 "${FILESDIR}/add-support-for-srv-records.patch" )
 
 src_install() {
        dobin valtz

Reply via email to