Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/rbldnsd/files/, net-dns/rbldnsd/
Date: Sat, 02 May 2020 11:17:45
Message-Id: 1588418118.d17b37ba9ddaa5fd66bb2e93adeed13b74418e04.mjo@gentoo
1 commit: d17b37ba9ddaa5fd66bb2e93adeed13b74418e04
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 2 11:15:18 2020 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sat May 2 11:15:18 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d17b37ba
7
8 net-dns/rbldnsd: prune the version with the python-2.7 test suite.
9
10 Closes: https://bugs.gentoo.org/715180
11 Package-Manager: Portage-2.3.89, Repoman-2.3.20
12 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
13
14 .../rbldnsd-0.997a-robust-ipv6-test-support.patch | 329 ---------------------
15 net-dns/rbldnsd/rbldnsd-0.998b.ebuild | 68 -----
16 2 files changed, 397 deletions(-)
17
18 diff --git a/net-dns/rbldnsd/files/rbldnsd-0.997a-robust-ipv6-test-support.patch b/net-dns/rbldnsd/files/rbldnsd-0.997a-robust-ipv6-test-support.patch
19 deleted file mode 100644
20 index e1ac1535dc9..00000000000
21 --- a/net-dns/rbldnsd/files/rbldnsd-0.997a-robust-ipv6-test-support.patch
22 +++ /dev/null
23 @@ -1,329 +0,0 @@
24 -diff --git a/NEWS b/NEWS
25 -index 8d8bdd9..4d8c01d 100644
26 ---- a/NEWS
27 -+++ b/NEWS
28 -@@ -1,6 +1,19 @@
29 - This file describes user-visible changes in rbldnsd.
30 - Newer news is at the top.
31 -
32 -+Next release
33 -+
34 -+ - fix tests for systems without ipv6 support, or when ipv6 is
35 -+ disabled in rbldnsd at compile-time
36 -+
37 -+ - fix tests for API change in pydns >= 2.3.6
38 -+
39 -+ - It is no longer an error to request binding to a particular
40 -+ address/port more than once. (The subsequent requests are simply
41 -+ ignored.) (This avoids confusion on certain systems/configurations
42 -+ where gethostbyname("localhost") can return 127.0.0.1 multiple
43 -+ times.)
44 -+
45 - 0.997a (23 Jul 2013)
46 -
47 - - minor fixes/changes in packaging, no code changes.
48 -diff --git a/rbldnsd.c b/rbldnsd.c
49 -index abf1d01..8322bdd 100644
50 ---- a/rbldnsd.c
51 -+++ b/rbldnsd.c
52 -@@ -203,10 +203,79 @@ static volatile int signalled;
53 - #define SIGNALLED_ZSTATS 0x10
54 - #define SIGNALLED_TERM 0x20
55 -
56 -+static inline int sockaddr_in_equal(const struct sockaddr_in *addr1,
57 -+ const struct sockaddr_in *addr2)
58 -+{
59 -+ return (addr1->sin_port == addr2->sin_port
60 -+ && addr1->sin_addr.s_addr == addr2->sin_addr.s_addr);
61 -+}
62 -+
63 -+#ifndef NO_IPv6
64 -+static inline int sockaddr_in6_equal(const struct sockaddr_in6 *addr1,
65 -+ const struct sockaddr_in6 *addr2)
66 -+{
67 -+ if (memcmp(addr1->sin6_addr.s6_addr, addr2->sin6_addr.s6_addr, 16) != 0)
68 -+ return 0;
69 -+ return (addr1->sin6_port == addr2->sin6_port
70 -+ && addr1->sin6_flowinfo == addr2->sin6_flowinfo
71 -+ && addr1->sin6_scope_id == addr2->sin6_scope_id);
72 -+}
73 -+#endif
74 -+
75 -+static inline int sockaddr_equal(const struct sockaddr *addr1,
76 -+ const struct sockaddr *addr2)
77 -+{
78 -+ if (addr1->sa_family != addr2->sa_family)
79 -+ return 0;
80 -+ switch (addr1->sa_family) {
81 -+ case AF_INET:
82 -+ return sockaddr_in_equal((const struct sockaddr_in *)addr1,
83 -+ (const struct sockaddr_in *)addr2);
84 -+#ifndef NO_IPv6
85 -+ return sockaddr_in6_equal((const struct sockaddr_in6 *)addr1,
86 -+ (const struct sockaddr_in6 *)addr2);
87 -+#endif
88 -+ default:
89 -+ error(0, "unknown address family (%d)", addr1->sa_family);
90 -+ }
91 -+}
92 -+
93 -+/* already_bound(addr, addrlen)
94 -+ *
95 -+ * Determine whether we've already bound to a particular address.
96 -+ * This is here mostly to deal with the fact that on certain systems,
97 -+ * gethostbyname()/getaddrinfo() can return a duplicate 127.0.0.1
98 -+ * for 'localhost'. See
99 -+ * - https://sourceware.org/bugzilla/show_bug.cgi?id=4980
100 -+ * - https://bugzilla.redhat.com/show_bug.cgi?id=496300
101 -+ */
102 -+static int already_bound(const struct sockaddr *addr, socklen_t addrlen) {
103 -+#ifdef NO_IPv6
104 -+ struct sockaddr_in addr_buf;
105 -+#else
106 -+ struct sockaddr_in6 addr_buf;
107 -+#endif
108 -+ struct sockaddr *boundaddr = (struct sockaddr *)&addr_buf;
109 -+ socklen_t buflen;
110 -+ int i;
111 -+
112 -+ for (i = 0; i < numsock; i++) {
113 -+ buflen = sizeof(addr_buf);
114 -+ if (getsockname(sock[i], boundaddr, &buflen) < 0)
115 -+ error(errno, "getsockname failed");
116 -+ if (buflen == addrlen && sockaddr_equal(boundaddr, addr))
117 -+ return 1;
118 -+ }
119 -+ return 0;
120 -+}
121 -+
122 - #ifdef NO_IPv6
123 - static void newsocket(struct sockaddr_in *sin) {
124 - int fd;
125 - const char *host = ip4atos(ntohl(sin->sin_addr.s_addr));
126 -+
127 -+ if (already_bound((struct sockaddr *)sin, sizeof(*sin)))
128 -+ return;
129 - if (numsock >= MAXSOCK)
130 - error(0, "too many listening sockets (%d max)", MAXSOCK);
131 - fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
132 -@@ -223,6 +292,8 @@ static int newsocket(struct addrinfo *ai) {
133 - int fd;
134 - char host[NI_MAXHOST], serv[NI_MAXSERV];
135 -
136 -+ if (already_bound(ai->ai_addr, ai->ai_addrlen))
137 -+ return 1;
138 - if (numsock >= MAXSOCK)
139 - error(0, "too many listening sockets (%d max)", MAXSOCK);
140 - fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
141 -diff --git a/rbldnsd.py b/rbldnsd.py
142 -index 9300ef2..4b78dee 100644
143 ---- a/rbldnsd.py
144 -+++ b/rbldnsd.py
145 -@@ -2,6 +2,7 @@
146 -
147 -
148 - """
149 -+import errno
150 - from itertools import count
151 - import subprocess
152 - from tempfile import NamedTemporaryFile, TemporaryFile
153 -@@ -12,6 +13,14 @@ try:
154 - import DNS
155 - except ImportError:
156 - raise RuntimeError("The pydns library is not installed")
157 -+try:
158 -+ from DNS import SocketError as DNS_SocketError
159 -+except ImportError:
160 -+ class DNS_SocketError(Exception):
161 -+ """ Dummy, never raised.
162 -+
163 -+ (Older versions of pydns before 2.3.6 do not raise SocketError.)
164 -+ """
165 -
166 - DUMMY_ZONE_HEADER = """
167 - $SOA 0 example.org. hostmaster.example.com. 0 1h 1h 2d 1h
168 -@@ -113,7 +122,6 @@ class Rbldnsd(object):
169 - stderr=self.stderr)
170 -
171 - # wait for rbldnsd to start responding
172 -- time.sleep(0.1)
173 - for retry in count():
174 - if daemon.poll() is not None:
175 - raise DaemonError(
176 -@@ -124,12 +132,18 @@ class Rbldnsd(object):
177 - break
178 - except QueryRefused:
179 - break
180 -+ except DNS_SocketError as ex:
181 -+ # pydns >= 2.3.6
182 -+ wrapped_error = ex.args[0]
183 -+ if wrapped_error.errno != errno.ECONNREFUSED:
184 -+ raise
185 - except DNS.DNSError as ex:
186 -+ # pydns < 2.3.6
187 - if str(ex) != 'no working nameservers found':
188 - raise
189 -- elif retries > 10:
190 -- raise DaemonError(
191 -- "rbldnsd does not seem to be responding")
192 -+ if retry > 10:
193 -+ raise DaemonError("rbldnsd does not seem to be responding")
194 -+ time.sleep(0.1)
195 -
196 - def _stop_daemon(self):
197 - daemon = self._daemon
198 -@@ -150,6 +164,22 @@ class Rbldnsd(object):
199 - raise DaemonError("rbldnsd exited with code %d"
200 - % daemon.returncode)
201 -
202 -+ @property
203 -+ def no_ipv6(self):
204 -+ """ Was rbldnsd compiled with -DNO_IPv6?
205 -+ """
206 -+ # If rbldnsd was compiled with -DNO_IPv6, the (therefore
207 -+ # unsupported) '-6' command-line switch will not be described
208 -+ # in the help message
209 -+ cmd = [self.daemon_bin, '-h']
210 -+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
211 -+ help_message = proc.stdout.readlines()
212 -+ if proc.wait() != 0:
213 -+ raise subprocess.CalledProcessError(proc.returncode, cmd)
214 -+ return not any(line.lstrip().startswith('-6 ')
215 -+ for line in help_message)
216 -+
217 -+
218 - class TestRbldnsd(unittest.TestCase):
219 - def test(self):
220 - rbldnsd = Rbldnsd()
221 -diff --git a/test_acl.py b/test_acl.py
222 -index d93ca0a..10bed1c 100644
223 ---- a/test_acl.py
224 -+++ b/test_acl.py
225 -@@ -1,5 +1,8 @@
226 - """ Tests for the acl dataset
227 - """
228 -+from functools import wraps
229 -+import socket
230 -+import sys
231 - from tempfile import NamedTemporaryFile
232 - import unittest
233 -
234 -@@ -9,6 +12,35 @@ __all__ = [
235 - 'TestAclDataset',
236 - ]
237 -
238 -+try:
239 -+ from unittest import skipIf
240 -+except ImportError:
241 -+ # hokey replacement (for python <= 2.6)
242 -+ def skipIf(condition, reason):
243 -+ if condition:
244 -+ def decorate(f):
245 -+ @wraps(f)
246 -+ def skipped(*args, **kw):
247 -+ sys.stderr.write("skipped test: %s " % reason)
248 -+ return skipped
249 -+ return decorate
250 -+ else:
251 -+ return lambda f: f
252 -+
253 -+def _have_ipv6():
254 -+ # Check for IPv6 support
255 -+ if not getattr(socket, 'has_ipv6', False):
256 -+ return False # no python support for ipv6
257 -+ elif Rbldnsd().no_ipv6:
258 -+ return False # rbldnsd compiled with -DNO_IPv6
259 -+ try:
260 -+ socket.socket(socket.AF_INET6, socket.SOCK_DGRAM).close()
261 -+ except socket.error:
262 -+ return False # no kernel (or libc) support for ipv6?
263 -+ return True
264 -+
265 -+no_ipv6 = not _have_ipv6()
266 -+
267 - def daemon(acl, addr='localhost'):
268 - """ Create an Rbldnsd instance with given ACL
269 - """
270 -@@ -33,11 +65,13 @@ class TestAclDataset(unittest.TestCase):
271 - addr='127.0.0.1') as dnsd:
272 - self.assertEqual(dnsd.query('test.example.com'), 'Success')
273 -
274 -+ @skipIf(no_ipv6, "IPv6 unsupported")
275 - def test_refuse_ipv6(self):
276 - with daemon(acl=["::1 :refuse"],
277 - addr='::1') as dnsd:
278 - self.assertRaises(QueryRefused, dnsd.query, 'test.example.com')
279 -
280 -+ @skipIf(no_ipv6, "IPv6 unsupported")
281 - def test_pass_ipv6(self):
282 - with daemon(acl=[ "0/0 :refuse",
283 - "0::1 :pass" ],
284 -diff --git a/test_ip4trie.py b/test_ip4trie.py
285 -index fe9e78f..2cce09b 100644
286 ---- a/test_ip4trie.py
287 -+++ b/test_ip4trie.py
288 -@@ -9,7 +9,7 @@ __all__ = [
289 - ]
290 -
291 - def ip4trie(zone_data):
292 -- """ Run rbldnsd with an ip6trie dataset
293 -+ """ Run rbldnsd with an ip4trie dataset
294 - """
295 - dnsd = Rbldnsd()
296 - dnsd.add_dataset('ip4trie', ZoneFile(zone_data))
297 -diff --git a/test_ip6trie.py b/test_ip6trie.py
298 -index d3600db..377c5dd 100644
299 ---- a/test_ip6trie.py
300 -+++ b/test_ip6trie.py
301 -@@ -15,15 +15,6 @@ def ip6trie(zone_data):
302 - dnsd.add_dataset('ip6trie', ZoneFile(zone_data))
303 - return dnsd
304 -
305 --def rfc3152(ip6addr, domain='example.com'):
306 -- from socket import inet_pton, AF_INET6
307 -- from struct import unpack
308 --
309 -- bytes = unpack("16B", inet_pton(AF_INET6, ip6addr))
310 -- nibbles = '.'.join("%x.%x" % (byte & 0xf, (byte >> 4) & 0xf)
311 -- for byte in reversed(bytes))
312 -- return "%s.%s" % (nibbles, domain)
313 --
314 - class TestIp6TrieDataset(unittest.TestCase):
315 - def test_exclusion(self):
316 - with ip6trie(["dead::/16 listed",
317 -@@ -31,5 +22,35 @@ class TestIp6TrieDataset(unittest.TestCase):
318 - self.assertEqual(dnsd.query(rfc3152("dead::beef")), None)
319 - self.assertEqual(dnsd.query(rfc3152("dead::beee")), "listed")
320 -
321 -+
322 -+def rfc3152(ip6addr, domain='example.com'):
323 -+ return "%s.%s" % ('.'.join(reversed(_to_nibbles(ip6addr))), domain)
324 -+
325 -+def _to_nibbles(ip6addr):
326 -+ """ Convert ip6 address (in rfc4291 notation) to a sequence of nibbles
327 -+
328 -+ NB: We avoid the use of socket.inet_pton(AF_INET6, ip6addr) here
329 -+ because it fails (with 'error: can't use AF_INET6, IPv6 is
330 -+ disabled') when python has been compiled without IPv6 support. See
331 -+ http://www.corpit.ru/pipermail/rbldnsd/2013q3/001181.html
332 -+
333 -+ """
334 -+ def _split_words(addr):
335 -+ return [ int(w, 16) for w in addr.split(':') ] if addr else []
336 -+
337 -+ if '::' in ip6addr:
338 -+ head, tail = [ _split_words(s) for s in ip6addr.split('::', 1) ]
339 -+ nzeros = 8 - len(head) - len(tail)
340 -+ assert nzeros >= 0
341 -+ words = head + [ 0 ] * nzeros + tail
342 -+ else:
343 -+ words = _split_words(ip6addr)
344 -+
345 -+ assert len(words) == 8
346 -+ for word in words:
347 -+ assert 0 <= word <= 0xffff
348 -+
349 -+ return ''.join("%04x" % word for word in words)
350 -+
351 - if __name__ == '__main__':
352 - unittest.main()
353
354 diff --git a/net-dns/rbldnsd/rbldnsd-0.998b.ebuild b/net-dns/rbldnsd/rbldnsd-0.998b.ebuild
355 deleted file mode 100644
356 index 9fb92e9d2ad..00000000000
357 --- a/net-dns/rbldnsd/rbldnsd-0.998b.ebuild
358 +++ /dev/null
359 @@ -1,68 +0,0 @@
360 -# Copyright 1999-2020 Gentoo Authors
361 -# Distributed under the terms of the GNU General Public License v2
362 -
363 -EAPI=7
364 -PYTHON_COMPAT=( python2_7 )
365 -
366 -inherit toolchain-funcs user python-any-r1
367 -
368 -DESCRIPTION="DNS server designed to serve blacklist zones"
369 -HOMEPAGE="https://rbldnsd.io/"
370 -SRC_URI="https://github.com/spamhaus/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
371 -
372 -LICENSE="GPL-2"
373 -SLOT="0"
374 -KEYWORDS="amd64 hppa ~sparc x86"
375 -IUSE="ipv6 test zlib"
376 -RESTRICT="!test? ( test )"
377 -
378 -RDEPEND="zlib? ( sys-libs/zlib )"
379 -DEPEND="${RDEPEND}"
380 -BDEPEND="
381 - test? (
382 - ${RDEPEND}
383 - ${PYTHON_DEPS}
384 - $(python_gen_any_dep 'dev-python/pydns:2[${PYTHON_USEDEP}]')
385 - )"
386 -
387 -PATCHES=(
388 - "${FILESDIR}/rbldnsd-0.997a-robust-ipv6-test-support.patch"
389 -)
390 -
391 -src_configure() {
392 - # The ./configure file is handwritten and doesn't support a `make
393 - # install` target, so there are no --prefix options. The econf
394 - # function appends those automatically, so we can't use it.
395 - ./configure \
396 - $(use_enable ipv6) \
397 - $(use_enable zlib) \
398 - || die "./configure failed"
399 -}
400 -
401 -src_compile() {
402 - emake \
403 - AR="$(tc-getAR)" \
404 - CC="$(tc-getCC)" \
405 - RANLIB="$(tc-getRANLIB)"
406 -}
407 -
408 -src_test() {
409 - emake check \
410 - CC="$(tc-getCC)" \
411 - PYTHON="${PYTHON}"
412 -}
413 -
414 -src_install() {
415 - einstalldocs
416 - dosbin rbldnsd
417 - doman rbldnsd.8
418 - keepdir /var/db/rbldnsd
419 - newinitd "${FILESDIR}"/initd-0.997a rbldnsd
420 - newconfd "${FILESDIR}"/confd-0.997a rbldnsd
421 -}
422 -
423 -pkg_preinst() {
424 - enewgroup rbldns
425 - enewuser rbldns -1 -1 -1 rbldns
426 - fowners rbldns:rbldns /var/db/rbldnsd
427 -}