diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 16:45:34 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 16:45:34 +0000 |
commit | a144d44fbdcdb3713769759ba2d0853b66412839 (patch) | |
tree | e228e13990435b275d91cc79508bb00b8b2d489d | |
parent | f01c8453d56f810031ded37ed9e37e71e7474089 (diff) | |
download | s6-dns-a144d44fbdcdb3713769759ba2d0853b66412839.tar.xz |
Adaptation to skalibs-2.7.0.0
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | doc/index.html | 4 | ||||
-rw-r--r-- | doc/upgrade.html | 6 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/libs6dns/s6dns_engine.c | 40 |
7 files changed, 55 insertions, 7 deletions
@@ -1,4 +1,4 @@ -Copyright (c) 2011-2017 Laurent Bercot <ska-skaware@skarnet.org> +Copyright (c) 2011-2018 Laurent Bercot <ska-skaware@skarnet.org> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.6.3.0 or later: http://skarnet.org/software/skalibs/ + - skalibs version 2.7.0.0 or later: http://skarnet.org/software/skalibs/ This software will run on any operating system that implements POSIX.1-2008, available at: @@ -1,5 +1,11 @@ Changelog for s6-dns. +In 2.3.0.1 +---------- + + - Adaptation to skalibs-2.7.0.0. + + In 2.3.0.0 ---------- diff --git a/doc/index.html b/doc/index.html index 67ccdc8..51c6aae 100644 --- a/doc/index.html +++ b/doc/index.html @@ -46,7 +46,7 @@ point in the future. <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.6.3.0 or later </li> +2.7.0.0 or later </li> </ul> <h3> Licensing </h3> @@ -59,7 +59,7 @@ point in the future. <h3> Download </h3> <ul> - <li> The current released version of s6-dns is <a href="s6-dns-2.3.0.0.tar.gz">2.3.0.0</a>. </li> + <li> The current released version of s6-dns is <a href="s6-dns-2.3.0.1.tar.gz">2.3.0.1</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-dns/">s6-dns git repository</a>: diff --git a/doc/upgrade.html b/doc/upgrade.html index 7b8fb84..6912610 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,12 @@ <h1> What has changed in s6-dns </h1> +<h2> in 2.3.0.1 </h2> + +<ul> + <li> skalibs dependency bumped to 2.7.0.0. </li> +</ul> + <h2> in 2.3.0.0 </h2> <ul> diff --git a/package/info b/package/info index bcc8aaf..ce9f66c 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-dns -version=2.3.0.0 +version=2.3.0.1 category=web package_macro_name=S6_DNS diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c index 26cb5f3..0057b14 100644 --- a/src/libs6dns/s6dns_engine.c +++ b/src/libs6dns/s6dns_engine.c @@ -10,7 +10,6 @@ #include <skalibs/error.h> #include <skalibs/tai.h> #include <skalibs/stralloc.h> -#include <skalibs/mininetstring.h> #include <skalibs/socket.h> #include <skalibs/djbunix.h> #include <skalibs/ip46.h> @@ -63,6 +62,43 @@ static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned return 1 ; } +static int s6dns_mininetstring_read (int fd, stralloc *sa, uint32_t *w) +{ + if (!*w) + { + char pack[2] ; + switch (fd_read(fd, pack, 2)) + { + case -1 : return -1 ; + case 0 : return 0 ; + case 1 : *w = ((uint32_t)pack[0] << 8) | (1U << 31) ; break ; + case 2 : *w = ((uint32_t)pack[0] << 8) | (uint32_t)pack[1] | (1U << 30) ; break ; + default : return (errno = EDOM, -1) ; + } + } + if (*w & (1U << 31)) + { + unsigned char c ; + switch (fd_read(fd, (char *)&c, 1)) + { + case -1 : return -1 ; + case 0 : return (errno = EPIPE, -1) ; + case 1 : *w |= (uint32_t)c | (1U << 30) ; *w &= ~(1U << 31) ; break ; + default : return (errno = EDOM, -1) ; + } + } + if (*w & (1U << 30)) + { + if (!stralloc_readyplus(sa, *w & ~(1U << 30))) return -1 ; + *w &= ~(1U << 30) ; + } + { + size_t r = allread(fd, sa->s + sa->len, *w) ; + sa->len += r ; *w -= r ; + } + return *w ? -1 : 1 ; +} + /* Network core functions: transport-dependent */ @@ -258,7 +294,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp) static int s6dns_engine_read_tcp (s6dns_engine_t *dt, tain_t const *stamp) { - ssize_t r = sanitize_read(mininetstring_read(dt->fd, &dt->sa, &dt->protostate)) ; + ssize_t r = sanitize_read(s6dns_mininetstring_read(dt->fd, &dt->sa, &dt->protostate)) ; if (r < 0) return (prepare_next(dt, stamp, 1), 0) ; else if (!r) return (errno = EAGAIN, 0) ; else if ((dt->sa.len - dt->querylen) < 12) |