From a144d44fbdcdb3713769759ba2d0853b66412839 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 21 Jul 2018 16:45:34 +0000 Subject: Adaptation to skalibs-2.7.0.0 --- COPYING | 2 +- INSTALL | 2 +- NEWS | 6 ++++++ doc/index.html | 4 ++-- doc/upgrade.html | 6 ++++++ package/info | 2 +- src/libs6dns/s6dns_engine.c | 40 ++++++++++++++++++++++++++++++++++++++-- 7 files changed, 55 insertions(+), 7 deletions(-) diff --git a/COPYING b/COPYING index cc344f1..1629e84 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2011-2017 Laurent Bercot +Copyright (c) 2011-2018 Laurent Bercot Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/INSTALL b/INSTALL index f6274cd..88d50d4 100644 --- a/INSTALL +++ b/INSTALL @@ -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: diff --git a/NEWS b/NEWS index b779c1a..eb2e00b 100644 --- a/NEWS +++ b/NEWS @@ -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.
  • A POSIX-compliant system with a standard C development environment
  • GNU make, version 3.81 or later
  • skalibs version -2.6.3.0 or later
  • +2.7.0.0 or later

    Licensing

    @@ -59,7 +59,7 @@ point in the future.

    Download

      -
    • The current released version of s6-dns is 2.3.0.0.
    • +
    • The current released version of s6-dns is 2.3.0.1.
    • Alternatively, you can checkout a copy of the s6-dns git repository: 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 @@

      What has changed in s6-dns

      +

      in 2.3.0.1

      + +
        +
      • skalibs dependency bumped to 2.7.0.0.
      • +
      +

      in 2.3.0.0

        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 #include #include -#include #include #include #include @@ -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) -- cgit v1.2.3