Index: dll/win32/dnsapi/dnsapi/query.c =================================================================== --- dll/win32/dnsapi/dnsapi/query.c (revision 72742) +++ dll/win32/dnsapi/dnsapi/query.c (working copy) @@ -76,7 +76,14 @@ { for(i = 0; i < Servers->AddrCount; i++) { +#ifdef OLD_ADNS adns_addserver(astate, *((struct in_addr *)&Servers->AddrArray[i])); +#else + struct sockaddr addr; + addr.sa_family = AF_INET; + memcpy(addr.sa_data, &Servers->AddrArray[i], sizeof(Servers->AddrArray[i])); + adns_addserver(astate, &addr, sizeof(addr.sa_family)+sizeof(Servers->AddrArray[i])); +#endif } } Index: sdk/lib/3rdparty/adns/acconfig.h =================================================================== --- sdk/lib/3rdparty/adns/acconfig.h (revision 72742) +++ sdk/lib/3rdparty/adns/acconfig.h (working copy) @@ -3,26 +3,25 @@ * input file for autoheader/autoconf/configure: extra stuff for config.h */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ /* Define if inline functions a la GCC are available. */ @@ -114,7 +113,3 @@ #ifdef HAVEUSE_RPCTYPES_H #include #endif - -#ifdef HAVE_SYS_SELECT_H -#include -#endif Index: sdk/lib/3rdparty/adns/aclocal.m4 =================================================================== --- sdk/lib/3rdparty/adns/aclocal.m4 (revision 72742) +++ sdk/lib/3rdparty/adns/aclocal.m4 (working copy) @@ -1,17 +1,15 @@ # aclocal.m4 - package-specific macros for autoconf # -# This file is -# Copyright (C) 1997-1999 Ian Jackson +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # -# It is part of adns, which is -# Copyright (C) 1997-1999 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch -# -# This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson -# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -20,8 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. dnl DPKG_CACHED_TRY_COMPILE(,,,,,) define(DPKG_CACHED_TRY_COMPILE,[ Index: sdk/lib/3rdparty/adns/adns_win32/adns_unix_calls.c =================================================================== --- sdk/lib/3rdparty/adns/adns_win32/adns_unix_calls.c (revision 72742) +++ sdk/lib/3rdparty/adns/adns_win32/adns_unix_calls.c (working copy) @@ -72,6 +72,53 @@ return (inp->s_addr == INADDR_NONE) ? -1 : 0; } +int adns_inet_pton(int af, const char *cp, void *dst) +{ +#if (NTDDI_VERSION >= NTDDI_VISTA) + return InetNtop(af, cp, dst); +#else + if (af == AF_INET) + { + return adns_inet_aton(cp, dst); + } +#ifdef WITH_IPV6 + else if (af == AF_INET6) + { + } +#endif + return -1; +#endif +} + +const char * adns_inet_ntop(u_short af, const void *src, char *buf, int buflen) +{ +#if (NTDDI_VERSION >= NTDDI_VISTA) + return InetPton(af, src, buf, buflen); +#else + if (af == AF_INET && src && buf && buflen > 0) + { + char *ret = inet_ntoa(*(IN_ADDR *)src); + if(ret) + { + strncpy(buf, ret, buflen); + return buf; + } + } +#ifdef WITH_IPV6 + else if (af == AF_INET6 && src && buf && buflen > 0) + { + char *ret = inet_ntoa(*(IN_ADDR6 *)src); + if (ret) + { + strncpy(buf, ret, buflen); + return buf; + } + } +#endif + return NULL; +#endif +} + int adns_getpid() { return GetCurrentProcessId(); Index: sdk/lib/3rdparty/adns/adns_win32/adns_win32.h =================================================================== --- sdk/lib/3rdparty/adns/adns_win32/adns_win32.h (revision 72742) +++ sdk/lib/3rdparty/adns/adns_win32/adns_win32.h (working copy) @@ -68,6 +68,7 @@ #if defined (_MSC_VER) #pragma warning(disable:4003) +#pragma warning(disable:4715) #endif /* _MSC_VER */ /* ---------------- START OF C HEADER -------------- */ @@ -82,6 +83,9 @@ #include #include #include +#if (NTDDI_VERSION >= NTDDI_VISTA) +#include +#endif //#include #include #include @@ -98,7 +102,8 @@ #define ADNS_SOCKET SOCKET #define adns_socket_close(sck) closesocket(sck) #define adns_socket_read(sck, data, len) recv(sck, (char *)data, len, 0) -#define adns_socket_write(sck, data, len) send(sck, (char *)data, len, 0) +#define adns_socket_write(sck, data, len) send(sck, (const char *)data, len, 0) +#define nrand48(sxi) rand() /* Win32 does not set errno on Winsock errors(!) * We have to map the winsock errors to errno manually @@ -148,6 +153,8 @@ ADNS_API int adns_gettimeofday(struct timeval *tv, struct timezone *tz); ADNS_API int adns_writev (int FileDescriptor, const struct iovec * iov, int iovCount); ADNS_API int adns_inet_aton(const char *cp, struct in_addr *inp); +ADNS_API int adns_inet_pton(int af, const char *cp, void *dst); +ADNS_API const char * adns_inet_ntop(u_short af, const void *src, char *buf, int buflen); ADNS_API int adns_getpid(); #ifdef ADNS_DLL @@ -159,6 +166,8 @@ #define gettimeofday(tv, tz) adns_gettimeofday(tv, tz) #define writev(FileDescriptor, iov, iovCount) adns_writev(FileDescriptor, iov, iovCount) #define inet_aton(ap, inp) adns_inet_aton(ap, inp) +#define inet_pton(af, ap, dst) adns_inet_pton(af, ap, dst) +#define inet_ntop(af, src, buf, buflen) adns_inet_ntop(af, src, buf, buflen) #define getpid() adns_getpid() #ifdef ADNS_DLL @@ -167,6 +176,30 @@ # define free(ptr) adns_free(ptr) #endif +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +typedef int socklen_t; +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 46 +#endif +#define IF_NAMESIZE 32 +#define EAFNOSUPPORT 57 // Address family not supported + +#if !defined(_Bool) && defined(_MSC_VER) +typedef unsigned char _Bool; +#endif /* _Bool */ + +/** + * Define the Boolean macros only if they are not already defined. + */ +#ifndef __bool_true_false_are_defined +#define bool _Bool +#define false 0 +#define true 1 +#define __bool_true_false_are_defined 1 +#endif /* __bool_true_false_are_defined */ + /* ---------------- END OF C HEADER -------------- */ #ifdef __cplusplus } Index: sdk/lib/3rdparty/adns/changelog =================================================================== --- sdk/lib/3rdparty/adns/changelog (revision 72742) +++ sdk/lib/3rdparty/adns/changelog (working copy) @@ -1,3 +1,175 @@ +adns (1.5.0) UPSTREAM; urgency=low + + * Release 1.5.0. No changes since 1.5.0~rc1. + + -- Ian Jackson Sun, 26 Oct 2014 14:57:10 +0000 + +adns (1.5.0~rc1) UPSTREAM; urgency=low + + ABI/API changes: + * Provide adns_qf_cname_strict flag, currently ignored because it's the + default. This will allow us to make this not the default in the future + while retaining forward and backward API and ABI compatibility. + * Add `sizeforce' enum member value to force enum types in the APIs to be + big (which will avoids theoretical future ABI-incompatibility). + * Reject unknown flags passed by our caller. This will make it ABI-safe + (although not ABI-backward-compatible) to add new flags in the future, + as newer clients running against this old library will get ENOSYS. + + resolv.conf parsing: + * Support `adns_ignoreunkcfg' resolv.conf option to ignore unknown + options and keywords in resolv.conf. + * Ignore various BIND9 resolv.conf keywords and options. + * Fix resolv.conf option word splitting. + + Tests, build system, coding style, etc.: + * Test cases show rrtype flag values in hex. + * Parallelise `make check'. + * Make vbuf__append_quoted1035 no longer extern (there are no out-of-file + callers). + * Remove all RCSids. + * When releasing, check that the `make dist' tarball is identical to git. + And provide a test mode for the RELEASE-CHECKLIST doc/script. + * Add `make dist' tarball signature to .gitignore. + * More correctly and effectively work around bugs in make (Debian #4073, + #756123) affecting regress. + + -- Ian Jackson Sun, 26 Oct 2014 13:24:00 +0000 + +adns (1.5.0~rc0) UPSTREAM; urgency=low + + New features: + * Support for queries about IPv6 data in all applicable adns + query types (including AAAA, PTR, and adns_r_addr queries). + (Thanks very much to Mark Wooding.) + * Support for transport over IPv6. (Thanks to Mark Wooding again.) + * adns_addr2text and adns_text2addr: Convenient functions for + converting between addresses and address literals. + + Bugfixes: + * Fix a crashing bug in adnslogres. (Debian#392102.) + * Do all checks of checked PTR owner name before actually sending the + query, and reject IPv4 PTR owner names whose labels have leading zero + digits or values >255. + + Build system fixes and improvements: + * `make clean' removes the pipes. + * Work around bugs in make (Debian #4073, #756123) affecting regress. + * Do not include Makefile and src/config.h in distribution tarball. + + Regression test debugging improvements: + * Provide gdbwrap convenience script. + * Honour ADNS_TEST_DEBUG env. var. (Mark Wooding.) + + Other improvements: + * Licence changed to GPLv3 (still LGPLv2 for adns.h). + * Source code cleanups. (Some from Mark Wooding.) + * Now in git. + * Documentation and webpage updates. + + -- Ian Jackson Mon, 20 Oct 2014 01:29:50 +0100 + +adns (1.4); urgency=low + + Improvements for multithreaded programs: + * New documentation comment in adns.h explaining thread guarantees + (or lack of them), replaces `single-threaded' note at the top. + * Fix string conversion of adns_r_addr not to use a static buffer + (function csp_addr) so as to make thread promise true. + * Make an internal variable const-correct (expectdomain in pa_ptr). + + -- Ian Jackson Tue, 17 Oct 2006 17:05:08 +0100 + +adns (1.3); urgency=low + + Portability fixes: + * Cast ptrdiff_t to int for %.*s length in adnsheloex and adnslogres, + as is required. (Report from Jim Meyering.) + * In configure.in, quote macro name argument to define() to + suppress spurious autoconf error. (Report from Mihai Ibanescu.) + * Use autoconf's values for {bin,lib,include}dir rather than inventing + our own from @exec_prefix@, making configure --libdir work. + (Patch from Mihai Ibanescu.) + * Remove spurious `_' from {bin,lib,include}dir Makefile variables. + (Report from Mihai Ibanescu.) + * Do away with `mismatch' variable in parse.c:adns__findrr_anychk so that + overzealous GCC cannot complain about members of eo_fls being + uninitialised. (Report from Jim Meyering.) + + -- Ian Jackson Tue, 6 Jun 2006 20:22:30 +0100 + +adns (1.2); urgency=medium + + New features: + * Support for SRV RRs. + * Support for unknown RR types (according to RFC3597) via adns_r_unknown. + * Allow `;'-comments in resolv.conf (report from Colin Charles). + * New adnsheloex client courtesy of Tony Finch. + * New adns_init_logfn etc. for having logging use a callback function. + + Bugfixes: + * Fix error in prototype in definition of adns__parse_domain. + * Add missing ENOTSOCK to hcommon.c.m4 (was already in hcommon.c!) + + Portability fixes prompted by Bernd Eckenfels, the Debian maintainer: + * Correct type of various printf arguments: ptrdiff_t != int. + * Do not print size of leaked blocks of memory (this causes + a spurious regression test failure on some platforms). + * Provide adns_if_none and adns_qf_none (which will help with compilers + which complain about plain `0' being passed where an enum is wanted). + * adnstest converts some errno values to EFOOBAR: all of the ones + mentioned in adns.h, at least. This makes the regression test + more portable (fixes problem noticed by Bernd Eckenfels). + * Add -Wno-pointer-sign if GCC has that option. + + Documentation improvements: + * Add documentation comment by definition of adns_r_ptr_raw type enum. + * Document in adns.h EINVAL from adns_init meaning bad configuration. + * Include several new references to related programs to README.html. + * Redacted the TODO list. + * New LICENCE.WAIVERS file for GPL-incompatility workarounds. + * Clarified GPL-vs-LGPL: a bit less hostile and a bit more mercenary. + * Copyright notices updated. + + Packaging changes: + * Update MINOR to 2 and DISTVERSION and ADNS_VERSION_STRING to 1.2. + * Reran autoconf/autoheader (autoconf Debian 2.13-54). + * Create $(bin_dir) and $(lib_dir) on `make install', and also + make a libadns.so.1 -> libadns.so.1. link. (Suggestions + and patch from Nix of esperi.org.uk.) + * Add .PHONY: install to Makefile, to help people with demented fs's. + * Darwin listed in INSTALL. + + Minor test harness improvements: + * Hgettimeofday calls Tensurerecordfile (was Tensureinput/outputfile). + * Add bind(2) and listen(2) wrappers (for epithet, but harmless in adns). + + -- Ian Jackson Sat, 8 Apr 2006 15:41:28 +0100 + +adns (1.1); urgency=medium + + Major bugfixes: + * Do not spin if connect() fails immediately (!) + * Stop searching on a CNAME (even if it's broken). + * When search list runs out, _qf_owner sets owner to query domain. + * Fix bogus multiple updates to p in transmit.c (!) + + Portability improvements: + * Fix up spurious #undef's in hredirect.h. + * Don't use any more, it was a mistake made in pre-1.0 + (and there doesn't seem to be much explanation why). + * Understand and sort of check OpenBSD `lookup' resolv.conf directive. + * #include in internal.h (for abort etc). + * Always #include before (for FreeBSD 4.6). + + Cosmetic and documentation improvements: + * Added wishlist entry re configurable port no. + * Problem with SERVFAIL in TODO. + * README.html: mentioned Jarle Aase's Windows port, and other fixes. + * Some better source code formatting/wrapping. + + -- Ian Jackson Tue, 1 Jul 2003 22:55:29 +0100 + adns (1.0); urgency=medium Bugfixes: Index: sdk/lib/3rdparty/adns/client/addrtext.c =================================================================== --- sdk/lib/3rdparty/adns/client/addrtext.c (nonexistent) +++ sdk/lib/3rdparty/adns/client/addrtext.c (working copy) @@ -0,0 +1,197 @@ +/* + some test cases + + + ./addrtext_s fe80::1%wlanx + ./addrtext_s fe80::1%wlan0 + ./addrtext_s fe80::1%23 + ./addrtext_s fe80::1%1 + ./addrtext_s 2001:ba8:1e3::%wlan0 + ./addrtext_s 2001:ba8:1e3::%23 + ./addrtext_s 2001:ba8:1e3::%1 # normally lo + ./addrtext_s 127.0.0.1x + ./addrtext_s 172.18.45.6 + ./addrtext_s 12345 + + + */ + +/* + * addrtext.c + * - test program for address<->string conversion, not part of the library + */ +/* + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "adns.h" + +#define PORT 1234 + +#define STRING(x) STRING2(x) +#define STRING2(x) #x + +static int fails; + +static void hex(const void *data_v, int l) { + const uint8_t *data= data_v; + int i; + for (i=0; isa_family); + + switch (sa->sa_family) { + case AF_INET: { + const struct sockaddr_in *s = (const void*)sa; + printf(".port=%d .addr=%08"PRIx32"", + ntohs(s->sin_port), + (uint32_t)ntohl(s->sin_addr.s_addr)); + break; + } + case AF_INET6: { + const struct sockaddr_in6 *s = (const void*)sa; + printf(".port=%d .flowinfo=%08"PRIx32" .scope_id=%08"PRIx32" .addr=", + ntohs(s->sin6_port), + (uint32_t)ntohl(s->sin6_flowinfo), + (uint32_t)ntohl(s->sin6_scope_id)); + hex(&s->sin6_addr, sizeof(s->sin6_addr)); + break; + } + } + printf("\n"); +} + +static void dotest(const char *input) { + adns_sockaddr ours; + socklen_t socklen; + struct addrinfo aip; + struct addrinfo *air=0; + char ourbuf[ADNS_ADDR2TEXT_BUFLEN]; + char theirbuf[ADNS_ADDR2TEXT_BUFLEN]; + + memset(&ours,0,sizeof(ours)); + + socklen= sizeof(ours); + int our_r= adns_text2addr(input,PORT,0,&ours.sa,&socklen); + + memset(&aip,0,sizeof(aip)); + aip.ai_flags= AI_NUMERICHOST|AI_NUMERICSERV; + aip.ai_socktype= SOCK_DGRAM; + aip.ai_protocol= IPPROTO_UDP; + air= 0; + int libc_r= getaddrinfo(input,STRING(PORT),&aip,&air); + printf("`%s': us %s; libc %s, air=%p", + input, strerror(our_r), libc_r ? gai_strerror(libc_r) : "0", air); + if (air) + printf(" .family=%d .socklen=%ld .addr=%p .next=%p", + air->ai_family, (long)air->ai_addrlen, air->ai_addr, air->ai_next); + printf(":"); + + if (libc_r==EAI_NONAME && !air) { + if (strchr(input,'%') && (our_r==ENOSYS || our_r==ENXIO)) { + printf(" bad-scope"); + goto ok; + } + if (strchr(input,'%') && our_r==ENOSYS) { + printf(" bad-scope"); + goto ok; + } + if (our_r==EINVAL) { + printf(" invalid"); + goto ok; + } + } + printf(" valid"); + +#define FAIL do{ printf(" | FAIL\n"); fails++; }while(0) +#define WANT(x) if (!(x)) { printf(" not %s",STRING(x)); FAIL; return; } else; + + WANT(!our_r); + WANT(!libc_r); + WANT(air); + WANT(air->ai_addr); + WANT(!air->ai_next); + if (air->ai_addrlen!=socklen || memcmp(&ours,air->ai_addr,socklen)) { + printf(" mismatch"); + FAIL; + dump("ours",&ours.sa,socklen); + dump("libc",air->ai_addr,air->ai_addrlen); + return; + } + + printf(" |"); + + int ourbuflen= sizeof(ourbuf); + int ourport; + our_r= adns_addr2text(&ours.sa,0, ourbuf,&ourbuflen, &ourport); + + printf(" us %s",strerror(our_r)); + if (!our_r) + printf(" `%s'",ourbuf); + + size_t theirbuflen= sizeof(theirbuf); + libc_r= getnameinfo(&ours.sa,socklen, theirbuf,theirbuflen, 0,0, + NI_NUMERICHOST|NI_NUMERICSERV); + printf("; libc %s", libc_r ? gai_strerror(libc_r) : "0"); + if (!libc_r) + printf(" `%s'",theirbuf); + + printf(":"); + + WANT(!our_r); + WANT(!libc_r); + WANT(ourport==PORT); + if (strcmp(ourbuf,theirbuf)) { + printf(" mismatch"); + FAIL; + return; + } + + ok: + printf(" | PASS\n"); +} + +int main(int argc, char **argv) { + const char *arg; + while ((arg= *++argv)) { + dotest(arg); + } + return !!fails; +} Index: sdk/lib/3rdparty/adns/client/adh-main.c =================================================================== --- sdk/lib/3rdparty/adns/client/adh-main.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/adh-main.c (working copy) @@ -4,33 +4,27 @@ * main program and useful subroutines */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -# include -#endif - #include "adnshost.h" int rcode; @@ -74,7 +68,7 @@ char *xstrsave(const char *str) { char *p; - + p= xmalloc(strlen(str)+1); strcpy(p,str); return p; @@ -95,26 +89,37 @@ { adns_r_ptr, "ptr" }, { adns_r_mx, "mx" }, { adns_r_rp, "rp" }, + { adns_r_srv, "srv" }, { adns_r_addr, "addr" }, - + /* types with only one version */ { adns_r_cname, "cname" }, { adns_r_hinfo, "hinfo" }, { adns_r_txt, "txt" }, - + /* raw versions */ { adns_r_a, "a" }, + { adns_r_aaaa, "aaaa" }, { adns_r_ns_raw, "ns-" }, { adns_r_soa_raw, "soa-" }, { adns_r_ptr_raw, "ptr-" }, { adns_r_mx_raw, "mx-" }, { adns_r_rp_raw, "rp-" }, + { adns_r_srv_raw, "srv-" }, { adns_r_none, 0 } }; const struct typename *tnp; + unsigned long unknowntype; + char *ep; + if (strlen(arg) > 4 && !memcmp(arg,"type",4) && + (unknowntype= strtoul(arg+4, &ep, 10), !*ep) && unknowntype < 65536) { + ov_type= unknowntype | adns_r_unknown; + return; + } + for (tnp=typenames; tnp->type && strcmp(arg,tnp->desc); tnp++); @@ -182,7 +187,7 @@ query_do(arg); } } - + static void read_stdin(void) { int anydone, r; char *newline, *space; @@ -229,18 +234,18 @@ int r, maxfd; fd_set readfds, writefds, exceptfds; const char *arg; - - ensure_adns_init(); - + while ((arg= *++argv)) process_optarg(arg,&argv,0); if (!ov_pipe && !ads) usageerr("no domains given, and -f/--pipe not used; try --help"); + ensure_adns_init(); + for (;;) { for (;;) { qu= ov_asynch ? 0 : outstanding.head ? outstanding.head->qu : 0; r= adns_check(ads,&qu,&answer,&qun_v); - if ((r == EAGAIN) || (r == EWOULDBLOCK)) break; + if (r == EAGAIN) break; if (r == ESRCH) { if (!ov_pipe) goto x_quit; else break; } assert(!r); query_done(qun_v,answer); @@ -255,9 +260,7 @@ } tv= 0; adns_beforeselect(ads, &maxfd, &readfds,&writefds,&exceptfds, &tv,&tvbuf,0); - ADNS_CLEAR_ERRNO; r= select(maxfd, &readfds,&writefds,&exceptfds, tv); - ADNS_CAPTURE_ERRNO; if (r == -1) { if (errno == EINTR) continue; sysfail("select",errno); Index: sdk/lib/3rdparty/adns/client/adh-opts.c =================================================================== --- sdk/lib/3rdparty/adns/client/adh-opts.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/adh-opts.c (working copy) @@ -4,32 +4,27 @@ * option handling tables etc. */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -#endif - #include "adnshost.h" int ov_env=1, ov_pipe=0, ov_asynch=0; @@ -36,7 +31,7 @@ int ov_verbose= 0; adns_rrtype ov_type= adns_r_none; int ov_search=0, ov_qc_query=0, ov_qc_anshost=0, ov_qc_cname=1; -int ov_tcp=0, ov_cname=0, ov_format=fmt_default; +int ov_tcp=0, ov_cname=0, ov_afflags=0, ov_v6map=0, ov_format=fmt_default; char *ov_id= 0; struct perqueryflags_remember ov_pqfr = { 1,1,1, tm_none }; @@ -48,7 +43,7 @@ "f", "pipe", &ov_pipe, 1 }, { ot_flag, "Allow answers to be reordered", "a", "asynch", &ov_asynch, 1 }, - + { ot_desconly, "answer/error output format and destination (see below):" }, { ot_value, "Answers to stdout, errors as messages to stderr (default)", "Fs", "fmt-simple", &ov_format, fmt_simple }, @@ -56,7 +51,7 @@ "Fi", "fmt-inline", &ov_format, fmt_inline }, { ot_value, "Fully-parseable output format (default for --asynch)", "Fa", "fmt-asynch", &ov_format, fmt_asynch }, - + { ot_desconly, "global verbosity level:" }, { ot_value, "Do not print anything to stderr", "Vq", "quiet", &ov_verbose, adns_if_noerrprint }, @@ -64,7 +59,7 @@ "Vn", "no-quiet", &ov_verbose, 0 }, { ot_value, "Debugging mode", "Vd", "debug", &ov_verbose, adns_if_debug }, - + { ot_desconly, "other global options:" }, { ot_funcarg, "Configuration to use instead of /etc/resolv.conf", 0, "config", 0,0, of_config, "" }, @@ -102,7 +97,7 @@ "Dt", "show-type", &ov_pqfr.show_type, 0 }, { ot_flag, "Do not display CNAME target in output", "Dc", "show-cname", &ov_pqfr.show_cname, 0 }, - + { ot_desconly, "per-query TTL mode (NB TTL is minimum across all info in reply):" }, { ot_value, "Show the TTL as a TTL", "Tt", "ttl-ttl", &ov_pqfr.ttl, tm_rel }, @@ -111,6 +106,16 @@ { ot_value, "Do not show the TTL (default)", "Tn", "no-ttl", &ov_pqfr.ttl, tm_none }, + { ot_desconly, "per-query address family options (for `addr' etc.):" }, + { ot_value, "Only return IPv4 addresses", + "A4", "--addr-ipv4-only", &ov_afflags, adns_qf_want_ipv4 }, + { ot_value, "Only return IPv6 addresses", + "A6", "--addr-ipv6-only", &ov_afflags, adns_qf_want_ipv6 }, + { ot_value, "Return all available addresses (default)", + "Aa", "--addr-all", &ov_afflags, 0 }, + { ot_flag, "Return IPv4 addresses as IPv6-mapped", + "Am", "--addr-ipv6-mapped", &ov_v6map, 1 }, + { ot_desconly, "per-query CNAME handling mode:" }, { ot_value, "Call it an error if a CNAME is found", "Cf", "cname-reject", &ov_cname, adns_qf_cname_forbid }, @@ -118,7 +123,7 @@ "Cl", "cname-loose", &ov_cname, adns_qf_cname_loose }, { ot_value, "CNAME ok for query domain, but not in RRs (default)", "Cs", "cname-ok", &ov_cname, 0 }, - + { ot_desconly, "asynchronous/pipe mode options:" }, { ot_funcarg, "Set , default is decimal sequence starting 0", 0, "asynch-id", 0,0, &of_asynch_id, "id" }, @@ -137,7 +142,7 @@ int maxsopt, maxlopt, l; maxsopt= maxlopt= 0; - + for (oiap=all_optiontables; *oiap; oiap++) { for (oip=*oiap; oip->type != ot_end; oip++) { if (oip->type == ot_funcarg) continue; @@ -149,7 +154,7 @@ } } } - + fputs("usage: adnshost [global-opts] [query-opts] query-domain\n" " [[query-opts] query-domain ...]\n" " adnshost [global-opts] [query-opts] -f|--pipe\n", @@ -223,7 +228,7 @@ printf("\nEscaping domains which might start with `-':\n" " - %-*s Next argument is a domain, but more options may follow\n", maxlopt+maxsopt+3, ""); - + fputs("\n" "Query domains should always be quoted according to master file format.\n" "\n" @@ -267,9 +272,10 @@ " 11 usage problems\n" "\n" "Query types (see adns.h; default is addr):\n" - " ns soa ptr mx rp addr - enhanced versions\n" - " cname hinfo txt - types with only one version\n" - " a ns- soa- ptr- mx- rp- - _raw versions\n" + " ns soa ptr mx rp srv addr - enhanced versions\n" + " cname hinfo txt - types with only one version\n" + " a aaaa ns- soa- ptr- mx- rp- srv- - _raw versions\n" + " type - `unknown' type, RFC3597\n" "Default is addr, or ptr for -i/--ptr queries\n", stdout); if (ferror(stdout)) sysfail("write usage message",errno); Index: sdk/lib/3rdparty/adns/client/adh-query.c =================================================================== --- sdk/lib/3rdparty/adns/client/adh-query.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/adh-query.c (working copy) @@ -4,32 +4,27 @@ * make queries and print answers */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -#endif - #include "adnshost.h" adns_state ads; @@ -40,12 +35,10 @@ void ensure_adns_init(void) { adns_initflags initflags; int r; - + if (ads) return; -#ifdef SIGPIPE if (signal(SIGPIPE,SIG_IGN) == SIG_ERR) sysfail("ignore SIGPIPE",errno); -#endif initflags= adns_if_noautosys|adns_if_nosigpipe|ov_verbose; if (!ov_env) initflags |= adns_if_noenv; @@ -61,13 +54,27 @@ ov_format= ov_asynch ? fmt_asynch : fmt_simple; } +void type_info(adns_rrtype type, const char **typename_r, + const void *datap, char **data_r) { + static char buf[12]; + adns_status st; + + st= adns_rr_info(type, typename_r, 0,0, datap,data_r); + if (st == adns_s_nomemory) sysfail("adns_rr_info failed",ENOMEM); + assert(!st); + if (typename_r && !*typename_r) { + sprintf(buf,"TYPE%d", (int)(type & adns_rrt_typemask)); + *typename_r= buf; + } +} + static void prep_query(struct query_node **qun_r, int *quflags_r) { struct query_node *qun; char idbuf[20]; - + if (ov_pipe && !ads) usageerr("-f/--pipe not consistent with domains on command line"); ensure_adns_init(); - + qun= malloc(sizeof(*qun)); qun->pqfr= ov_pqfr; if (ov_id) { @@ -85,24 +92,31 @@ (ov_qc_query ? adns_qf_quoteok_query : 0) | (ov_qc_anshost ? adns_qf_quoteok_anshost : 0) | (ov_qc_cname ? 0 : adns_qf_quoteok_cname) | - ov_cname, - + (ov_v6map ? adns_qf_ipv6_mapv4 : 0) | + ov_cname | ov_afflags; + *qun_r= qun; } +static void sockaddr_aton(const char *text, adns_rr_addr *a) { + int err; + + a->len= sizeof(a->addr); + err= adns_text2addr(text,0,adns_qf_addrlit_scope_forbid, + &a->addr.sa,&a->len); + if (err == EINVAL) usageerr("invalid IP address %s",text); + else if (err) sysfail("adns_text2addr",err); +} + void of_ptr(const struct optioninfo *oi, const char *arg, const char *arg2) { struct query_node *qun; int quflags, r; - struct sockaddr_in sa; + adns_rr_addr a; - memset(&sa,0,sizeof(sa)); - sa.sin_family= AF_INET; - if (!inet_aton(arg,&sa.sin_addr)) usageerr("invalid IP address %s",arg); - + sockaddr_aton(arg,&a); prep_query(&qun,&quflags); qun->owner= xstrsave(arg); - r= adns_submit_reverse(ads, - (struct sockaddr*)&sa, + r= adns_submit_reverse(ads, &a.addr.sa, ov_type == adns_r_none ? adns_r_ptr : ov_type, quflags, qun, @@ -115,17 +129,13 @@ void of_reverse(const struct optioninfo *oi, const char *arg, const char *arg2) { struct query_node *qun; int quflags, r; - struct sockaddr_in sa; + adns_rr_addr a; - memset(&sa,0,sizeof(sa)); - sa.sin_family= AF_INET; - if (!inet_aton(arg,&sa.sin_addr)) usageerr("invalid IP address %s",arg); - + sockaddr_aton(arg,&a); prep_query(&qun,&quflags); qun->owner= xmalloc(strlen(arg) + strlen(arg2) + 2); sprintf(qun->owner, "%s %s", arg,arg2); - r= adns_submit_reverse_any(ads, - (struct sockaddr*)&sa, arg2, + r= adns_submit_reverse_any(ads, &a.addr.sa,arg2, ov_type == adns_r_none ? adns_r_txt : ov_type, quflags, qun, @@ -165,7 +175,7 @@ static void print_ttl(struct query_node *qun, adns_answer *answer) { unsigned long ttl; time_t now; - + switch (qun->pqfr.ttl) { case tm_none: return; @@ -227,8 +237,7 @@ static void print_dnsfail(adns_status st, struct query_node *qun, adns_answer *answer) { int r; const char *typename, *statusstring; - adns_status ist; - + if (ov_format == fmt_inline) { if (fputs("; failed ",stdout) == EOF) outerr(); print_status(st,qun,answer); @@ -238,7 +247,7 @@ if (st == adns_s_nxdomain) { r= fprintf(stderr,"%s does not exist\n", owner_show(qun,answer)); } else { - ist= adns_rr_info(answer->type, &typename, 0,0,0,0); + type_info(answer->type, &typename, 0,0); if (st == adns_s_nodata) { r= fprintf(stderr,"%s has no %s record\n", owner_show(qun,answer), typename); } else { @@ -249,9 +258,9 @@ } if (r == EOF) sysfail("write error message to stderr",errno); } - + void query_done(struct query_node *qun, adns_answer *answer) { - adns_status st, ist; + adns_status st; int rrn, nrrs; const char *rrp, *realowner, *typename; char *datastr; @@ -285,9 +294,7 @@ rrn++, rrp += answer->rrsz) { if (realowner) print_withspace(realowner); print_ttl(qun,answer); - ist= adns_rr_info(answer->type, &typename, 0, 0, rrp, &datastr); - if (ist == adns_s_nomemory) sysfail("adns_rr_info failed",ENOMEM); - assert(!ist); + type_info(answer->type,&typename, rrp,&datastr); if (qun->pqfr.show_type) print_withspace(typename); if (printf("%s\n",datastr) == EOF) outerr(); free(datastr); Index: sdk/lib/3rdparty/adns/client/adnsheloex.c =================================================================== --- sdk/lib/3rdparty/adns/client/adnsheloex.c (nonexistent) +++ sdk/lib/3rdparty/adns/client/adnsheloex.c (working copy) @@ -0,0 +1,300 @@ +/* + * adnsheloex.c + * - look up the A record of hosts in an Exim log that failed HELO verification + */ +/* + * This file is + * Copyright (C) 2004 Tony Finch + * + * It is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation. + * + * This file is by Tony Finch, based on adnslogres.c. + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "adns.h" +#include "client.h" + +#ifdef ADNS_REGRESS_TEST +# include "hredirect.h" +#endif + +/* maximum number of concurrent DNS queries */ +#define MAXMAXPENDING 64000 +#define DEFMAXPENDING 2000 + +/* maximum length of a line */ +#define MAXLINE 1024 + +/* option flags */ +#define OPT_DEBUG 1 +#define OPT_POLL 2 + +static const char *const progname= "adnsheloex"; +static const char *config_text; + +#define guard_null(str) ((str) ? (str) : "") + +#define sensible_ctype(type,ch) (type((unsigned char)(ch))) + /* isfoo() functions from ctype.h can't safely be fed char - blech ! */ + +static void msg(const char *fmt, ...) { + va_list al; + + fprintf(stderr, "%s: ", progname); + va_start(al,fmt); + vfprintf(stderr, fmt, al); + va_end(al); + fputc('\n',stderr); +} + +static void aargh(const char *cause) { + const char *why = strerror(errno); + if (!why) why = "Unknown error"; + msg("%s: %s (%d)", cause, why, errno); + exit(1); +} + +typedef struct logline { + struct logline *next; + char *start, *name, *rest, *addr; + adns_query query; +} logline; + +static logline *readline(FILE *inf, adns_state adns, int opts) { + static char buf[MAXLINE]; + char *str, *p, *q, *r; + logline *line; + + if (fgets(buf, MAXLINE, inf)) { + str= malloc(sizeof(*line) + strlen(buf) + 1); + if (!str) aargh("malloc"); + line= (logline*)str; + line->next= NULL; + line->start= str+sizeof(logline); + strcpy(line->start, buf); + line->name= line->rest= line->addr= NULL; + /* look for unverifiable HELO information matching the regex + H=[a-z0-9.- ]*[(][a-z0-9.-]*[)] [[][0-9.]*[]] */ + for (p= strchr(line->start, ' '); p; p= strchr(p+1, ' ')) { + if (!strncmp(p, " H=", 3)) { + r= strchr(p, '['); + if (!r) break; + q= strchr(p, ')'); + if (!q || q>r) break; + p= strchr(p, '('); + if (!p || p>q) break; + line->name= p+1; + line->rest= q; + line->addr= r+1; + break; + } + } + if (line->name) { + *line->rest= '\0'; + if (opts & OPT_DEBUG) + msg("submitting %s", line->name); + if (adns_submit(adns, line->name, adns_r_a, + adns_qf_quoteok_query|adns_qf_quoteok_cname|adns_qf_cname_loose, + NULL, &line->query)) + aargh("adns_submit"); + *line->rest= ')'; + } else { + if (opts & OPT_DEBUG) + msg("no query"); + line->query= NULL; + } + return line; + } + if (!feof(inf)) + aargh("fgets"); + return NULL; +} + +static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) { + int eof, err, len; + adns_state adns; + adns_answer *answer; + logline *head, *tail, *line; + adns_initflags initflags; + + initflags= (opts & OPT_DEBUG) ? adns_if_debug : 0; + if (config_text) { + errno= adns_init_strcfg(&adns, initflags, stderr, config_text); + } else { + errno= adns_init(&adns, initflags, 0); + } + if (errno) aargh("adns_init"); + head= tail= readline(inf, adns, opts); + len= 1; eof= 0; + while (head) { + while (head) { + if (head->query) { + if (opts & OPT_DEBUG) + msg("%d in queue; checking %.*s", len, + (int)(head->rest-head->name), guard_null(head->name)); + if (eof || len >= maxpending) { + if (opts & OPT_POLL) + err= adns_wait_poll(adns, &head->query, &answer, NULL); + else + err= adns_wait(adns, &head->query, &answer, NULL); + } else { + err= adns_check(adns, &head->query, &answer, NULL); + } + if (err == EAGAIN) break; + if (err) { + fprintf(stderr, "%s: adns_wait/check: %s", progname, strerror(err)); + exit(1); + } + if (answer->status == adns_s_ok) { + const char *addr; + int ok = 0; + fprintf(outf, "%.*s", (int)(head->rest-head->start), head->start); + while(answer->nrrs--) { + addr= inet_ntoa(answer->rrs.inaddr[answer->nrrs]); + ok |= !strncmp(addr, head->addr, strlen(addr)); + fprintf(outf, " [%s]", addr); + } + fprintf(outf, "%s%s", ok ? " OK" : "", head->rest); + } else { + if (opts & OPT_DEBUG) + msg("query failed"); + fputs(head->start, outf); + } + free(answer); + len--; + } else { + if (opts & OPT_DEBUG) + msg("%d in queue; no query on this line", len); + fputs(head->start, outf); + } + line= head; head= head->next; + free(line); + } + if (!eof) { + line= readline(inf, adns, opts); + if (line) { + if (!head) head= line; + else tail->next= line; + tail= line; + if (line->query) len++; + } else { + eof= 1; + } + } + } + adns_finish(adns); +} + +static void printhelp(FILE *file) { + fputs("usage: adnsheloex [] []\n" + " adnsheloex --version|--help\n" + "options: -c set max number of outstanding queries\n" + " -p use poll(2) instead of select(2)\n" + " -d turn on debugging\n" + " -C use instead of contents of resolv.conf\n", + stdout); +} + +static void usage(void) { + printhelp(stderr); + exit(1); +} + +int main(int argc, char *argv[]) { + int c, opts, maxpending; + extern char *optarg; + FILE *inf; + + if (argv[1] && !strncmp(argv[1],"--",2)) { + if (!strcmp(argv[1],"--help")) { + printhelp(stdout); + } else if (!strcmp(argv[1],"--version")) { + fputs(VERSION_MESSAGE("adnsheloex"),stdout); + } else { + usage(); + } + if (ferror(stdout) || fclose(stdout)) { perror("stdout"); exit(1); } + exit(0); + } + + maxpending= DEFMAXPENDING; + opts= 0; + while ((c= getopt(argc, argv, "c:C:dp")) != -1) + switch (c) { + case 'c': + maxpending= atoi(optarg); + if (maxpending < 1 || maxpending > MAXMAXPENDING) { + fprintf(stderr, "%s: unfeasible concurrency %d\n", progname, maxpending); + exit(1); + } + break; + case 'C': + config_text= optarg; + break; + case 'd': + opts|= OPT_DEBUG; + break; + case 'p': + opts|= OPT_POLL; + break; + default: + usage(); + } + + argc-= optind; + argv+= optind; + + inf= NULL; + if (argc == 0) + inf= stdin; + else if (argc == 1) + inf= fopen(*argv, "r"); + else + usage(); + + if (!inf) + aargh("couldn't open input"); + + proclog(inf, stdout, maxpending, opts); + + if (fclose(inf)) + aargh("fclose input"); + if (fclose(stdout)) + aargh("fclose output"); + + return 0; +} Index: sdk/lib/3rdparty/adns/client/adnshost.h =================================================================== --- sdk/lib/3rdparty/adns/client/adnshost.h (revision 72742) +++ sdk/lib/3rdparty/adns/client/adnshost.h (working copy) @@ -3,26 +3,25 @@ * - useful general-purpose resolver client program, header file */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifndef ADNSHOST_H_INCLUDED @@ -38,13 +37,12 @@ #include #include -#ifndef ADNS_JGAA_WIN32 -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#define ADNS_FEATURE_MANYAF #include "config.h" #include "adns.h" #include "dlist.h" @@ -83,7 +81,7 @@ extern int ov_verbose; extern adns_rrtype ov_type; extern int ov_search, ov_qc_query, ov_qc_anshost, ov_qc_cname; -extern int ov_tcp, ov_cname, ov_format; +extern int ov_tcp, ov_cname, ov_afflags, ov_v6map, ov_format; extern char *ov_id; extern struct perqueryflags_remember ov_pqfr; @@ -110,6 +108,12 @@ void query_do(const char *domain); void query_done(struct query_node *qun, adns_answer *answer); +void type_info(adns_rrtype type, const char **typename_r, + const void *datap, char **data_r); + /* wrapper for adns_rr_info which uses a static buffer to provide + * *typename_r for adns_r_unknown */ + + /* declarations related to main program and useful utility functions */ void sysfail(const char *what, int errnoval) NONRETURNING; Index: sdk/lib/3rdparty/adns/client/adnslogres.c =================================================================== --- sdk/lib/3rdparty/adns/client/adnslogres.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/adnslogres.c (working copy) @@ -8,22 +8,24 @@ * Copyright (C) 1999-2000 Ian Jackson * * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. * * This version was originally supplied by Tony Finch, but has been * modified by Ian Jackson as it was incorporated into adns and @@ -30,21 +32,17 @@ * subsequently. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -# include "getopt.h" -#else -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "config.h" #include "adns.h" #include "client.h" @@ -62,11 +60,8 @@ /* option flags */ #define OPT_DEBUG 1 +#define OPT_POLL 2 -#ifdef HAVE_POLL -# define OPT_POLL 2 -#endif - static const char *const progname= "adnslogres"; static const char *config_text; @@ -119,10 +114,10 @@ } } sprintf(buf, "%.*s.%.*s.%.*s.%.*s.in-addr.arpa.", - ptrs[4]-ptrs[3]-1, ptrs[3], - ptrs[3]-ptrs[2]-1, ptrs[2], - ptrs[2]-ptrs[1]-1, ptrs[1], - ptrs[1]-ptrs[0]-1, ptrs[0]); + (int)(ptrs[4]-ptrs[3]-1), ptrs[3], + (int)(ptrs[3]-ptrs[2]-1), ptrs[2], + (int)(ptrs[2]-ptrs[1]-1), ptrs[1], + (int)(ptrs[1]-ptrs[0]-1), ptrs[0]); *addr= ptrs[0]; *rest= ptrs[4]-1; return buf; @@ -130,7 +125,7 @@ static void printline(FILE *outf, char *start, char *addr, char *rest, char *domain) { if (domain) - fprintf(outf, "%.*s%s%s", addr - start, start, domain, rest); + fprintf(outf, "%.*s%s%s", (int)(addr - start), start, domain, rest); else fputs(start, outf); if (ferror(outf)) aargh("write output"); @@ -156,7 +151,7 @@ strcpy(line->start, buf); str= ipaddr2domain(line->start, &line->addr, &line->rest); if (opts & OPT_DEBUG) - msg("submitting %.*s -> %s", line->rest-line->addr, guard_null(line->addr), str); + msg("submitting %.*s -> %s", (int)(line->rest-line->addr), guard_null(line->addr), str); if (adns_submit(adns, str, adns_r_ptr, adns_qf_quoteok_cname|adns_qf_cname_loose, NULL, &line->query)) @@ -167,7 +162,7 @@ aargh("fgets"); return NULL; } - + static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) { int eof, err, len; adns_state adns; @@ -188,18 +183,16 @@ while (head) { if (opts & OPT_DEBUG) msg("%d in queue; checking %.*s", len, - head->rest-head->addr, guard_null(head->addr)); + (int)(head->rest-head->addr), guard_null(head->addr)); if (eof || len >= maxpending) { -#ifdef HAVE_POLL if (opts & OPT_POLL) err= adns_wait_poll(adns, &head->query, &answer, NULL); else -#endif err= adns_wait(adns, &head->query, &answer, NULL); } else { err= adns_check(adns, &head->query, &answer, NULL); } - if ((err == EAGAIN) || (EWOULDBLOCK == err)) break; + if (err == EAGAIN) break; if (err) { fprintf(stderr, "%s: adns_wait/check: %s", progname, strerror(err)); exit(1); @@ -229,9 +222,7 @@ fputs("usage: adnslogres [] []\n" " adnslogres --version|--help\n" "options: -c set max number of outstanding queries\n" -#ifdef HAVE_POLL " -p use poll(2) instead of select(2)\n" -#endif " -d turn on debugging\n" " -C use instead of contents of resolv.conf\n", stdout); @@ -276,11 +267,9 @@ case 'd': opts|= OPT_DEBUG; break; -#ifdef HAVE_POLL case 'p': opts|= OPT_POLL; break; -#endif default: usage(); } Index: sdk/lib/3rdparty/adns/client/adnsresfilter.c =================================================================== --- sdk/lib/3rdparty/adns/client/adnsresfilter.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/adnsresfilter.c (working copy) @@ -3,26 +3,25 @@ * - filter which does resolving, not part of the library */ /* - * This file is - * Copyright (C) 1999-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #include @@ -49,8 +48,7 @@ struct outqueuenode { struct outqueuenode *next, *back; - void *buffer; - char *textp; + char *buffer, *textp; int textlen; struct timeval printbefore; struct treething *addr; @@ -86,7 +84,7 @@ static int nonblock(int fd, int isnonblock) { int r; - r= fcntl(fd,F_GETFL); + r= fcntl(fd,F_GETFL); if (r==-1) return -1; r= fcntl(fd,F_SETFL, isnonblock ? r|O_NONBLOCK : r&~O_NONBLOCK); if (r==-1) return -1; @@ -215,10 +213,11 @@ static void queueoutchar(int c) { struct outqueuenode *entry; - + entry= outqueue.tail; - if (!entry || entry->addr || entry->textlen >= peroutqueuenode) { - peroutqueuenode= !peroutqueuenode || !entry || entry->addr ? 128 : + if (!entry || entry->addr || + entry->textlen >= peroutqueuenode - (entry->textp - entry->buffer)) { + peroutqueuenode= !peroutqueuenode || !entry || entry->addr ? 128 : peroutqueuenode >= 1024 ? 4096 : peroutqueuenode<<2; entry= xmalloc(sizeof(*entry)); entry->buffer= xmalloc(peroutqueuenode); @@ -310,7 +309,7 @@ void **searchfound; struct outqueuenode *entry; int r; - + if (!newthing) { newthing= xmalloc(sizeof(struct treething)); newthing->qu= 0; @@ -427,7 +426,7 @@ continue; } if (entry->addr->ans) { - if (entry->addr->ans->nrrs) + if (entry->addr->ans->nrrs) replacetextwithname(entry); entry->addr= 0; continue; @@ -450,10 +449,8 @@ } if (outblocked) FD_SET(1,&writefds); if (!inputeof && outqueuelen<1024) FD_SET(0,&readfds); - - ADNS_CLEAR_ERRNO; + r= select(maxfd,&readfds,&writefds,&exceptfds,tv); - ADNS_CAPTURE_ERRNO; if (r < 0) { if (r == EINTR) continue; else sysfail("select"); } r= gettimeofday(&now,0); if (r) sysfail("gettimeofday"); Index: sdk/lib/3rdparty/adns/client/adnstest.c =================================================================== --- sdk/lib/3rdparty/adns/client/adnstest.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/adnstest.c (working copy) @@ -3,40 +3,36 @@ * - simple test program, not part of the library */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -#else -# include -# include -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include +#include +#include +#define ADNS_FEATURE_MANYAF #include "config.h" #include "adns.h" @@ -49,7 +45,7 @@ int doneyet, found; const char *fdom; }; - + static struct myctx *mcs; static adns_state ads; static adns_rrtype *types_a; @@ -59,7 +55,7 @@ free(mcs); free(types_a); if (ads) adns_finish(ads); - + exit(rc); } @@ -68,7 +64,6 @@ int poll(struct pollfd *ufds, int nfds, int timeout) { fputs("poll(2) not supported on this system\n",stderr); quitnow(5); - return -1; /* compiler food */ } #define adns_beforepoll(a,b,c,d,e) 0 #define adns_afterpoll(a,b,c,d) 0 @@ -82,7 +77,18 @@ static void failure_errno(const char *what, int errnoval) NONRETURNING; static void failure_errno(const char *what, int errnoval) { - fprintf(stderr,"adns failure: %s: errno=%d\n",what,errnoval); + switch (errnoval) { +#define CE(e) \ + case e: fprintf(stderr,"adns failure: %s: errno=" #e "\n",what); break + CE(EINVAL); + CE(EINTR); + CE(ESRCH); + CE(EAGAIN); + CE(ENOSYS); + CE(ERANGE); +#undef CE + default: fprintf(stderr,"adns failure: %s: errno=%d\n",what,errnoval); break; + } quitnow(2); } @@ -96,6 +102,7 @@ "initflags: p use poll(2) instead of select(2)\n" " s use adns_wait with specified query, instead of 0\n" "queryflags: a print status abbrevs instead of strings\n" + "typenum: may be 0x|, or 0x or \n" "exit status: 0 ok (though some queries may have failed)\n" " 1 used by test harness to indicate test failed\n" " 2 unable to submit or init or some such\n" @@ -116,12 +123,12 @@ adns_r_mx_raw, adns_r_txt, adns_r_rp_raw, - + adns_r_addr, adns_r_ns, adns_r_ptr, adns_r_mx, - + adns_r_soa, adns_r_rp, @@ -130,7 +137,7 @@ static void dumptype(adns_status ri, const char *rrtn, const char *fmtn) { fprintf(stdout, "%s(%s)%s%s", - ri ? "?" : rrtn, ri ? "?" : fmtn ? fmtn : "-", + (!ri && rrtn) ? rrtn : "?", ri ? "?" : fmtn ? fmtn : "-", ri ? " " : "", ri ? adns_strerror(ri) : ""); } @@ -195,18 +202,25 @@ } else { usageerr("bad [,]"); } - + if (argv[0] && argv[1] && argv[1][0] == ':') { for (cp= argv[1]+1, tc=1; (ch= *cp); cp++) if (ch==',') tc++; types_a= malloc(sizeof(*types_a)*(tc+1)); if (!types_a) { perror("malloc types"); quitnow(3); } - for (cp= argv[1]+1, ti=0; tidoneyet= 0; mc->fdom= fdomlist[qi]; - fprintf(stdout,"%s flags %d type %d",domain,qflags,types[ti]); + fprintf(stdout,"%s flags %d type %d", + domain,qflags,types[ti]&adns_rrt_reprmask); r= adns_submit(ads,domain,types[ti],qflags,mc,&mc->qu); if (r == ENOSYS) { fprintf(stdout," not implemented\n"); @@ -297,25 +312,22 @@ mc= 0; } -#ifdef HAVE_POLL - if (strchr(owninitflags,'p')) { - r= adns_wait_poll(ads,&qu,&ans,&mcr); - } else -#endif - { + if (strchr(owninitflags,'p')) { + r= adns_wait_poll(ads,&qu,&ans,&mcr); + } else { r= adns_wait(ads,&qu,&ans,&mcr); } if (r) failure_errno("wait/check",r); - + if (mc) assert(mcr==mc); else mc= mcr; assert(qu==mc->qu); assert(!mc->doneyet); - + fdom_split(mc->fdom,&domain,&qflags,ownflags,sizeof(ownflags)); if (gettimeofday(&now,0)) { perror("gettimeofday"); quitnow(3); } - + ri= adns_rr_info(ans->type, &rrtn,&fmtn,&len, 0,0); fprintf(stdout, "%s flags %d type ",domain,qflags); dumptype(ri,rrtn,fmtn); Index: sdk/lib/3rdparty/adns/client/client.h =================================================================== --- sdk/lib/3rdparty/adns/client/client.h (revision 72742) +++ sdk/lib/3rdparty/adns/client/client.h (working copy) @@ -3,36 +3,37 @@ * - useful declarations and definitions for adns client programs */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifndef CLIENT_H_INCLUDED #define CLIENT_H_INCLUDED -#define ADNS_VERSION_STRING "1.0" +#define ADNS_VERSION_STRING "1.5.0" #define COPYRIGHT_MESSAGE \ - "Copyright (C) 1997-2000 Ian Jackson \n" \ - "Copyright (C) 1999-2000 Tony Finch \n" \ + "Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson\n" \ + "Copyright (C) 2014 Mark Wooding\n" \ + "Copyright (C) 1999-2000,2003,2006 Tony Finch\n" \ + "Copyright (C) 1991 Massachusetts Institute of Technology\n" \ "This is free software; see the source for copying conditions. There is NO\n" \ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" Index: sdk/lib/3rdparty/adns/client/fanftest.c =================================================================== --- sdk/lib/3rdparty/adns/client/fanftest.c (revision 72742) +++ sdk/lib/3rdparty/adns/client/fanftest.c (working copy) @@ -8,38 +8,37 @@ * Copyright (C) 1999-2000 Ian Jackson * * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. * * This version was originally supplied by Tony Finch, but has been * modified by Ian Jackson as it was incorporated into adns. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -#else -# include -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include +#include + #include "config.h" #include "adns.h" Index: sdk/lib/3rdparty/adns/client/Makefile.in =================================================================== --- sdk/lib/3rdparty/adns/client/Makefile.in (revision 72742) +++ sdk/lib/3rdparty/adns/client/Makefile.in (working copy) @@ -1,15 +1,15 @@ # client/Makefile - client program(s) Makefile # -# This file is -# Copyright (C) 1997-2000 Ian Jackson -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -18,8 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. srcdir= @srcdir@ VPATH= @srcdir@ @@ -27,15 +26,15 @@ PROGS_SYSDEP= @PROGS_HAVE_TSEARCH@ ENABLE_DYNAMIC= @ENABLE_DYNAMIC@ -PROGRAMS= adnslogres adnshost $(PROGS_SYSDEP) -PROGRAMS_LOCAL= fanftest adnstest +PROGRAMS= adnslogres adnsheloex adnshost $(PROGS_SYSDEP) +PROGRAMS_LOCAL= fanftest adnstest addrtext PROGRAMS_ALL= $(PROGRAMS) $(PROGRAMS_LOCAL) -STATIC_LIB= $(ADNSDIR)/libadns.a +STATIC_LIB= ../src/libadns.a ifeq ($(ENABLE_DYNAMIC),elf) -DYNAMIC_DEP= $(srcdir)/../dynamic/$(SHLIBFILE) -DYNAMIC_LINK= -L$(srcdir)/../dynamic -ladns +DYNAMIC_DEP= ../dynamic/$(SHLIBFILE) +DYNAMIC_LINK= -L../dynamic -ladns DYNAMIC_SUFFIX= _s else DYNAMIC_DEP= $(STATIC_LIB) @@ -46,24 +45,25 @@ TARG_INSTALL= $(PROGRAMS) TARG_LOCAL= $(addsuffix $(DYNAMIC_SUFFIX), $(PROGRAMS_ALL)) TARGETS= $(TARG_LOCAL) $(TARG_INSTALL) -include $(srcdir)/../settings.make +include ../settings.make -DIRCFLAGS= -I$(srcdir)/../src +ADNSDIR= $(srcdir)/../src +DIRCFLAGS= -I. -I../src -I$(ADNSDIR) TARG_OBJS= $(addsuffix .o, $(PROGRAMS_ALL)) ADH_OBJS= adh-main.o adh-opts.o adh-query.o ALL_OBJS= $(ADH_OBJS) $(TARG_OBJS) -ADNSDIR= $(srcdir)/../src/ all: $(TARGETS) install: $(TARG_INSTALL) + mkdir -p $(bindir) set -xe; for f in $(TARG_INSTALL); \ - do $(INSTALL_PROGRAM) $$f $(bin_dir)/$$f; done + do $(INSTALL_PROGRAM) $$f $(bindir)/$$f; done uninstall: - for f in $(TARGETS); do rm -f $(bin_dir)/$$f; done + for f in $(TARGETS); do rm -f $(bindir)/$$f; done adnshost: $(ADH_OBJS) $(DYNAMIC_DEP) $(CC) $(LDFLAGS) $(ADH_OBJS) $(DYNAMIC_LINK) -o $@ $(LDLIBS) @@ -72,7 +72,7 @@ $(CC) $(LDFLAGS) $(ADH_OBJS) $(STATIC_LIB) -o $@ $(LDLIBS) $(ADH_OBJS): adnshost.h -$(ALL_OBJS): $(ADNSDIR)/adns.h $(ADNSDIR)/config.h +$(ALL_OBJS): $(ADNSDIR)/adns.h ../src/config.h adnsresfilter.o: $(ADNSDIR)/tvarith.h %: %.o $(DYNAMIC_DEP) Index: sdk/lib/3rdparty/adns/CMakeLists.txt =================================================================== --- sdk/lib/3rdparty/adns/CMakeLists.txt (revision 72742) +++ sdk/lib/3rdparty/adns/CMakeLists.txt (working copy) @@ -9,6 +9,7 @@ list(APPEND SOURCE adns_win32/adns_unix_calls.c + src/addrfam.c src/check.c src/event.c src/general.c @@ -26,5 +27,5 @@ add_pch(adns src/internal.h SOURCE) if((NOT MSVC) AND (NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")) - add_target_compile_flags(adns "-Wno-unused-but-set-variable") + add_target_compile_flags(adns "-Wno-unused-but-set-variable -Wno-unused-function -Wno-return-type -Wno-pointer-sign") endif() Index: sdk/lib/3rdparty/adns/common.make.in =================================================================== --- sdk/lib/3rdparty/adns/common.make.in (nonexistent) +++ sdk/lib/3rdparty/adns/common.make.in (working copy) @@ -0,0 +1,63 @@ +# common.make[.in] - common configuration settings for Makefiles, +# used by autoconf/configure to generate settings.make +# +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation. + +MAJOR= 1 +MINOR= 5 +SHLIBFILE= @SHLIBFILE@ +SHLIBSONAME= @SHLIBSONAME@ +SHLIBFORLINK= @SHLIBFORLINK@ + +CC= @CC@ +CFLAGS= $(AUTOCFLAGS) $(WARNS) $(WERROR) $(DIRCFLAGS) $(XCFLAGS) +LDFLAGS= $(AUTOLDFLAGS) $(DIRLDFLAGS) $(XLDFLAGS) +LDLIBS= @LIBS@ $(XLIBS) +AUTOCFLAGS= @CFLAGS@ +AUTOLDFLAGS= @LDFLAGS@ +WARNS= @WARNS@ +#WERROR= -Werror + +M4= m4 +RANLIB= @RANLIB@ + +SHLIBCC= @SHLIBCC@ + +MKSHLIB_1= @MKSHLIB_1@ +MKSHLIB_2= @MKSHLIB_2@ +MKSHLIB_3= @MKSHLIB_3@ + +prefix= @prefix@ +exec_prefix= @exec_prefix@ +bindir= @bindir@ +libdir= @libdir@ +includedir= @includedir@ + +AC_INSTALL= @INSTALL@ +ifeq ($(AC_INSTALL),./install-sh -c) +INSTALL= $(srcdir)/../$(AC_INSTALL) +else +INSTALL= $(AC_INSTALL) +endif + +INSTALL_PROGRAM= $(INSTALL) -m 755 $(INSTALL_PROGRAM_FLAGS) +INSTALL_DATA= $(INSTALL) -m 644 + Index: sdk/lib/3rdparty/adns/configure =================================================================== --- sdk/lib/3rdparty/adns/configure (nonexistent) +++ sdk/lib/3rdparty/adns/configure (working copy) @@ -0,0 +1,5342 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="src/adns.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +SHLIBSONAME +SHLIBFILE +SHLIBFORLINK +MKSHLIB_3 +MKSHLIB_2 +MKSHLIB_1 +SHLIBCC +WARNS +EGREP +GREP +PROGS_HAVE_TSEARCH +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +RANLIB +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +ENABLE_DYNAMIC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dynamic +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dynamic use static linking + --enable-dynamic=elf create and use ELF dynamic library (default) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_config_headers="$ac_config_headers src/config.h" + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether you requested dynamic linking" >&5 +$as_echo_n "checking whether you requested dynamic linking... " >&6; } + +# Check whether --enable-dynamic was given. +if test "${enable_dynamic+set}" = set; then : + enableval=$enable_dynamic; case "$enableval" in + elf|yes) + ENABLE_DYNAMIC=elf + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (ELF)" >&5 +$as_echo "yes (ELF)" >&6; } + ;; + no) ENABLE_DYNAMIC=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + *) as_fn_error $? "\"invalid value $enableval for --enable-dynamic, try yes or elf\"" "$LINENO" 5 + ;; + esac + +else + + ENABLE_DYNAMIC=elf + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, by default" >&5 +$as_echo "yes, by default" >&6; } + +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + +for ac_func in poll +do : + ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" +if test "x$ac_cv_func_poll" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_POLL 1 +_ACEOF + +fi +done + + + ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" +if test "x$ac_cv_func_socket" = xyes; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 +$as_echo_n "checking for socket in -lsocket... " >&6; } +if ${ac_cv_lib_socket_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_socket=yes +else + ac_cv_lib_socket_socket=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 +$as_echo "$ac_cv_lib_socket_socket" >&6; } +if test "x$ac_cv_lib_socket_socket" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSOCKET 1 +_ACEOF + + LIBS="-lsocket $LIBS" + +else + + as_fn_error $? "cannot find library function socket" "$LINENO" 5 + +fi + + +fi + + + + ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" +if test "x$ac_cv_func_inet_ntoa" = xyes; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnsl" >&5 +$as_echo_n "checking for inet_ntoa in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_inet_ntoa+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_ntoa (); +int +main () +{ +return inet_ntoa (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nsl_inet_ntoa=yes +else + ac_cv_lib_nsl_inet_ntoa=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_inet_ntoa" >&5 +$as_echo "$ac_cv_lib_nsl_inet_ntoa" >&6; } +if test "x$ac_cv_lib_nsl_inet_ntoa" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNSL 1 +_ACEOF + + LIBS="-lnsl $LIBS" + +else + + as_fn_error $? "cannot find library function inet_ntoa" "$LINENO" 5 + +fi + + +fi + + + +PROGS_IF_TSEARCH=adnsresfilter + +ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" +if test "x$ac_cv_func_tsearch" = xyes; then : + + PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH + +else + + PROGS_HAVE_TSEARCH=''; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: tsearch missing - not building client program(s) $PROGS_IF_TSEARCH" >&5 +$as_echo "$as_me: WARNING: tsearch missing - not building client program(s) $PROGS_IF_TSEARCH" >&2;} + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for INADDR_LOOPBACK" >&5 +$as_echo_n "checking for INADDR_LOOPBACK... " >&6; } +if ${adns_cv_decl_inaddrloopback+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + + INADDR_LOOPBACK; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + adns_cv_decl_inaddrloopback=yes +else + adns_cv_decl_inaddrloopback=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +if test "$adns_cv_decl_inaddrloopback" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not in standard headers, urgh..." >&5 +$as_echo "not in standard headers, urgh..." >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_header_mongrel "$LINENO" "rpc/types.h" "ac_cv_header_rpc_types_h" "$ac_includes_default" +if test "x$ac_cv_header_rpc_types_h" = xyes; then : + + $as_echo "#define HAVEUSE_RPCTYPES_H 1" >>confdefs.h + + +else + + as_fn_error $? "cannot find INADDR_LOOPBACK or rpc/types.h" "$LINENO" 5 + +fi + + +fi + + + ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton" +if test "x$ac_cv_func_inet_aton" = xyes; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 +$as_echo_n "checking for inet_aton in -lresolv... " >&6; } +if ${ac_cv_lib_resolv_inet_aton+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_aton (); +int +main () +{ +return inet_aton (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_resolv_inet_aton=yes +else + ac_cv_lib_resolv_inet_aton=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 +$as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } +if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : + + LIBS="-lresolv $LIBS"; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: inet_aton is in libresolv, urgh. Must use -lresolv." >&5 +$as_echo "$as_me: WARNING: inet_aton is in libresolv, urgh. Must use -lresolv." >&2;} + +else + + as_fn_error $? "cannot find library function inet_aton" "$LINENO" 5 + +fi + + +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking inlines" >&5 +$as_echo_n "checking inlines... " >&6; } + if ${dpkg_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +} inline int foo (int x) { + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + dpkg_cv_c_inline=yes +else + dpkg_cv_c_inline=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + if test "x$dpkg_cv_c_inline" = xyes; then + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_INLINE 1" >>confdefs.h + + else + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + + +if test "${GCC-no}" = yes; then + WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith" + saved_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Wno-pointer-sign" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking -Wno-pointer-sign" >&5 +$as_echo_n "checking -Wno-pointer-sign... " >&6; } + if ${adns_cv_c_wnoptrsign+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + adns_cv_c_wnoptrsign=yes +else + adns_cv_c_wnoptrsign=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + if test "x$adns_cv_c_wnoptrsign" = xyes; then + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + WARNS="$WARNS -Wno-pointer-sign" + else + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + CFLAGS="$saved_cflags" +else + WARNS= +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking __attribute__((,,))" >&5 +$as_echo_n "checking __attribute__((,,))... " >&6; } + if ${adns_cv_c_attribute_supported+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern int testfunction(int x) __attribute__((,,)) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + adns_cv_c_attribute_supported=yes +else + adns_cv_c_attribute_supported=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + if test "x$adns_cv_c_attribute_supported" = xyes; then + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_GNUC25_ATTRIB 1" >>confdefs.h + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking __attribute__((noreturn))" >&5 +$as_echo_n "checking __attribute__((noreturn))... " >&6; } + if ${adns_cv_c_attribute_noreturn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern int testfunction(int x) __attribute__((noreturn)) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + adns_cv_c_attribute_noreturn=yes +else + adns_cv_c_attribute_noreturn=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + if test "x$adns_cv_c_attribute_noreturn" = xyes; then + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_GNUC25_NORETURN 1" >>confdefs.h + + else + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking __attribute__((const))" >&5 +$as_echo_n "checking __attribute__((const))... " >&6; } + if ${adns_cv_c_attribute_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern int testfunction(int x) __attribute__((const)) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + adns_cv_c_attribute_const=yes +else + adns_cv_c_attribute_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + if test "x$adns_cv_c_attribute_const" = xyes; then + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_GNUC25_CONST 1" >>confdefs.h + + else + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking __attribute__((format...))" >&5 +$as_echo_n "checking __attribute__((format...))... " >&6; } + if ${adns_cv_attribute_format+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern int testfunction(char *y, ...) __attribute__((format(printf,1,2))) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + adns_cv_attribute_format=yes +else + adns_cv_attribute_format=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + if test "x$adns_cv_attribute_format" = xyes; then + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_GNUC25_PRINTFFORMAT 1" >>confdefs.h + + else + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + else + true + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + + + + + + + + + + +SHLIBFORLINK='libadns.so' +SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)' +SHLIBFILE='$(SHLIBSONAME).$(MINOR)' + +SHLIBCC='$(CC) $(CFLAGS) -fpic' +MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o' +MKSHLIB_2='' +MKSHLIB_3='-lc' + +ac_config_files="$ac_config_files common.make settings.make Makefile src/Makefile client/Makefile dynamic/Makefile regress/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; + "common.make") CONFIG_FILES="$CONFIG_FILES common.make" ;; + "settings.make") CONFIG_FILES="$CONFIG_FILES settings.make" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "client/Makefile") CONFIG_FILES="$CONFIG_FILES client/Makefile" ;; + "dynamic/Makefile") CONFIG_FILES="$CONFIG_FILES dynamic/Makefile" ;; + "regress/Makefile") CONFIG_FILES="$CONFIG_FILES regress/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + Index: sdk/lib/3rdparty/adns/configure.in =================================================================== --- sdk/lib/3rdparty/adns/configure.in (revision 72742) +++ sdk/lib/3rdparty/adns/configure.in (working copy) @@ -1,15 +1,15 @@ # configure.in - input to autoconf # -# This file is -# Copyright (C) 1997-2000 Ian Jackson -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -18,14 +18,13 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. AC_INIT(src/adns.h) AC_CONFIG_HEADER(src/config.h) dnl DPKG_CACHED_TRY_COMPILE(,,,,,) -define(DPKG_CACHED_TRY_COMPILE,[ +define([DPKG_CACHED_TRY_COMPILE],[ AC_MSG_CHECKING($1) AC_CACHE_VAL($2,[ AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no]) @@ -112,17 +111,24 @@ AC_DEFINE(HAVE_INLINE), AC_MSG_RESULT(no)) -ADNS_C_GCCATTRIB -AC_CHECK_HEADERS(sys/select.h) - AC_SUBST(WARNS) if test "${GCC-no}" = yes; then WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith" + saved_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Wno-pointer-sign" + DPKG_CACHED_TRY_COMPILE(-Wno-pointer-sign,adns_cv_c_wnoptrsign,, + [], + AC_MSG_RESULT(yes) + WARNS="$WARNS -Wno-pointer-sign", + AC_MSG_RESULT(no)) + CFLAGS="$saved_cflags" else WARNS= fi +ADNS_C_GCCATTRIB + AC_SUBST(SHLIBCC) AC_SUBST(MKSHLIB_1) AC_SUBST(MKSHLIB_2) @@ -142,6 +148,6 @@ MKSHLIB_3='-lc' AC_OUTPUT( - settings.make Makefile + common.make settings.make Makefile src/Makefile client/Makefile dynamic/Makefile regress/Makefile ) Index: sdk/lib/3rdparty/adns/COPYING =================================================================== --- sdk/lib/3rdparty/adns/COPYING (revision 72742) +++ sdk/lib/3rdparty/adns/COPYING (working copy) @@ -1,286 +1,627 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". + TERMS AND CONDITIONS -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. + 0. Definitions. - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. + "This License" refers to version 3 of the GNU General Public License. -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. + A "covered work" means either the unmodified Program or a work based +on the Program. - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: + 1. Source Code. - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. + The Corresponding Source for a work in source code form is that +same work. - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. + 13. Use with the GNU Affero General Public License. -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. + 14. Revised Versions of this License. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. - NO WARRANTY + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. + 15. Disclaimer of Warranty. - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + 16. Limitation of Liability. + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. @@ -287,15 +628,15 @@ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -304,37 +645,30 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this program. If not, see . - Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. Index: sdk/lib/3rdparty/adns/dynamic/Makefile.in =================================================================== --- sdk/lib/3rdparty/adns/dynamic/Makefile.in (revision 72742) +++ sdk/lib/3rdparty/adns/dynamic/Makefile.in (working copy) @@ -1,15 +1,15 @@ # dynamic/Makefile - dynamic library Makefile # -# This file is -# Copyright (C) 1997-1999 Ian Jackson -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -18,24 +18,25 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. srcdir= @srcdir@ VPATH= @srcdir@ TARGETS= $(SHLIBFILE) $(SHLIBSONAME) $(SHLIBFORLINK) -include $(srcdir)/../settings.make +include ../settings.make include $(srcdir)/../src/adns.make ALLOBJS= $(addsuffix _p.o, $(basename $(LIBOBJS))) install: - $(INSTALL_PROGRAM) $(SHLIBFILE) $(lib_dir)/$(SHLIBFILE) - ln -sf $(SHLIBFILE) $(lib_dir)/$(SHLIBSONAME) + mkdir -p $(libdir) + $(INSTALL_PROGRAM) $(SHLIBFILE) $(libdir)/$(SHLIBFILE) + ln -sf $(SHLIBFILE) $(libdir)/$(SHLIBSONAME) + ln -sf $(SHLIBSONAME) $(libdir)/$(SHLIBFORLINK) uninstall: - rm -f $(lib_dir)/$(SHLIBFILE) $(lib_dir)/$(SHLIBSONAME) + rm -f $(libdir)/$(SHLIBFILE) $(libdir)/$(SHLIBSONAME) $(SHLIBFORLINK): ln -s $(SHLIBSONAME) $(SHLIBFORLINK) @@ -48,7 +49,7 @@ $(MKSHLIB_1) $@ $(MKSHLIB_2) $(ALLOBJS) $(LDLIBS) $(MKSHLIB_3) %_p.o: $(srcdir)/../src/%.c $(srcdir)/../src/adns.h \ - $(srcdir)/../src/internal.h $(srcdir)/../src/config.h - $(SHLIBCC) -I$(srcdir)/../src -c -o $@ $< + $(srcdir)/../src/internal.h ../src/config.h + $(SHLIBCC) -I. -I../src -I$(srcdir)/../src -c -o $@ $< $(LIBOBJS): Index: sdk/lib/3rdparty/adns/GPL-vs-LGPL =================================================================== --- sdk/lib/3rdparty/adns/GPL-vs-LGPL (revision 72742) +++ sdk/lib/3rdparty/adns/GPL-vs-LGPL (working copy) @@ -8,39 +8,33 @@ . Typically there are two or three kinds of situation where people make -this request: the first is where someone is developing a proprietary -program and wishes to make use of adns but doesn't wish to make their -program free software. The second case is where a free software -project is currently using an MIT-like licence or the LGPL and fear -`GPL infection'. The third case, which often overlaps with the -second, is where another free software project currently using a -GPL-incompatible licence, wishes to use adns. +this request: the first is where another free software project +currently using a GPL-incompatible licence, wishes to use adns. The +second case, which often overlaps with the first, is where a free +software project is currently using an MIT-like licence or the LGPL +and fear `GPL infection'. The third case is where someone is +developing a proprietary program and wishes to make use of adns but +doesn't wish to make their program free software -1. Proprietary applications of adns ------------------------------------ +1. GPL-incompatible free software licences +------------------------------------------ -So, let me get this straight. You're writing a proprietary -program, by which I mean that you will not be distributing source code -and not allowing users to modify and share your software; most likely -you are doing this for your own (personal or corporate) financial -gain. +Regrettably, there are a number of free software licences (and +semi-free licences) in existence which are not compatible with the +GPL. That is, they impose restrictions which are not present in the +GPL, and therefore distributing a whole work which contains both such +a program and a GPL'd program is not possible: either the combination +would have to be distributed under the GPL (violating the restrictions +made by the original author), or under the GPL-incompatible licence +(violating the GPL). -However, you want to take advantage of adns, software which I have -spent my time and effort on, and which I release as free software so -that everyone can improve, share and use it. +I may be prepared to make exceptions for such a licence. Please +contact me at with the full text +of the GPL-incompatible licence. However, I would usually prefer it +if you could use a GPL-compatible licence for your project instead. -Don't you think that is a little hypocritical ? I'm sorry, but I -don't want you to just take my nice convenient software, without -giving something back to the free software community or giving the -same rights to your users as I do to you. -If you really aren't the nasty kind of person I've described here, for -example if you have a good reason other than your own selfishness for -wanting to restrict distribution of your program, then perhaps you -should contact me to discuss it. - - 2. GPL-avoiding projects (MIT licence, et al) --------------------------------------------- @@ -96,27 +90,6 @@ at http://www.fsf.org/philosophy/why-not-lgpl.html -3. GPL-incompatible free software licences ------------------------------------------- - -Regrettably, there are a number of free software licences (and -semi-free licences) in existence which are not compatible with the -GPL. That is, they impose restrictions which are not present in the -GPL, and therefore distributing a whole work which contains both such -a program and a GPL'd program is not possible: either the combination -would have to be distributed under the GPL (violating the restrictions -made by the original author), or under the GPL-incompatible licence -(violating the GPL). - -I may be prepared to make exceptions for such a licence. Please -contact me at with the full text -of the GPL-incompatible licence. However, I would usually prefer it -if you could use a GPL-compatible licence for your project instead. - - --- Ian Jackson 17.9.2000 - - Local variables: mode: text End: Index: sdk/lib/3rdparty/adns/INSTALL =================================================================== --- sdk/lib/3rdparty/adns/INSTALL (revision 72742) +++ sdk/lib/3rdparty/adns/INSTALL (working copy) @@ -25,6 +25,7 @@ 1.0 IRIX 6.5 *not* with GCC [1], [2] 1.0 AIX 4.1.5 1.0 HP-UX 10.20, 11.00 + 1.1 Darwin (kernel 7.5.1) Later versions of the same OS should work too. Usually entries in this table mean adns passes its own regression test, when compiled with GCC, and appears to install and run correctly. If you have more @@ -60,7 +61,7 @@ Makefiles only know how to use GCC to make dynamic libraries. The adnsresfilter utility uses `tsearch' from the C library (a la SVID -and X/Open). If you don't have tsearch configure will arranges for +and X/Open). If you don't have tsearch configure will arrange for adnsresfilter not to be built. To fix this, install a C library containing tsearch, such as the GNU C library. It is best if tsearch uses an automatically-balancing tree algorithm, like the glibc version @@ -97,16 +98,17 @@ This file, INSTALL, contains installation instructions and other details for adns. It is - Copyright (C) 1997-2000 Ian Jackson + Copyright (C) 1997-2000 Ian Jackson adns is - Copyright (C) 1997-2000 Ian Jackson - Copyright (C) 1999-2000 Tony Finch [1] - Copyright (C) 1991 Massachusetts Institute of Technology [2] + Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + Copyright (C) 2014 Mark Wooding + Copyright (C) 1999-2000,2003,2006 Tony Finch [1] + Copyright (C) 1991 Massachusetts Institute of Technology [2] adns is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2 of the License, or (at your +Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but @@ -116,11 +118,11 @@ You should have received a copy of the GNU General Public License along with adns as the file COPYING; if not, email me at the address -above or write to the Free Software Foundation, 59 Temple Place - -Suite 330, Boston, MA 02111-1307, USA. +above or write to the Free Software Foundation. -[1] Tony Finch holds the original copyright on client/adnslogres.c and - client/fanftest.c, and some modifications to those files. +[1] Tony Finch holds the original copyright on client/adnslogres.c, + client/adnsheloex.c and client/fanftest.c, and some modifications + to those files. [2] MIT hold the original copyright on the included install-sh, which came via GNU autoconf. Index: sdk/lib/3rdparty/adns/Makefile.in =================================================================== --- sdk/lib/3rdparty/adns/Makefile.in (revision 72742) +++ sdk/lib/3rdparty/adns/Makefile.in (working copy) @@ -1,15 +1,15 @@ -# Makefile - top-level Makefile +# Makefile[.in] - top-level Makefile # -# This file is -# Copyright (C) 1997-2000 Ian Jackson -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -18,12 +18,13 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. +include ./common.make + # Remember to change ADNS_VERSION_STRING in client/client.h too, and -# possibly library soname (MAJOR and MINOR in settings.make.in). -DISTVERSION= 1.0 +# possibly library soname (MAJOR and MINOR in common.make.in). +DISTVERSION= 1.5.0 srcdir= @srcdir@ VPATH= @srcdir@ @@ -35,6 +36,8 @@ SUBDIRS_DYNAMIC= endif +WEBDIR=web + SUBDIRS= src $(SUBDIRS_DYNAMIC) client regress all install uninstall clean distclean mostlyclean maintainer-clean distprep: @@ -45,10 +48,11 @@ clean-here mostlyclean-here: rm -f *~ ./#*# core *.orig *.rej adns-*.tar.gz - rm -rf dist_tmp + rm -rf dist_tmp web adnshost.txt distclean-here maintainer-clean-here: clean-here - rm -f settings.make config.h config.cache config.log config.status + rm -f settings.make common.make + rm -f config.cache config.log config.status Makefile install-strip: $(MAKE) INSTALL_PROGRAM_FLAGS=-s @@ -57,9 +61,9 @@ dist: distprep rm -rf dist_tmp* mkdir dist_tmp $(dist_tmp) - find \( -name CVS -o -name dist_tmp* \) -prune -o -type d -print | \ + find \( -name .git -o -name dist_tmp* \) -prune -o -type d -print | \ sed -e 's#.*#mkdir -p $(dist_tmp)/&#' | sh - find \( -name CVS -o -name dist_tmp* \) -prune -o -type f -print | \ + find \( -name .git -o -name dist_tmp* \) -prune -o -type f -print | \ sed -e 's#.*#ln & $(dist_tmp)/&#' | sh $(MAKE) -C dist_tmp/adns-$(DISTVERSION) distclean cd dist_tmp && tar cf ../$(dist_tmp).tar `basename $(dist_tmp)` @@ -66,12 +70,24 @@ gzip -9 $(dist_tmp).tar mv $(dist_tmp).tar.gz . +adnshost.txt: all + client/adnshost_s --help >$@.tmp && mv -f $@.tmp $@ + +web-install: adnshost.txt + test -e $(WEBDIR) || mkdir $(WEBDIR) + $(INSTALL_DATA) $(srcdir)/README.html $(WEBDIR)/ + $(INSTALL_DATA) $(srcdir)/src/adns.h $(WEBDIR)/adns.h.txt + $(INSTALL_DATA) COPYING $(WEBDIR)/COPYING.txt + $(INSTALL_DATA) adnshost.txt $(WEBDIR)/ + check: all $(MAKE) -C regress check README: README.html - lynx -dump -number_links -cfg=/dev/null ./README.html >README.tmp - mv -f README.tmp README + lynx -dump -number_links -cfg=/dev/null $(srcdir)/README.html >README.tmp + mv -f README.tmp $(srcdir)/README TAGS info dvi: # do nothing + +.PHONY: install #people with case-insensitive filesystems lose otherwise! Index: sdk/lib/3rdparty/adns/NEWS =================================================================== --- sdk/lib/3rdparty/adns/NEWS (nonexistent) +++ sdk/lib/3rdparty/adns/NEWS (working copy) @@ -0,0 +1,70 @@ +Changes in adns 1.5.0, since adns 1.4, are: + + New features: + + * This release provides full IPv6 support. Applications can request + AAAA records (containing IPv6 addresses) as well as, or instead of, + A records (containing IPv4 addresses). adns 1.5 can speak to + nameservers over IPv6. + + * adns_addr2text and adns_text2addr: Convenient C functions for + converting between addresses and address literals. These carry + less baggage than getaddrinfo and getnameinfo. + + Bugfixes: + + * We fix a crashing bug in adnslogres. (Debian#392102.) + + * Previously, parsing of some adns_specific options in resolv.conf + would go awry if multiple options were specified on the same line. + (Fixed since 1.5.0~rc0.) + + * adns now knows to ignore more things in resolv.conf, rather than + warn about them, and there's also an option to disable all of these + warnings. (Debian#411263.) (Fixed since 1.5.0~rc0.) + + * Previously, some harmless but wrong owner names for checked ptr + queries would be accepted; now they are rejected with `Domain + invalid for particular DNS query type'. + + Other: + + * There are some minor API/ABI changes and improvements, for future + proofing. + + * There are also some build system, test suite and coding style + improvements. + + * Licence is now GPLv3. + +Compatibility: + + adns 1.5 is fully forwards API- and ABI-compatible with 1.4. + + adns 1.5 is not backwards ABI-compatible, in the sense that + applications built against adns 1.5 but run with adns 1.4 may + experience `Function not implemented' errors, or `symbol lookup + error' due to undefined symbols. But applications built against 1.4 + will not experience data corruption due to ABI mismatches. + + adns_r_addr queries (general `address' queries where the application + does not specify the kind of address) used to only return AF_INET + (IPv4) addresses. To avoid surprising existing applications, + AF_INET6 (IPv6) addresses will be returned only if the application + explicitly states its support for handling a mixture of address + families in the results from adns_r_addr. In a future version of + adns this will become the default. + + adnshost and the other command-line utilities are fully forward- and + backward-compatible, except that in adns 1.5, adnshost will return + IPv6 as well as IPv4 information if simply asked for `addresses'. + Calling programs which did not ask for a specific address type ought + to cope with this. + + The API in 1.5.0 also fixes a technical nonconformance to the C + specification. On platforms where an `enum' type might be an + integer type whose size is bits is not a power of two, there could + be an incompatible ABI change between 1.4 and 1.5 - but we don't + think there are many (if any) such platforms which are sufficiently + POSIX-like for adns. (Changed since 1.5.0~rc0.) + Index: sdk/lib/3rdparty/adns/README =================================================================== --- sdk/lib/3rdparty/adns/README (revision 72742) +++ sdk/lib/3rdparty/adns/README (working copy) @@ -1,35 +1,34 @@ + GNU adns - GNU adns - Advanced, easy to use, asynchronous-capable DNS client library and utilities. - + adns is a resolver library for C (and C++) programs, and a collection of useful DNS resolver utilities. - + C library In contrast with the standard interfaces, gethostbyname et al and libresolv, it has the following features: - * It is reasonably easy to use for simple programs which just want - to translate names to addresses, look up MX records, etc. + * It is reasonably easy to use for simple programs which just want to + translate names to addresses, look up MX records, etc. * It can be used in an asynchronous, non-blocking, manner. Many queries can be handled simultaneously. * Responses are decoded automatically into a natural representation - for a C program - there is no need to deal with DNS packet - formats. + for a C program - there is no need to deal with DNS packet and + RRDATA formats. * Sanity checking (eg, name syntax checking, reverse/forward - correspondence, CNAME pointing to CNAME) is performed - automatically. - * Time-to-live, CNAME and other similar information is returned in - an easy-to-use form, without getting in the way. + correspondence, CNAME pointing to CNAME) is performed automatically + by default. + * Time-to-live, CNAME and other similar information is returned in an + easy-to-use form, without getting in the way. * There is no global state in the library; resolver state is an opaque data structure which the client creates explicitly. A program can have several instances of the resolver. * Errors are reported to the application in a way that distinguishes the various causes of failure properly. - * Understands conventional resolv.conf, but this can overridden by - environment variables. + * adns understands conventional resolv.conf, but this can overridden + by environment variables. * Flexibility. For example, the application can tell adns to: ignore environment variables (for setuid programs), disable hostname syntax sanity checks to return arbitrary data, override or ignore @@ -38,7 +37,7 @@ TCP in case of long replies or queries, or to other nameservers if several are available. It has sensible handling of bad responses etc. - + DNS utility programs adns also comes with a number of utility programs for use from the @@ -49,12 +48,12 @@ delaying the output. For example, you can usefully pipe the output of netstat -n, tcpdump -ln, and the like, into it. * adnshost is a general-purpose DNS lookup utility which can be used - easily in from the command line and from shell scripts to do - simple lookups. In a more advanced mode it can be used as a + easily in from the command line and from shell scripts to do simple + lookups. In a more advanced mode it can be used as a general-purpose DNS helper program for scripting languages which can invoke and communicate with subprocesses. See the [1]adnshost usage message for a summary of its capabilities. - + Documentation I'm afraid there is no manual yet. However, competent C programmers @@ -61,107 +60,111 @@ should be able to use the library based on the [2]commented adns.h header file, and the usage messages for the programs should be sufficient. - + Feedback I'd be pleased if you would let me know if you're using my library in your project, and what you think of it. - - If you are subscribed to adns-discuss please send feedback, including - bug reports, there; otherwise send mail to - adns-bugreports@chiark.greenend.org.uk. If you'd prefer that your - message wasn't forwarded to the adns-bugreports list, send it to - adns-maint@chiark.greenend.org.uk. - + + Bug reports should be reported to the [3]GNU Debbugs. Send an email to + submit@debbugs.gnu.org and at the top of your email, in a paragraph of + its own, write the single line +Package: adns + + Your bug report will be published via to the adns-discuss list. + + Feedback and discussion takes place on the adns-discuss list. You can + mail me privately at ijackson@chiark.greenend.org.uk. + Mailinglists I have set up mailinglists adns-announce and adns-discuss. The announcements list is moderated and will contain only announcements of - important bugs, new versions, etc. The bug reports address mentioned - above is also a mailing list; feel free to subscribe to it. - - There are [3]archives and subscription web pages, or you can subscribe + important bugs, new versions, etc. + + There are [4]archives and subscription web pages, or you can subscribe by sending mail containing the word `subscribe' to adns-announce-REQUEST@chiark.greenend.org.uk or adns-discuss-REQUEST@chiark.greenend.org.uk. - -Download - Available for download from [4]chiark.greenend.org.uk are: - * The [5]current release as a gzipped tarfile. - * [6]adns.h API header file with comments, and [7]usage message for - adnshost (currently there is no manual, sorry). - * All versions released so far are also available via [8]anonymous - FTP and [9]HTTP, - * A mirror of my CVS repository is available via rsync from - rsync.chiark.greenend.org.uk::ftp/users/ian/cvs-pub/adns (use FTP - first to find your way around), or via [10]cvsweb. - - adns is also available from the [11]GNU Project FTP servers and their - [12]mirrors. - -Technical note +Documentation - adns requires a real nameserver like [13]BIND or [14]Dents running on - the same system or a nearby one, which must be willing to provide - `recursive service'. I.e., adns is a `stub resolver'. All properly - configured UN*X and GNU systems will already have such nameserver(s); - they are usually listed in /etc/resolv.conf. - + * [5]adns.h API header file with documentation comments + * [6]usage message for adnshost + +Download and source code + + * The [7]current release as a gzipped tarfile. + * [8]Previous versions and other files (including OpenPGP + signatures). + * [9]master git (version control) repository browser. + + adns is also available from the [10]GNU Project FTP servers and their + [11]mirrors. + +Installation note + + adns requires a real nameserver like BIND running on the same system or + a nearby one, which must be willing to provide `recursive service'. + I.e., adns is a `stub resolver'. + + adns requires that your real nameserver is on the same machine, or + connected via a secure network, so that an attacker cannot fake the + replies to adns's queries. + +References and related projects + + * [12]Python bindings by Andy Dustman. + * [13]liboop event loop library has a built-in binding for adns. + * [14]port to MS Visual Studio 6 C++ by Jarle Aase. + Copyright and licensing - adns is Copyright 1997-2000 Ian Jackson, Copyright 1999-2000 Tony - Finch, and Copyright (C) 1991 Massachusetts Institute of Technology. - + adns is Copyright 1997-2000,2003,2006,2014 Ian Jackson, Copyright 2014 + Mark Wooding, Copyright 1999-2000,2003,2006 Tony Finch, and Copyright + (C) 1991 Massachusetts Institute of Technology. + adns is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your + Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program and documentation is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty - of merchantability or fitness for a particular purpose. See the - [15]GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with adns, or one should be available above; if not, write to - the [16]Free Software Foundation, 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA, or email adns-maint@chiark.greenend.org.uk. - _________________________________________________________________ - - [17]Ian Jackson / [18]adns-maint@chiark.greenend.org.uk; more [19]free - software by me. - - [20]GNU home page; [21]chiark home page; [22]site or mirror home page - - This web page is Copyright (C)1996-2000 Ian Jackson. See the - [23]Copyright/acknowledgements. - - Use any browser - [24]Campaign for a non-browser-specific WWW + of merchantability or fitness for a particular purpose. See the [15]GNU + General Public License for more details. + You should have received a copy of the GNU General Public License along + with adns, or one should be available above; if not, write to the + [16]Free Software Foundation or email ijackson@chiark.greenend.org.uk. + __________________________________________________________________ + + Ian Jackson / ijackson@chiark.greenend.org.uk. + + [17]GNU home page; [18]chiark home page; [19]site or mirror home page + + This web page is Copyright (C)1996-2005,2014 Ian Jackson. See the + [20]Copyright/acknowledgements. + References - 1. http://www.chiark.greenend.org.uk/~ian/adns/adnshost.txt - 2. http://www.chiark.greenend.org.uk/~ian/adns/adns.h.txt - 3. http://www.chiark.greenend.org.uk/mailman/listinfo - 4. http://www.chiark.greenend.org.uk/~ian/adns/ - 5. http://www.chiark.greenend.org.uk/~ian/adns/adns.tar.gz - 6. http://www.chiark.greenend.org.uk/~ian/adns/adns.h.txt - 7. http://www.chiark.greenend.org.uk/~ian/adns/adnshost.txt - 8. ftp://ftp.chiark.greenend.org.uk/users/ian/adns/ - 9. http://www.chiark.greenend.org.uk/~ian/adns/ftp/ - 10. http://www.chiark.greenend.org.uk/ucgi/~ijackson/cvsweb/adns/ - 11. http://www.gnu.org/ - 12. http://www.gnu.org/order/ftp.html - 13. http://www.isc.org/view.cgi?/products/BIND/index.phtml - 14. http://www.dents.org/ - 15. http://www.chiark.greenend.org.uk/~ian/COPYING.txt + 1. http://www.chiark.greenend.org.uk/~ian/adns/docs/adnshost.txt + 2. http://www.chiark.greenend.org.uk/~ian/adns/docs/adns.h.txt + 3. http://debbugs.gnu.org/ + 4. http://www.chiark.greenend.org.uk/mailman/listinfo + 5. http://www.chiark.greenend.org.uk/~ian/adns/docs/adns.h.txt + 6. http://www.chiark.greenend.org.uk/~ian/adns/docs/adnshost.txt + 7. http://www.chiark.greenend.org.uk/~ian/adns/adns.tar.gz + 8. http://www.chiark.greenend.org.uk/~ian/adns/ftp/ + 9. http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git/adns.git/ + 10. http://www.gnu.org/ + 11. http://www.gnu.org/order/ftp.html + 12. http://code.google.com/p/adns-python + 13. http://www.lysator.liu.se/liboop/ + 14. http://adns.jgaa.com/ + 15. http://www.chiark.greenend.org.uk/~ian/adns/docs/COPYING.txt 16. http://www.fsf.org/ - 17. http://www.chiark.greenend.org.uk/ - 18. mailto:adns-maint@chiark.greenend.org.uk - 19. http://www.chiark.greenend.org.uk/~ian/software/ - 20. http://www.gnu.org/ - 21. http://www.chiark.greenend.org.uk/ - 22. file://localhost/ - 23. http://www.chiark.greenend.org.uk/~ian/sw-www-copy.html - 24. http://www.anybrowser.org/campaign/ + 17. http://www.gnu.org/ + 18. http://www.chiark.greenend.org.uk/ + 19. file://localhost/ + 20. http://www.chiark.greenend.org.uk/~ian/sw-www-copy.html Index: sdk/lib/3rdparty/adns/README.html =================================================================== --- sdk/lib/3rdparty/adns/README.html (revision 72742) +++ sdk/lib/3rdparty/adns/README.html (working copy) @@ -1,7 +1,6 @@ - - -adns - advanced, alternative, asynchronous resolver +adns - advanced, alternative, asynchronous resolver +

GNU adns

@@ -9,7 +8,7 @@ Advanced, easy to use, asynchronous-capable DNS client library and utilities. - + @@ -16,7 +15,6 @@ -

@@ -38,10 +36,12 @@ queries can be handled simultaneously.

  • Responses are decoded automatically into a natural representation -for a C program - there is no need to deal with DNS packet formats. +for a C program - there is no need to deal with DNS packet and RRDATA +formats.
  • Sanity checking (eg, name syntax checking, reverse/forward -correspondence, CNAME pointing to CNAME) is performed automatically. +correspondence, CNAME pointing to CNAME) is performed automatically +by default.
  • Time-to-live, CNAME and other similar information is returned in an easy-to-use form, without getting in the way. @@ -53,8 +53,8 @@
  • Errors are reported to the application in a way that distinguishes the various causes of failure properly. -
  • Understands conventional resolv.conf, but this can overridden by -environment variables. +
  • adns understands conventional resolv.conf, but this can overridden +by environment variables.
  • Flexibility. For example, the application can tell adns to: ignore environment variables (for setuid programs), disable hostname @@ -87,7 +87,7 @@ scripts to do simple lookups. In a more advanced mode it can be used as a general-purpose DNS helper program for scripting languages which can invoke and communicate with subprocesses. See the -adnshost +adnshost usage message for a summary of its capabilities. @@ -96,7 +96,7 @@ I'm afraid there is no manual yet. However, competent C programmers should be able to use the library based on the -commented +commented adns.h header file, and the usage messages for the programs should be sufficient. @@ -107,19 +107,26 @@

    -If you are subscribed to adns-discuss please send -feedback, including bug reports, there; otherwise send mail to -adns-bugreports@chiark.greenend.org.uk. If you'd prefer -that your message wasn't forwarded to the adns-bugreports -list, send it to adns-maint@chiark.greenend.org.uk. +Bug reports should be reported to the +GNU Debbugs. Send an email +to submit@debbugs.gnu.org and at the top of your email, +in a paragraph of its own, write the single line +

    +Package: adns
    +
    +Your bug report will be published via to the adns-discuss list. +

    + +Feedback and discussion takes place on the adns-discuss +list. You can mail me privately +at ijackson@chiark.greenend.org.uk. +

    Mailinglists

    I have set up mailinglists adns-announce and adns-discuss. The announcements list is moderated and will contain only announcements of important bugs, new versions, etc. -The bug reports address mentioned above is also a mailing list; feel -free to subscribe to it.

    @@ -130,25 +137,24 @@ adns-announce-REQUEST@chiark.greenend.org.uk or adns-discuss-REQUEST@chiark.greenend.org.uk. -

    Download

    +

    Documentation

    -Available for download from -chiark.greenend.org.uk -are: + +

    Download and source code

    + + adns is also available from the @@ -155,28 +161,41 @@ GNU Project FTP servers and their mirrors. -

    Technical note

    +

    Installation note

    -adns requires a real nameserver like -BIND -or -Dents running on -the same system or a nearby one, which must be willing to provide -`recursive service'. I.e., adns is a `stub resolver'. All properly -configured UN*X and GNU systems will already have such nameserver(s); -they are usually listed in /etc/resolv.conf. +adns requires a real nameserver like BIND running on the same system +or a nearby one, which must be willing to provide `recursive service'. +I.e., adns is a `stub resolver'. +

    +adns requires that your real nameserver is on the same machine, or +connected via a secure network, so that an attacker cannot fake the +replies to adns's queries. + +

    References and related projects

    + + +

    Copyright and licensing

    -adns is Copyright 1997-2000 Ian Jackson, Copyright -1999-2000 Tony Finch, and Copyright (C) 1991 Massachusetts Institute -of Technology. +adns is Copyright 1997-2000,2003,2006,2014 Ian Jackson, +Copyright 2014 Mark Wooding, Copyright 1999-2000,2003,2006 Tony Finch, +and Copyright (C) 1991 Massachusetts Institute of Technology.

    adns is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at +the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

    @@ -185,7 +204,7 @@ be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the -GNU +GNU General Public License for more details.

    @@ -192,18 +211,13 @@ You should have received a copy of the GNU General Public License along with adns, or one should be available above; if not, -write to the -Free Software Foundation, -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, -or email adns-maint@chiark.greenend.org.uk. +write to the Free Software Foundation +or email ijackson@chiark.greenend.org.uk.


    -Ian Jackson / -adns-maint@chiark.greenend.org.uk; -more free -software by me. +Ian Jackson / ijackson@chiark.greenend.org.uk.

    GNU home page; @@ -211,12 +225,8 @@ site or mirror home page

    -This web page is Copyright (C)1996-2000 Ian Jackson. See the +This web page is Copyright (C)1996-2005,2014 Ian Jackson. See the Copyright/acknowledgements. -

    -Use any browser - -Campaign for a non-browser-specific WWW - Index: sdk/lib/3rdparty/adns/RELEASE-CHECKLIST =================================================================== --- sdk/lib/3rdparty/adns/RELEASE-CHECKLIST (nonexistent) +++ sdk/lib/3rdparty/adns/RELEASE-CHECKLIST (working copy) @@ -0,0 +1,100 @@ +#!/bin/bash +# This is for the benefit of the upstream maintainers of GNU adns +# +# * Maybe rerun autoconf +# * Ensure changelog reflects changes +# * Ensure NEWS reflects changes +# * Maybe update MAJOR and/or MINOR in common.make.in +# * Update DISTVERSION in Makefile.in +# * Update ADNS_VERSION_STRING in client/client.h +# * Update version in ./changelog +# * Commit the result +# +# * Run this script +# ./RELEASE-CHECKLIST [--real] +# +# * On chiark, maybe, replace ~ian/public-html/adns/current +# with symlink to web-$(version) +# +# * On chiark, maybe, replace docs link (as directed by script) +# +# * If not an rc release, put files on ftp.gnu.org +# +# * Send release announcement (use last one as template) +# +# * Update DISTVERSION, ADNS_VERSION_STRING and start new changelog entry + +set -e + +fail () { echo >&2 "$0: $*"; exit 16; } + +real=false +if [ "x$1" = x--real ]; then + real=true; shift +fi + +if [ $# != 1 ]; then fail "wrong # arguments"; fi +wantversion="$1" + +version=`sed -n -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -19,56 +19,19 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. -MAJOR= 1 -MINOR= 0 -SHLIBFILE= @SHLIBFILE@ -SHLIBSONAME= @SHLIBSONAME@ -SHLIBFORLINK= @SHLIBFORLINK@ +include ../common.make -CC= @CC@ -CFLAGS= $(AUTOCFLAGS) $(WARNS) $(WERROR) $(DIRCFLAGS) $(XCFLAGS) -LDFLAGS= $(AUTOLDFLAGS) $(DIRLDFLAGS) $(XLDFLAGS) -LDLIBS= @LIBS@ $(XLIBS) -AUTOCFLAGS= @CFLAGS@ -AUTOLDFLAGS= @LDFLAGS@ -WARNS= @WARNS@ -#WERROR= -Werror - -M4= m4 -RANLIB= @RANLIB@ - -SHLIBCC= @SHLIBCC@ - -MKSHLIB_1= @MKSHLIB_1@ -MKSHLIB_2= @MKSHLIB_2@ -MKSHLIB_3= @MKSHLIB_3@ - -prefix= @prefix@ -exec_prefix= @exec_prefix@ -bin_dir= $(exec_prefix)/bin -lib_dir= $(exec_prefix)/lib -include_dir= $(prefix)/include - -AC_INSTALL= @INSTALL@ -ifeq ($(AC_INSTALL),./install-sh -c) -INSTALL= $(srcdir)/../$(AC_INSTALL) -else -INSTALL= $(AC_INSTALL) -endif - -INSTALL_PROGRAM= $(INSTALL) -m 755 $(INSTALL_PROGRAM_FLAGS) -INSTALL_DATA= $(INSTALL) -m 644 - all: $(TARGETS) clean mostlyclean: - rm -f *.o *.tmp* *.so *.so.* + rm -f *.o *.tmp* *.so *.so.* pipe.* + rm -f output-*.err output-*.leftover + rm -f output-*.out output-*.report distclean: clean - rm -f $(TARGETS) *~ ./#*# core *.orig *.rej Makefile + rm -f $(TARGETS) *~ ./#*# core *.orig *.rej Makefile config.h distprep: $(AUTOCSRCS) $(AUTOCHDRS) Index: sdk/lib/3rdparty/adns/src/addrfam.c =================================================================== --- sdk/lib/3rdparty/adns/src/addrfam.c (nonexistent) +++ sdk/lib/3rdparty/adns/src/addrfam.c (working copy) @@ -0,0 +1,791 @@ +/* + * addrfam.c + * - address-family specific code + */ +/* + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation. + */ + +#ifdef ADNS_JGAA_WIN32 +# include "adns_win32.h" +#else +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#include "internal.h" + +/* + * General address-family operations. + */ + +#define SIN(cnst, sa) ((void)(sa)->sa_family, (cnst struct sockaddr_in *)(sa)) +#define SIN6(cnst, sa) ((void)(sa)->sa_family, (cnst struct sockaddr_in6 *)(sa)) + +static void unknown_af(int af) NONRETURNING; +static void unknown_af(int af) { + fprintf(stderr, "ADNS INTERNAL: unknown address family %d\n", af); + abort(); +} + +/* + * SOCKADDR_IN_IN6(CNST, struct sockaddr *sa, SIN, { + * // struct sockaddr_in *const SIN; // implicitly + * code for inet; + * }, { + * // struct sockaddr_in6 *const SIN6; // implicitly + * code for inet6; + * }) + * + * SOCKADDR_IN_IN6_PAIR(CNST, struct sockaddr *sa, SINA, + * struct sockaddr *sb, SINB, { + * // struct sockaddr_in *const SINA; // implicitly + * // struct sockaddr_in *const SINB; // implicitly + * code for inet; + * },{ + * // struct sockaddr_in6 *const SINA6; // implicitly + * // struct sockaddr_in6 *const SINB6; // implicitly + * code for inet6; + * }); + * + * SOCKADDR_IN_IN6_OTHER(CNST, struct sockaddr *sa, SIN, { in }, { in6 }, { + * code for other address family + * }) + * + * AF_IN_IN6_OTHER(af, { in }, { in6 }, { other }) + * + * Executes the first or second block according to the AF in sa. CNST + * may be `const' or empty. For _PAIR, sa and sb must be same AF. + * + * All except _OTHER handle unknown AFs with unknown_af. + * + * Code blocks may not contain , outside parens. + */ +#ifdef WITH_IPV6 +#define AF_IN_IN6_OTHER(af, for_inet, for_inet6, other) \ + if ((af) == AF_INET) { \ + for_inet \ + } else if ((af) == AF_INET6) { \ + for_inet6 \ + } else { \ + other \ + } +#define SOCKADDR_IN_IN6_OTHER(cnst, sa, sin, for_inet, for_inet6, other) \ + AF_IN_IN6_OTHER((sa)->sa_family, { \ + cnst struct sockaddr_in *const sin = SIN(cnst,(sa)); \ + for_inet \ + }, { \ + cnst struct sockaddr_in6 *const sin##6 = SIN6(cnst,(sa)); \ + for_inet6 \ + }, \ + other \ + ) +#define SOCKADDR_IN_IN6(cnst, sa, sin, for_inet, for_inet6) \ + SOCKADDR_IN_IN6_OTHER(cnst, sa, sin, for_inet, for_inet6, { \ + unknown_af((sa)->sa_family); \ + }) +#define SOCKADDR_IN_IN6_PAIR(cnst, sa, sina, sb, sinb, for_inet, for_inet6) \ + do{ \ + assert((sa)->sa_family == (sb)->sa_family); \ + SOCKADDR_IN_IN6(cnst, sa, sina, { \ + cnst struct sockaddr_in *const sinb = SIN(cnst,(sb)); \ + for_inet \ + }, { \ + cnst struct sockaddr_in6 *const sinb##6 = SIN6(cnst,(sb)); \ + for_inet6 \ + }); \ + }while(0) +#else +#define AF_IN_IN6_OTHER(af, for_inet, other) \ + if ((af) == AF_INET) { \ + for_inet \ + } else { \ + other \ + } +#define SOCKADDR_IN_IN6_OTHER(cnst, sa, sin, for_inet, other) \ + AF_IN_IN6_OTHER((sa)->sa_family, { \ + cnst struct sockaddr_in *const sin = SIN(cnst,(sa)); \ + for_inet \ + }, \ + other \ + ) +#define SOCKADDR_IN_IN6(cnst, sa, sin, for_inet) \ + SOCKADDR_IN_IN6_OTHER(cnst, sa, sin, for_inet, { \ + unknown_af((sa)->sa_family); \ + }) +#define SOCKADDR_IN_IN6_PAIR(cnst, sa, sina, sb, sinb, for_inet) \ + do{ \ + assert((sa)->sa_family == (sb)->sa_family); \ + SOCKADDR_IN_IN6(cnst, sa, sina, { \ + cnst struct sockaddr_in *const sinb = SIN(cnst,(sb)); \ + for_inet \ + }); \ + }while(0) +#endif +int adns__addrs_equal_raw(const struct sockaddr *a, + int bf, const void *b) { + if (a->sa_family != bf) return 0; + +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6(const, a, sin, { + return sin->sin_addr.s_addr == ((const struct in_addr*)b)->s_addr; + }, { + return !memcmp(&sin6->sin6_addr, b, sizeof(struct in6_addr)); + }); +#else + SOCKADDR_IN_IN6(const, a, sin, { + return sin->sin_addr.s_addr == ((const struct in_addr*)b)->s_addr; + }); +#endif +} + +int adns__addrs_equal(const adns_sockaddr *a, const adns_sockaddr *b) { + return adns__addrs_equal_raw(&a->sa, b->sa.sa_family, + adns__sockaddr_addr(&b->sa)); +} + +int adns__sockaddrs_equal(const struct sockaddr *sa, + const struct sockaddr *sb) { + if (!adns__addrs_equal_raw(sa, sb->sa_family, adns__sockaddr_addr(sb))) + return 0; +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6_PAIR(const, sa, sina, sb, sinb, { + return sina->sin_port == sinb->sin_port; + }, { + return sina6->sin6_port == sinb6->sin6_port && + sina6->sin6_scope_id == sinb6->sin6_scope_id; + }); +#else + SOCKADDR_IN_IN6_PAIR(const, sa, sina, sb, sinb, { + return sina->sin_port == sinb->sin_port; + }); +#endif +} + +int adns__addr_width(int af) { +#ifdef WITH_IPV6 + AF_IN_IN6_OTHER(af, { + return 32; + }, { + return 128; + }, { + unknown_af(af); + }); +#else + AF_IN_IN6_OTHER(af, { + return 32; + }, { + unknown_af(af); + }); +#endif +} + +void adns__prefix_mask(adns_sockaddr *sa, int len) { +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6(, &sa->sa, sin, { + assert(len <= 32); + sin->sin_addr.s_addr= htonl(!len ? 0 : 0xffffffff << (32-len)); + }, { + int i= len/8; + int j= len%8; + unsigned char *m= sin6->sin6_addr.s6_addr; + assert(len <= 128); + memset(m, 0xff, i); + if (j) m[i++]= (0xff << (8-j)) & 0xff; + memset(m+i, 0, 16-i); + }); +#else + SOCKADDR_IN_IN6(, &sa->sa, sin, { + assert(len <= 32); + sin->sin_addr.s_addr= htonl(!len ? 0 : 0xffffffff << (32-len)); + }); +#endif +} + +int adns__guess_prefix_length(const adns_sockaddr *sa) { +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6(const, &sa->sa, sin, { + unsigned a= (ntohl(sin->sin_addr.s_addr) >> 24) & 0xff; + if (a < 128) return 8; + else if (a < 192) return 16; + else if (a < 224) return 24; + else return -1; + }, { + (void)sin6; + return 64; + }); +#else + SOCKADDR_IN_IN6(const, &sa->sa, sin, { + unsigned a= (ntohl(sin->sin_addr.s_addr) >> 24) & 0xff; + if (a < 128) return 8; + else if (a < 192) return 16; + else if (a < 224) return 24; + else return -1; + }); +#endif +} + +int adns__addr_matches(int af, const void *addr, + const adns_sockaddr *base, const adns_sockaddr *mask) +{ + if (af != base->sa.sa_family) return 0; +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6_PAIR(const, &base->sa, sbase, &mask->sa, smask, { + const struct in_addr *v4 = addr; + return (v4->s_addr & smask->sin_addr.s_addr) + == sbase->sin_addr.s_addr; + }, { + int i; + const char *a= addr; + const char *b= sbase6->sin6_addr.s6_addr; + const char *m= smask6->sin6_addr.s6_addr; + for (i = 0; i < 16; i++) + if ((a[i] & m[i]) != b[i]) return 0; + return 1; + }); +#else + SOCKADDR_IN_IN6_PAIR(const, &base->sa, sbase, &mask->sa, smask, { + const struct in_addr *v4 = addr; + return (v4->s_addr & smask->sin_addr.s_addr) + == sbase->sin_addr.s_addr; + }); +#endif +} + +const void *adns__sockaddr_addr(const struct sockaddr *sa) { +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6(const, sa, sin, { + return &sin->sin_addr; + }, { + return &sin6->sin6_addr; + }); +#else + SOCKADDR_IN_IN6(const, sa, sin, { + return &sin->sin_addr; + }); +#endif +} + +void adns__addr_inject(const void *a, adns_sockaddr *sa) { +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6( , &sa->sa, sin, { + memcpy(&sin->sin_addr, a, sizeof(sin->sin_addr)); + }, { + memcpy(&sin6->sin6_addr, a, sizeof(sin6->sin6_addr)); + }); +#else + SOCKADDR_IN_IN6( , &sa->sa, sin, { + memcpy(&sin->sin_addr, a, sizeof(sin->sin_addr)); + }); +#endif +} + +/* + * addr2text and text2addr + */ + +//#define ADDRFAM_DEBUG +#ifdef ADDRFAM_DEBUG +static void af_debug_func(const char *fmt, ...) { + int esave= errno; + va_list al; + va_start(al,fmt); + vfprintf(stderr,fmt,al); + va_end(al); + errno= esave; +} +# define af_debug(fmt,...) \ + (af_debug_func("%s: " fmt "\n", __func__, __VA_ARGS__)) +#else +# define af_debug(fmt,...) ((void)("" fmt "", __VA_ARGS__)) +#endif + +static bool addrtext_our_errno(int e) { + return + e==EAFNOSUPPORT || + e==EINVAL || + e==ENOSPC || + e==ENOSYS; +} + +#ifdef WITH_IPV6 +static bool addrtext_scope_use_ifname(const struct sockaddr *sa) { + const struct in6_addr *in6= &SIN6(const,sa)->sin6_addr; + return + IN6_IS_ADDR_LINKLOCAL(in6) || + IN6_IS_ADDR_MC_LINKLOCAL(in6); +} +#endif + +static int textaddr_check_qf(adns_queryflags flags) { + if (flags & ~(adns_queryflags)(adns_qf_addrlit_scope_forbid| + adns_qf_addrlit_scope_numeric| + adns_qf_addrlit_ipv4_quadonly| + 0x40000000)) + return ENOSYS; + return 0; +} + +int adns_text2addr(const char *text, uint16_t port, adns_queryflags flags, + struct sockaddr *sa, socklen_t *salen_io) { + int r, af; +#ifdef WITH_IPV6 + char copybuf[INET6_ADDRSTRLEN]; +#endif + const char *parse=text; + const char *scopestr=0; + socklen_t needlen; + void *dst; + uint16_t *portp; + + r= textaddr_check_qf(flags); if (r) return r; + +#define INVAL(how) do{ \ + af_debug("invalid: %s: `%s'", how, text); \ + return EINVAL; \ +}while(0) + +#ifdef WITH_IPV6 +#define AFCORE(INETx,SINx,sinx) \ + af= AF_##INETx; \ + dst = &SINx(,sa)->sinx##_addr; \ + portp = &SINx(,sa)->sinx##_port; \ + needlen= sizeof(*SINx(,sa)); + + if (!strchr(text, ':')) { /* INET */ + + AFCORE(INET,SIN,sin); + + } else { /* INET6 */ + + AFCORE(INET6,SIN6,sin6); + + const char *percent= strchr(text, '%'); + if (percent) { + ptrdiff_t lhslen = percent - text; + if (lhslen >= INET6_ADDRSTRLEN) INVAL("scoped addr lhs too long"); + memcpy(copybuf, text, lhslen); + copybuf[lhslen]= 0; + + parse= copybuf; + scopestr= percent+1; + + af_debug("will parse scoped addr `%s' %% `%s'", parse, scopestr); + } + + } +#else +#define AFCORE(INETx,SINx,sinx) \ + af= AF_##INETx; \ + dst = &SINx(,sa)->sinx##_addr; \ + portp = &SINx(,sa)->sinx##_port; \ + needlen= sizeof(*SINx(,sa)); + + if (!strchr(text, ':')) { /* INET */ + + AFCORE(INET,SIN,sin); + + } +#endif + +#undef AFCORE + + if (scopestr && (flags & adns_qf_addrlit_scope_forbid)) + INVAL("scoped addr but _scope_forbid"); + + if (*salen_io < needlen) { + *salen_io = needlen; + return ENOSPC; + } + + memset(sa, 0, needlen); + + sa->sa_family= af; + *portp = htons(port); + + if (af == AF_INET && !(flags & adns_qf_addrlit_ipv4_quadonly)) { + /* we have to use inet_aton to deal with non-dotted-quad literals */ + int r= inet_aton(parse,&SIN(,sa)->sin_addr); + if (!r) INVAL("inet_aton rejected"); + } else { + int r= inet_pton(af,parse,dst); + if (!r) INVAL("inet_pton rejected"); + assert(r>0); + } + +#ifdef WITH_IPV6 + if (scopestr) { + char *ep; + unsigned long scope= strtoul(scopestr,&ep,10); + errno=0; + if (errno==ERANGE) INVAL("numeric scope id too large for unsigned long"); + assert(!errno); + if (!*ep) { + if (scope > ~(uint32_t)0) + INVAL("numeric scope id too large for uint32_t"); + } else { /* !!*ep */ + if (flags & adns_qf_addrlit_scope_numeric) + INVAL("non-numeric scope but _scope_numeric"); + if (!addrtext_scope_use_ifname(sa)) { + af_debug("cannot convert non-numeric scope" + " in non-link-local addr `%s'", text); + return ENOSYS; + } + errno= 0; + scope= if_nametoindex(scopestr); + if (!scope) { + /* RFC3493 says "No errors are defined". It's not clear + * whether that is supposed to mean if_nametoindex "can't + * fail" (other than by the supplied name not being that of an + * interface) which seems unrealistic, or that it conflates + * all its errors together by failing to set errno, or simply + * that they didn't bother to document the errors. + * + * glibc, FreeBSD and OpenBSD all set errno (to ENXIO when + * appropriate). See Debian bug #749349. + * + * We attempt to deal with this by clearing errno to start + * with, and then perhaps mapping the results. */ + af_debug("if_nametoindex rejected scope name (errno=%s)", + strerror(errno)); + if (errno==0) { + return ENXIO; + } else if (addrtext_our_errno(errno)) { + /* we use these for other purposes, urgh. */ + perror("adns: adns_text2addr: if_nametoindex" + " failed with unexpected error"); + return EIO; + } else { + return errno; + } + } else { /* ix>0 */ + if (scope > ~(uint32_t)0) { + fprintf(stderr,"adns: adns_text2addr: if_nametoindex" + " returned an interface index >=2^32 which will not fit" + " in sockaddr_in6.sin6_scope_id"); + return EIO; + } + } + } /* else; !!*ep */ + + SIN6(,sa)->sin6_scope_id= scope; + } /* if (scopestr) */ +#endif + *salen_io = needlen; + return 0; +} + +int adns_addr2text(const struct sockaddr *sa, adns_queryflags flags, + char *buffer, int *buflen_io, int *port_r) { + const void *src; + int r, port; + const char *ok; + + r= textaddr_check_qf(flags); if (r) return r; + + if (*buflen_io < ADNS_ADDR2TEXT_BUFLEN) { + *buflen_io = ADNS_ADDR2TEXT_BUFLEN; + return ENOSPC; + } + +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6_OTHER(const, sa, sin, { + src= &sin->sin_addr; port= sin->sin_port; + }, { + src= &sin6->sin6_addr; port= sin6->sin6_port; + }, { + return EAFNOSUPPORT; + }); +#else + SOCKADDR_IN_IN6_OTHER(const, sa, sin, { + src= &sin->sin_addr; port= sin->sin_port; + }, { + return EAFNOSUPPORT; + }); +#endif + + ok= inet_ntop(sa->sa_family, src, buffer, *buflen_io); + assert(ok); + +#ifdef WITH_IPV6 + if (sa->sa_family == AF_INET6) { + uint32_t scope = SIN6(const,sa)->sin6_scope_id; + if (scope) { + if (flags & adns_qf_addrlit_scope_forbid) + return EINVAL; + int scopeoffset = strlen(buffer); + int remain = *buflen_io - scopeoffset; + char *scopeptr = buffer + scopeoffset; + assert(remain >= IF_NAMESIZE+1/*%*/); + *scopeptr++= '%'; remain--; + bool parsedname = 0; + af_debug("will print scoped addr `%.*s' %% %"PRIu32"", + scopeoffset,buffer, scope); + if (scope <= UINT_MAX /* so we can pass it to if_indextoname */ + && !(flags & adns_qf_addrlit_scope_numeric) + && addrtext_scope_use_ifname(sa)) { + parsedname = if_indextoname(scope, scopeptr); + if (!parsedname) { + af_debug("if_indextoname rejected scope (errno=%s)", + strerror(errno)); + if (errno==ENXIO) { + /* fair enough, show it as a number then */ + } else if (addrtext_our_errno(errno)) { + /* we use these for other purposes, urgh. */ + perror("adns: adns_addr2text: if_indextoname" + " failed with unexpected error"); + return EIO; + } else { + return errno; + } + } + } + if (!parsedname) { + int r = snprintf(scopeptr, remain, + "%"PRIu32"", scope); + assert(r < *buflen_io - scopeoffset); + } + af_debug("printed scoped addr `%s'", buffer); + } + } +#endif + + if (port_r) *port_r= ntohs(port); + return 0; +} + +char *adns__sockaddr_ntoa(const struct sockaddr *sa, char *buf) { + int err; + int len= ADNS_ADDR2TEXT_BUFLEN; + + err= adns_addr2text(sa, 0, buf, &len, 0); + if (err == EIO) + err= adns_addr2text(sa, adns_qf_addrlit_scope_numeric, buf, &len, 0); + assert(!err); + return buf; +} + +/* + * Reverse-domain parsing and construction. + */ + +int adns__make_reverse_domain(const struct sockaddr *sa, const char *zone, + char **buf_io, size_t bufsz, + char **buf_free_r) { + size_t req; + char *p; +#ifdef WITH_IPV6 + unsigned c, y; + const unsigned char *ap; + int j; +#endif + unsigned long aa; + int i; + +#ifdef WITH_IPV6 + AF_IN_IN6_OTHER(sa->sa_family, { + req= 4 * 4; + if (!zone) zone= "in-addr.arpa"; + }, { + req = 2 * 32; + if (!zone) zone= "ip6.arpa"; + }, { + return ENOSYS; + }); +#else + AF_IN_IN6_OTHER(sa->sa_family, { + req= 4 * 4; + if (!zone) zone= "in-addr.arpa"; + }, { + return ENOSYS; + }); +#endif + + req += strlen(zone) + 1; + if (req <= bufsz) + p= *buf_io; + else { + p= malloc(req); if (!p) return errno; + *buf_free_r = p; + } + + *buf_io= p; +#ifdef WITH_IPV6 + SOCKADDR_IN_IN6(const, sa, sin, { + aa= ntohl(sin->sin_addr.s_addr); + for (i=0; i<4; i++) { + p += sprintf(p, "%d", (int)(aa & 0xff)); + *p++= '.'; + aa >>= 8; + } + }, { + ap= sin6->sin6_addr.s6_addr + 16; + for (i=0; i<16; i++) { + c= *--ap; + for (j=0; j<2; j++) { + y= c & 0xf; + *p++= (y < 10) ? y + '0' : y - 10 + 'a'; + c >>= 4; + *p++= '.'; + } + } + }); +#else + SOCKADDR_IN_IN6(const, sa, sin, { + aa= ntohl(sin->sin_addr.s_addr); + for (i=0; i<4; i++) { + p += sprintf(p, "%d", (int)(aa & 0xff)); + *p++= '.'; + aa >>= 8; + } + }); +#endif + + strcpy(p, zone); + return 0; +} + + +#define REVPARSE_P_L(labnum) \ + const char *p= dgram + rps->labstart[labnum]; \ + int l= rps->lablen[labnum] + /* + * REVPARSE_P_L(int labnum); + * expects: + * const char *dgram; + * const struct revparse_state *rps; + * produces: + * const char *p; // start of label labnum in dgram + * int l; // length of label in dgram + */ + +static bool revparse_check_tail(struct revparse_state *rps, + const char *dgram, int nlabels, + int bodylen, const char *inarpa) { + int i; + + if (nlabels != bodylen+2) return 0; + for (i=0; i<2; i++) { + REVPARSE_P_L(bodylen+i); + const char *want= !i ? inarpa : "arpa"; + if (!adns__labels_equal(p,l, want,strlen(want))) return 0; + } + return 1; +} + +static bool revparse_atoi(const char *p, int l, int base, + unsigned max, unsigned *v_r) { + unsigned v=0; + if (l>3) return 0; + if (l>1 && p[0]=='0') return 0; + while (l-- > 0) { + int tv; + int c= ctype_toupper(*p++); + if ('0'<=c && c<='9') tv = c-'0'; + else if ('A'<=c && c<='Z') tv = c-'A'+10; + else return 0; + if (tv >= base) return 0; + v *= base; + v += tv; + } + if (v>max) return 0; + *v_r= v; + return 1; +} + +static bool revparse_inet(struct revparse_state *rps, + const char *dgram, int nlabels, + adns_rrtype *rrtype_r, adns_sockaddr *addr_r) { + uint32_t a=0; + int i; + if (!revparse_check_tail(rps,dgram,nlabels,4,"in-addr")) return 0; + + for (i=3; i>=0; i--) { + REVPARSE_P_L(i); + unsigned v; + if (!revparse_atoi(p,l,10,255,&v)) return 0; + a <<= 8; + a |= v; + } + *rrtype_r= adns_r_a; + addr_r->inet.sin_family= AF_INET; + addr_r->inet.sin_addr.s_addr= htonl(a); + return 1; +} + +#ifdef WITH_IPV6 +static bool revparse_inet6(struct revparse_state *rps, + const char *dgram, int nlabels, + adns_rrtype *rrtype_r, adns_sockaddr *addr_r) { + if (!revparse_check_tail(rps,dgram,nlabels,32,"ip6")) return 0; + + int i, j; + memset(addr_r,0,sizeof(*addr_r)); + unsigned char *a= addr_r->inet6.sin6_addr.s6_addr+16; + for (i=0; i<32; ) { /* i incremented in inner loop */ + unsigned b=0; + for (j=0; j<2; j++, i++) { + REVPARSE_P_L(i); + unsigned v; + if (!revparse_atoi(p,l,16,15,&v)) return 0; + b >>= 4; + b |= v << 4; + } + *--a= b; + } + *rrtype_r= adns_r_aaaa; + addr_r->inet.sin_family= AF_INET6; + return 1; +} +#endif + +bool adns__revparse_label(struct revparse_state *rps, int labnum, + const char *dgram, int labstart, int lablen) { + if (labnum >= MAXREVLABELS) + return 0; + + assert(labstart <= 65535); + assert(lablen <= 255); + rps->labstart[labnum] = labstart; + rps->lablen[labnum] = lablen; + return 1; +} + +bool adns__revparse_done(struct revparse_state *rps, + const char *dgram, int nlabels, + adns_rrtype *rrtype_r, adns_sockaddr *addr_r) { + return + revparse_inet(rps,dgram,nlabels,rrtype_r,addr_r) +#ifdef WITH_IPV6 + || revparse_inet6(rps,dgram,nlabels,rrtype_r,addr_r) +#endif + ; +} Index: sdk/lib/3rdparty/adns/src/adns.h =================================================================== --- sdk/lib/3rdparty/adns/src/adns.h (revision 72742) +++ sdk/lib/3rdparty/adns/src/adns.h (working copy) @@ -1,39 +1,40 @@ /* * adns.h - * - adns user-visible API (single-threaded, without any locking) + * - adns user-visible API */ /* * * This file is - * Copyright (C) 1997-2000 Ian Jackson + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson * * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * + * * For the benefit of certain LGPL'd `omnibus' software which * provides a uniform interface to various things including adns, I * make the following additional licence. I do this because the GPL * would otherwise force either the omnibus software to be GPL'd or * the adns-using part to be distributed separately. - * + * * So: you may also redistribute and/or modify adns.h (but only the * public header file adns.h and not any other part of adns) under the * terms of the GNU Library General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at * your option) any later version. - * + * * Note that adns itself is GPL'd. Authors of adns-using applications * with GPL-incompatible licences, and people who distribute adns with * applications where the whole distribution is not GPL'd, are still @@ -47,10 +48,8 @@ * * You should have received a copy of the GNU General Public License, * or the GNU Library General Public License, as appropriate, along - * with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * with this program; if not, write to the Free Software Foundation. * - * */ #ifndef ADNS_H_INCLUDED @@ -59,20 +58,15 @@ #ifdef ADNS_JGAA_WIN32 # include "adns_win32.h" #else -# include -# include -# include -# include -# include -# include +#include +#include -# define ADNS_API -# define ADNS_SOCKET int -# define adns_socket_close(sck) close(sck) -# define adns_socket_read(sck, data, len) read(sck, data, len) -# define adns_socket_write(sck, data, len) write(sck, data, len) -# define ADNS_CAPTURE_ERRNO {} -# define ADNS_CLEAR_ERRNO {} +#include +#include +#include +#include +#include +#include #endif #ifdef __cplusplus @@ -79,69 +73,156 @@ extern "C" { /* I really dislike this - iwj. */ #endif +/* Whether to support address families other than IPv4 in responses which use + * the `adns_rr_addr' structure. This is a source-compatibility issue: old + * clients may not expect to find address families other than AF_INET in + * their query results. There's a separate binary compatibility issue to do + * with the size of the `adns_rr_addr' structure, but we'll assume you can + * cope with that because you have this header file. Define + * `ADNS_FEATURE_IPV4ONLY' if you only want to see AF_INET addresses by + * default, or `ADNS_FEATURE_MANYAF' to allow multiple address families; the + * default is currently to stick with AF_INET only, but this is likely to + * change in a later release of ADNS. Note that any adns_qf_want_... flags + * in your query are observed: this setting affects only the default address + * families. + */ +#if !defined(ADNS_FEATURE_IPV4ONLY) && !defined(ADNS_FEATURE_MANYAF) +# define ADNS_FEATURE_IPV4ONLY +#elif defined(ADNS_FEATURE_IPV4ONLY) && defined(ADNS_FEATURE_MANYAF) +# error "Feature flags ADNS_FEATURE_IPV4ONLY and ..._MANYAF are incompatible" +#endif + /* All struct in_addr anywhere in adns are in NETWORK byte order. */ typedef struct adns__state *adns_state; typedef struct adns__query *adns_query; -typedef enum { - adns_if_noenv= 0x0001, /* do not look at environment */ - adns_if_noerrprint= 0x0002, /* never print output to stderr (_debug overrides) */ - adns_if_noserverwarn= 0x0004, /* do not warn to stderr about duff nameservers etc */ - adns_if_debug= 0x0008, /* enable all output to stderr plus debug msgs */ - adns_if_logpid= 0x0080, /* include pid in diagnostic output */ - adns_if_noautosys= 0x0010, /* do not make syscalls at every opportunity */ - adns_if_eintr= 0x0020, /* allow _wait and _synchronous to return EINTR */ - adns_if_nosigpipe= 0x0040, /* applic has SIGPIPE set to SIG_IGN, do not protect */ - adns_if_checkc_entex= 0x0100, /* do consistency checks on entry/exit to adns funcs */ - adns_if_checkc_freq= 0x0300 /* do consistency checks very frequently (slow!) */ +typedef enum { /* In general, or together the desired flags: */ + adns_if_none= 0x0000,/* no flags. nicer than 0 for some compilers */ + adns_if_noenv= 0x0001,/* do not look at environment */ + adns_if_noerrprint= 0x0002,/* never print to stderr (_debug overrides) */ + adns_if_noserverwarn=0x0004,/* do not warn to stderr about duff servers etc */ + adns_if_debug= 0x0008,/* enable all output to stderr plus debug msgs */ + adns_if_logpid= 0x0080,/* include pid in diagnostic output */ + adns_if_noautosys= 0x0010,/* do not make syscalls at every opportunity */ + adns_if_eintr= 0x0020,/* allow _wait and _synchronous to return EINTR */ + adns_if_nosigpipe= 0x0040,/* applic has SIGPIPE ignored, do not protect */ + adns_if_checkc_entex=0x0100,/* consistency checks on entry/exit to adns fns */ + adns_if_checkc_freq= 0x0300,/* consistency checks very frequently (slow!) */ + + adns_if_permit_ipv4= 0x0400,/* allow _addr queries to return IPv4 addresses */ + adns_if_permit_ipv6= 0x0800,/* allow _addr queries to return IPv6 addresses */ + adns_if_afmask= 0x0c00, + /* These are policy flags, and overridden by the adns_af:... option in + * resolv.conf. If the adns_qf_want_... query flags are incompatible with + * these settings (in the sense that no address families are permitted at + * all) then the query flags take precedence; otherwise only records which + * satisfy all of the stated requirements are allowed. + */ + adns__if_sizeforce= 0x7fff, } adns_initflags; -typedef enum { - adns_qf_search= 0x00000001, /* use the searchlist */ - adns_qf_usevc= 0x00000002, /* use a virtual circuit (TCP connection) */ - adns_qf_owner= 0x00000004, /* fill in the owner field in the answer */ - adns_qf_quoteok_query= 0x00000010, /* allow special chars in query domain */ - adns_qf_quoteok_cname= 0x00000000, /* allow ... in CNAME we go via - now default */ - adns_qf_quoteok_anshost= 0x00000040, /* allow ... in things supposed to be hostnames */ - adns_qf_quotefail_cname= 0x00000080, /* refuse if quote-req chars in CNAME we go via */ - adns_qf_cname_loose= 0x00000100, /* allow refs to CNAMEs - without, get _s_cname */ - adns_qf_cname_forbid= 0x00000200, /* don't follow CNAMEs, instead give _s_cname */ - adns__qf_internalmask= 0x0ff00000 -} adns_queryflags; +typedef enum { /* In general, or together the desired flags: */ + adns_qf_none= 0x00000000,/* no flags */ + adns_qf_search= 0x00000001,/* use the searchlist */ + adns_qf_usevc= 0x00000002,/* use a virtual circuit (TCP conn) */ + adns_qf_owner= 0x00000004,/* fill in the owner field in the answer */ + adns_qf_quoteok_query= 0x00000010,/* allow special chars in query domain */ + adns_qf_quoteok_cname= 0x00000000,/* ... in CNAME we go via (now default) */ + adns_qf_quoteok_anshost=0x00000040,/* ... in things supposedly hostnames */ + adns_qf_quotefail_cname=0x00000080,/* refuse if quote-req chars in CNAME we go via */ + adns_qf_cname_loose= 0x00000100,/* allow refs to CNAMEs - without, get _s_cname */ + adns_qf_cname_strict= 0x00010000,/* forbid CNAME refs (default, currently) */ + adns_qf_cname_forbid= 0x00000200,/* don't follow CNAMEs, instead give _s_cname */ -typedef enum { - adns__rrt_typemask= 0x0ffff, - adns__qtf_deref= 0x10000, /* dereference domains and perhaps produce extra data */ - adns__qtf_mail822= 0x20000, /* make mailboxes be in RFC822 rcpt field format */ + adns_qf_want_ipv4= 0x00000400,/* try to return IPv4 addresses */ + adns_qf_want_ipv6= 0x00000800,/* try to return IPv6 addresses */ + adns_qf_want_allaf= 0x00000c00,/* all the above flag bits */ + /* Without any of the _qf_want_... flags, _qtf_deref queries try to return + * all address families permitted by _if_permit_... (as overridden by the + * `adns_af:...' configuration option). Set flags to restrict the + * returned address families to the ones selected. + */ + adns_qf_ipv6_mapv4= 0x00001000,/* ... return IPv4 addresses as v6-mapped */ - adns_r_none= 0, + adns_qf_addrlit_scope_forbid=0x00002000,/* forbid % in IPv6 literals */ + adns_qf_addrlit_scope_numeric=0x00004000,/* % may only be numeric */ + adns_qf_addrlit_ipv4_quadonly=0x00008000,/* reject non-dotted-quad ipv4 */ - adns_r_a= 1, + adns__qf_internalmask= 0x0ff00000, + adns__qf_sizeforce= 0x7fffffff +} adns_queryflags; - adns_r_ns_raw= 2, - adns_r_ns= adns_r_ns_raw|adns__qtf_deref, +typedef enum { + adns_rrt_typemask= 0x0ffff, + adns_rrt_reprmask= 0xffffff, + adns__qtf_deref_bit=0x10000,/* internal version of ..._deref below */ + adns__qtf_mail822= 0x20000,/* return mailboxes in RFC822 rcpt field fmt */ - adns_r_cname= 5, + adns__qtf_bigaddr=0x1000000,/* use the new larger sockaddr union */ + adns__qtf_manyaf= 0x2000000,/* permitted to return multiple address families */ - adns_r_soa_raw= 6, - adns_r_soa= adns_r_soa_raw|adns__qtf_mail822, + adns__qtf_deref= adns__qtf_deref_bit|adns__qtf_bigaddr +#ifdef ADNS_FEATURE_MANYAF + |adns__qtf_manyaf +#endif + ,/* dereference domains; perhaps get extra data */ - adns_r_ptr_raw= 12, - adns_r_ptr= adns_r_ptr_raw|adns__qtf_deref, + adns_r_unknown= 0x40000, + /* To use this, ask for records of type |adns_r_unknown. + * adns will not process the RDATA - you'll get adns_rr_byteblocks, + * where the int is the length and the unsigned char* points to the + * data. String representation of the RR data (by adns_rrinfo) is as in + * RFC3597. adns_rr_info will not return the type name in *rrtname_r + * (due to memory management problems); *fmtname_r will be set to + * "unknown". + * + * Do not specify adns_r_unknown along with a known RR type which + * requires domain name uncompression (see RFC3597 s4); domain names + * will not be uncompressed and the resulting data would be useless. + * Asking for meta-RR types via adns_r_unknown will not work properly + * either and may make adns complain about server misbehaviour, so don't + * do that. + * + * Don't forget adns_qf_quoteok if that's what you want. */ - adns_r_hinfo= 13, + adns_r_none= 0, + + adns_r_a= 1, + + adns_r_ns_raw= 2, + adns_r_ns= adns_r_ns_raw|adns__qtf_deref, + + adns_r_cname= 5, + + adns_r_soa_raw= 6, + adns_r_soa= adns_r_soa_raw|adns__qtf_mail822, + + adns_r_ptr_raw= 12, /* do not mind PTR with wrong or missing addr */ + adns_r_ptr= adns_r_ptr_raw|adns__qtf_deref, + + adns_r_hinfo= 13, + + adns_r_mx_raw= 15, + adns_r_mx= adns_r_mx_raw|adns__qtf_deref, + + adns_r_txt= 16, + + adns_r_rp_raw= 17, + adns_r_rp= adns_r_rp_raw|adns__qtf_mail822, - adns_r_mx_raw= 15, - adns_r_mx= adns_r_mx_raw|adns__qtf_deref, + adns_r_aaaa= 28, - adns_r_txt= 16, + /* For SRV records, query domain without _qf_quoteok_query must look + * as expected from SRV RFC with hostname-like Name. _With_ + * _quoteok_query, any query domain is allowed. */ + adns_r_srv_raw= 33, + adns_r_srv= adns_r_srv_raw|adns__qtf_deref, + + adns_r_addr= adns_r_a|adns__qtf_deref, - adns_r_rp_raw= 17, - adns_r_rp= adns_r_rp_raw|adns__qtf_mail822, - - adns_r_addr= adns_r_a|adns__qtf_deref - + adns__rrt_sizeforce= 0x7fffffff, + } adns_rrtype; /* @@ -149,7 +230,7 @@ * legal syntax, or you get adns_s_querydomainvalid (if the query * domain contains bad characters) or adns_s_answerdomaininvalid (if * the answer contains bad characters). - * + * * In queries _with_ qf_quoteok_*, domains in the query or response * may contain any characters, quoted according to RFC1035 5.1. On * input to adns, the char* is a pointer to the interior of a " @@ -213,66 +294,85 @@ */ typedef enum { - adns_s_ok, + adns_s_ok, - /* locally induced errors */ - adns_s_nomemory, - adns_s_unknownrrtype, - adns_s_systemfail, + /* locally induced errors */ + adns_s_nomemory, + adns_s_unknownrrtype, + adns_s_systemfail, - adns_s_max_localfail= 29, + adns_s_max_localfail= 29, + + /* remotely induced errors, detected locally */ + adns_s_timeout, + adns_s_allservfail, + adns_s_norecurse, + adns_s_invalidresponse, + adns_s_unknownformat, - /* remotely induced errors, detected locally */ - adns_s_timeout, - adns_s_allservfail, - adns_s_norecurse, - adns_s_invalidresponse, - adns_s_unknownformat, + adns_s_max_remotefail= 59, + + /* remotely induced errors, reported by remote server to us */ + adns_s_rcodeservfail, + adns_s_rcodeformaterror, + adns_s_rcodenotimplemented, + adns_s_rcoderefused, + adns_s_rcodeunknown, - adns_s_max_remotefail= 59, + adns_s_max_tempfail= 99, - /* remotely induced errors, reported by remote server to us */ - adns_s_rcodeservfail, - adns_s_rcodeformaterror, - adns_s_rcodenotimplemented, - adns_s_rcoderefused, - adns_s_rcodeunknown, + /* remote configuration errors */ + adns_s_inconsistent, /* PTR gives domain whose addr is missing or mismatch */ + adns_s_prohibitedcname, /* CNAME, but eg A expected (not if _qf_cname_loose) */ + adns_s_answerdomaininvalid, + adns_s_answerdomaintoolong, + adns_s_invaliddata, + + adns_s_max_misconfig= 199, - adns_s_max_tempfail= 99, + /* permanent problems with the query */ + adns_s_querydomainwrong, + adns_s_querydomaininvalid, + adns_s_querydomaintoolong, + + adns_s_max_misquery= 299, - /* remote configuration errors */ - adns_s_inconsistent, /* PTR gives domain whose A does not exist and match */ - adns_s_prohibitedcname, /* CNAME found where eg A expected (not if _qf_loosecname) */ - adns_s_answerdomaininvalid, - adns_s_answerdomaintoolong, - adns_s_invaliddata, + /* permanent errors */ + adns_s_nxdomain, + adns_s_nodata, - adns_s_max_misconfig= 199, + adns_s_max_permfail= 499 + +} adns_status; - /* permanent problems with the query */ - adns_s_querydomainwrong, - adns_s_querydomaininvalid, - adns_s_querydomaintoolong, +typedef union { + struct sockaddr sa; + struct sockaddr_in inet; +} adns_sockaddr_v4only; - adns_s_max_misquery= 299, +#ifdef WITH_IPV6 +typedef union { + struct sockaddr sa; + struct sockaddr_in inet; + struct sockaddr_in6 inet6; +} adns_sockaddr; +#else +typedef adns_sockaddr_v4only adns_sockaddr; +#endif - /* permanent errors */ - adns_s_nxdomain, - adns_s_nodata, - - adns_s_max_permfail= 499 - -} adns_status; - typedef struct { int len; - union { - struct sockaddr sa; - struct sockaddr_in inet; - } addr; + adns_sockaddr addr; } adns_rr_addr; typedef struct { + /* the old v4-only structure; handy if you have complicated binary + * compatibility problems. */ + int len; + adns_sockaddr_v4only addr; +} adns_rr_addr_v4only; + +typedef struct { char *host; adns_status astatus; int naddrs; /* temp fail => -1, perm fail => 0, s_ok => >0 */ @@ -289,10 +389,11 @@ } adns_rr_inthostaddr; typedef struct { - /* Used both for mx_raw, in which case i is the preference and str the domain, - * and for txt, in which case each entry has i for the `text' length, - * and str for the data (which will have had an extra nul appended - * so that if it was plain text it is now a null-terminated string). + /* Used both for mx_raw, in which case i is the preference and str + * the domain, and for txt, in which case each entry has i for the + * `text' length, and str for the data (which will have had an extra + * nul appended so that if it was plain text it is now a + * null-terminated string). */ int i; char *str; @@ -308,25 +409,44 @@ } adns_rr_soa; typedef struct { + int priority, weight, port; + char *host; +} adns_rr_srvraw; + +typedef struct { + int priority, weight, port; + adns_rr_hostaddr ha; +} adns_rr_srvha; + +typedef struct { + int len; + unsigned char *data; +} adns_rr_byteblock; + +typedef struct { adns_status status; char *cname; /* always NULL if query was for CNAME records */ - char *owner; /* only set if requested in query flags, and may be 0 on error anyway */ + char *owner; /* only set if req'd in query flags; maybe 0 on error anyway */ adns_rrtype type; /* guaranteed to be same as in query */ - time_t expires; /* expiry time, defined only if _s_ok, nxdomain or nodata. NOT TTL! */ + time_t expires;/*abs time. def only if _s_ok, nxdomain or nodata. NOT TTL!*/ int nrrs, rrsz; /* nrrs is 0 if an error occurs */ union { void *untyped; unsigned char *bytes; - char *(*str); /* ns_raw, cname, ptr, ptr_raw */ - adns_rr_intstr *(*manyistr); /* txt (list of strings ends with i=-1, str=0) */ - adns_rr_addr *addr; /* addr */ - struct in_addr *inaddr; /* a */ - adns_rr_hostaddr *hostaddr; /* ns */ - adns_rr_intstrpair *intstrpair; /* hinfo */ - adns_rr_strpair *strpair; /* rp, rp_raw */ - adns_rr_inthostaddr *inthostaddr; /* mx */ - adns_rr_intstr *intstr; /* mx_raw */ - adns_rr_soa *soa; /* soa, soa_raw */ + char *(*str); /* ns_raw, cname, ptr, ptr_raw */ + adns_rr_intstr *(*manyistr); /* txt (list strs ends with i=-1, str=0)*/ + adns_rr_addr *addr; /* addr */ + struct in_addr *inaddr; /* a */ + struct in6_addr *in6addr; /* aaaa */ + adns_rr_hostaddr *hostaddr; /* ns */ + adns_rr_intstrpair *intstrpair; /* hinfo */ + adns_rr_strpair *strpair; /* rp, rp_raw */ + adns_rr_inthostaddr *inthostaddr;/* mx */ + adns_rr_intstr *intstr; /* mx_raw */ + adns_rr_soa *soa; /* soa, soa_raw */ + adns_rr_srvraw *srvraw; /* srv_raw */ + adns_rr_srvha *srvha;/* srv */ + adns_rr_byteblock *byteblock; /* ...|unknown */ } rrs; } adns_answer; @@ -346,8 +466,9 @@ * * For _init, _init_strcfg, _submit and _synchronous, system errors * (eg, failure to create sockets, malloc failure, etc.) return errno - * values. - * + * values. EINVAL from _init et al means the configuration file + * is erroneous and cannot be parsed. + * * For _wait and _check failures are reported in the answer * structure, and only 0, ESRCH or (for _check) EAGAIN is * returned: if no (appropriate) requests are done adns_check returns @@ -363,15 +484,40 @@ * requested. */ -ADNS_API int adns_init(adns_state *newstate_r, adns_initflags flags, +/* Threads: + * adns does not use any static modifiable state, so it + * is safe to call adns_init several times and then use the + * resulting adns_states concurrently. + * However, it is NOT safe to make simultaneous calls into + * adns using the same adns_state; a single adns_state must be used + * only by one thread at a time. You can solve this problem by + * having one adns_state per thread, or if that isn't feasible, you + * could maintain a pool of adns_states. Unfortunately neither of + * these approaches has optimal performance. + */ + +int adns_init(adns_state *newstate_r, adns_initflags flags, FILE *diagfile /*0=>stderr*/); /* ReactOS addition */ -ADNS_API void adns_addserver(adns_state state, struct in_addr server); +void adns_addserver(adns_state state, struct sockaddr *server, int salen); -ADNS_API int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, +int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, FILE *diagfile /*0=>discard*/, const char *configtext); +typedef void adns_logcallbackfn(adns_state ads, void *logfndata, + const char *fmt, va_list al); + /* Will be called perhaps several times for each message; when the + * message is complete, the string implied by fmt and al will end in + * a newline. Log messages start with `adns debug:' or `adns + * warning:' or `adns:' (for errors), or `adns debug [PID]:' + * etc. if adns_if_logpid is set. */ + +int adns_init_logfn(adns_state *newstate_r, adns_initflags flags, + const char *configtext /*0=>use default config files*/, + adns_logcallbackfn *logfn /*0=>logfndata is a FILE* */, + void *logfndata /*0 with logfn==0 => discard*/); + /* Configuration: * adns_init reads /etc/resolv.conf, which is expected to be (broadly * speaking) in the format expected by libresolv, and then @@ -381,7 +527,7 @@ * is set later overrides any that is set earlier. * * Standard directives understood in resolv[-adns].conf: - * + * * nameserver

    * Must be followed by the IP address of a nameserver. Several * nameservers may be specified, and they will be tried in the order @@ -446,6 +592,21 @@ * setting of adns_if_check_entex, adns_if_check_freq, or neither, * in the flags passed to adns_init. * + * adns_af:{ipv4,ipv6},... adns_af:any + * Determines which address families ADNS looks up (either as an + * adns_r_addr query, or when dereferencing an answer yielding hostnames + * (e.g., adns_r_mx). The argument is a comma-separated list: only the + * address families listed will be looked up. The default is `any'. + * Lookups occur (logically) concurrently; use the `sortlist' directive to + * control the relative order of addresses in answers. This option + * overrides the corresponding init flags (covered by adns_if_afmask). + * + * adns_ignoreunkcfg + * Ignore unknown options and configuration directives, rather than + * logging them. To be effective, appear in the configuration + * before the unknown options. ADNS_RES_OPTIONS is generally early + * enough. + * * There are a number of environment variables which can modify the * behaviour of adns. They take effect only if adns_init is used, and * the caller of adns_init can disable them using adns_if_noenv. In @@ -472,7 +633,7 @@ * line in resolv.conf. */ -ADNS_API int adns_synchronous(adns_state ads, +int adns_synchronous(adns_state ads, const char *owner, adns_rrtype type, adns_queryflags flags, @@ -483,7 +644,7 @@ * processing functions to actually get things to happen. */ -ADNS_API int adns_submit(adns_state ads, +int adns_submit(adns_state ads, const char *owner, adns_rrtype type, adns_queryflags flags, @@ -492,23 +653,23 @@ /* The owner should be quoted in master file format. */ -ADNS_API int adns_check(adns_state ads, +int adns_check(adns_state ads, adns_query *query_io, adns_answer **answer_r, void **context_r); -ADNS_API int adns_wait(adns_state ads, +int adns_wait(adns_state ads, adns_query *query_io, adns_answer **answer_r, void **context_r); /* same as adns_wait but uses poll(2) internally */ -ADNS_API int adns_wait_poll(adns_state ads, +int adns_wait_poll(adns_state ads, adns_query *query_io, adns_answer **answer_r, void **context_r); -ADNS_API void adns_cancel(adns_query query); +void adns_cancel(adns_query query); /* The adns_query you get back from _submit is valid (ie, can be * legitimately passed into adns functions) until it is returned by @@ -522,7 +683,7 @@ * query type. */ -ADNS_API int adns_submit_reverse(adns_state ads, +int adns_submit_reverse(adns_state ads, const struct sockaddr *addr, adns_rrtype type, adns_queryflags flags, @@ -532,7 +693,7 @@ * addr->sa_family must be AF_INET or you get ENOSYS. */ -ADNS_API int adns_submit_reverse_any(adns_state ads, +int adns_submit_reverse_any(adns_state ads, const struct sockaddr *addr, const char *rzone, adns_rrtype type, @@ -545,14 +706,69 @@ * addr->sa_family must be AF_INET or you get ENOSYS. */ -ADNS_API void adns_finish(adns_state ads); +void adns_finish(adns_state ads); /* You may call this even if you have queries outstanding; * they will be cancelled. */ +#define ADNS_ADDR2TEXT_BUFLEN \ + (INET6_ADDRSTRLEN + 1/*%*/ \ + + ((IF_NAMESIZE-1) > 9 ? (IF_NAMESIZE-1) : 9/*uint32*/) \ + + 1/* nul; included in IF_NAMESIZE */) -ADNS_API void adns_forallqueries_begin(adns_state ads); -ADNS_API adns_query adns_forallqueries_next(adns_state ads, void **context_r); +int adns_text2addr(const char *text, uint16_t port, adns_queryflags flags, + struct sockaddr *sa_r, + socklen_t *salen_io /* updated iff OK or ENOSPC */); +int adns_addr2text(const struct sockaddr *sa, adns_queryflags flags, + char *buffer, int *buflen_io /* updated ONLY on ENOSPC */, + int *port_r /* may be 0 */); + /* + * port is always in host byte order and is simply copied to and + * from the appropriate sockaddr field (byteswapped as necessary). + * + * The only flags supported are adns_qf_addrlit_... + * + * Error return values are: + * + * ENOSPC Output buffer is too small. Can only happen if + * *buflen_io < ADNS_ADDR2TEXT_BUFLEN or + * *salen_io < sizeof(adns_sockaddr). On return, + * *buflen_io or *salen_io has been updated by adns. + * + * EINVAL text has invalid syntax. + * + * text represents an address family not supported by + * this version of adns. + * + * Scoped address supplied (text contained "%" or + * sin6_scope_id nonzero) but caller specified + * adns_qf_addrlit_scope_forbid. + * + * Scope name (rather than number) supplied in text but + * caller specified adns_qf_addrlit_scope_numeric. + * + * EAFNOSUPPORT sa->sa_family is not supported (addr2text only). + * + * ENOSYS Unsupported flags set. + * + * Only if neither adns_qf_addrlit_scope_forbid nor + * adns_qf_addrlit_scope_numeric are set: + * + * ENOSYS Scope name supplied in text but IPv6 address part of + * sockaddr is not a link local address. + * + * ENXIO Scope name supplied in text but if_nametoindex + * said it wasn't a valid local interface name. + * + * EIO Scoped address supplied but if_nametoindex failed + * in an unexpected way; adns has printed a message to + * stderr. + * + * any other if_nametoindex failed in a more-or-less expected way. + */ + +void adns_forallqueries_begin(adns_state ads); +adns_query adns_forallqueries_next(adns_state ads, void **context_r); /* Iterator functions, which you can use to loop over the outstanding * (submitted but not yet successfuly checked/waited) queries. * @@ -568,7 +784,7 @@ * context_r may be 0. *context_r may not be set when _next returns 0. */ -ADNS_API void adns_checkconsistency(adns_state ads, adns_query qu); +void adns_checkconsistency(adns_state ads, adns_query qu); /* Checks the consistency of adns's internal data structures. * If any error is found, the program will abort(). * You may pass 0 for qu; if you pass non-null then additional checks @@ -600,7 +816,7 @@ * blocking, or you may not have an up-to-date list of it's fds. */ -ADNS_API int adns_processany(adns_state ads); +int adns_processany(adns_state ads); /* Gives adns flow-of-control for a bit. This will never block, and * can be used with any threading/asynch-io model. If some error * occurred which might cause an event loop to spin then the errno @@ -607,9 +823,9 @@ * value is returned. */ -ADNS_API int adns_processreadable(adns_state ads, ADNS_SOCKET fd, const struct timeval *now); -ADNS_API int adns_processwriteable(adns_state ads, ADNS_SOCKET fd, const struct timeval *now); -ADNS_API int adns_processexceptional(adns_state ads, ADNS_SOCKET fd, const struct timeval *now); +int adns_processreadable(adns_state ads, int fd, const struct timeval *now); +int adns_processwriteable(adns_state ads, int fd, const struct timeval *now); +int adns_processexceptional(adns_state ads, int fd, const struct timeval *now); /* Gives adns flow-of-control so that it can process incoming data * from, or send outgoing data via, fd. Very like _processany. If it * returns zero then fd will no longer be readable or writeable @@ -628,7 +844,7 @@ * then the errno value is returned. */ -ADNS_API void adns_processtimeouts(adns_state ads, const struct timeval *now); +void adns_processtimeouts(adns_state ads, const struct timeval *now); /* Gives adns flow-of-control so that it can process any timeouts * which might have happened. Very like _processreadable/writeable. * @@ -636,12 +852,12 @@ * obtained from gettimeofday. */ -ADNS_API void adns_firsttimeout(adns_state ads, +void adns_firsttimeout(adns_state ads, struct timeval **tv_mod, struct timeval *tv_buf, struct timeval now); /* Asks adns when it would first like the opportunity to time * something out. now must be the current time, from gettimeofday. - * + * * If tv_mod points to 0 then tv_buf must be non-null, and * _firsttimeout will fill in *tv_buf with the time until the first * timeout, and make *tv_mod point to tv_buf. If adns doesn't have @@ -655,7 +871,7 @@ * is using. It always succeeds and never blocks. */ -ADNS_API void adns_globalsystemfailure(adns_state ads); +void adns_globalsystemfailure(adns_state ads); /* If serious problem(s) happen which globally affect your ability to * interact properly with adns, or adns's ability to function * properly, you or adns can call this function. @@ -674,7 +890,7 @@ * Entrypoints for select-loop based asynch io: */ -ADNS_API void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds, +void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval **tv_mod, struct timeval *tv_buf, const struct timeval *now); @@ -684,13 +900,13 @@ * for adns_firsttimeout. readfds, writefds, exceptfds and maxfd_io may * not be 0. * - * If now is not 0 then this will never actually do any I/O, or change - * the fds that adns is using or the timeouts it wants. In any case - * it won't block, and it will set the timeout to zero if a query - * finishes in _beforeselect. + * If tv_mod is 0 on entry then this will never actually do any I/O, + * or change the fds that adns is using or the timeouts it wants. In + * any case it won't block, and it will set the timeout to zero if a + * query finishes in _beforeselect. */ -ADNS_API void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds, +void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds, const fd_set *writefds, const fd_set *exceptfds, const struct timeval *now); /* Gives adns flow-of-control for a bit; intended for use after @@ -724,12 +940,13 @@ * entrypoints will not be defined in libadns. Sorry ! */ -ADNS_API int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, int *timeout_io, +int adns_beforepoll(adns_state ads, struct pollfd *fds, + int *nfds_io, int *timeout_io, const struct timeval *now); /* Finds out which fd's adns is interested in, and when it would like * to be able to time things out. This is in a form suitable for use * with poll(2). - * + * * On entry, usually fds should point to at least *nfds_io structs. * adns will fill up to that many structs will information for poll, * and record in *nfds_io how many structs it filled. If it wants to @@ -769,7 +986,7 @@ * In any case this call won't block. */ -#define ADNS_POLLFDS_RECOMMENDED 2 +#define ADNS_POLLFDS_RECOMMENDED 3 /* If you allocate an fds buf with at least RECOMMENDED entries then * you are unlikely to need to enlarge it. You are recommended to do * so if it's convenient. However, you must be prepared for adns to @@ -776,7 +993,7 @@ * require more space than this. */ -ADNS_API void adns_afterpoll(adns_state ads, const struct pollfd *fds, int nfds, +void adns_afterpoll(adns_state ads, const struct pollfd *fds, int nfds, const struct timeval *now); /* Gives adns flow-of-control for a bit; intended for use after * poll(2). fds and nfds should be the results from poll(). pollfd @@ -784,7 +1001,7 @@ */ -ADNS_API adns_status adns_rr_info(adns_rrtype type, +adns_status adns_rr_info(adns_rrtype type, const char **rrtname_r, const char **fmtname_r, int *len_r, const void *datap, char **data_r); @@ -844,9 +1061,9 @@ * dns2.spong.dyn.ml.org timeout "DNS query timed out" ? */ -ADNS_API const char *adns_strerror(adns_status st); -ADNS_API const char *adns_errabbrev(adns_status st); -ADNS_API const char *adns_errtypeabbrev(adns_status st); +const char *adns_strerror(adns_status st); +const char *adns_errabbrev(adns_status st); +const char *adns_errtypeabbrev(adns_status st); /* Like strerror but for adns_status values. adns_errabbrev returns * the abbreviation of the error - eg, for adns_s_timeout it returns * "timeout". adns_errtypeabbrev returns the abbreviation of the Index: sdk/lib/3rdparty/adns/src/adns.make =================================================================== --- sdk/lib/3rdparty/adns/src/adns.make (revision 72742) +++ sdk/lib/3rdparty/adns/src/adns.make (working copy) @@ -1,15 +1,15 @@ # src/adns.make - library definitions, including list of object files # -# This file is -# Copyright (C) 1997-1999 Ian Jackson -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -18,8 +18,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. LIBOBJS= types.o event.o query.o reply.o general.o setup.o transmit.o \ - parse.o poll.o check.o + parse.o poll.o check.o addrfam.o Index: sdk/lib/3rdparty/adns/src/check.c =================================================================== --- sdk/lib/3rdparty/adns/src/check.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/check.c (working copy) @@ -3,26 +3,25 @@ * - consistency checks */ /* - * This file is - * Copyright (C) 1997-1999 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #include "internal.h" @@ -31,56 +30,32 @@ adns__consistency(ads,qu,cc_user); } -/* The original macro. Too gnuish for other compilers */ -#if 0 -#define DLIST_CHECK(list, nodevar, part, body) \ - if ((list).head) { \ - assert(! (list).head->part back); \ - for ((nodevar)= (list).head; (nodevar); (nodevar)= (nodevar)->part next) { \ - assert((nodevar)->part next \ - ? (nodevar) == (nodevar)->part next->part back \ - : (nodevar) == (list).tail); \ - body \ - } \ +#define DLIST_CHECK(list, nodevar, part, body) \ + if ((list).head) { \ + assert(! (list).head->part back); \ + for ((nodevar)= (list).head; \ + (nodevar); \ + (nodevar)= (nodevar)->part next) { \ + assert((nodevar)->part next \ + ? (nodevar) == (nodevar)->part next->part back \ + : (nodevar) == (list).tail); \ + body \ + } \ } -#endif /* 0 */ -#define DLIST_CHECK1(list, nodevar, body) \ - if ((list).head) { \ - assert(! (list).head->back); \ - for ((nodevar)= (list).head; (nodevar); (nodevar)= (nodevar)->next) { \ - assert((nodevar)->next \ - ? (nodevar) == (nodevar)->next->back \ - : (nodevar) == (list).tail); \ - body \ - } \ - } - -#define DLIST_CHECK2(list, nodevar, part, body) \ - if ((list).head) { \ - assert(! (list).head->part.back); \ - for ((nodevar)= (list).head; (nodevar); (nodevar)= (nodevar)->part.next) { \ - assert((nodevar)->part.next \ - ? (nodevar) == (nodevar)->part.next->part.back \ - : (nodevar) == (list).tail); \ - body \ - } \ - } - -#define DLIST_ASSERTON(node, nodevar, list, part) \ - do { \ - for ((nodevar)= (list).head; \ - (nodevar) != (node); \ - (nodevar)= (nodevar)->part next) { \ - assert((nodevar)); \ - } \ +#define DLIST_ASSERTON(node, nodevar, list, part) \ + do { \ + for ((nodevar)= (list).head; \ + (nodevar) != (node); \ + (nodevar)= (nodevar)->part next) { \ + assert((nodevar)); \ + } \ } while(0) static void checkc_query_alloc(adns_state ads, adns_query qu) { allocnode *an; - - DLIST_CHECK1(qu->allocations, an, { + DLIST_CHECK(qu->allocations, an, , { }); } @@ -100,15 +75,20 @@ } static void checkc_global(adns_state ads) { + const struct sortlist *sl; int i; - assert(ads->udpsocket >= 0); + assert(ads->udpsockets >= 0); - for (i=0; insortlist; i++) - assert(!(ads->sortlist[i].base.s_addr & ~ads->sortlist[i].mask.s_addr)); + for (i=0; insortlist; i++) { + sl= &ads->sortlist[i]; + assert(adns__addr_matches(sl->base.sa.sa_family, + adns__sockaddr_addr(&sl->base.sa), + &sl->base,&sl->mask)); + } assert(ads->tcpserver >= 0 && ads->tcpserver < ads->nservers); - + switch (ads->tcpstate) { case server_connecting: assert(ads->tcpsocket >= 0); @@ -132,8 +112,8 @@ static void checkc_queue_udpw(adns_state ads) { adns_query qu; - - DLIST_CHECK1(ads->udpw, qu, { + + DLIST_CHECK(ads->udpw, qu, , { assert(qu->state==query_tosend); assert(qu->retries <= UDPMAXRETRIES); assert(qu->udpsent); @@ -145,8 +125,8 @@ static void checkc_queue_tcpw(adns_state ads) { adns_query qu; - - DLIST_CHECK1(ads->tcpw, qu, { + + DLIST_CHECK(ads->tcpw, qu, , { assert(qu->state==query_tcpw); assert(!qu->children.head && !qu->children.tail); assert(qu->retries <= ads->nservers+1); @@ -158,10 +138,10 @@ static void checkc_queue_childw(adns_state ads) { adns_query parent, child; - DLIST_CHECK1(ads->childw, parent, { + DLIST_CHECK(ads->childw, parent, , { assert(parent->state == query_childw); assert(parent->children.head); - DLIST_CHECK2(parent->children, child, siblings, { + DLIST_CHECK(parent->children, child, siblings., { assert(child->parent == parent); assert(child->state != query_done); }); @@ -170,26 +150,41 @@ }); } +static void checkc_query_done(adns_state ads, adns_query qu) { + assert(qu->state == query_done); + assert(!qu->children.head && !qu->children.tail); + checkc_query(ads,qu); +} + static void checkc_queue_output(adns_state ads) { adns_query qu; - - DLIST_CHECK1(ads->output, qu, { - assert(qu->state == query_done); - assert(!qu->children.head && !qu->children.tail); + + DLIST_CHECK(ads->output, qu, , { assert(!qu->parent); assert(!qu->allocations.head && !qu->allocations.tail); - checkc_query(ads,qu); + checkc_query_done(ads,qu); }); } +static void checkc_queue_intdone(adns_state ads) { + adns_query qu; + + DLIST_CHECK(ads->intdone, qu, , { + assert(qu->parent); + assert(qu->ctx.callback); + checkc_query_done(ads,qu); + }); +} + void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc) { adns_query search; - + switch (cc) { case cc_user: break; case cc_entex: if (!(ads->iflags & adns_if_checkc_entex)) return; + assert(!ads->intdone.head); break; case cc_freq: if ((ads->iflags & adns_if_checkc_freq) != adns_if_checkc_freq) return; @@ -203,6 +198,7 @@ checkc_queue_tcpw(ads); checkc_queue_childw(ads); checkc_queue_output(ads); + checkc_queue_intdone(ads); if (qu) { switch (qu->state) { @@ -216,7 +212,10 @@ DLIST_ASSERTON(qu, search, ads->childw, ); break; case query_done: - DLIST_ASSERTON(qu, search, ads->output, ); + if (qu->parent) + DLIST_ASSERTON(qu, search, ads->intdone, ); + else + DLIST_ASSERTON(qu, search, ads->output, ); break; default: assert(!"specific query state"); Index: sdk/lib/3rdparty/adns/src/config.h.in =================================================================== --- sdk/lib/3rdparty/adns/src/config.h.in (revision 72742) +++ sdk/lib/3rdparty/adns/src/config.h.in (working copy) @@ -1,4 +1,4 @@ -/* src/config.h.in. Generated automatically from configure.in by autoheader. */ +/* src/config.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* Define if inline functions a la GCC are available. */ #undef HAVE_INLINE @@ -21,9 +21,6 @@ /* Define if you have the poll function. */ #undef HAVE_POLL -/* Define if you have the header file. */ -#undef HAVE_SYS_SELECT_H - /* Define if you have the nsl library (-lnsl). */ #undef HAVE_LIBNSL @@ -99,7 +96,3 @@ #ifdef HAVEUSE_RPCTYPES_H #include #endif - -#ifdef HAVE_SYS_SELECT_H -#include -#endif Index: sdk/lib/3rdparty/adns/src/dlist.h =================================================================== --- sdk/lib/3rdparty/adns/src/dlist.h (revision 72742) +++ sdk/lib/3rdparty/adns/src/dlist.h (working copy) @@ -3,26 +3,25 @@ * - macros for handling doubly linked lists */ /* - * This file is - * Copyright (C) 1997-1999 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifndef ADNS_DLIST_H_INCLUDED @@ -31,8 +30,8 @@ #define LIST_INIT(list) ((list).head= (list).tail= 0) #define LINK_INIT(link) ((link).next= (link).back= 0) -#define LIST_UNLINK_PART(list,node,part) \ - do { \ +#define LIST_UNLINK_PART(list,node,part) \ + do { \ if ((node)->part back) (node)->part back->part next= (node)->part next; \ else (list).head= (node)->part next; \ if ((node)->part next) (node)->part next->part back= (node)->part back; \ @@ -39,12 +38,13 @@ else (list).tail= (node)->part back; \ } while(0) -#define LIST_LINK_TAIL_PART(list,node,part) \ - do { \ - (node)->part next= 0; \ - (node)->part back= (list).tail; \ - if ((list).tail) (list).tail->part next= (node); else (list).head= (node); \ - (list).tail= (node); \ +#define LIST_LINK_TAIL_PART(list,node,part) \ + do { \ + (node)->part next= 0; \ + (node)->part back= (list).tail; \ + if ((list).tail) (list).tail->part next= (node); \ + else (list).head= (node); \ + (list).tail= (node); \ } while(0) #define LIST_UNLINK(list,node) LIST_UNLINK_PART(list,node,) Index: sdk/lib/3rdparty/adns/src/event.c =================================================================== --- sdk/lib/3rdparty/adns/src/event.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/event.c (working copy) @@ -5,26 +5,25 @@ * - user-visible check/wait and event-loop-related functions */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, adns_socket_write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #include @@ -48,9 +47,6 @@ /* TCP connection management. */ static void tcp_close(adns_state ads) { - int serv; - - serv= ads->tcpserver; adns_socket_close(ads->tcpsocket); ads->tcpsocket= -1; ads->tcprecv.used= ads->tcprecv_skip= ads->tcpsend.used= 0; @@ -59,7 +55,7 @@ void adns__tcp_broken(adns_state ads, const char *what, const char *why) { int serv; adns_query qu; - + assert(ads->tcpstate == server_connecting || ads->tcpstate == server_ok); serv= ads->tcpserver; if (what) adns__warn(ads,serv,0,"TCP connection failed: %s: %s",what,why); @@ -77,7 +73,7 @@ static void tcp_connected(adns_state ads, struct timeval now) { adns_query qu, nqu; - + adns__debug(ads,ads->tcpserver,0,"TCP connected"); ads->tcpstate= server_ok; for (qu= ads->tcpw.head; qu && ads->tcpstate == server_ok; qu= nqu) { @@ -87,10 +83,24 @@ } } +static void tcp_broken_events(adns_state ads) { + adns_query qu, nqu; + + assert(ads->tcpstate == server_broken); + for (qu= ads->tcpw.head; qu; qu= nqu) { + nqu= qu->next; + assert(qu->state == query_tcpw); + if (qu->retries > ads->nservers) { + LIST_UNLINK(ads->tcpw,qu); + adns__query_fail(qu,adns_s_allservfail); + } + } + ads->tcpstate= server_disconnected; +} + void adns__tcp_tryconnect(adns_state ads, struct timeval now) { - int r, tries; - ADNS_SOCKET fd; - struct sockaddr_in addr; + int r, fd, tries; + adns_rr_addr *addr; struct protoent *proto; for (tries=0; triesnservers; tries++) { @@ -104,16 +114,18 @@ default: abort(); } - + assert(!ads->tcpsend.used); assert(!ads->tcprecv.used); assert(!ads->tcprecv_skip); proto= getprotobyname("tcp"); - if (!proto) { adns__diag(ads,-1,0,"unable to find protocol no. for TCP !"); return; } - ADNS_CLEAR_ERRNO - fd= socket(AF_INET,SOCK_STREAM,proto->p_proto); - ADNS_CAPTURE_ERRNO; + if (!proto) { + adns__diag(ads,-1,0,"unable to find protocol no. for TCP !"); + return; + } + addr = &ads->servers[ads->tcpserver]; + fd= socket(addr->addr.sa.sa_family, SOCK_STREAM, proto->p_proto); if (fd<0) { adns__diag(ads,-1,0,"cannot create TCP socket: %s",strerror(errno)); return; @@ -120,17 +132,12 @@ } r= adns__setnonblock(ads,fd); if (r) { - adns__diag(ads,-1,0,"cannot make TCP socket nonblocking: %s",strerror(r)); + adns__diag(ads,-1,0,"cannot make TCP socket nonblocking:" + " %s",strerror(r)); adns_socket_close(fd); return; } - memset(&addr,0,sizeof(addr)); - addr.sin_family= AF_INET; - addr.sin_port= htons(DNS_PORT); - addr.sin_addr= ads->servers[ads->tcpserver].addr; - ADNS_CLEAR_ERRNO; - r= connect(fd,(const struct sockaddr*)&addr,sizeof(addr)); - ADNS_CAPTURE_ERRNO; + r= connect(fd,&addr->addr.sa,addr->len); ads->tcpsocket= fd; ads->tcpstate= server_connecting; if (r==0) { tcp_connected(ads,now); return; } @@ -140,7 +147,7 @@ return; } adns__tcp_broken(ads,"connect",strerror(errno)); - ads->tcpstate= server_disconnected; + tcp_broken_events(ads); } } @@ -169,7 +176,7 @@ timerclear(rbuf); } - + static void inter_maxto(struct timeval **tv_io, struct timeval *tvbuf, struct timeval maxto) { struct timeval *rbuf; @@ -206,7 +213,7 @@ struct timeval **tv_io, struct timeval *tvbuf, struct timeval now, struct query_queue *queue) { adns_query qu, nqu; - + for (qu= queue->head; qu; qu= nqu) { nqu= qu->next; if (!timercmp(&now,&qu->timeout,>)) { @@ -227,21 +234,11 @@ static void tcp_events(adns_state ads, int act, struct timeval **tv_io, struct timeval *tvbuf, struct timeval now) { - adns_query qu, nqu; - for (;;) { switch (ads->tcpstate) { case server_broken: if (!act) { inter_immed(tv_io,tvbuf); return; } - for (qu= ads->tcpw.head; qu; qu= nqu) { - nqu= qu->next; - assert(qu->state == query_tcpw); - if (qu->retries > ads->nservers) { - LIST_UNLINK(ads->tcpw,qu); - adns__query_fail(qu,adns_s_allservfail); - } - } - ads->tcpstate= server_disconnected; + tcp_broken_events(ads); case server_disconnected: /* fall through */ if (!ads->tcpw.head) return; if (!act) { inter_immed(tv_io,tvbuf); return; } @@ -293,7 +290,7 @@ struct timeval now) { adns__consistency(ads,0,cc_entex); adns__timeouts(ads, 0, tv_io,tvbuf, now); - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } void adns_processtimeouts(adns_state ads, const struct timeval *now) { @@ -302,7 +299,7 @@ adns__consistency(ads,0,cc_entex); adns__must_gettimeofday(ads,&now,&tv_buf); if (now) adns__timeouts(ads, 1, 0,0, *now); - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } /* fd handling functions. These are the top-level of the real work of @@ -311,35 +308,47 @@ int adns__pollfds(adns_state ads, struct pollfd pollfds_buf[MAX_POLLFDS]) { /* Returns the number of entries filled in. Always zeroes revents. */ + int nwanted=0; +#define ADD_POLLFD(wantfd, wantevents) do{ \ + pollfds_buf[nwanted].fd= (wantfd); \ + pollfds_buf[nwanted].events= (wantevents); \ + pollfds_buf[nwanted].revents= 0; \ + nwanted++; \ + }while(0) - assert(MAX_POLLFDS==2); + int i; - pollfds_buf[0].fd= ads->udpsocket; - pollfds_buf[0].events= POLLIN; - pollfds_buf[0].revents= 0; + assert(MAX_POLLFDS == MAXUDP + 1); + for (i=0; inudpsockets; i++) + ADD_POLLFD(ads->udpsockets[i].fd, POLLIN); + switch (ads->tcpstate) { case server_disconnected: case server_broken: - return 1; + break; case server_connecting: - pollfds_buf[1].events= POLLOUT; + ADD_POLLFD(ads->tcpsocket, POLLOUT); break; case server_ok: - pollfds_buf[1].events= ads->tcpsend.used ? POLLIN|POLLOUT|POLLPRI : POLLIN|POLLPRI; + ADD_POLLFD(ads->tcpsocket, + ads->tcpsend.used ? POLLIN|POLLOUT|POLLPRI : POLLIN|POLLPRI); break; default: abort(); } - pollfds_buf[1].fd= ads->tcpsocket; - return 2; + assert(nwanted<=MAX_POLLFDS); +#undef ADD_POLLFD + return nwanted; } -int adns_processreadable(adns_state ads, ADNS_SOCKET fd, const struct timeval *now) { - int want, dgramlen, r, udpaddrlen, serv, old_skip; +int adns_processreadable(adns_state ads, int fd, const struct timeval *now) { + int want, dgramlen, r, i, udpaddrlen, serv, old_skip; byte udpbuf[DNS_MAXUDP]; - struct sockaddr_in udpaddr; - + char addrbuf[ADNS_ADDR2TEXT_BUFLEN]; + struct udpsocket *udp; + adns_sockaddr udpaddr; + adns__consistency(ads,0,cc_entex); switch (ads->tcpstate) { @@ -367,16 +376,15 @@ want= 2; } ads->tcprecv.used -= ads->tcprecv_skip; - memmove(ads->tcprecv.buf,ads->tcprecv.buf+ads->tcprecv_skip, (size_t) ads->tcprecv.used); + memmove(ads->tcprecv.buf, ads->tcprecv.buf+ads->tcprecv_skip, + ads->tcprecv.used); ads->tcprecv_skip= 0; if (!adns__vbuf_ensure(&ads->tcprecv,want)) { r= ENOMEM; goto xit; } assert(ads->tcprecv.used <= ads->tcprecv.avail); if (ads->tcprecv.used == ads->tcprecv.avail) continue; - ADNS_CLEAR_ERRNO; r= adns_socket_read(ads->tcpsocket, ads->tcprecv.buf+ads->tcprecv.used, ads->tcprecv.avail-ads->tcprecv.used); - ADNS_CAPTURE_ERRNO; if (r>0) { ads->tcprecv.used+= r; } else { @@ -385,7 +393,7 @@ if (errno==EINTR) continue; if (errno_resources(errno)) { r= errno; goto xit; } } - adns__tcp_broken(ads,"adns_socket_read",r?strerror(errno):"closed"); + adns__tcp_broken(ads,"read",r?strerror(errno):"closed"); } } while (ads->tcpstate == server_ok); r= 0; goto xit; @@ -392,57 +400,42 @@ default: abort(); } - if (fd == ads->udpsocket) { + for (i=0; inudpsockets; i++) { + udp= &ads->udpsockets[i]; + if (fd != udp->fd) continue; for (;;) { udpaddrlen= sizeof(udpaddr); - ADNS_CLEAR_ERRNO; - r= recvfrom(ads->udpsocket,(char*)udpbuf,sizeof(udpbuf),0, - (struct sockaddr*)&udpaddr,&udpaddrlen); - ADNS_CAPTURE_ERRNO; + r= recvfrom(fd,udpbuf,sizeof(udpbuf),0, &udpaddr.sa,&udpaddrlen); if (r<0) { - if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ECONNRESET) { r= 0; goto xit; } + if (errno == EAGAIN || errno == EWOULDBLOCK) { r= 0; goto xit; } if (errno == EINTR) continue; if (errno_resources(errno)) { r= errno; goto xit; } - adns__warn(ads,-1,0,"datagram receive error: %s (%d)",strerror(errno), errno); + adns__warn(ads,-1,0,"datagram receive error: %s",strerror(errno)); r= 0; goto xit; } - if (udpaddrlen != sizeof(udpaddr)) { - adns__diag(ads,-1,0,"datagram received with wrong address length %d" - " (expected %lu)", udpaddrlen, - (unsigned long)sizeof(udpaddr)); - continue; - } - if (udpaddr.sin_family != AF_INET) { - adns__diag(ads,-1,0,"datagram received with wrong protocol family" - " %u (expected %u)",udpaddr.sin_family,AF_INET); - continue; - } - if (ntohs(udpaddr.sin_port) != DNS_PORT) { - adns__diag(ads,-1,0,"datagram received from wrong port %u (expected %u)", - ntohs(udpaddr.sin_port),DNS_PORT); - continue; - } for (serv= 0; serv < ads->nservers && - ads->servers[serv].addr.s_addr != udpaddr.sin_addr.s_addr; + !adns__sockaddrs_equal(&udpaddr.sa, + &ads->servers[serv].addr.sa); serv++); if (serv >= ads->nservers) { adns__warn(ads,-1,0,"datagram received from unknown nameserver %s", - inet_ntoa(udpaddr.sin_addr)); + adns__sockaddr_ntoa(&udpaddr.sa, addrbuf)); continue; } adns__procdgram(ads,udpbuf,r,serv,0,*now); } + break; } r= 0; xit: - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } -int adns_processwriteable(adns_state ads, ADNS_SOCKET fd, const struct timeval *now) { +int adns_processwriteable(adns_state ads, int fd, const struct timeval *now) { int r; - + adns__consistency(ads,0,cc_entex); switch (ads->tcpstate) { @@ -455,20 +448,18 @@ assert(ads->tcprecv_skip==0); for (;;) { if (!adns__vbuf_ensure(&ads->tcprecv,1)) { r= ENOMEM; goto xit; } - ADNS_CLEAR_ERRNO; r= adns_socket_read(ads->tcpsocket,&ads->tcprecv.buf,1); - ADNS_CAPTURE_ERRNO; if (r==0 || (r<0 && (errno==EAGAIN || errno==EWOULDBLOCK))) { tcp_connected(ads,*now); r= 0; goto xit; } if (r>0) { - adns__tcp_broken(ads,"connect/adns_socket_read","sent data before first request"); + adns__tcp_broken(ads,"connect/read","sent data before first request"); r= 0; goto xit; } if (errno==EINTR) continue; if (errno_resources(errno)) { r= errno; goto xit; } - adns__tcp_broken(ads,"connect/adns_socket_read",strerror(errno)); + adns__tcp_broken(ads,"connect/read",strerror(errno)); r= 0; goto xit; } /* not reached */ case server_ok: @@ -475,19 +466,17 @@ if (fd != ads->tcpsocket) break; while (ads->tcpsend.used) { adns__sigpipe_protect(ads); - ADNS_CLEAR_ERRNO; r= adns_socket_write(ads->tcpsocket,ads->tcpsend.buf,ads->tcpsend.used); - ADNS_CAPTURE_ERRNO; adns__sigpipe_unprotect(ads); if (r<0) { if (errno==EINTR) continue; if (errno==EAGAIN || errno==EWOULDBLOCK) { r= 0; goto xit; } if (errno_resources(errno)) { r= errno; goto xit; } - adns__tcp_broken(ads,"adns_socket_write",strerror(errno)); + adns__tcp_broken(ads,"write",strerror(errno)); r= 0; goto xit; } else if (r>0) { ads->tcpsend.used -= r; - memmove(ads->tcpsend.buf,ads->tcpsend.buf+r, (size_t) ads->tcpsend.used); + memmove(ads->tcpsend.buf,ads->tcpsend.buf+r,ads->tcpsend.used); } } r= 0; @@ -497,11 +486,12 @@ } r= 0; xit: - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } - -int adns_processexceptional(adns_state ads, ADNS_SOCKET fd, const struct timeval *now) { + +int adns_processexceptional(adns_state ads, int fd, + const struct timeval *now) { adns__consistency(ads,0,cc_entex); switch (ads->tcpstate) { case server_disconnected: @@ -515,25 +505,27 @@ default: abort(); } - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return 0; } -static void fd_event(adns_state ads, ADNS_SOCKET fd, +static void fd_event(adns_state ads, int fd, int revent, int pollflag, int maxfd, const fd_set *fds, - int (*func)(adns_state, ADNS_SOCKET fd, const struct timeval *now), + int (*func)(adns_state, int fd, + const struct timeval *now), struct timeval now, int *r_r) { int r; - + if (!(revent & pollflag)) return; - if (fds && !((int)fd= maxfd) maxfd= fd+1; + if (fd >= maxfd) maxfd= fd+1; revents= pollfds[i].revents; - fd_event(ads,fd, revents,POLLIN, maxfd,readfds, adns_processreadable,now,r_r); - fd_event(ads,fd, revents,POLLOUT, maxfd,writefds, adns_processwriteable,now,r_r); - fd_event(ads,fd, revents,POLLPRI, maxfd,exceptfds, adns_processexceptional,now,r_r); +#define EV(pollfl,fds,how) \ + fd_event(ads,fd, revents,pollfl, maxfd,fds, adns_process##how,now,r_r) + EV( POLLIN, readfds, readable ); + EV( POLLOUT, writefds, writeable ); + EV( POLLPRI, exceptfds, exceptional ); +#undef EV } } @@ -565,9 +559,8 @@ const struct timeval *now) { struct timeval tv_nowbuf; struct pollfd pollfds[MAX_POLLFDS]; - int i, maxfd, npollfds; - ADNS_SOCKET fd; - + int i, fd, maxfd, npollfds; + adns__consistency(ads,0,cc_entex); if (tv_mod && (!*tv_mod || (*tv_mod)->tv_sec || (*tv_mod)->tv_usec)) { @@ -581,7 +574,7 @@ maxfd= *maxfd_io; for (i=0; i= maxfd) maxfd= fd+1; + if (fd >= maxfd) maxfd= fd+1; if (pollfds[i].events & POLLIN) FD_SET(fd,readfds_io); if (pollfds[i].events & POLLOUT) FD_SET(fd,writefds_io); if (pollfds[i].events & POLLPRI) FD_SET(fd,exceptfds_io); @@ -589,7 +582,7 @@ *maxfd_io= maxfd; xit: - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds, @@ -611,7 +604,7 @@ maxfd,readfds,writefds,exceptfds, *now, 0); xit: - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } /* General helpful functions. */ @@ -621,7 +614,7 @@ while (ads->udpw.head) adns__query_fail(ads->udpw.head, adns_s_systemfail); while (ads->tcpw.head) adns__query_fail(ads->tcpw.head, adns_s_systemfail); - + switch (ads->tcpstate) { case server_connecting: case server_ok: @@ -633,7 +626,7 @@ default: abort(); } - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } int adns_processany(adns_state ads) { @@ -649,7 +642,7 @@ /* We just use adns__fdevents to loop over the fd's trying them. * This seems more sensible than calling select, since we're most - * likely just to want to do a adns_socket_read on one or two fds anyway. + * likely just to want to do a read on one or two fds anyway. */ npollfds= adns__pollfds(ads,pollfds); for (i=0; iiflags & adns_if_eintr) { r= EINTR; break; } @@ -724,7 +715,7 @@ adns_afterselect(ads,maxfd,&readfds,&writefds,&exceptfds,0); } } - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } @@ -734,12 +725,12 @@ void **context_r) { struct timeval now; int r; - + adns__consistency(ads,*query_io,cc_entex); r= gettimeofday(&now,0); if (!r) adns__autosys(ads,now); r= adns__internal_check(ads,query_io,answer_r,context_r); - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } Index: sdk/lib/3rdparty/adns/src/general.c =================================================================== --- sdk/lib/3rdparty/adns/src/general.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/general.c (working copy) @@ -4,26 +4,25 @@ * - vbuf handling */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #include @@ -42,22 +41,35 @@ /* Core diagnostic functions */ +void adns__vlprintf(adns_state ads, const char *fmt, va_list al) { + ads->logfn(ads,ads->logfndata,fmt,al); +} + +void adns__lprintf(adns_state ads, const char *fmt, ...) { + va_list al; + va_start(al,fmt); + adns__vlprintf(ads,fmt,al); + va_end(al); +} + void adns__vdiag(adns_state ads, const char *pfx, adns_initflags prevent, int serv, adns_query qu, const char *fmt, va_list al) { + char buf[ADNS_ADDR2TEXT_BUFLEN]; const char *bef, *aft; vbuf vb; - - if (!ads->diagfile || - (!(ads->iflags & adns_if_debug) && (!prevent || (ads->iflags & prevent)))) + + if (!ads->logfn || + (!(ads->iflags & adns_if_debug) + && (!prevent || (ads->iflags & prevent)))) return; if (ads->iflags & adns_if_logpid) { - fprintf(ads->diagfile,"adns%s [%ld]: ",pfx,(long)getpid()); + adns__lprintf(ads,"adns%s [%ld]: ",pfx,(long)getpid()); } else { - fprintf(ads->diagfile,"adns%s: ",pfx); + adns__lprintf(ads,"adns%s: ",pfx); } - vfprintf(ads->diagfile,fmt,al); + adns__vlprintf(ads,fmt,al); bef= " ("; aft= "\n"; @@ -64,26 +76,28 @@ if (qu && qu->query_dgram) { adns__vbuf_init(&vb); - fprintf(ads->diagfile,"%sQNAME=%s, QTYPE=%s", + adns__lprintf(ads,"%sQNAME=%s, QTYPE=%s", bef, adns__diag_domain(qu->ads,-1,0, &vb, qu->query_dgram,qu->query_dglen,DNS_HDRSIZE), qu->typei ? qu->typei->rrtname : ""); if (qu->typei && qu->typei->fmtname) - fprintf(ads->diagfile,"(%s)",qu->typei->fmtname); + adns__lprintf(ads,"(%s)",qu->typei->fmtname); bef=", "; aft=")\n"; adns__vbuf_free(&vb); } - + if (serv>=0) { - fprintf(ads->diagfile,"%sNS=%s",bef,inet_ntoa(ads->servers[serv].addr)); + adns__lprintf(ads,"%sNS=%s",bef, + adns__sockaddr_ntoa(&ads->servers[serv].addr.sa, buf)); bef=", "; aft=")\n"; } - fputs(aft,ads->diagfile); + adns__lprintf(ads,"%s",aft); } -void adns__debug(adns_state ads, int serv, adns_query qu, const char *fmt, ...) { +void adns__debug(adns_state ads, int serv, adns_query qu, + const char *fmt, ...) { va_list al; va_start(al,fmt); @@ -91,15 +105,18 @@ va_end(al); } -void adns__warn(adns_state ads, int serv, adns_query qu, const char *fmt, ...) { +void adns__warn(adns_state ads, int serv, adns_query qu, + const char *fmt, ...) { va_list al; va_start(al,fmt); - adns__vdiag(ads," warning",adns_if_noerrprint|adns_if_noserverwarn,serv,qu,fmt,al); + adns__vdiag(ads," warning", + adns_if_noerrprint|adns_if_noserverwarn, serv,qu,fmt,al); va_end(al); } -void adns__diag(adns_state ads, int serv, adns_query qu, const char *fmt, ...) { +void adns__diag(adns_state ads, int serv, adns_query qu, + const char *fmt, ...) { va_list al; va_start(al,fmt); @@ -115,16 +132,16 @@ int adns__vbuf_ensure(vbuf *vb, int want) { void *nb; - + if (vb->avail >= want) return 1; - nb= realloc(vb->buf, (size_t) want); if (!nb) return 0; + nb= realloc(vb->buf,want); if (!nb) return 0; vb->buf= nb; vb->avail= want; return 1; } - + void adns__vbuf_appendq(vbuf *vb, const byte *data, int len) { - memcpy(vb->buf+vb->used,data, (size_t) len); + memcpy(vb->buf+vb->used,data,len); vb->used+= len; } @@ -136,8 +153,8 @@ if (vb->avail < newlen) { if (newlen<20) newlen= 20; newlen <<= 1; - nb= realloc(vb->buf,(size_t) newlen); - if (!nb) { newlen= vb->used+len; nb= realloc(vb->buf, (size_t) newlen); } + nb= realloc(vb->buf,newlen); + if (!nb) { newlen= vb->used+len; nb= realloc(vb->buf,newlen); } if (!nb) return 0; vb->buf= nb; vb->avail= newlen; @@ -149,7 +166,7 @@ int adns__vbuf_appendstr(vbuf *vb, const char *data) { int l; l= strlen(data); - return adns__vbuf_append(vb,(byte*)data,l); + return adns__vbuf_append(vb,data,l); } void adns__vbuf_free(vbuf *vb) { @@ -160,10 +177,12 @@ /* Additional diagnostic functions */ const char *adns__diag_domain(adns_state ads, int serv, adns_query qu, - vbuf *vb, const byte *dgram, int dglen, int cbyte) { + vbuf *vb, const byte *dgram, + int dglen, int cbyte) { adns_status st; - st= adns__parse_domain(ads,serv,qu,vb, pdf_quoteok, dgram,dglen,&cbyte,dglen); + st= adns__parse_domain(ads,serv,qu,vb, pdf_quoteok, + dgram,dglen,&cbyte,dglen); if (st == adns_s_nomemory) { return ""; } @@ -172,17 +191,20 @@ if (!(adns__vbuf_appendstr(vb,"") && - adns__vbuf_append(vb,(byte*)"",1))) { + adns__vbuf_append(vb,"",1))) { return ""; } } if (!vb->used) { adns__vbuf_appendstr(vb,""); - adns__vbuf_append(vb,(byte*)"",1); + adns__vbuf_append(vb,"",1); } - return (char*)vb->buf; + return vb->buf; } +int adns__getrrsz_default(const typeinfo *typei, adns_rrtype type) + { return typei->fixed_rrsz; } + adns_status adns_rr_info(adns_rrtype type, const char **rrtname_r, const char **fmtname_r, int *len_r, @@ -196,17 +218,17 @@ if (rrtname_r) *rrtname_r= typei->rrtname; if (fmtname_r) *fmtname_r= typei->fmtname; - if (len_r) *len_r= typei->rrsz; + if (len_r) *len_r= typei->getrrsz(typei, type); if (!datap) return adns_s_ok; - + adns__vbuf_init(&vb); st= typei->convstring(&vb,datap); if (st) goto x_freevb; - if (!adns__vbuf_append(&vb,(byte*)"",1)) { st= adns_s_nomemory; goto x_freevb; } - assert((int)strlen((char*)vb.buf) == vb.used-1); - *data_r= realloc(vb.buf, (size_t) vb.used); - if (!*data_r) *data_r= (char*)vb.buf; + if (!adns__vbuf_append(&vb,"",1)) { st= adns_s_nomemory; goto x_freevb; } + assert(strlen(vb.buf) == vb.used-1); + *data_r= realloc(vb.buf,vb.used); + if (!*data_r) *data_r= vb.buf; return adns_s_ok; x_freevb: @@ -222,36 +244,36 @@ const char *abbrev; const char *string; } sinfos[]= { - SINFO( ok, "OK" ), - - SINFO( nomemory, "Out of memory" ), - SINFO( unknownrrtype, "Query not implemented in DNS library" ), - SINFO( systemfail, "General resolver or system failure" ), - - SINFO( timeout, "DNS query timed out" ), - SINFO( allservfail, "All nameservers failed" ), - SINFO( norecurse, "Recursion denied by nameserver" ), - SINFO( invalidresponse, "Nameserver sent bad response" ), - SINFO( unknownformat, "Nameserver used unknown format" ), - - SINFO( rcodeservfail, "Nameserver reports failure" ), - SINFO( rcodeformaterror, "Query not understood by nameserver" ), - SINFO( rcodenotimplemented, "Query not implemented by nameserver" ), - SINFO( rcoderefused, "Query refused by nameserver" ), - SINFO( rcodeunknown, "Nameserver sent unknown response code" ), - - SINFO( inconsistent, "Inconsistent resource records in DNS" ), - SINFO( prohibitedcname, "DNS alias found where canonical name wanted" ), - SINFO( answerdomaininvalid, "Found syntactically invalid domain name" ), - SINFO( answerdomaintoolong, "Found overly-long domain name" ), - SINFO( invaliddata, "Found invalid DNS data" ), - - SINFO( querydomainwrong, "Domain invalid for particular DNS query type" ), - SINFO( querydomaininvalid, "Domain name is syntactically invalid" ), - SINFO( querydomaintoolong, "Domain name or component is too long" ), - - SINFO( nxdomain, "No such domain" ), - SINFO( nodata, "No such data" ) + SINFO( ok, "OK" ), + + SINFO( nomemory, "Out of memory" ), + SINFO( unknownrrtype, "Query not implemented in DNS library" ), + SINFO( systemfail, "General resolver or system failure" ), + + SINFO( timeout, "DNS query timed out" ), + SINFO( allservfail, "All nameservers failed" ), + SINFO( norecurse, "Recursion denied by nameserver" ), + SINFO( invalidresponse, "Nameserver sent bad response" ), + SINFO( unknownformat, "Nameserver used unknown format" ), + + SINFO( rcodeservfail, "Nameserver reports failure" ), + SINFO( rcodeformaterror, "Query not understood by nameserver" ), + SINFO( rcodenotimplemented, "Query not implemented by nameserver" ), + SINFO( rcoderefused, "Query refused by nameserver" ), + SINFO( rcodeunknown, "Nameserver sent unknown response code" ), + + SINFO( inconsistent, "Inconsistent resource records in DNS" ), + SINFO( prohibitedcname, "DNS alias found where canonical name wanted" ), + SINFO( answerdomaininvalid, "Found syntactically invalid domain name" ), + SINFO( answerdomaintoolong, "Found overly-long domain name" ), + SINFO( invaliddata, "Found invalid DNS data" ), + + SINFO( querydomainwrong, "Domain invalid for particular DNS query type" ), + SINFO( querydomaininvalid, "Domain name is syntactically invalid" ), + SINFO( querydomaintoolong, "Domain name or component is too long" ), + + SINFO( nxdomain, "No such domain" ), + SINFO( nodata, "No such data" ) }; static int si_compar(const void *key, const void *elem) { @@ -262,7 +284,8 @@ } static const struct sinfo *findsinfo(adns_status st) { - return bsearch(&st,sinfos,sizeof(sinfos)/sizeof(*sinfos),sizeof(*sinfos),si_compar); + return bsearch(&st,sinfos, sizeof(sinfos)/sizeof(*sinfos), + sizeof(*sinfos), si_compar); } const char *adns_strerror(adns_status st) { @@ -304,7 +327,7 @@ here= *st; min= (sti==stinfos) ? 0 : sti[-1].stmax+1; max= sti->stmax; - + return here < min ? -1 : here > max ? 1 : 0; } @@ -311,7 +334,8 @@ const char *adns_errtypeabbrev(adns_status st) { const struct stinfo *sti; - sti= bsearch(&st,stinfos,sizeof(stinfos)/sizeof(*stinfos),sizeof(*stinfos),sti_compar); + sti= bsearch(&st,stinfos, sizeof(stinfos)/sizeof(*stinfos), + sizeof(*stinfos), sti_compar); return sti->abbrev; } @@ -327,9 +351,9 @@ place>0 && needswap(context, data + (place-1)*sz, data + i*sz); place--); if (place != i) { - memcpy(tempbuf, data + i*sz, (size_t) sz); - memmove(data + (place+1)*sz, data + place*sz, (size_t) (i-place)*sz); - memcpy(data + place*sz, tempbuf, (size_t) sz); + memcpy(tempbuf, data + i*sz, sz); + memmove(data + (place+1)*sz, data + place*sz, (i-place)*sz); + memcpy(data + place*sz, tempbuf, sz); } } } @@ -351,7 +375,7 @@ sa.sa_handler= SIG_IGN; sigfillset(&sa.sa_mask); sa.sa_flags= 0; - + r= sigprocmask(SIG_SETMASK,&toblock,&ads->stdsigmask); assert(!r); r= sigaction(SIGPIPE,&sa,&ads->stdsigpipe); assert(!r); #endif Index: sdk/lib/3rdparty/adns/src/internal.h =================================================================== --- sdk/lib/3rdparty/adns/src/internal.h (revision 72742) +++ sdk/lib/3rdparty/adns/src/internal.h (working copy) @@ -5,16 +5,16 @@ * - comments regarding library data structures */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -23,8 +23,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifndef ADNS_INTERNAL_H_INCLUDED @@ -36,7 +35,6 @@ typedef unsigned char byte; #endif - #include #include @@ -46,11 +44,14 @@ #include #include #include +#include #ifndef ADNS_JGAA_WIN32 +# include # include #endif +#define ADNS_FEATURE_MANYAF #include "adns.h" #include "dlist.h" @@ -77,10 +78,29 @@ #define DNS_IDOFFSET 0 #define DNS_CLASS_IN 1 -#define DNS_INADDR_ARPA "in-addr", "arpa" - #define MAX_POLLFDS ADNS_POLLFDS_RECOMMENDED +/* Some preprocessor hackery */ + +#define GLUE(x, y) GLUE_(x, y) +#define GLUE_(x, y) x##y + +/* C99 macro `...' must match at least one argument, so the naive definition + * `#define CAR(car, ...) car' won't work. But it's easy to arrange for the + * tail to be nonempty if we're just going to discard it anyway. */ +#define CAR(...) CAR_(__VA_ARGS__, _) +#define CAR_(car, ...) car + +/* Extracting the tail of an argument list is rather more difficult. The + * following trick is based on one by Laurent Deniau to count the number of + * arguments to a macro, simplified in two ways: (a) it only handles up to + * eight arguments, and (b) it only needs to distinguish the one-argument + * case from many arguments. */ +#define CDR(...) CDR_(__VA_ARGS__, m, m, m, m, m, m, m, 1, _)(__VA_ARGS__) +#define CDR_(_1, _2, _3, _4, _5, _6, _7, _8, n, ...) CDR_##n +#define CDR_1(_) +#define CDR_m(_, ...) __VA_ARGS__ + typedef enum { cc_user, cc_entex, @@ -96,17 +116,13 @@ rcode_refused } dns_rcode; +enum { + adns__qf_addr_answer= 0x01000000,/* addr query received an answer */ + adns__qf_addr_cname = 0x02000000 /* addr subquery performed on cname */ +}; + /* Shared data structures */ -typedef union { - adns_status status; - char *cp; - adns_rrtype type; - int i; - struct in_addr ia; - unsigned long ul; -} rr_align; - typedef struct { int used, avail; byte *buf; @@ -121,11 +137,41 @@ struct timeval now; } parseinfo; +#define MAXREVLABELS 34 /* keep in sync with addrfam! */ +struct revparse_state { + uint16_t labstart[MAXREVLABELS]; + uint8_t lablen[MAXREVLABELS]; +}; + +union checklabel_state { + struct revparse_state ptr; +}; + typedef struct { - adns_rrtype type; + void *ext; + void (*callback)(adns_query parent, adns_query child); + + union { + struct { + adns_rrtype rev_rrtype; + adns_sockaddr addr; + } ptr; + struct { + unsigned want, have; + } addr; + } tinfo; /* type-specific state for the query itself: zero-init if you + * don't know better. */ + + union { + adns_rr_hostaddr *hostaddr; + } pinfo; /* state for use by parent's callback function */ +} qcontext; + +typedef struct typeinfo { + adns_rrtype typekey; const char *rrtname; const char *fmtname; - int rrsz; + int fixed_rrsz; void (*makefinal)(adns_query qu, void *data); /* Change memory management of *data. @@ -138,11 +184,12 @@ * and will not be null-terminated by convstring. */ - adns_status (*parse)(const parseinfo *pai, int cbyte, int max, void *store_r); + adns_status (*parse)(const parseinfo *pai, int cbyte, + int max, void *store_r); /* Parse one RR, in dgram of length dglen, starting at cbyte and * extending until at most max. * - * The RR should be stored at *store_r, of length qu->typei->rrsz. + * The RR should be stored at *store_r, of length qu->typei->getrrsz(). * * If there is an overrun which might indicate truncation, it should set * *rdstart to -1; otherwise it may set it to anything else positive. @@ -150,14 +197,54 @@ * nsstart is the offset of the authority section. */ - int (*diff_needswap)(adns_state ads, const void *datap_a, const void *datap_b); + int (*diff_needswap)(adns_state ads,const void *datap_a,const void *datap_b); /* Returns !0 if RR a should be strictly after RR b in the sort order, * 0 otherwise. Must not fail. */ + + adns_status (*checklabel)(adns_state ads, adns_queryflags flags, + union checklabel_state *cls, qcontext *ctx, + int labnum, const char *dgram, + int labstart, int lablen); + /* Check a label from the query domain string. The label is not + * necessarily null-terminated. The hook can refuse the query's submission + * by returning a nonzero status. State can be stored in *cls between + * calls, and useful information can be stashed in ctx->tinfo, to be stored + * with the query (e.g., it will be available to the parse hook). This + * hook can detect a first call because labnum is zero, and a final call + * because lablen is zero. + */ + + void (*postsort)(adns_state ads, void *array, int nrrs, int rrsz, + const struct typeinfo *typei); + /* Called immediately after the RRs have been sorted, and may rearrange + * them. (This is really for the benefit of SRV's bizarre weighting + * stuff.) May be 0 to mean nothing needs to be done. + */ + + int (*getrrsz)(const struct typeinfo *typei, adns_rrtype type); + /* Return the output resource-record element size; if this is null, then + * the rrsz member can be used. + */ + + void (*query_send)(adns_query qu, struct timeval now); + /* Send the query to nameservers, and hook it into the appropriate queue. + * Normal behaviour is to call adns__query_send, but this can be overridden + * for special effects. + */ } typeinfo; +adns_status adns__ckl_hostname(adns_state ads, adns_queryflags flags, + union checklabel_state *cls, + qcontext *ctx, int labnum, + const char *dgram, int labstart, int lablen); + /* implemented in query.c, used by types.c as default + * and as part of implementation for some fancier types + * doesn't require any state */ + typedef struct allocnode { struct allocnode *next, *back; + size_t sz; } allocnode; union maxalign { @@ -167,17 +254,8 @@ void *p; void (*fp)(void); union maxalign *up; -}; +} data; -typedef struct { - void *ext; - void (*callback)(adns_query parent, adns_query child); - union { - adns_rr_addr ptr_parent_addr; - adns_rr_hostaddr *hostaddr; - } info; -} qcontext; - struct adns__query { adns_state ads; enum { query_tosend, query_tcpw, query_childw, query_done } state; @@ -250,6 +328,10 @@ * Queries in state tcpw/tcpw have been sent (or are in the to-send buffer) * iff the tcp connection is in state server_ok. * + * Internal queries (from adns__submit_internal) end up on intdone + * instead of output, and the callbacks are made on the way out of + * adns, to avoid reentrancy hazards. + * * +------------------------+ * START -----> | tosend/NONE | * +------------------------+ @@ -288,14 +370,18 @@ struct query_queue { adns_query head, tail; }; +#define MAXUDP 2 + struct adns__state { adns_initflags iflags; - FILE *diagfile; + adns_logcallbackfn *logfn; + void *logfndata; int configerrno; - struct query_queue udpw, tcpw, childw, output; + struct query_queue udpw, tcpw, childw, output, intdone; adns_query forallnext; - int nextid; - ADNS_SOCKET udpsocket, tcpsocket; + int nextid, tcpsocket; + struct udpsocket { int af; int fd; } udpsockets[MAXUDP]; + int nudpsockets; vbuf tcpsend, tcprecv; int nservers, nsortlist, nsearchlist, searchndots, tcpserver, tcprecv_skip; enum adns__tcpstate { @@ -313,21 +399,120 @@ sigset_t stdsigmask; #endif struct pollfd pollfds_buf[MAX_POLLFDS]; - struct server { - struct in_addr addr; - } servers[MAXSERVERS]; + adns_rr_addr servers[MAXSERVERS]; struct sortlist { - struct in_addr base, mask; + adns_sockaddr base, mask; } sortlist[MAXSORTLIST]; char **searchlist; + unsigned config_report_unknown:1; + unsigned short rand48xsubi[3]; }; +/* From addrfam.c: */ + +extern int adns__addrs_equal_raw(const struct sockaddr *a, + int bf, const void *b); +/* Returns nonzero a's family is bf and a's protocol address field + * refers to the same protocol address as that stored at ba. + */ + +extern int adns__addrs_equal(const adns_sockaddr *a, + const adns_sockaddr *b); +/* Returns nonzero if the two refer to the same protocol address + * (disregarding port, IPv6 scope, etc). + */ + +extern int adns__sockaddrs_equal(const struct sockaddr *sa, + const struct sockaddr *sb); +/* Return nonzero if the two socket addresses are equal (in all significant + * respects). + */ + +extern int adns__addr_width(int af); +/* Return the width of addresses of family af, in bits. */ + +extern void adns__prefix_mask(adns_sockaddr *sa, int len); +/* Stores in sa's protocol address field an address mask for address + * family af, whose first len bits are set and the remainder are + * clear. On entry, sa's af field must be set. This is what you want + * for converting a prefix length into a netmask. + */ + +extern int adns__guess_prefix_length(const adns_sockaddr *addr); +/* Given a network base address, guess the appropriate prefix length based on + * the appropriate rules for the address family (e.g., for IPv4, this uses + * the old address classes). + */ + +extern int adns__addr_matches(int af, const void *addr, + const adns_sockaddr *base, + const adns_sockaddr *mask); +/* Return nonzero if the protocol address specified by af and addr + * lies within the network specified by base and mask. + */ + +extern void adns__addr_inject(const void *a, adns_sockaddr *sa); +/* Injects the protocol address *a into the socket adress sa. Assumes + * that sa->sa_family is already set correctly. + */ + +extern const void *adns__sockaddr_addr(const struct sockaddr *sa); +/* Returns the address of the protocol address field in sa. + */ + +char *adns__sockaddr_ntoa(const struct sockaddr *sa, char *buf); +/* Converts sa to a string, and writes it to buf, which must be at + * least ADNS_ADDR2TEXT_BUFLEN bytes long (unchecked). Returns buf; + * can't fail. + */ + +extern int adns__make_reverse_domain(const struct sockaddr *sa, + const char *zone, + char **buf_io, size_t bufsz, + char **buf_free_r); +/* Construct a reverse domain string, given a socket address and a parent + * zone. If zone is null, then use the standard reverse-lookup zone for the + * address family. If the length of the resulting string is no larger than + * bufsz, then the result is stored starting at *buf_io; otherwise a new + * buffer is allocated is used, and a pointer to it is stored in both *buf_io + * and *buf_free_r (the latter of which should be null on entry). If + * something goes wrong, then an errno value is returned: ENOSYS if the + * address family of sa isn't recognized, or ENOMEM if the attempt to + * allocate an output buffer failed. + */ + +extern bool adns__revparse_label(struct revparse_state *rps, int labnum, + const char *dgram, + int labstart, int lablen); +/* Parse a label in a reverse-domain name, given its index labnum (starting + * from zero), a pointer to its contents (which need not be null-terminated), + * and its length. The state in *rps is initialized implicitly when labnum + * is zero. + * + * Returns 1 if the parse is proceeding successfully, 0 if the domain + * name is definitely invalid and the parse must be abandoned. + */ + +extern bool adns__revparse_done(struct revparse_state *rps, + const char *dgram, int nlabels, + adns_rrtype *rrtype_r, adns_sockaddr *addr_r); +/* Finishes parsing a reverse-domain name, given the total number of + * labels in the name. On success, fills in the af and protocol + * address in *addr_r, and the forward query type in *rrtype_r + * (because that turns out to be useful). Returns 1 if the parse + * was successful. + */ + /* From setup.c: */ -int adns__setnonblock(adns_state ads, ADNS_SOCKET fd); /* => errno value */ +int adns__setnonblock(adns_state ads, int fd); /* => errno value */ /* From general.c: */ +void adns__vlprintf(adns_state ads, const char *fmt, va_list al); +void adns__lprintf(adns_state ads, const char *fmt, + ...) PRINTFFORMAT(2,3); + void adns__vdiag(adns_state ads, const char *pfx, adns_initflags prevent, int serv, adns_query qu, const char *fmt, va_list al); @@ -339,7 +524,7 @@ const char *fmt, ...) PRINTFFORMAT(4,5); int adns__vbuf_ensure(vbuf *vb, int want); -int adns__vbuf_appendstr(vbuf *vb, const char *data); /* does not include nul */ +int adns__vbuf_appendstr(vbuf *vb, const char *data); /* doesn't include nul */ int adns__vbuf_append(vbuf *vb, const byte *data, int len); /* 1=>success, 0=>realloc failed */ void adns__vbuf_appendq(vbuf *vb, const byte *data, int len); @@ -347,7 +532,8 @@ void adns__vbuf_free(vbuf *vb); const char *adns__diag_domain(adns_state ads, int serv, adns_query qu, - vbuf *vb, const byte *dgram, int dglen, int cbyte); + vbuf *vb, + const byte *dgram, int dglen, int cbyte); /* Unpicks a domain in a datagram and returns a string suitable for * printing it as. Never fails - if an error occurs, it will * return some kind of string describing the error. @@ -359,6 +545,11 @@ * vb before using the return value. */ +int adns__getrrsz_default(const typeinfo *typei, adns_rrtype type); +/* Default function for the `getrrsz' type hook; returns the `fixed_rrsz' + * value from the typeinfo entry. + */ + void adns__isort(void *array, int nobjs, int sz, void *tempbuf, int (*needswap)(void *context, const void *a, const void *b), void *context); @@ -381,12 +572,14 @@ adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, const char *owner, int ol, - const typeinfo *typei, adns_queryflags flags); + const typeinfo *typei, adns_rrtype type, + adns_queryflags flags); /* Assembles a query packet in vb. A new id is allocated and returned. */ adns_status adns__mkquery_frdgram(adns_state ads, vbuf *vb, int *id_r, - const byte *qd_dgram, int qd_dglen, int qd_begin, + const byte *qd_dgram, int qd_dglen, + int qd_begin, adns_rrtype type, adns_queryflags flags); /* Same as adns__mkquery, but takes the owner domain from an existing datagram. * That domain must be correct and untruncated. @@ -398,11 +591,20 @@ * might be broken, but no reconnect will be attempted. */ +struct udpsocket *adns__udpsocket_by_af(adns_state ads, int af); +/* Find the UDP socket structure in ads which has the given address family. + * Return null if there isn't one. + * + * This is used during initialization, so ads is only partially filled in. + * The requirements are that nudp is set, and that udpsocket[i].af are + * defined for 0<=ivb). * - * *ctx is copied byte-for-byte into the query. + * *ctx is copied byte-for-byte into the query. Before doing this, its tinfo + * field may be modified by type hooks. * * When the child query is done, ctx->callback will be called. The * child will already have been taken off both the global list of @@ -472,7 +677,7 @@ * answer->cname and answer->owner are _preserved. */ -void adns__transfer_interim(adns_query from, adns_query to, void *block, size_t sz); +void adns__transfer_interim(adns_query from, adns_query to, void *block); /* Transfers an interim allocation from one query to another, so that * the `to' query will have room for the data when we get to makefinal * and so that the free will happen when the `to' query is freed @@ -486,6 +691,10 @@ * TTLs get inherited by their parents. */ +void adns__free_interim(adns_query qu, void *p); +/* Forget about a block allocated by adns__alloc_interim. + */ + void *adns__alloc_mine(adns_query qu, size_t sz); /* Like _interim, but does not record the length for later * copying into the answer. This just ensures that the memory @@ -507,9 +716,19 @@ * in a datagram and discover that we need to retry the query. */ +void adns__cancel(adns_query qu); void adns__query_done(adns_query qu); -void adns__query_fail(adns_query qu, adns_status stat); +void adns__query_fail(adns_query qu, adns_status st); +void adns__cancel_children(adns_query qu); +void adns__returning(adns_state ads, adns_query qu); +/* Must be called before returning from adns any time that we have + * progressed (including made, finished or destroyed) queries. + * + * Might reenter adns via internal query callbacks, so + * external-faciing functions which call adns__returning should + * normally be avoided in internal code. */ + /* From reply.c: */ void adns__procdgram(adns_state ads, const byte *dgram, int len, @@ -549,7 +768,8 @@ * serv may be -1, qu may be null - they are for error reporting. */ -adns_status adns__findlabel_next(findlabel_state *fls, int *lablen_r, int *labstart_r); +adns_status adns__findlabel_next(findlabel_state *fls, + int *lablen_r, int *labstart_r); /* Then, call this one repeatedly. * * It will return adns_s_ok if all is well, and tell you the length @@ -579,8 +799,9 @@ } parsedomain_flags; adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu, - vbuf *vb, adns_queryflags flags, - const byte *dgram, int dglen, int *cbyte_io, int max); + vbuf *vb, parsedomain_flags flags, + const byte *dgram, int dglen, int *cbyte_io, + int max); /* vb must already have been initialised; it will be reset if necessary. * If there is truncation, vb->used will be set to 0; otherwise * (if there is no error) vb will be null-terminated. @@ -590,7 +811,8 @@ */ adns_status adns__parse_domain_more(findlabel_state *fls, adns_state ads, - adns_query qu, vbuf *vb, parsedomain_flags flags, + adns_query qu, vbuf *vb, + parsedomain_flags flags, const byte *dgram); /* Like adns__parse_domain, but you pass it a pre-initialised findlabel_state, * for continuing an existing domain or some such of some kind. Also, unlike @@ -629,10 +851,11 @@ adns_status adns__findrr_anychk(adns_query qu, int serv, const byte *dgram, int dglen, int *cbyte_io, - int *type_r, int *class_r, unsigned long *ttl_r, + int *type_r, int *class_r, + unsigned long *ttl_r, int *rdlen_r, int *rdstart_r, - const byte *eo_dgram, int eo_dglen, int eo_cbyte, - int *eo_matched_r); + const byte *eo_dgram, int eo_dglen, + int eo_cbyte, int *eo_matched_r); /* Like adns__findrr_checked, except that the datagram and * owner to compare with can be specified explicitly. * @@ -647,12 +870,13 @@ * untruncated. */ -void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now); +void adns__update_expires(adns_query qu, unsigned long ttl, + struct timeval now); /* Updates the `expires' field in the query, so that it doesn't exceed * now + ttl. */ -int vbuf__append_quoted1035(vbuf *vb, const byte *buf, int len); +bool adns__labels_equal(const byte *a, int al, const byte *b, int bl); /* From event.c: */ @@ -669,6 +893,7 @@ void adns__must_gettimeofday(adns_state ads, const struct timeval **now_io, struct timeval *tv_buf); +/* Call with care - might reentrantly cause queries to be completed! */ int adns__pollfds(adns_state ads, struct pollfd pollfds_buf[MAX_POLLFDS]); void adns__fdevents(adns_state ads, @@ -694,12 +919,19 @@ /* Useful static inline functions: */ -static inline int ctype_whitespace(int c) { return c==' ' || c=='\n' || c=='\t'; } +static inline int ctype_whitespace(int c) { + return c==' ' || c=='\n' || c=='\t'; +} static inline int ctype_digit(int c) { return c>='0' && c<='9'; } static inline int ctype_alpha(int c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } -static inline int ctype_822special(int c) { return strchr("()<>@,;:\\\".[]",c) != 0; } +static inline int ctype_toupper(int c) { + return ctype_alpha(c) ? (c & ~32) : c; +} +static inline int ctype_822special(int c) { + return strchr("()<>@,;:\\\".[]",c) != 0; +} static inline int ctype_domainunquoted(int c) { return ctype_alpha(c) || ctype_digit(c) || (strchr("-_/+",c) != 0); } @@ -708,18 +940,18 @@ /* Useful macros */ -#define MEM_ROUND(sz) \ - (( ((sz)+sizeof(union maxalign)-1) / sizeof(union maxalign) ) \ +#define MEM_ROUND(sz) \ + (( ((sz)+sizeof(union maxalign)-1) / sizeof(union maxalign) ) \ * sizeof(union maxalign) ) #define GETIL_B(cb) (((dgram)[(cb)++]) & 0x0ff) #define GET_B(cb,tv) ((tv)= GETIL_B((cb))) -#define GET_W(cb,tv) ((tv)=0, (tv)|=(GETIL_B((cb))<<8), (tv)|=GETIL_B(cb), (tv)) -#define GET_L(cb,tv) ( (tv)=0, \ - (tv)|=(GETIL_B((cb))<<24), \ - (tv)|=(GETIL_B((cb))<<16), \ - (tv)|=(GETIL_B((cb))<<8), \ - (tv)|=GETIL_B(cb), \ +#define GET_W(cb,tv) ((tv)=0,(tv)|=(GETIL_B((cb))<<8), (tv)|=GETIL_B(cb), (tv)) +#define GET_L(cb,tv) ( (tv)=0, \ + (tv)|=(GETIL_B((cb))<<24), \ + (tv)|=(GETIL_B((cb))<<16), \ + (tv)|=(GETIL_B((cb))<<8), \ + (tv)|=GETIL_B(cb), \ (tv) ) #endif Index: sdk/lib/3rdparty/adns/src/Makefile.in =================================================================== --- sdk/lib/3rdparty/adns/src/Makefile.in (revision 72742) +++ sdk/lib/3rdparty/adns/src/Makefile.in (working copy) @@ -1,15 +1,15 @@ -# src/Makefile - library main Makefile +# src/Makefile[.in] - library main Makefile # -# This file is -# Copyright (C) 1997-1999 Ian Jackson -# -# It is part of adns, which is -# Copyright (C) 1997-2000 Ian Jackson -# Copyright (C) 1999-2000 Tony Finch +# This file is part of adns, which is +# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson +# Copyright (C) 2014 Mark Wooding +# Copyright (C) 1999-2000,2003,2006 Tony Finch +# Copyright (C) 1991 Massachusetts Institute of Technology +# (See the file INSTALL for full details.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -18,24 +18,26 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation. srcdir= @srcdir@ VPATH= @srcdir@ TARGETS= libadns.a -include $(srcdir)/../settings.make -include adns.make +include ../settings.make +include $(srcdir)/adns.make +DIRCFLAGS= -I. -I$(srcdir) + install: + mkdir -p $(libdir) $(includedir) set -xe; for f in $(TARGETS); \ - do $(INSTALL_DATA) $$f $(lib_dir)/$$f; done - $(INSTALL_DATA) $(srcdir)/../src/adns.h $(include_dir)/adns.h + do $(INSTALL_DATA) $$f $(libdir)/$$f; done + $(INSTALL_DATA) $(srcdir)/../src/adns.h $(includedir)/adns.h uninstall: - for f in $(TARGETS); do rm -f $(lib_dir)/$$f; done - rm -f $(include_dir)/adns.h + for f in $(TARGETS); do rm -f $(libdir)/$$f; done + rm -f $(includedir)/adns.h ALLOBJS= $(LIBOBJS) Index: sdk/lib/3rdparty/adns/src/parse.c =================================================================== --- sdk/lib/3rdparty/adns/src/parse.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/parse.c (working copy) @@ -3,38 +3,33 @@ * - parsing assistance functions (mainly for domains inside datagrams) */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -#endif - #include "internal.h" -int vbuf__append_quoted1035(vbuf *vb, const byte *buf, int len) { +static int vbuf_append_quoted1035(vbuf *vb, const byte *buf, int len) { char qbuf[10]; int i, ch; - + while (len) { qbuf[0]= 0; for (i=0; idgram; + dgram= fls->dgram; for (;;) { if (fls->cbyte >= fls->dglen) goto x_truncated; if (fls->cbyte >= fls->max) goto x_badresponse; @@ -109,23 +105,27 @@ *lablen_r= -1; return adns_s_ok; - x_badresponse: - adns__diag(fls->ads,fls->serv,fls->qu,"label in domain runs beyond end of domain"); + x_badresponse: + adns__diag(fls->ads,fls->serv,fls->qu, + "label in domain runs beyond end of domain"); return adns_s_invalidresponse; } adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu, - vbuf *vb, adns_queryflags flags, - const byte *dgram, int dglen, int *cbyte_io, int max) { + vbuf *vb, parsedomain_flags flags, + const byte *dgram, int dglen, int *cbyte_io, + int max) { findlabel_state fls; - - adns__findlabel_start(&fls,ads, serv,qu, dgram,dglen,max, *cbyte_io,cbyte_io); + + adns__findlabel_start(&fls,ads, serv,qu, dgram,dglen,max, + *cbyte_io,cbyte_io); vb->used= 0; return adns__parse_domain_more(&fls,ads,qu, vb,flags,dgram); } adns_status adns__parse_domain_more(findlabel_state *fls, adns_state ads, - adns_query qu, vbuf *vb, parsedomain_flags flags, + adns_query qu, vbuf *vb, + parsedomain_flags flags, const byte *dgram) { int lablen, labstart, i, ch, first; adns_status st; @@ -139,14 +139,15 @@ if (first) { first= 0; } else { - if (!adns__vbuf_append(vb,(byte*)".",1)) return adns_s_nomemory; + if (!adns__vbuf_append(vb,".",1)) return adns_s_nomemory; } if (flags & pdf_quoteok) { - if (!vbuf__append_quoted1035(vb,dgram+labstart,lablen)) + if (!vbuf_append_quoted1035(vb,dgram+labstart,lablen)) return adns_s_nomemory; } else { ch= dgram[labstart]; - if (!ctype_alpha(ch) && !ctype_digit(ch)) return adns_s_answerdomaininvalid; + if (!ctype_alpha(ch) && !ctype_digit(ch)) + return adns_s_answerdomaininvalid; for (i= labstart+1; i 0) { + int ac= ctype_toupper(*a++); + int bc= ctype_toupper(*b++); + if (ac != bc) return 0; + } + return 1; +} + adns_status adns__findrr_anychk(adns_query qu, int serv, const byte *dgram, int dglen, int *cbyte_io, - int *type_r, int *class_r, unsigned long *ttl_r, + int *type_r, int *class_r, + unsigned long *ttl_r, int *rdlen_r, int *rdstart_r, - const byte *eo_dgram, int eo_dglen, int eo_cbyte, - int *eo_matched_r) { - findlabel_state fls, eo_fls; + const byte *eo_dgram, int eo_dglen, + int eo_cbyte, int *eo_matched_r) { + findlabel_state fls, eo_fls_buf; + findlabel_state *eo_fls; /* 0 iff we know it's not matching eo_... */ int cbyte; - - int tmp, rdlen, mismatch; + + int tmp, rdlen; unsigned long ttl; - int lablen, labstart, ch; - int eo_lablen, eo_labstart, eo_ch; + int lablen, labstart; + int eo_lablen, eo_labstart; adns_status st; cbyte= *cbyte_io; @@ -179,31 +192,29 @@ adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte); if (eo_dgram) { - adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0); - mismatch= 0; + eo_fls= &eo_fls_buf; + adns__findlabel_start(eo_fls,qu->ads, -1,0, + eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0); } else { - mismatch= 1; + eo_fls= 0; } - + for (;;) { st= adns__findlabel_next(&fls,&lablen,&labstart); if (st) return st; if (lablen<0) goto x_truncated; - if (!mismatch) { - st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart); + if (eo_fls) { + st= adns__findlabel_next(eo_fls,&eo_lablen,&eo_labstart); assert(!st); assert(eo_lablen>=0); - if (lablen != eo_lablen) mismatch= 1; - while (!mismatch && eo_lablen-- > 0) { - ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32; - eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32; - if (ch != eo_ch) mismatch= 1; - } + if (!adns__labels_equal(dgram+labstart, lablen, + eo_dgram+eo_labstart, eo_lablen)) + eo_fls= 0; } if (!lablen) break; } - if (eo_matched_r) *eo_matched_r= !mismatch; - + if (eo_matched_r) *eo_matched_r= !!eo_fls; + if (cbyte+10>dglen) goto x_truncated; GET_W(cbyte,tmp); *type_r= tmp; GET_W(cbyte,tmp); *class_r= tmp; @@ -211,7 +222,7 @@ GET_L(cbyte,ttl); if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE; *ttl_r= ttl; - + GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen; if (rdstart_r) *rdstart_r= cbyte; cbyte+= rdlen; Index: sdk/lib/3rdparty/adns/src/poll.c =================================================================== --- sdk/lib/3rdparty/adns/src/poll.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/poll.c (working copy) @@ -3,26 +3,25 @@ * - wrappers for poll(2) */ /* - * This file is - * Copyright (C) 1997-1999 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #include @@ -32,8 +31,8 @@ #ifdef HAVE_POLL -int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, int *timeout_io, - const struct timeval *now) { +int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, + int *timeout_io, const struct timeval *now) { struct timeval tv_nowbuf, tv_tobuf, *tv_to; int space, found, timeout_ms, r; struct pollfd fds_tmp[MAX_POLLFDS]; @@ -65,7 +64,7 @@ } *timeout_io= timeout_ms; } - + space= *nfds_io; if (space >= MAX_POLLFDS) { found= adns__pollfds(ads,fds); @@ -78,7 +77,7 @@ } r= 0; xit: - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } @@ -92,7 +91,7 @@ adns__timeouts(ads, 1, 0,0, *now); adns__fdevents(ads, fds,nfds, 0,0,0,0, *now,0); } - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } int adns_wait_poll(adns_state ads, @@ -101,7 +100,7 @@ void **context_r) { int r, nfds, to; struct pollfd fds[MAX_POLLFDS]; - + adns__consistency(ads,0,cc_entex); for (;;) { @@ -124,7 +123,7 @@ } xit: - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } Index: sdk/lib/3rdparty/adns/src/query.c =================================================================== --- sdk/lib/3rdparty/adns/src/query.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/query.c (working copy) @@ -5,28 +5,28 @@ * - query submission and cancellation (user-visible and internal) */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ + #ifdef ADNS_JGAA_WIN32 # include "adns_win32.h" #else @@ -38,14 +38,16 @@ #include "internal.h" -static adns_query query_alloc(adns_state ads, const typeinfo *typei, +static adns_query query_alloc(adns_state ads, + const typeinfo *typei, adns_rrtype type, adns_queryflags flags, struct timeval now) { /* Allocate a virgin query and return it. */ adns_query qu; - + qu= malloc(sizeof(*qu)); if (!qu) return 0; - qu->answer= malloc(sizeof(*qu->answer)); if (!qu->answer) { free(qu); return 0; } - + qu->answer= malloc(sizeof(*qu->answer)); + if (!qu->answer) { free(qu); return 0; } + qu->ads= ads; qu->state= query_tosend; qu->back= qu->next= qu->parent= 0; @@ -79,11 +81,11 @@ qu->answer->status= adns_s_ok; qu->answer->cname= qu->answer->owner= 0; - qu->answer->type= typei->type; + qu->answer->type= type; qu->answer->expires= -1; qu->answer->nrrs= 0; qu->answer->rrs.untyped= 0; - qu->answer->rrsz= typei->rrsz; + qu->answer->rrsz= typei->getrrsz(typei,type); return qu; } @@ -98,30 +100,81 @@ qu->vb= *qumsg_vb; adns__vbuf_init(qumsg_vb); - qu->query_dgram= malloc( (size_t) qu->vb.used); + qu->query_dgram= malloc(qu->vb.used); if (!qu->query_dgram) { adns__query_fail(qu,adns_s_nomemory); return; } - + qu->id= id; qu->query_dglen= qu->vb.used; - memcpy(qu->query_dgram,qu->vb.buf,(size_t) qu->vb.used); + memcpy(qu->query_dgram,qu->vb.buf,qu->vb.used); - adns__query_send(qu,now); + typei->query_send(qu,now); } +adns_status adns__ckl_hostname(adns_state ads, adns_queryflags flags, + union checklabel_state *cls, + qcontext *ctx, int labnum, + const char *dgram, int labstart, int lablen) +{ + int i, c; + const char *label = dgram+labstart; + + if (flags & adns_qf_quoteok_query) return adns_s_ok; + for (i=0; i= 0); + st= typei->checklabel(ads,flags, &cls,ctx, + labnum++, dgram,labstart,lablen); + if (st) return st; + } while (lablen); + return adns_s_ok; +} + adns_status adns__internal_submit(adns_state ads, adns_query *query_r, - const typeinfo *typei, vbuf *qumsg_vb, int id, + adns_query parent, + const typeinfo *typei, adns_rrtype type, + vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now, - const qcontext *ctx) { + qcontext *ctx) { adns_query qu; + adns_status st; - qu= query_alloc(ads,typei,flags,now); - if (!qu) { adns__vbuf_free(qumsg_vb); return adns_s_nomemory; } + st= check_domain_name(ads, flags,ctx,typei, qumsg_vb->buf,qumsg_vb->used); + if (st) goto x_err; + qu= query_alloc(ads,typei,type,flags,now); + if (!qu) { st = adns_s_nomemory; goto x_err; } *query_r= qu; - memcpy(&qu->ctx,ctx,(size_t) sizeof(qu->ctx)); + qu->parent= parent; + LIST_LINK_TAIL_PART(parent->children,qu,siblings.); + memcpy(&qu->ctx,ctx,sizeof(qu->ctx)); query_submit(ads,qu, typei,qumsg_vb,id,flags,now); + + return adns_s_ok; - return adns_s_ok; +x_err: + adns__vbuf_free(qumsg_vb); + return st; } static void query_simple(adns_state ads, adns_query qu, @@ -130,19 +183,23 @@ struct timeval now) { vbuf vb_new; int id; - adns_status stat; + adns_status st; - stat= adns__mkquery(ads,&qu->vb,&id, owner,ol, typei,flags); - if (stat) { - if (stat == adns_s_querydomaintoolong && (flags & adns_qf_search)) { + st= adns__mkquery(ads,&qu->vb,&id, owner,ol, + typei,qu->answer->type, flags); + if (st) { + if (st == adns_s_querydomaintoolong && (flags & adns_qf_search)) { adns__search_next(ads,qu,now); return; } else { - adns__query_fail(qu,stat); + adns__query_fail(qu,st); return; } } + st= check_domain_name(ads, flags,&qu->ctx,typei, qu->vb.buf,qu->vb.used); + if (st) { adns__query_fail(qu,st); return; } + vb_new= qu->vb; adns__vbuf_init(&qu->vb); query_submit(ads,qu, typei,&vb_new,id, flags,now); @@ -150,8 +207,8 @@ void adns__search_next(adns_state ads, adns_query qu, struct timeval now) { const char *nextentry; - adns_status stat; - + adns_status st; + if (qu->search_doneabs<0) { nextentry= 0; qu->search_doneabs= 1; @@ -158,8 +215,8 @@ } else { if (qu->search_pos >= ads->nsearchlist) { if (qu->search_doneabs) { - stat= adns_s_nxdomain; goto x_fail; - return; + qu->search_vb.used= qu->search_origlen; + st= adns_s_nxdomain; goto x_fail; } else { nextentry= 0; qu->search_doneabs= 1; @@ -171,20 +228,22 @@ qu->search_vb.used= qu->search_origlen; if (nextentry) { - if (!adns__vbuf_append(&qu->search_vb,(byte*)".",1) || - !adns__vbuf_appendstr(&qu->search_vb,nextentry)) { - stat= adns_s_nomemory; goto x_fail; - } + if (!adns__vbuf_append(&qu->search_vb,".",1) || + !adns__vbuf_appendstr(&qu->search_vb,nextentry)) + goto x_nomemory; } free(qu->query_dgram); qu->query_dgram= 0; qu->query_dglen= 0; - query_simple(ads,qu, (char*)qu->search_vb.buf, qu->search_vb.used, qu->typei, qu->flags, now); + query_simple(ads,qu, qu->search_vb.buf, qu->search_vb.used, + qu->typei, qu->flags, now); return; +x_nomemory: + st= adns_s_nomemory; x_fail: - adns__query_fail(qu,stat); + adns__query_fail(qu,st); } static int save_owner(adns_query qu, const char *owner, int ol) { @@ -191,12 +250,14 @@ /* Returns 1 if OK, otherwise there was no memory. */ adns_answer *ans; + if (!(qu->flags & adns_qf_owner)) return 1; + ans= qu->answer; assert(!ans->owner); - ans->owner= adns__alloc_preserved(qu, (size_t) ol+1); if (!ans->owner) return 0; + ans->owner= adns__alloc_preserved(qu,ol+1); if (!ans->owner) return 0; - memcpy(ans->owner,owner, (size_t) ol); + memcpy(ans->owner,owner,ol); ans->owner[ol]= 0; return 1; } @@ -208,7 +269,7 @@ void *context, adns_query *query_r) { int r, ol, ndots; - adns_status stat; + adns_status st; const typeinfo *typei; struct timeval now; adns_query qu; @@ -216,22 +277,29 @@ adns__consistency(ads,0,cc_entex); + if (flags & ~(adns_queryflags)0x4009ffff) + /* 0x40080000 are reserved for `harmless' future expansion + * 0x00000020 used to be adns_qf_quoteok_cname, now the default; + * see also addrfam.c:textaddr_check_qf */ + return ENOSYS; + typei= adns__findtype(type); if (!typei) return ENOSYS; r= gettimeofday(&now,0); if (r) goto x_errno; - qu= query_alloc(ads,typei,flags,now); if (!qu) goto x_errno; - + qu= query_alloc(ads,typei,type,flags,now); if (!qu) goto x_errno; + qu->ctx.ext= context; qu->ctx.callback= 0; - memset(&qu->ctx.info,0,sizeof(qu->ctx.info)); + memset(&qu->ctx.pinfo,0,sizeof(qu->ctx.pinfo)); + memset(&qu->ctx.tinfo,0,sizeof(qu->ctx.tinfo)); *query_r= qu; ol= strlen(owner); - if (!ol) { stat= adns_s_querydomaininvalid; goto x_adnsfail; } - if (ol>DNS_MAXDOMAIN+1) { stat= adns_s_querydomaintoolong; goto x_adnsfail; } - + if (!ol) { st= adns_s_querydomaininvalid; goto x_adnsfail; } + if (ol>DNS_MAXDOMAIN+1) { st= adns_s_querydomaintoolong; goto x_adnsfail; } + if (ol>=1 && owner[ol-1]=='.' && (ol<2 || owner[ol-2]!='\\')) { flags &= ~adns_qf_search; qu->flags= flags; @@ -239,8 +307,8 @@ } if (flags & adns_qf_search) { - r= adns__vbuf_append(&qu->search_vb,(byte*)owner,ol); - if (!r) { stat= adns_s_nomemory; goto x_adnsfail; } + r= adns__vbuf_append(&qu->search_vb,owner,ol); + if (!r) { st= adns_s_nomemory; goto x_adnsfail; } for (ndots=0, p=owner; (p= strchr(p,'.')); p++, ndots++); qu->search_doneabs= (ndots >= ads->searchndots) ? -1 : 0; @@ -248,23 +316,23 @@ adns__search_next(ads,qu,now); } else { if (flags & adns_qf_owner) { - if (!save_owner(qu,owner,ol)) { stat= adns_s_nomemory; goto x_adnsfail; } + if (!save_owner(qu,owner,ol)) { st= adns_s_nomemory; goto x_adnsfail; } } query_simple(ads,qu, owner,ol, typei,flags, now); } adns__autosys(ads,now); - adns__consistency(ads,qu,cc_entex); + adns__returning(ads,qu); return 0; x_adnsfail: - adns__query_fail(qu,stat); - adns__consistency(ads,qu,cc_entex); + adns__query_fail(qu,st); + adns__returning(ads,qu); return 0; x_errno: r= errno; assert(r); - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } @@ -275,27 +343,15 @@ adns_queryflags flags, void *context, adns_query *query_r) { - const unsigned char *iaddr; - char *buf, *buf_free; + char *buf, *buf_free = 0; char shortbuf[100]; - int r, lreq; + int r; flags &= ~adns_qf_search; - if (addr->sa_family != AF_INET) return ENOSYS; - iaddr= (const unsigned char*) &(((const struct sockaddr_in*)addr) -> sin_addr); - - lreq= strlen(zone) + 4*4 + 1; - if (lreq > (int)sizeof(shortbuf)) { - buf= malloc( strlen(zone) + 4*4 + 1 ); - if (!buf) return errno; - buf_free= buf; - } else { - buf= shortbuf; - buf_free= 0; - } - sprintf(buf, "%d.%d.%d.%d.%s", iaddr[3], iaddr[2], iaddr[1], iaddr[0], zone); - + buf = shortbuf; + r= adns__make_reverse_domain(addr,zone, &buf,sizeof(shortbuf),&buf_free); + if (r) return r; r= adns_submit(ads,buf,type,flags,context,query_r); free(buf_free); return r; @@ -307,8 +363,10 @@ adns_queryflags flags, void *context, adns_query *query_r) { - if (type != adns_r_ptr && type != adns_r_ptr_raw) return EINVAL; - return adns_submit_reverse_any(ads,addr,"in-addr.arpa",type,flags,context,query_r); + if (((type^adns_r_ptr) & adns_rrt_reprmask) && + ((type^adns_r_ptr_raw) & adns_rrt_reprmask)) + return EINVAL; + return adns_submit_reverse_any(ads,addr,0,type,flags,context,query_r); } int adns_synchronous(adns_state ads, @@ -318,7 +376,7 @@ adns_answer **answer_r) { adns_query qu; int r; - + r= adns_submit(ads,owner,type,flags,0,&qu); if (r) return r; @@ -336,12 +394,13 @@ an= malloc(MEM_ROUND(MEM_ROUND(sizeof(*an)) + sz)); if (!an) return 0; LIST_LINK_TAIL(qu->allocations,an); + an->sz= sz; return (byte*)an + MEM_ROUND(sizeof(*an)); } void *adns__alloc_interim(adns_query qu, size_t sz) { void *rv; - + sz= MEM_ROUND(sz); rv= alloc_common(qu,sz); if (!rv) return 0; @@ -351,7 +410,7 @@ void *adns__alloc_preserved(adns_query qu, size_t sz) { void *rv; - + sz= MEM_ROUND(sz); rv= adns__alloc_interim(qu,sz); if (!rv) return 0; @@ -359,23 +418,43 @@ return rv; } +static allocnode *alloc__info(adns_query qu, void *p, size_t *sz_r) { + allocnode *an; + + if (!p || p == qu) { *sz_r= 0; return 0; } + an= (allocnode *)((byte *)p - MEM_ROUND(sizeof(allocnode))); + *sz_r= MEM_ROUND(an->sz); + return an; +} + +void adns__free_interim(adns_query qu, void *p) { + size_t sz; + allocnode *an= alloc__info(qu, p, &sz); + + if (!an) return; + assert(!qu->final_allocspace); + LIST_UNLINK(qu->allocations, an); + free(an); + qu->interim_allocd -= sz; + assert(!qu->interim_allocd >= 0); +} + void *adns__alloc_mine(adns_query qu, size_t sz) { return alloc_common(qu,MEM_ROUND(sz)); } -void adns__transfer_interim(adns_query from, adns_query to, void *block, size_t sz) { - allocnode *an; +void adns__transfer_interim(adns_query from, adns_query to, void *block) { + size_t sz; + allocnode *an= alloc__info(from, block, &sz); - if (!block) return; - an= (void*)((byte*)block - MEM_ROUND(sizeof(*an))); + if (!an) return; assert(!to->final_allocspace); assert(!from->final_allocspace); - + LIST_UNLINK(from->allocations,an); LIST_LINK_TAIL(to->allocations,an); - sz= MEM_ROUND(sz); from->interim_allocd -= sz; to->interim_allocd += sz; @@ -398,18 +477,18 @@ return rp; } -static void cancel_children(adns_query qu) { +void adns__cancel_children(adns_query qu) { adns_query cqu, ncqu; for (cqu= qu->children.head; cqu; cqu= ncqu) { ncqu= cqu->siblings.next; - adns_cancel(cqu); + adns__cancel(cqu); } } void adns__reset_preserved(adns_query qu) { assert(!qu->final_allocspace); - cancel_children(qu); + adns__cancel_children(qu); qu->answer->nrrs= 0; qu->answer->rrs.untyped= 0; qu->interim_allocd= qu->preserved_allocd; @@ -418,7 +497,7 @@ static void free_query_allocs(adns_query qu) { allocnode *an, *ann; - cancel_children(qu); + adns__cancel_children(qu); for (an= qu->allocations.head; an; an= ann) { ann= an->next; free(an); } LIST_INIT(qu->allocations); adns__vbuf_free(&qu->vb); @@ -427,11 +506,26 @@ qu->query_dgram= 0; } -void adns_cancel(adns_query qu) { +void adns__returning(adns_state ads, adns_query qu_for_caller) { + while (ads->intdone.head) { + adns_query iq= ads->intdone.head; + adns_query parent= iq->parent; + LIST_UNLINK_PART(parent->children,iq,siblings.); + LIST_UNLINK(iq->ads->childw,parent); + LIST_UNLINK(ads->intdone,iq); + iq->ctx.callback(parent,iq); + free_query_allocs(iq); + free(iq->answer); + free(iq); + } + adns__consistency(ads,qu_for_caller,cc_entex); +} + +void adns__cancel(adns_query qu) { adns_state ads; ads= qu->ads; - adns__consistency(ads,qu,cc_entex); + adns__consistency(ads,qu,cc_freq); if (qu->parent) LIST_UNLINK_PART(qu->parent->children,qu,siblings.); switch (qu->state) { case query_tosend: @@ -444,7 +538,10 @@ LIST_UNLINK(ads->childw,qu); break; case query_done: - LIST_UNLINK(ads->output,qu); + if (qu->parent) + LIST_UNLINK(ads->intdone,qu); + else + LIST_UNLINK(ads->output,qu); break; default: abort(); @@ -452,10 +549,20 @@ free_query_allocs(qu); free(qu->answer); free(qu); - adns__consistency(ads,0,cc_entex); } -void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now) { +void adns_cancel(adns_query qu) { + adns_state ads; + + assert(!qu->parent); + ads= qu->ads; + adns__consistency(ads,qu,cc_entex); + adns__cancel(qu); + adns__returning(ads,0); +} + +void adns__update_expires(adns_query qu, unsigned long ttl, + struct timeval now) { time_t max; assert(ttl <= MAXTTLBELIEVE); @@ -471,7 +578,8 @@ ans= qu->answer; if (qu->interim_allocd) { - ans= realloc(qu->answer, MEM_ROUND(MEM_ROUND(sizeof(*ans)) + qu->interim_allocd)); + ans= realloc(qu->answer, + MEM_ROUND(MEM_ROUND(sizeof(*ans)) + qu->interim_allocd)); if (!ans) goto x_nomem; qu->answer= ans; } @@ -479,17 +587,17 @@ qu->final_allocspace= (byte*)ans + MEM_ROUND(sizeof(*ans)); adns__makefinal_str(qu,&ans->cname); adns__makefinal_str(qu,&ans->owner); - + if (ans->nrrs) { - adns__makefinal_block(qu, &ans->rrs.untyped, (size_t) ans->nrrs*ans->rrsz); + adns__makefinal_block(qu, &ans->rrs.untyped, ans->nrrs*ans->rrsz); for (rrn=0; rrnnrrs; rrn++) qu->typei->makefinal(qu, ans->rrs.bytes + rrn*ans->rrsz); } - + free_query_allocs(qu); return; - + x_nomem: qu->preserved_allocd= 0; qu->answer->cname= 0; @@ -501,17 +609,16 @@ } void adns__query_done(adns_query qu) { + adns_state ads=qu->ads; adns_answer *ans; - adns_query parent; - cancel_children(qu); + adns__cancel_children(qu); qu->id= -1; ans= qu->answer; - if (qu->flags & adns_qf_owner && qu->flags & adns_qf_search && - ans->status != adns_s_nomemory) { - if (!save_owner(qu, (char*)qu->search_vb.buf, qu->search_vb.used)) { + if (qu->flags & adns_qf_search && ans->status != adns_s_nomemory) { + if (!save_owner(qu, qu->search_vb.buf, qu->search_vb.used)) { adns__query_fail(qu,adns_s_nomemory); return; } @@ -518,35 +625,34 @@ } if (ans->nrrs && qu->typei->diff_needswap) { - if (!adns__vbuf_ensure(&qu->vb,qu->typei->rrsz)) { + if (!adns__vbuf_ensure(&qu->vb,qu->answer->rrsz)) { adns__query_fail(qu,adns_s_nomemory); return; } adns__isort(ans->rrs.bytes, ans->nrrs, ans->rrsz, qu->vb.buf, - (int(*)(void*, const void*, const void*))qu->typei->diff_needswap, + (int(*)(void*, const void*, const void*)) + qu->typei->diff_needswap, qu->ads); } + if (ans->nrrs && qu->typei->postsort) { + qu->typei->postsort(qu->ads, ans->rrs.bytes, + ans->nrrs,ans->rrsz, qu->typei); + } ans->expires= qu->expires; - parent= qu->parent; - if (parent) { - LIST_UNLINK_PART(parent->children,qu,siblings.); - LIST_UNLINK(qu->ads->childw,parent); - qu->ctx.callback(parent,qu); - free_query_allocs(qu); - free(qu->answer); - free(qu); + qu->state= query_done; + if (qu->parent) { + LIST_LINK_TAIL(ads->intdone,qu); } else { makefinal_query(qu); LIST_LINK_TAIL(qu->ads->output,qu); - qu->state= query_done; } } -void adns__query_fail(adns_query qu, adns_status stat) { +void adns__query_fail(adns_query qu, adns_status st) { adns__reset_preserved(qu); - qu->answer->status= stat; + qu->answer->status= st; adns__query_done(qu); } @@ -557,9 +663,9 @@ before= *strp; if (!before) return; l= strlen(before)+1; - after= adns__alloc_final(qu, (size_t) l); - memcpy(after,before,(size_t) l); - *strp= after; + after= adns__alloc_final(qu,l); + memcpy(after,before,l); + *strp= after; } void adns__makefinal_block(adns_query qu, void **blpp, size_t sz) { @@ -568,6 +674,6 @@ before= *blpp; if (!before) return; after= adns__alloc_final(qu,sz); - memcpy(after,before, (size_t) sz); + memcpy(after,before,sz); *blpp= after; } Index: sdk/lib/3rdparty/adns/src/reply.c =================================================================== --- sdk/lib/3rdparty/adns/src/reply.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/reply.c (working copy) @@ -3,36 +3,31 @@ * - main handling and parsing routine for received datagrams */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ -#ifdef ADNS_JGAA_WIN32 -# include "adns_win32.h" -#endif - #include #include "internal.h" - + void adns__procdgram(adns_state ads, const byte *dgram, int dglen, int serv, int viatcp, struct timeval now) { int cbyte, rrstart, wantedrrs, rri, foundsoa, foundns, cname_here; @@ -39,7 +34,7 @@ int id, f1, f2, qdcount, ancount, nscount, arcount; int flg_ra, flg_rd, flg_tc, flg_qr, opcode; int rrtype, rrclass, rdlength, rdstart; - int anstart, nsstart, arstart; + int anstart, nsstart; int ownermatched, l, nrrs; unsigned long ttl, soattl; const typeinfo *typei; @@ -49,9 +44,10 @@ vbuf tempvb; byte *newquery, *rrsdata; parseinfo pai; - + if (dglentcpw.head : ads->udpw.head; qu; qu= nqu) { @@ -92,7 +89,7 @@ if (dglen < qu->query_dglen) continue; if (memcmp(qu->query_dgram+DNS_HDRSIZE, dgram+DNS_HDRSIZE, - (size_t) qu->query_dglen-DNS_HDRSIZE)) + qu->query_dglen-DNS_HDRSIZE)) continue; if (viatcp) { assert(qu->state == query_tcpw); @@ -108,7 +105,7 @@ else LIST_UNLINK(ads->udpw,qu); } } - + /* If we're going to ignore the packet, we return as soon as we have * failed the query (if any) and printed the warning message (if * any). @@ -118,7 +115,8 @@ case rcode_nxdomain: break; case rcode_formaterror: - adns__warn(ads,serv,qu,"server cannot understand our query (Format Error)"); + adns__warn(ads,serv,qu,"server cannot understand our query" + " (Format Error)"); if (qu) adns__query_fail(qu,adns_s_rcodeformaterror); return; case rcode_servfail: @@ -143,21 +141,22 @@ if (!qdcount) { adns__diag(ads,serv,0,"server sent reply without quoting our question"); } else if (qdcount>1) { - adns__diag(ads,serv,0,"server claimed to answer %d questions with one message", - qdcount); + adns__diag(ads,serv,0,"server claimed to answer %d" + " questions with one message", qdcount); } else if (ads->iflags & adns_if_debug) { adns__vbuf_init(&tempvb); adns__debug(ads,serv,0,"reply not found, id %02x, query owner %s", - id, adns__diag_domain(ads,serv,0,&tempvb,dgram,dglen,DNS_HDRSIZE)); + id, adns__diag_domain(ads,serv,0,&tempvb, + dgram,dglen,DNS_HDRSIZE)); adns__vbuf_free(&tempvb); } return; } - /* We're definitely going to do something with this packet and this query now. */ - + /* We're definitely going to do something with this packet and this + * query now. */ + anstart= qu->query_dglen; - arstart= -1; /* Now, take a look at the answer section, and see if it is complete. * If it has any CNAMEs we stuff them in the answer. @@ -173,47 +172,54 @@ if (rrtype == -1) goto x_truncated; if (rrclass != DNS_CLASS_IN) { - adns__diag(ads,serv,qu,"ignoring answer RR with wrong class %d (expected IN=%d)", - rrclass,DNS_CLASS_IN); + adns__diag(ads,serv,qu,"ignoring answer RR with wrong class %d" + " (expected IN=%d)", rrclass,DNS_CLASS_IN); continue; } if (!ownermatched) { if (ads->iflags & adns_if_debug) { adns__debug(ads,serv,qu,"ignoring RR with an unexpected owner %s", - adns__diag_domain(ads,serv,qu, &qu->vb, dgram,dglen,rrstart)); + adns__diag_domain(ads,serv,qu, &qu->vb, + dgram,dglen,rrstart)); } continue; } if (rrtype == adns_r_cname && - (qu->typei->type & adns__rrt_typemask) != adns_r_cname) { + (qu->answer->type & adns_rrt_typemask) != adns_r_cname) { if (qu->flags & adns_qf_cname_forbid) { adns__query_fail(qu,adns_s_prohibitedcname); return; } else if (qu->cname_dgram) { /* Ignore second and subsequent CNAME(s) */ - adns__debug(ads,serv,qu,"allegedly canonical name %s is actually alias for %s", - qu->answer->cname, - adns__diag_domain(ads,serv,qu, &qu->vb, dgram,dglen,rdstart)); + adns__debug(ads,serv,qu,"allegedly canonical name %s" + " is actually alias for %s", qu->answer->cname, + adns__diag_domain(ads,serv,qu, &qu->vb, + dgram,dglen,rdstart)); adns__query_fail(qu,adns_s_prohibitedcname); return; } else if (wantedrrs) { /* Ignore CNAME(s) after RR(s). */ adns__debug(ads,serv,qu,"ignoring CNAME (to %s) coexisting with RR", - adns__diag_domain(ads,serv,qu, &qu->vb, dgram,dglen,rdstart)); + adns__diag_domain(ads,serv,qu, &qu->vb, + dgram,dglen,rdstart)); } else { qu->cname_begin= rdstart; qu->cname_dglen= dglen; st= adns__parse_domain(ads,serv,qu, &qu->vb, - qu->flags & adns_qf_quotefail_cname ? 0 : pdf_quoteok, + qu->flags & adns_qf_quotefail_cname + ? 0 : pdf_quoteok, dgram,dglen, &rdstart,rdstart+rdlength); if (!qu->vb.used) goto x_truncated; if (st) { adns__query_fail(qu,st); return; } - l= strlen((char*)qu->vb.buf)+1; - qu->answer->cname= adns__alloc_preserved(qu,(size_t) l); - if (!qu->answer->cname) { adns__query_fail(qu,adns_s_nomemory); return; } + l= strlen(qu->vb.buf)+1; + qu->answer->cname= adns__alloc_preserved(qu,l); + if (!qu->answer->cname) { + adns__query_fail(qu,adns_s_nomemory); + return; + } - qu->cname_dgram= adns__alloc_mine(qu, (size_t) dglen); - memcpy(qu->cname_dgram,dgram,(size_t) dglen); + qu->cname_dgram= adns__alloc_mine(qu,dglen); + memcpy(qu->cname_dgram,dgram,dglen); - memcpy(qu->answer->cname,qu->vb.buf, (size_t) l); + memcpy(qu->answer->cname,qu->vb.buf,l); cname_here= 1; adns__update_expires(qu,ttl,now); /* If we find the answer section truncated after this point we restart @@ -222,10 +228,11 @@ * it contains the relevant info. */ } - } else if (rrtype == ((INT)qu->typei->type & (INT)adns__rrt_typemask)) { + } else if (rrtype == (qu->answer->type & adns_rrt_typemask)) { wantedrrs++; } else { - adns__debug(ads,serv,qu,"ignoring answer RR with irrelevant type %d",rrtype); + adns__debug(ads,serv,qu,"ignoring answer RR" + " with irrelevant type %d",rrtype); } } @@ -233,13 +240,15 @@ * which we could use. */ if (flg_tc) goto x_truncated; - + nsstart= cbyte; if (!wantedrrs) { - /* Oops, NODATA or NXDOMAIN or perhaps a referral (which would be a problem) */ + /* Oops, NODATA or NXDOMAIN or perhaps a referral + * (which would be a problem) */ - /* RFC2308: NODATA has _either_ a SOA _or_ _no_ NS records in authority section */ + /* RFC2308: NODATA has _either_ a SOA _or_ _no_ NS records + * in authority section */ foundsoa= 0; soattl= 0; foundns= 0; for (rri= 0; rriflags & adns_qf_search) { + if (qu->flags & adns_qf_search && !qu->cname_dgram) { adns__search_next(ads,qu,now); } else { adns__query_fail(qu,adns_s_nxdomain); @@ -285,13 +294,16 @@ /* Bloody hell, I thought we asked for recursion ? */ if (!flg_ra) { - adns__diag(ads,serv,qu,"server is not willing to do recursive lookups for us"); + adns__diag(ads,serv,qu,"server is not willing" + " to do recursive lookups for us"); adns__query_fail(qu,adns_s_norecurse); } else { if (!flg_rd) - adns__diag(ads,serv,qu,"server thinks we didn't ask for recursive lookup"); + adns__diag(ads,serv,qu,"server thinks" + " we didn't ask for recursive lookup"); else - adns__debug(ads,serv,qu,"server claims to do recursion, but gave us a referral"); + adns__debug(ads,serv,qu,"server claims to do recursion," + " but gave us a referral"); adns__query_fail(qu,adns_s_invalidresponse); } return; @@ -299,8 +311,11 @@ /* Now, we have some RRs which we wanted. */ - qu->answer->rrs.untyped= adns__alloc_interim(qu,(size_t) qu->typei->rrsz*wantedrrs); - if (!qu->answer->rrs.untyped) { adns__query_fail(qu,adns_s_nomemory); return; } + qu->answer->rrs.untyped= adns__alloc_interim(qu,qu->answer->rrsz*wantedrrs); + if (!qu->answer->rrs.untyped) { + adns__query_fail(qu,adns_s_nomemory); + return; + } typei= qu->typei; cbyte= anstart; @@ -322,11 +337,12 @@ &ownermatched); assert(!st); assert(rrtype != -1); if (rrclass != DNS_CLASS_IN || - rrtype != ((INT)qu->typei->type & (INT)adns__rrt_typemask) || + rrtype != (qu->answer->type & adns_rrt_typemask) || !ownermatched) continue; adns__update_expires(qu,ttl,now); - st= typei->parse(&pai, rdstart,rdstart+rdlength, rrsdata+nrrs*typei->rrsz); + st= typei->parse(&pai, rdstart,rdstart+rdlength, + rrsdata+nrrs*qu->answer->rrsz); if (st) { adns__query_fail(qu,st); return; } if (rdstart==-1) goto x_truncated; nrrs++; @@ -344,7 +360,7 @@ return; x_truncated: - + if (!flg_tc) { adns__diag(ads,serv,qu,"server sent datagram which points outside itself"); adns__query_fail(qu,adns_s_invalidresponse); @@ -351,22 +367,22 @@ return; } qu->flags |= adns_qf_usevc; - + x_restartquery: if (qu->cname_dgram) { st= adns__mkquery_frdgram(qu->ads,&qu->vb,&qu->id, - qu->cname_dgram, qu->cname_dglen, qu->cname_begin, - qu->typei->type, qu->flags); + qu->cname_dgram,qu->cname_dglen,qu->cname_begin, + qu->answer->type, qu->flags); if (st) { adns__query_fail(qu,st); return; } - - newquery= realloc(qu->query_dgram, (size_t) qu->vb.used); + + newquery= realloc(qu->query_dgram,qu->vb.used); if (!newquery) { adns__query_fail(qu,adns_s_nomemory); return; } - + qu->query_dgram= newquery; qu->query_dglen= qu->vb.used; - memcpy(newquery,qu->vb.buf, (size_t) qu->vb.used); + memcpy(newquery,qu->vb.buf,qu->vb.used); } - + if (qu->state == query_tcpw) qu->state= query_tosend; qu->retries= 0; adns__reset_preserved(qu); Index: sdk/lib/3rdparty/adns/src/setup.c =================================================================== --- sdk/lib/3rdparty/adns/src/setup.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/setup.c (working copy) @@ -4,26 +4,25 @@ * - management of global state */ /* - * This file is - * Copyright (C) 1997-1999 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifdef ADNS_JGAA_WIN32 @@ -35,6 +34,7 @@ # include # include # include +# include # include # include # include @@ -45,24 +45,29 @@ static void readconfig(adns_state ads, const char *filename, int warnmissing); -static void addserver(adns_state ads, struct in_addr addr) { +static void addserver(adns_state ads, const struct sockaddr *sa, int salen) { int i; - struct server *ss; - + adns_rr_addr *ss; + char buf[ADNS_ADDR2TEXT_BUFLEN]; + for (i=0; inservers; i++) { - if (ads->servers[i].addr.s_addr == addr.s_addr) { - adns__debug(ads,-1,0,"duplicate nameserver %s ignored",inet_ntoa(addr)); + if (adns__sockaddrs_equal(sa, &ads->servers[i].addr.sa)) { + adns__debug(ads,-1,0,"duplicate nameserver %s ignored", + adns__sockaddr_ntoa(sa, buf)); return; } } - + if (ads->nservers>=MAXSERVERS) { - adns__diag(ads,-1,0,"too many nameservers, ignoring %s",inet_ntoa(addr)); + adns__diag(ads,-1,0,"too many nameservers, ignoring %s", + adns__sockaddr_ntoa(sa, buf)); return; } ss= ads->servers+ads->nservers; - ss->addr= addr; + assert(salen <= sizeof(ss->addr)); + ss->len = salen; + memcpy(&ss->addr, sa, salen); ads->nservers++; } @@ -80,14 +85,14 @@ va_list al; saveerr(ads,EINVAL); - if (!ads->diagfile || (ads->iflags & adns_if_noerrprint)) return; + if (!ads->logfn || (ads->iflags & adns_if_noerrprint)) return; - if (lno==-1) fprintf(ads->diagfile,"adns: %s: ",fn); - else fprintf(ads->diagfile,"adns: %s:%d: ",fn,lno); + if (lno==-1) adns__lprintf(ads,"adns: %s: ",fn); + else adns__lprintf(ads,"adns: %s:%d: ",fn,lno); va_start(al,fmt); - vfprintf(ads->diagfile,fmt,al); + adns__vlprintf(ads,fmt,al); va_end(al); - fputc('\n',ads->diagfile); + adns__lprintf(ads,"\n"); } static int nextword(const char **bufp_io, const char **word_r, int *l_r) { @@ -107,18 +112,32 @@ return 1; } -static void ccf_nameserver(adns_state ads, const char *fn, int lno, const char *buf) { - struct in_addr ia; +static void ccf_nameserver(adns_state ads, const char *fn, + int lno, const char *buf) { + adns_rr_addr a; + char addrbuf[ADNS_ADDR2TEXT_BUFLEN]; + int err; - if (!inet_aton(buf,&ia)) { + a.len= sizeof(a.addr); + err= adns_text2addr(buf,DNS_PORT, 0, &a.addr.sa,&a.len); + switch (err) { + case 0: + break; + case EINVAL: configparseerr(ads,fn,lno,"invalid nameserver address `%s'",buf); return; + default: + configparseerr(ads,fn,lno,"failed to parse nameserver address `%s': %s", + buf,strerror(err)); + return; } - adns__debug(ads,-1,0,"using nameserver %s",inet_ntoa(ia)); - addserver(ads,ia); + adns__debug(ads,-1,0,"using nameserver %s", + adns__sockaddr_ntoa(&a.addr.sa, addrbuf)); + addserver(ads,&a.addr.sa,a.len); } -static void ccf_search(adns_state ads, const char *fn, int lno, const char *buf) { +static void ccf_search(adns_state ads, const char *fn, + int lno, const char *buf) { const char *bufp, *word; char *newchars, **newptrs, **pp; int count, tl, l; @@ -130,9 +149,12 @@ tl= 0; while (nextword(&bufp,&word,&l)) { count++; tl += l+1; } - newptrs= malloc(sizeof(char*)*count); if (!newptrs) { saveerr(ads,errno); return; } - newchars= malloc(tl); if (!newchars) { saveerr(ads,errno); free(newptrs); return; } + newptrs= malloc(sizeof(char*)*count); + if (!newptrs) { saveerr(ads,errno); return; } + newchars= malloc(tl); + if (!newchars) { saveerr(ads,errno); free(newptrs); return; } + bufp= buf; pp= newptrs; while (nextword(&bufp,&word,&l)) { @@ -147,19 +169,34 @@ ads->searchlist= newptrs; } -static void ccf_sortlist(adns_state ads, const char *fn, int lno, const char *buf) { +static int gen_pton(const char *text, int want_af, adns_sockaddr *a) { + int err; + int len; + + len= sizeof(*a); + err= adns_text2addr(text,0, adns_qf_addrlit_scope_forbid, + &a->sa, &len); + if (err) { assert(err == EINVAL); return 0; } + if (want_af != AF_UNSPEC && a->sa.sa_family != want_af) return 0; + return 1; +} + +static void ccf_sortlist(adns_state ads, const char *fn, + int lno, const char *buf) { const char *word; char tbuf[200], *slash, *ep; - struct in_addr base, mask; + const char *maskwhat; + struct sortlist *sl; int l; - unsigned long initial, baselocal; + int initial= -1; if (!buf) return; - + ads->nsortlist= 0; while (nextword(&buf,&word,&l)) { if (ads->nsortlist >= MAXSORTLIST) { - adns__diag(ads,-1,0,"too many sortlist entries, ignoring %.*s onwards",l,word); + adns__diag(ads,-1,0,"too many sortlist entries," + " ignoring %.*s onwards",l,word); return; } @@ -167,59 +204,67 @@ configparseerr(ads,fn,lno,"sortlist entry `%.*s' too long",l,word); continue; } - + memcpy(tbuf,word,l); tbuf[l]= 0; slash= strchr(tbuf,'/'); if (slash) *slash++= 0; - if (!inet_aton(tbuf,&base)) { + sl= &ads->sortlist[ads->nsortlist]; + if (!gen_pton(tbuf, AF_UNSPEC, &sl->base)) { configparseerr(ads,fn,lno,"invalid address `%s' in sortlist",tbuf); continue; } if (slash) { - if (strchr(slash,'.')) { - if (!inet_aton(slash,&mask)) { + if (slash[strspn(slash, "0123456789")]) { + maskwhat = "mask"; + if (!gen_pton(slash, sl->base.sa.sa_family, &sl->mask)) { configparseerr(ads,fn,lno,"invalid mask `%s' in sortlist",slash); continue; } - if (base.s_addr & ~mask.s_addr) { - configparseerr(ads,fn,lno, - "mask `%s' in sortlist overlaps address `%s'",slash,tbuf); - continue; - } } else { + maskwhat = "prefix length"; initial= strtoul(slash,&ep,10); - if (*ep || initial>32) { + if (*ep || initial>adns__addr_width(sl->base.sa.sa_family)) { configparseerr(ads,fn,lno,"mask length `%s' invalid",slash); continue; } - mask.s_addr= htonl((0x0ffffffffUL) << (32-initial)); + sl->mask.sa.sa_family= sl->base.sa.sa_family; + adns__prefix_mask(&sl->mask, initial); } } else { - baselocal= ntohl(base.s_addr); - if (!(baselocal & 0x080000000UL)) /* class A */ - mask.s_addr= htonl(0x0ff000000UL); - else if ((baselocal & 0x0c0000000UL) == 0x080000000UL) - mask.s_addr= htonl(0x0ffff0000UL); /* class B */ - else if ((baselocal & 0x0f0000000UL) == 0x0e0000000UL) - mask.s_addr= htonl(0x0ff000000UL); /* class C */ - else { - configparseerr(ads,fn,lno, - "network address `%s' in sortlist is not in classed ranges," + maskwhat = "implied prefix length"; + initial= adns__guess_prefix_length(&sl->base); + if (initial < 0) { + configparseerr(ads,fn,lno, "network address `%s'" + " in sortlist is not in classed ranges," " must specify mask explicitly", tbuf); continue; } + sl->mask.sa.sa_family= sl->base.sa.sa_family; + adns__prefix_mask(&sl->mask, initial); } - ads->sortlist[ads->nsortlist].base= base; - ads->sortlist[ads->nsortlist].mask= mask; + if (!adns__addr_matches(sl->base.sa.sa_family, + adns__sockaddr_addr(&sl->base.sa), + &sl->base,&sl->mask)) { + if (initial >= 0) { + configparseerr(ads,fn,lno, "%s %d in sortlist" + " overlaps address `%s'",maskwhat,initial,tbuf); + } else { + configparseerr(ads,fn,lno, "%s `%s' in sortlist" + " overlaps address `%s'",maskwhat,slash,tbuf); + } + continue; + } + ads->nsortlist++; } } -static void ccf_options(adns_state ads, const char *fn, int lno, const char *buf) { - const char *word; +static void ccf_options(adns_state ads, const char *fn, + int lno, const char *buf) { + const char *opt, *word, *endword, *endopt; char *ep; unsigned long v; int l; @@ -226,44 +271,97 @@ if (!buf) return; +#define WORD__IS(s,op) ((endword-word) op (sizeof(s)-1) && \ + !memcmp(word,s,(sizeof(s)-1))) +#define WORD_IS(s) (WORD__IS(s,==)) +#define WORD_STARTS(s) (WORD__IS(s,>=) ? ((word+=sizeof(s)-1)) : 0) + while (nextword(&buf,&word,&l)) { - if (l==5 && !memcmp(word,"debug",5)) { + opt=word; + endopt=endword=word+l; + if (WORD_IS("debug")) { ads->iflags |= adns_if_debug; continue; } - if (l>=6 && !memcmp(word,"ndots:",6)) { - v= strtoul(word+6,&ep,10); - if (l==6 || ep != word+l || v > INT_MAX) { - configparseerr(ads,fn,lno,"option `%.*s' malformed or has bad value",l,word); + if (WORD_STARTS("ndots:")) { + v= strtoul(word,&ep,10); + if (ep==word || ep != endword || v > INT_MAX) { + configparseerr(ads,fn,lno,"option `%.*s' malformed" + " or has bad value",l,opt); continue; } ads->searchndots= v; continue; } - if (l>=12 && !memcmp(word,"adns_checkc:",12)) { - if (!strcmp(word+12,"none")) { + if (WORD_STARTS("adns_checkc:")) { + if (WORD_IS("none")) { ads->iflags &= ~adns_if_checkc_freq; ads->iflags |= adns_if_checkc_entex; - } else if (!strcmp(word+12,"entex")) { + } else if (WORD_IS("entex")) { ads->iflags &= ~adns_if_checkc_freq; ads->iflags |= adns_if_checkc_entex; - } else if (!strcmp(word+12,"freq")) { + } else if (WORD_IS("freq")) { ads->iflags |= adns_if_checkc_freq; } else { configparseerr(ads,fn,lno, "option adns_checkc has bad value `%s' " - "(must be none, entex or freq", word+12); + "(must be none, entex or freq", word); } continue; } - adns__diag(ads,-1,0,"%s:%d: unknown option `%.*s'", fn,lno, l,word); + if (WORD_STARTS("adns_af:")) { + ads->iflags &= ~adns_if_afmask; + if (!WORD_IS("any")) for (;;) { + const char *comma= memchr(word,',',endopt-word); + endword=comma?comma:endopt; + if (WORD_IS("ipv4")) + ads->iflags |= adns_if_permit_ipv4; + else if (WORD_IS("ipv6")) + ads->iflags |= adns_if_permit_ipv6; + else { + if (ads->config_report_unknown) + adns__diag(ads,-1,0,"%s:%d: " + "option adns_af has bad value or entry `%.*s' " + "(option must be `any', or list of `ipv4',`ipv6')", + fn,lno, (int)(endword-word),word); + break; + } + if (!comma) break; + word= comma+1; + } + continue; + } + if (WORD_IS("adns_ignoreunkcfg")) { + ads->config_report_unknown=0; + continue; + } + if (/* adns's query strategy is not configurable */ + WORD_STARTS("timeout:") || + WORD_STARTS("attempts:") || + WORD_IS("rotate") || + /* adns provides the application with knob for this */ + WORD_IS("no-check-names") || + /* adns normally does IPv6 if the application wants it; control + * this with the adns_af: option if you like */ + WORD_IS("inet6") || + /* adns does not do edns0 and this is not a problem */ + WORD_IS("edns0")) + continue; + if (ads->config_report_unknown) + adns__diag(ads,-1,0,"%s:%d: unknown option `%.*s'", fn,lno, l,opt); } + +#undef WORD__IS +#undef WORD_IS +#undef WORD_STARTS } -static void ccf_clearnss(adns_state ads, const char *fn, int lno, const char *buf) { +static void ccf_clearnss(adns_state ads, const char *fn, + int lno, const char *buf) { ads->nservers= 0; } -static void ccf_include(adns_state ads, const char *fn, int lno, const char *buf) { +static void ccf_include(adns_state ads, const char *fn, + int lno, const char *buf) { if (!*buf) { configparseerr(ads,fn,lno,"`include' directive with no filename"); return; @@ -271,6 +369,40 @@ readconfig(ads,buf,1); } +static void ccf_lookup(adns_state ads, const char *fn, int lno, + const char *buf) { + int found_bind=0; + const char *word; + int l; + + if (!*buf) { + configparseerr(ads,fn,lno,"`lookup' directive with no databases"); + return; + } + + while (nextword(&buf,&word,&l)) { + if (l==4 && !memcmp(word,"bind",4)) { + found_bind=1; + } else if (l==4 && !memcmp(word,"file",4)) { + /* ignore this and hope /etc/hosts is not essential */ + } else if (l==2 && !memcmp(word,"yp",2)) { + adns__diag(ads,-1,0,"%s:%d: yp lookups not supported by adns", fn,lno); + found_bind=-1; + } else { + if (ads->config_report_unknown) + adns__diag(ads,-1,0,"%s:%d: unknown `lookup' database `%.*s'", + fn,lno, l,word); + found_bind=-1; + } + } + if (!found_bind) + adns__diag(ads,-1,0,"%s:%d: `lookup' specified, but not `bind'", fn,lno); +} + +static void ccf_ignore(adns_state ads, const char *fn, int lno, + const char *buf) { +} + static const struct configcommandinfo { const char *name; void (*fn)(adns_state ads, const char *fn, int lno, const char *buf); @@ -282,6 +414,8 @@ { "options", ccf_options }, { "clearnameservers", ccf_clearnss }, { "include", ccf_include }, + { "lookup", ccf_lookup }, /* OpenBSD */ + { "lwserver", ccf_ignore }, /* BIND9 lwresd */ { 0 } }; @@ -299,7 +433,7 @@ p= buf; buflen--; i= 0; - + for (;;) { /* loop over chars */ if (i == buflen) { adns__diag(ads,-1,0,"%s:%d: line too long, ignored",filename,lno); @@ -314,7 +448,8 @@ } else if (c == EOF) { if (ferror(file)) { saveerr(ads,errno); - adns__diag(ads,-1,0,"%s:%d: read error: %s",filename,lno,strerror(errno)); + adns__diag(ads,-1,0,"%s:%d: read error: %s", + filename,lno,strerror(errno)); return -1; } if (!i) return -1; @@ -350,7 +485,7 @@ saveerr(ads,EINVAL); return -2; } - + memcpy(buf,cp,l); buf[l]= 0; return l; @@ -377,16 +512,18 @@ linebuf[l]= 0; p= linebuf; while (ctype_whitespace(*p)) p++; - if (*p == '#' || !*p) continue; + if (*p == '#' || *p == ';' || !*p) continue; q= p; while (*q && !ctype_whitespace(*q)) q++; dirl= q-p; for (ccip=configcommandinfos; - ccip->name && !((int)strlen(ccip->name)==dirl && !memcmp(ccip->name,p,q-p)); + ccip->name && + !(strlen(ccip->name)==dirl && !memcmp(ccip->name,p,q-p)); ccip++); if (!ccip->name) { - adns__diag(ads,-1,0,"%s:%d: unknown configuration directive `%.*s'", - filename,lno,q-p,p); + if (ads->config_report_unknown) + adns__diag(ads,-1,0,"%s:%d: unknown configuration directive `%.*s'", + filename,lno,(int)(q-p),p); continue; } while (ctype_whitespace(*q)) q++; @@ -399,18 +536,20 @@ value= getenv(envvar); if (!value) adns__debug(ads,-1,0,"environment variable %s not set",envvar); - else adns__debug(ads,-1,0,"environment variable %s set to `%s'",envvar,value); + else adns__debug(ads,-1,0,"environment variable %s" + " set to `%s'",envvar,value); return value; } static void readconfig(adns_state ads, const char *filename, int warnmissing) { getline_ctx gl_ctx; - + gl_ctx.file= fopen(filename,"r"); if (!gl_ctx.file) { if (errno == ENOENT) { if (warnmissing) - adns__debug(ads,-1,0,"configuration file `%s' does not exist",filename); + adns__debug(ads,-1,0, "configuration file" + " `%s' does not exist",filename); return; } saveerr(ads,errno); @@ -420,17 +559,18 @@ } readconfiggeneric(ads,filename,gl_file,gl_ctx); - + fclose(gl_ctx.file); } -static void readconfigtext(adns_state ads, const char *text, const char *showname) { +static void readconfigtext(adns_state ads, const char *text, + const char *showname) { getline_ctx gl_ctx; - + gl_ctx.text= text; readconfiggeneric(ads,showname,gl_text,gl_ctx); } - + static void readconfigenv(adns_state ads, const char *envvar) { const char *filename; @@ -454,13 +594,13 @@ } -int adns__setnonblock(adns_state ads, ADNS_SOCKET fd) { +int adns__setnonblock(adns_state ads, int fd) { #ifdef ADNS_JGAA_WIN32 unsigned long Val = 1; return (ioctlsocket (fd, FIONBIO, &Val) == 0) ? 0 : -1; #else int r; - + r= fcntl(fd,F_GETFL,0); if (r<0) return errno; r |= O_NONBLOCK; r= fcntl(fd,F_SETFL,r); if (r<0) return errno; @@ -468,27 +608,30 @@ #endif } -static int init_begin(adns_state *ads_r, adns_initflags flags, FILE *diagfile) { +static int init_begin(adns_state *ads_r, adns_initflags flags, + adns_logcallbackfn *logfn, void *logfndata) { adns_state ads; + pid_t pid; + + if (flags & ~(adns_initflags)(0x4fff)) + /* 0x4000 is reserved for `harmless' future expansion */ + return ENOSYS; -#ifdef ADNS_JGAA_WIN32 - WORD wVersionRequested = MAKEWORD( 2, 0 ); - WSADATA wsaData; - int err; -#endif - ads= malloc(sizeof(*ads)); if (!ads) return errno; ads->iflags= flags; - ads->diagfile= diagfile; + ads->logfn= logfn; + ads->logfndata= logfndata; ads->configerrno= 0; LIST_INIT(ads->udpw); LIST_INIT(ads->tcpw); LIST_INIT(ads->childw); LIST_INIT(ads->output); + LIST_INIT(ads->intdone); ads->forallnext= 0; ads->nextid= 0x311f; - ads->udpsocket= ads->tcpsocket= -1; + ads->nudpsockets= 0; + ads->tcpsocket= -1; adns__vbuf_init(&ads->tcpsend); adns__vbuf_init(&ads->tcprecv); ads->tcprecv_skip= 0; @@ -497,58 +640,55 @@ ads->tcpstate= server_disconnected; timerclear(&ads->tcptimeout); ads->searchlist= 0; + ads->config_report_unknown=1; - #ifdef ADNS_JGAA_WIN32 - err= WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) { - if (ads->diagfile && ads->iflags & adns_if_debug) - fprintf(ads->diagfile,"adns: WSAStartup() failed. \n"); - return -1;} - if (LOBYTE( wsaData.wVersion ) != 2 || - HIBYTE( wsaData.wVersion ) != 0 ) { - if (ads->diagfile && ads->iflags & adns_if_debug) - fprintf(ads->diagfile,"adns: Need Winsock 2.0 or better!\n"); + pid= getpid(); + ads->rand48xsubi[0]= pid; + ads->rand48xsubi[1]= (unsigned long)pid >> 16; + ads->rand48xsubi[2]= pid ^ ((unsigned long)pid >> 16); - WSACleanup(); - return -1;} - - /* The WinSock DLL is acceptable. Proceed. */ -#endif - *ads_r= ads; - return 0; } static int init_finish(adns_state ads) { - struct in_addr ia; + struct sockaddr_in sin; struct protoent *proto; + struct udpsocket *udp; + int i; int r; - + if (!ads->nservers) { - if (ads->diagfile && ads->iflags & adns_if_debug) - fprintf(ads->diagfile,"adns: no nameservers, using localhost\n"); - ia.s_addr= htonl(INADDR_LOOPBACK); - addserver(ads,ia); + if (ads->logfn && ads->iflags & adns_if_debug) + adns__lprintf(ads,"adns: no nameservers, using IPv4 localhost\n"); + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(DNS_PORT); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + addserver(ads,(struct sockaddr *)&sin, sizeof(sin)); } proto= getprotobyname("udp"); if (!proto) { r= ENOPROTOOPT; goto x_free; } - ADNS_CLEAR_ERRNO; - ads->udpsocket= socket(AF_INET,SOCK_DGRAM,proto->p_proto); - ADNS_CAPTURE_ERRNO; - if (ads->udpsocket<0) { r= errno; goto x_free; } - - r= adns__setnonblock(ads,ads->udpsocket); - if (r) { r= errno; goto x_closeudp; } + ads->nudpsockets= 0; + for (i=0; inservers; i++) { + if (adns__udpsocket_by_af(ads, ads->servers[i].addr.sa.sa_family)) + continue; + assert(ads->nudpsockets < MAXUDP); + udp= &ads->udpsockets[ads->nudpsockets]; + udp->af= ads->servers[i].addr.sa.sa_family; + udp->fd= socket(udp->af,SOCK_DGRAM,proto->p_proto); + if (udp->fd < 0) { r= errno; goto x_free; } + ads->nudpsockets++; + r= adns__setnonblock(ads,udp->fd); + if (r) { r= errno; goto x_closeudp; } + } + return 0; x_closeudp: - adns_socket_close(ads->udpsocket); + for (i=0; inudpsockets; i++) adns_socket_close(ads->udpsockets[i].fd); x_free: free(ads); -#ifdef ADNS_JGAA_WIN32 - WSACleanup(); -#endif /* WIN32 */ return r; } @@ -558,34 +698,20 @@ free(ads->searchlist); } free(ads); -#ifdef ADNS_JGAA_WIN32 - WSACleanup(); -#endif /* WIN32 */ +} +static void logfn_file(adns_state ads, void *logfndata, + const char *fmt, va_list al) { + vfprintf(logfndata,fmt,al); } -int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) { +static int init_files(adns_state *ads_r, adns_initflags flags, + adns_logcallbackfn *logfn, void *logfndata) { adns_state ads; const char *res_options, *adns_res_options; int r; -#ifdef ADNS_JGAA_WIN32 - #define SECURE_PATH_LEN (MAX_PATH - 64) - char PathBuf[MAX_PATH]; - struct in_addr addr; -#ifdef __REACTOS__ - PFIXED_INFO network_info; - ULONG network_info_blen = 0; -#else - #define ADNS_PFIXED_INFO_BLEN (2048) - PFIXED_INFO network_info = (PFIXED_INFO)_alloca(ADNS_PFIXED_INFO_BLEN); - ULONG network_info_blen = ADNS_PFIXED_INFO_BLEN; -#endif /* __REACTOS__ */ - DWORD network_info_result; - PIP_ADDR_STRING pip; - const char *network_err_str = ""; -#endif - r= init_begin(&ads, flags, diagfile ? diagfile : stderr); + r= init_begin(&ads, flags, logfn, logfndata); if (r) return r; res_options= instrum_getenv(ads,"RES_OPTIONS"); @@ -593,54 +719,8 @@ ccf_options(ads,"RES_OPTIONS",-1,res_options); ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options); -#ifdef ADNS_JGAA_WIN32 - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\\resolv.conf"); - readconfig(ads,PathBuf,1); - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\\resolv-adns.conf"); - readconfig(ads,PathBuf,0); - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\\System32\\Drivers\\etc\\resolv.conf"); - readconfig(ads,PathBuf,1); - GetWindowsDirectory(PathBuf, SECURE_PATH_LEN); - strcat(PathBuf,"\\System32\\Drivers\\etc\\resolv-adns.conf"); - readconfig(ads,PathBuf,0); -#ifdef __REACTOS__ - network_info_result = GetNetworkParams(NULL, &network_info_blen); - network_info = (PFIXED_INFO)malloc((size_t)network_info_blen); -#endif - network_info_result = GetNetworkParams(network_info, &network_info_blen); - if (network_info_result != ERROR_SUCCESS){ - switch(network_info_result) { - case ERROR_BUFFER_OVERFLOW: network_err_str = "ERROR_BUFFER_OVERFLOW"; break; - case ERROR_INVALID_PARAMETER: network_err_str = "ERROR_INVALID_PARAMETER"; break; - case ERROR_NO_DATA: network_err_str = "ERROR_NO_DATA"; break; - case ERROR_NOT_SUPPORTED: network_err_str = "ERROR_NOT_SUPPORTED"; break;} - adns__diag(ads,-1,0,"GetNetworkParams() failed with error [%d] %s", - network_info_result,network_err_str); - } - else { - for(pip = &(network_info->DnsServerList); pip; pip = pip->Next) { - addr.s_addr = inet_addr(pip->IpAddress.String); - if ((addr.s_addr != INADDR_ANY) && (addr.s_addr != INADDR_NONE)) - addserver(ads, addr); -#ifdef __REACTOS__ - if (network_info->DomainName) - ccf_search(ads, "LOCALDOMAIN", -1, network_info->DomainName); - else - ccf_search(ads, "LOCALDOMAIN", -1, ""); -#endif - } - } -#ifdef __REACTOS__ - if (network_info) free(network_info); -#endif -#else readconfig(ads,"/etc/resolv.conf",1); readconfig(ads,"/etc/resolv-adns.conf",0); -#endif - readconfigenv(ads,"RES_CONF"); readconfigenv(ads,"ADNS_RES_CONF"); @@ -667,12 +747,18 @@ return 0; } -int adns_init_strcfg(adns_state *ads_r, adns_initflags flags, - FILE *diagfile, const char *configtext) { +int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) { + return init_files(ads_r, flags, logfn_file, diagfile ? diagfile : stderr); +} + +static int init_strcfg(adns_state *ads_r, adns_initflags flags, + adns_logcallbackfn *logfn, void *logfndata, + const char *configtext) { adns_state ads; int r; - r= init_begin(&ads, flags, diagfile); if (r) return r; + r= init_begin(&ads, flags, logfn, logfndata); + if (r) return r; readconfigtext(ads,configtext,""); if (ads->configerrno) { @@ -687,26 +773,42 @@ return 0; } +int adns_init_strcfg(adns_state *ads_r, adns_initflags flags, + FILE *diagfile, const char *configtext) { + return init_strcfg(ads_r, flags, + diagfile ? logfn_file : 0, diagfile, + configtext); +} +int adns_init_logfn(adns_state *newstate_r, adns_initflags flags, + const char *configtext /*0=>use default config files*/, + adns_logcallbackfn *logfn /*0=>logfndata is a FILE* */, + void *logfndata /*0 with logfn==0 => discard*/) { + if (!logfn && logfndata) + logfn= logfn_file; + if (configtext) + return init_strcfg(newstate_r, flags, logfn, logfndata, configtext); + else + return init_files(newstate_r, flags, logfn, logfndata); +} + void adns_finish(adns_state ads) { + int i; adns__consistency(ads,0,cc_entex); for (;;) { - if (ads->udpw.head) adns_cancel(ads->udpw.head); - else if (ads->tcpw.head) adns_cancel(ads->tcpw.head); - else if (ads->childw.head) adns_cancel(ads->childw.head); - else if (ads->output.head) adns_cancel(ads->output.head); + if (ads->udpw.head) adns__cancel(ads->udpw.head); + else if (ads->tcpw.head) adns__cancel(ads->tcpw.head); + else if (ads->childw.head) adns__cancel(ads->childw.head); + else if (ads->output.head) adns__cancel(ads->output.head); + else if (ads->intdone.head) adns__cancel(ads->output.head); else break; } - adns_socket_close(ads->udpsocket); - if (ads->tcpsocket != -1) adns_socket_close(ads->tcpsocket); + for (i=0; inudpsockets; i++) adns_socket_close(ads->udpsockets[i].fd); + if (ads->tcpsocket >= 0) adns_socket_close(ads->tcpsocket); adns__vbuf_free(&ads->tcpsend); adns__vbuf_free(&ads->tcprecv); freesearchlist(ads); free(ads); -#ifdef ADNS_JGAA_WIN32 - WSACleanup(); -#endif /* WIN32 */ - } void adns_forallqueries_begin(adns_state ads) { @@ -717,7 +819,7 @@ ads->childw.head ? ads->childw.head : ads->output.head; } - + adns_query adns_forallqueries_next(adns_state ads, void **context_r) { adns_query qu, nqu; @@ -750,6 +852,6 @@ } /* ReactOS addition */ -void adns_addserver(adns_state ads, struct in_addr addr) { - addserver(ads, addr); +void adns_addserver(adns_state ads, struct sockaddr *server, int salen) { + addserver(ads, server, salen); } Index: sdk/lib/3rdparty/adns/src/transmit.c =================================================================== --- sdk/lib/3rdparty/adns/src/transmit.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/transmit.c (working copy) @@ -4,26 +4,25 @@ * - send queries */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #include @@ -43,15 +42,16 @@ #define MKQUERY_ADDW(w) (MKQUERY_ADDB(((w)>>8)&0x0ff), MKQUERY_ADDB((w)&0x0ff)) #define MKQUERY_STOP(vb) ((vb)->used= rqp-(vb)->buf) -static adns_status mkquery_header(adns_state ads, vbuf *vb, int *id_r, int qdlen) { +static adns_status mkquery_header(adns_state ads, vbuf *vb, + int *id_r, int qdlen) { int id; byte *rqp; - + if (!adns__vbuf_ensure(vb,DNS_HDRSIZE+qdlen+4)) return adns_s_nomemory; vb->used= 0; MKQUERY_START(vb); - + *id_r= id= (ads->nextid++) & 0x0ffff; MKQUERY_ADDW(id); MKQUERY_ADDB(0x01); /* QR=Q(0), OPCODE=QUERY(0000), !AA, !TC, RD */ @@ -62,7 +62,7 @@ MKQUERY_ADDW(0); /* ARCOUNT=0 */ MKQUERY_STOP(vb); - + return adns_s_ok; } @@ -70,73 +70,89 @@ byte *rqp; MKQUERY_START(vb); - MKQUERY_ADDW(type & adns__rrt_typemask); /* QTYPE */ + MKQUERY_ADDW(type & adns_rrt_typemask); /* QTYPE */ MKQUERY_ADDW(DNS_CLASS_IN); /* QCLASS=IN */ MKQUERY_STOP(vb); assert(vb->used <= vb->avail); + + return adns_s_ok; +} +static adns_status qdparselabel(adns_state ads, + const char **p_io, const char *pe, + char label_r[], int *ll_io, + adns_queryflags flags) { + int ll, c; + const char *p; + + ll= 0; + p= *p_io; + + while (p!=pe && (c= *p++)!='.') { + if (c=='\\') { + if (!(flags & adns_qf_quoteok_query)) return adns_s_querydomaininvalid; + if (ctype_digit(p[0])) { + if (p+1==pe || p+2==pe) return adns_s_querydomaininvalid; + if (ctype_digit(p[1]) && ctype_digit(p[2])) { + c= (*p++ - '0')*100; + c += (*p++ - '0')*10; + c += (*p++ - '0'); + if (c >= 256) return adns_s_querydomaininvalid; + } else { + return adns_s_querydomaininvalid; + } + } else if (!(c= *p++)) { + return adns_s_querydomaininvalid; + } + } + if (ll == *ll_io) return adns_s_querydomaininvalid; + label_r[ll++]= c; + } + + *p_io= p; + *ll_io= ll; return adns_s_ok; } adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, const char *owner, int ol, - const typeinfo *typei, adns_queryflags flags) { - int ll, c, nbytes; - byte label[255], *rqp; + const typeinfo *typei, adns_rrtype type, + adns_queryflags flags) { + int ll, nbytes; + byte label[255]; + byte *rqp; const char *p, *pe; adns_status st; st= mkquery_header(ads,vb,id_r,ol+2); if (st) return st; - + MKQUERY_START(vb); p= owner; pe= owner+ol; nbytes= 0; while (p!=pe) { - ll= 0; - while (p!=pe && (c= *p++)!='.') { - if (c=='\\') { - if (!(flags & adns_qf_quoteok_query)) return adns_s_querydomaininvalid; - if (ctype_digit(p[0])) { - if (ctype_digit(p[1]) && ctype_digit(p[2])) { - c= (p[0] - '0')*100 + (p[1] - '0')*10 + (p[2] - '0'); - p += 3; - if (c >= 256) return adns_s_querydomaininvalid; - } else { - return adns_s_querydomaininvalid; - } - } else if (!(c= *p++)) { - return adns_s_querydomaininvalid; - } - } - if (!(flags & adns_qf_quoteok_query)) { - if (c == '-') { - if (!ll) return adns_s_querydomaininvalid; - } else if (!ctype_alpha(c) && !ctype_digit(c)) { - return adns_s_querydomaininvalid; - } - } - if (ll == sizeof(label)) return adns_s_querydomaininvalid; - label[ll++]= c; - } + ll= sizeof(label); + st= qdparselabel(ads, &p,pe, label, &ll, flags); + if (st) return st; if (!ll) return adns_s_querydomaininvalid; if (ll > DNS_MAXLABEL) return adns_s_querydomaintoolong; nbytes+= ll+1; if (nbytes >= DNS_MAXDOMAIN) return adns_s_querydomaintoolong; MKQUERY_ADDB(ll); - memcpy(rqp,label,(size_t) ll); rqp+= ll; + memcpy(rqp,label,ll); rqp+= ll; } MKQUERY_ADDB(0); MKQUERY_STOP(vb); - - st= mkquery_footer(vb,typei->type); - + + st= mkquery_footer(vb,type); + return adns_s_ok; } adns_status adns__mkquery_frdgram(adns_state ads, vbuf *vb, int *id_r, - const byte *qd_dgram, int qd_dglen, int qd_begin, + const byte *qd_dgram, int qd_dglen, + int qd_begin, adns_rrtype type, adns_queryflags flags) { byte *rqp; findlabel_state fls; @@ -153,15 +169,15 @@ if (!lablen) break; assert(lablen<255); MKQUERY_ADDB(lablen); - memcpy(rqp,qd_dgram+labstart, (size_t) lablen); + memcpy(rqp,qd_dgram+labstart,lablen); rqp+= lablen; } MKQUERY_ADDB(0); MKQUERY_STOP(vb); - + st= mkquery_footer(vb,type); - + return adns_s_ok; } @@ -179,7 +195,8 @@ length[1]= (qu->query_dglen&0x0ff); ads= qu->ads; - if (!adns__vbuf_ensure(&ads->tcpsend,ads->tcpsend.used+qu->query_dglen+2)) return; + if (!adns__vbuf_ensure(&ads->tcpsend,ads->tcpsend.used+qu->query_dglen+2)) + return; qu->retries++; @@ -189,18 +206,15 @@ if (ads->tcpsend.used) { wr= 0; } else { - iov[0].iov_base= (char*)length; + iov[0].iov_base= length; iov[0].iov_len= 2; - iov[1].iov_base= (char*)qu->query_dgram; + iov[1].iov_base= qu->query_dgram; iov[1].iov_len= qu->query_dglen; adns__sigpipe_protect(qu->ads); - - ADNS_CLEAR_ERRNO; wr= writev(qu->ads->tcpsocket,iov,2); - ADNS_CAPTURE_ERRNO; adns__sigpipe_unprotect(qu->ads); if (wr < 0) { - if (!(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ENOSPC || + if (!(errno == EAGAIN || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM)) { adns__tcp_broken(ads,"write",strerror(errno)); return; @@ -216,7 +230,8 @@ wr-= 2; } if (wrquery_dglen) { - r= adns__vbuf_append(&ads->tcpsend,qu->query_dgram+wr,qu->query_dglen-wr); assert(r); + r= adns__vbuf_append(&ads->tcpsend,qu->query_dgram+wr,qu->query_dglen-wr); + assert(r); } } @@ -229,10 +244,18 @@ adns__tcp_tryconnect(qu->ads,now); } +struct udpsocket *adns__udpsocket_by_af(adns_state ads, int af) { + int i; + for (i=0; inudpsockets; i++) + if (ads->udpsockets[i].af == af) return &ads->udpsockets[i]; + return 0; +} + void adns__query_send(adns_query qu, struct timeval now) { - struct sockaddr_in servaddr; int serv, r; adns_state ads; + struct udpsocket *udp; + adns_rr_addr *addr; assert(qu->state == query_tosend); if ((qu->flags & adns_qf_usevc) || (qu->query_dglen > DNS_MAXUDP)) { @@ -245,21 +268,22 @@ return; } + ads= qu->ads; serv= qu->udpnextserver; - memset(&servaddr,0,sizeof(servaddr)); - - ads= qu->ads; - servaddr.sin_family= AF_INET; - servaddr.sin_addr= ads->servers[serv].addr; - servaddr.sin_port= htons(DNS_PORT); - - ADNS_CLEAR_ERRNO; - r= sendto(ads->udpsocket,(char*)qu->query_dgram,qu->query_dglen,0, - (const struct sockaddr*)&servaddr,sizeof(servaddr)); - ADNS_CAPTURE_ERRNO; - if (r<0 && errno == EMSGSIZE) { qu->retries= 0; query_usetcp(qu,now); return; } - if (r<0 && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) adns__warn(ads,serv,0,"sendto failed: %s (%d)",strerror(errno), errno); - + addr= &ads->servers[serv]; + udp= adns__udpsocket_by_af(ads, addr->addr.sa.sa_family); + assert(udp); + + r= sendto(udp->fd,qu->query_dgram,qu->query_dglen,0, + &addr->addr.sa,addr->len); + if (r<0 && errno == EMSGSIZE) { + qu->retries= 0; + query_usetcp(qu,now); + return; + } + if (r<0 && errno != EAGAIN) + adns__warn(ads,serv,0,"sendto failed: %s",strerror(errno)); + qu->timeout= now; timevaladd(&qu->timeout,UDPRETRYMS); qu->udpsent |= (1< + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -21,8 +21,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifndef ADNS_TVARITH_H_INCLUDED Index: sdk/lib/3rdparty/adns/src/types.c =================================================================== --- sdk/lib/3rdparty/adns/src/types.c (revision 72742) +++ sdk/lib/3rdparty/adns/src/types.c (working copy) @@ -3,31 +3,31 @@ * - RR-type-specific code, and the machinery to call it */ /* - * This file is - * Copyright (C) 1997-1999 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch - * + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson + * Copyright (C) 2014 Mark Wooding + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, write to the Free Software Foundation. */ #ifdef ADNS_JGAA_WIN32 # include "adns_win32.h" #else +# include # include # include # include @@ -37,8 +37,10 @@ #include "internal.h" -#define R_NOMEM return adns_s_nomemory -#define CSP_ADDSTR(s) do { if (!adns__vbuf_appendstr(vb,(s))) R_NOMEM; } while (0) +#define R_NOMEM return adns_s_nomemory +#define CSP_ADDSTR(s) do { \ + if (!adns__vbuf_appendstr(vb,(s))) R_NOMEM; \ + } while (0) /* * order of sections: @@ -49,24 +51,35 @@ * _intstr (mf,csp,cs) * _manyistr (mf,cs) * _txt (pa) - * _inaddr (pa,dip,di) - * _addr (pa,di,csp,cs) - * _domain (pap) + * _inaddr (pa,di,cs + * +search_sortlist, dip_genaddr, csp_genaddr) + * _in6addr (pa,di,cs) + * _addr (pap,pa,di,div,csp,cs,gsz,qs + * +search_sortlist_sa, dip_sockaddr, + * addr_rrtypes, addr_submit, icb_addr) + * _domain (pap,csp,cs) + * _dom_raw (pa) * _host_raw (pa) - * _hostaddr (pap,pa,dip,di,mfp,mf,csp,cs +pap_findaddrs) + * _hostaddr (pap,pa,dip,di,mfp,mf,csp,cs + * +pap_findaddrs, icb_hostaddr) * _mx_raw (pa,di) * _mx (pa,di) * _inthostaddr (mf,cs) - * _ptr (pa) - * _strpair (mf,cs) - * _intstrpair (mf,cs) + * _inthost (cs) + * _ptr (ckl,pa +icb_ptr) + * _strpair (mf) + * _intstrpair (mf) * _hinfo (pa) - * _mailbox (pap +pap_mailbox822) - * _rp (pa) + * _mailbox (pap,csp +pap_mailbox822) + * _rp (pa,cs) * _soa (pa,mf,cs) + * _srv* (ckl,(pap),pa*2,mf*2,di,(csp),cs*2,postsort) + * _byteblock (mf) + * _opaque (pa,cs) * _flat (mf) * * within each section: + * ckl_* * pap_* * pa_* * dip_* @@ -75,6 +88,9 @@ * mf_* * csp_* * cs_* + * gsz_* + * postsort_* + * qs_* */ /* @@ -95,17 +111,17 @@ if (cbyte >= max) return adns_s_invaliddata; GET_B(cbyte,l); if (cbyte+l > max) return adns_s_invaliddata; - - str= adns__alloc_interim(pai->qu, (size_t)l+1); + + str= adns__alloc_interim(pai->qu, l+1); if (!str) R_NOMEM; - + str[l]= 0; - memcpy(str,dgram+cbyte,(size_t)l); + memcpy(str,dgram+cbyte,l); *len_r= l; *str_r= str; *cbyte_io= cbyte+l; - + return adns_s_ok; } @@ -129,7 +145,7 @@ } } CSP_ADDSTR("\""); - + return adns_s_ok; } @@ -175,7 +191,8 @@ * _txt (pa,cs) */ -static adns_status pa_txt(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_txt(const parseinfo *pai, int cbyte, + int max, void *datap) { adns_rr_intstr **rrp= datap, *table, *te; const byte *dgram= pai->dgram; int ti, tc, l, startbyte; @@ -202,7 +219,7 @@ te->i= -1; te->str= 0; - + *rrp= table; return adns_s_ok; } @@ -235,73 +252,232 @@ } /* - * _inaddr (pa,dip,di) + * _inaddr (pa,di,cs +search_sortlist, dip_genaddr, csp_genaddr) */ -static adns_status pa_inaddr(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_inaddr(const parseinfo *pai, int cbyte, + int max, void *datap) { struct in_addr *storeto= datap; - + if (max-cbyte != 4) return adns_s_invaliddata; memcpy(storeto, pai->dgram + cbyte, 4); return adns_s_ok; } -static int search_sortlist(adns_state ads, struct in_addr ad) { +static int search_sortlist(adns_state ads, int af, const void *ad) { const struct sortlist *slp; + struct in_addr a4; int i; - + int v6mappedp= 0; +#ifdef WITH_IPV6 + if (af == AF_INET6) { + const struct in6_addr *a6= ad; + if (IN6_IS_ADDR_V4MAPPED(a6)) { + a4.s_addr= htonl(((unsigned long)a6->s6_addr[12] << 24) | + ((unsigned long)a6->s6_addr[13] << 16) | + ((unsigned long)a6->s6_addr[14] << 8) | + ((unsigned long)a6->s6_addr[15] << 0)); + v6mappedp= 1; + } + } +#endif for (i=0, slp=ads->sortlist; - insortlist && !((ad.s_addr & slp->mask.s_addr) == slp->base.s_addr); + insortlist && + !adns__addr_matches(af,ad, &slp->base,&slp->mask) && + !(v6mappedp && + adns__addr_matches(AF_INET,&a4, &slp->base,&slp->mask)); i++, slp++); return i; } -static int dip_inaddr(adns_state ads, struct in_addr a, struct in_addr b) { +static int dip_genaddr(adns_state ads, int af, const void *a, const void *b) { int ai, bi; - + if (!ads->nsortlist) return 0; - ai= search_sortlist(ads,a); - bi= search_sortlist(ads,b); + ai= search_sortlist(ads,af,a); + bi= search_sortlist(ads,af,b); return bis6_addr, pai->dgram + cbyte, 16); return adns_s_ok; } +static int di_in6addr(adns_state ads, + const void *datap_a, const void *datap_b) { + return dip_genaddr(ads,AF_INET6,datap_a,datap_b); +} + +static adns_status cs_in6addr(vbuf *vb, const void *datap) { + return csp_genaddr(vb,AF_INET6,datap); +} +#endif /* - * _addr (pa,di,csp,cs) + * _addr (pap,pa,di,div,csp,cs,gsz,qs + * +search_sortlist_sa, dip_sockaddr, addr_rrtypes, + * addr_submit, icb_addr) */ -static adns_status pa_addr(const parseinfo *pai, int cbyte, int max, void *datap) { - adns_rr_addr *storeto= datap; - const byte *dgram= pai->dgram; +static const typeinfo tinfo_addrsub; - if (max-cbyte != 4) return adns_s_invaliddata; - storeto->len= sizeof(storeto->addr.inet); - memset(&storeto->addr,0,sizeof(storeto->addr.inet)); - storeto->addr.inet.sin_family= AF_INET; - memcpy(&storeto->addr.inet.sin_addr,dgram+cbyte,4); +#define ADDR_RRTYPES(_) _(a) _(aaaa) + +static const adns_rrtype addr_all_rrtypes[] = { +#define RRTY_CODE(ty) adns_r_##ty, + ADDR_RRTYPES(RRTY_CODE) +#undef RRTY_CODE +}; + +enum { +#define RRTY_INDEX(ty) addr__ri_##ty, + ADDR_RRTYPES(RRTY_INDEX) +#undef RRTY_INDEX + addr_nrrtypes, +#define RRTY_FLAG(ty) addr_rf_##ty = 1 << addr__ri_##ty, + ADDR_RRTYPES(RRTY_FLAG) + addr__rrty_eat_final_comma +#undef RRTY_FLAG +}; + +static unsigned addr_rrtypeflag(adns_rrtype type) { + int i; + + type &= adns_rrt_typemask; + for (i=0; icname slot. We discard address records from the + * wrong name. And finally we cancel the outstanding child queries, and + * resubmit address queries for the address families we don't yet have, with + * adns__qf_addr_cname set so that we know that we're in the fixup state. + */ + +static adns_status pap_addr(const parseinfo *pai, int in_rrty, size_t out_rrsz, + int *cbyte_io, int cbyte_max, adns_rr_addr *out) { + int in_addrlen; + int out_af, out_salen; +#ifdef WITH_IPV6 + struct in6_addr v6map; +#endif + const void *use_addr= pai->dgram + *cbyte_io; + + switch (in_rrty) { + case adns_r_a: in_addrlen= 4; out_af= AF_INET; break; +#ifdef WITH_IPV6 + case adns_r_aaaa: in_addrlen= 16; out_af= AF_INET6; break; +#endif + default: abort(); + } + + if ((*cbyte_io + in_addrlen) != cbyte_max) return adns_s_invaliddata; + +#ifdef WITH_IPV6 + if (out_af==AF_INET && + (pai->qu->flags & adns_qf_ipv6_mapv4) && + (pai->qu->answer->type & adns__qtf_bigaddr)) { + memset(v6map.s6_addr + 0, 0x00, 10); + memset(v6map.s6_addr + 10, 0xff, 2); + memcpy(v6map.s6_addr + 12, use_addr, 4); + use_addr= v6map.s6_addr; + out_af= AF_INET6; + } +#endif + + switch (out_af) { + case AF_INET: out_salen= sizeof(out->addr.inet); break; +#ifdef WITH_IPV6 + case AF_INET6: out_salen= sizeof(out->addr.inet6); break; +#endif + default: abort(); + } + + assert(offsetof(adns_rr_addr, addr) + out_salen <= out_rrsz); + + memset(&out->addr, 0, out_salen); + out->len= out_salen; + out->addr.sa.sa_family= out_af; + adns__addr_inject(use_addr, &out->addr); + + *cbyte_io += in_addrlen; return adns_s_ok; } +static adns_status pa_addr(const parseinfo *pai, int cbyte, + int max, void *datap) { + int err= pap_addr(pai, pai->qu->answer->type & adns_rrt_typemask, + pai->qu->answer->rrsz, &cbyte, max, datap); + if (err) return err; + if (cbyte != max) return adns_s_invaliddata; + return adns_s_ok; +} + +static int search_sortlist_sa(adns_state ads, const struct sockaddr *sa) { + const void *pa = adns__sockaddr_addr(sa); + return search_sortlist(ads, sa->sa_family, pa); +} + +static int dip_sockaddr(adns_state ads, + const struct sockaddr *sa, + const struct sockaddr *sb) { + if (!ads->sortlist) return 0; + return search_sortlist_sa(ads, sa) > search_sortlist_sa(ads, sb); +} + static int di_addr(adns_state ads, const void *datap_a, const void *datap_b) { const adns_rr_addr *ap= datap_a, *bp= datap_b; - - assert(ap->addr.sa.sa_family == AF_INET); - return dip_inaddr(ads, ap->addr.inet.sin_addr, bp->addr.inet.sin_addr); + return dip_sockaddr(ads, &ap->addr.sa, &bp->addr.sa); } static int div_addr(void *context, const void *datap_a, const void *datap_b) { @@ -308,17 +484,25 @@ const adns_state ads= context; return di_addr(ads, datap_a, datap_b); -} +} static adns_status csp_addr(vbuf *vb, const adns_rr_addr *rrp) { - const char *ia; - static char buf[30]; + char buf[ADNS_ADDR2TEXT_BUFLEN]; + int len= sizeof(buf); + int err; switch (rrp->addr.inet.sin_family) { case AF_INET: CSP_ADDSTR("INET "); - ia= inet_ntoa(rrp->addr.inet.sin_addr); assert(ia); - CSP_ADDSTR(ia); +#ifdef WITH_IPV6 + goto a2t; + case AF_INET6: + CSP_ADDSTR("INET6 "); + goto a2t; + a2t: +#endif + err= adns_addr2text(&rrp->addr.sa,0, buf,&len, 0); assert(!err); + CSP_ADDSTR(buf); break; default: sprintf(buf,"AF=%u",rrp->addr.sa.sa_family); @@ -334,6 +518,255 @@ return csp_addr(vb,rrp); } +static int gsz_addr(const typeinfo *typei, adns_rrtype type) { + return type & adns__qtf_bigaddr ? + sizeof(adns_rr_addr) : sizeof(adns_rr_addr_v4only); +} + +static unsigned addr_rrtypes(adns_state ads, adns_rrtype type, + adns_queryflags qf) { + /* Return a mask of addr_rf_... flags indicating which address families are + * wanted, given a query type and flags. + */ + + adns_queryflags permitaf= 0; + unsigned want= 0; + + if (!(type & adns__qtf_bigaddr)) + qf= (qf & ~adns_qf_want_allaf) | adns_qf_want_ipv4; + else { + if (!(qf & adns_qf_want_allaf)) { + qf |= (type & adns__qtf_manyaf) ? + adns_qf_want_allaf : adns_qf_want_ipv4; + } + if (ads->iflags & adns_if_permit_ipv4) permitaf |= adns_qf_want_ipv4; + if (ads->iflags & adns_if_permit_ipv6) permitaf |= adns_qf_want_ipv6; + if (qf & permitaf) qf &= permitaf | ~adns_qf_want_allaf; + } + + if (qf & adns_qf_want_ipv4) want |= addr_rf_a; + if (qf & adns_qf_want_ipv6) want |= addr_rf_aaaa; + + return want; +} + +static void icb_addr(adns_query parent, adns_query child); + +static void addr_subqueries(adns_query qu, struct timeval now, + adns_queryflags qf_extra, + const byte *qd_dgram, int qd_dglen) { + int i, err, id; + adns_query cqu; + adns_queryflags qf= (qu->flags & ~adns_qf_search) | qf_extra; + adns_rrtype qtf= qu->answer->type & adns__qtf_deref; + unsigned which= qu->ctx.tinfo.addr.want & ~qu->ctx.tinfo.addr.have; + qcontext ctx; + + memset(&ctx, 0, sizeof(ctx)); + ctx.callback= icb_addr; + for (i=0; iads, &qu->vb, &id, qd_dgram,qd_dglen, + DNS_HDRSIZE, addr_all_rrtypes[i], qf); + if (err) goto x_error; + err= adns__internal_submit(qu->ads, &cqu, qu, &tinfo_addrsub, + addr_all_rrtypes[i] | qtf, + &qu->vb, id, qf, now, &ctx); + if (err) goto x_error; + cqu->answer->rrsz= qu->answer->rrsz; + } + qu->state= query_childw; + LIST_LINK_TAIL(qu->ads->childw, qu); + return; + +x_error: + adns__query_fail(qu, err); +} + +static adns_status addr_submit(adns_query parent, adns_query *query_r, + vbuf *qumsg_vb, int id, unsigned want, + adns_queryflags flags, struct timeval now, + qcontext *ctx) { + /* This is effectively a substitute for adns__internal_submit, intended for + * the case where the caller (possibly) only wants a subset of the + * available record types. The memory management and callback rules are + * the same as for adns__internal_submit. + * + * Some differences: the query is linked onto the parent's children + * list before exit (though the parent's state is not changed, and + * it is not linked into the childw list queue); and we set the + * `tinfo' portion of the context structure (yes, modifying *ctx), + * since this is, in fact, the main purpose of this function. + */ + + adns_state ads= parent->ads; + adns_query qu; + adns_status err; + adns_rrtype type= ((adns_r_addr & adns_rrt_reprmask) | + (parent->answer->type & ~adns_rrt_reprmask)); + + ctx->tinfo.addr.want= want; + ctx->tinfo.addr.have= 0; + err= adns__internal_submit(ads, &qu, parent, adns__findtype(adns_r_addr), + type, qumsg_vb, id, flags, now, ctx); + if (err) return err; + + *query_r= qu; + return adns_s_ok; +} + +static adns_status append_addrs(adns_query qu, size_t rrsz, + adns_rr_addr **dp, int *dlen, + const adns_rr_addr *sp, int slen) { + /* Append a vector of slen addr records, each of size rrsz, starting at ap, + * to a vector starting at *dp, of length *dlen. On successful completion, + * *dp and *dlen are updated. + */ + + size_t drrsz= *dlen*rrsz, srrsz= slen*rrsz; + byte *p; + + if (!slen) return adns_s_ok; + p= adns__alloc_interim(qu, drrsz + srrsz); + if (!p) R_NOMEM; + if (*dlen) { + memcpy(p, *dp, drrsz); + adns__free_interim(qu, *dp); + } + memcpy(p + drrsz, sp, srrsz); + *dlen += slen; + *dp= (adns_rr_addr *)p; + return adns_s_ok; +} + +static void propagate_ttl(adns_query to, adns_query from) + { if (to->expires > from->expires) to->expires= from->expires; } + +static adns_status copy_cname_from_child(adns_query parent, adns_query child) { + adns_answer *pans= parent->answer, *cans= child->answer; + size_t n= strlen(cans->cname) + 1; + + pans->cname= adns__alloc_preserved(parent, n); + if (!pans->cname) R_NOMEM; + memcpy(pans->cname, cans->cname, n); + return adns_s_ok; +} + +static void done_addr_type(adns_query qu, adns_rrtype type) { + unsigned f= addr_rrtypeflag(type); + assert(f); qu->ctx.tinfo.addr.have |= f; +} + +static void icb_addr(adns_query parent, adns_query child) { + adns_state ads= parent->ads; + adns_answer *pans= parent->answer, *cans= child->answer; + struct timeval now; + adns_status err; + adns_queryflags qf; + int id, r; + + propagate_ttl(parent, child); + + if (!(child->flags & adns__qf_addr_cname) && + (parent->flags & adns__qf_addr_answer) && + (!!pans->cname != !!cans->cname || + (pans->cname && strcmp(pans->cname, cans->cname)))) { + /* We've detected an inconsistency in CNAME records, and must deploy + * countermeasures. + */ + + if (!pans->cname) { + /* The child has a CNAME record, but the parent doesn't. We must + * discard all of the parent's addresses, and substitute the child's. + */ + + assert(pans->rrsz == cans->rrsz); + adns__free_interim(parent, pans->rrs.bytes); + adns__transfer_interim(child, parent, cans->rrs.bytes); + pans->rrs.bytes= cans->rrs.bytes; + pans->nrrs= cans->nrrs; + parent->ctx.tinfo.addr.have= 0; + done_addr_type(parent, cans->type); + err= copy_cname_from_child(parent, child); if (err) goto x_err; + } + + /* We've settled on the CNAME (now) associated with the parent, which + * already has appropriate address records. Build a query datagram for + * this name so that we can issue child queries for the missing address + * families. The child's vbuf looks handy for this. + */ + err= adns__mkquery(ads, &child->vb, &id, pans->cname, + strlen(pans->cname), &tinfo_addrsub, + adns_r_addr, parent->flags); + if (err) goto x_err; + + /* Now cancel the remaining children, and try again with the CNAME we've + * settled on. + */ + adns__cancel_children(parent); + r= gettimeofday(&now, 0); if (r) goto x_gtod; + qf= adns__qf_addr_cname; + if (!(parent->flags & adns_qf_cname_loose)) qf |= adns_qf_cname_forbid; + addr_subqueries(parent, now, qf, child->vb.buf, child->vb.used); + return; + } + + if (cans->cname && !pans->cname) { + err= copy_cname_from_child(parent, child); + if (err) goto x_err; + } + + if ((parent->flags & adns_qf_search) && + !pans->cname && cans->status == adns_s_nxdomain) { + /* We're searching a list of suffixes, and the name doesn't exist. Try + * the next one. + */ + + adns__cancel_children(parent); + adns__free_interim(parent, pans->rrs.bytes); + pans->rrs.bytes= 0; pans->nrrs= 0; + r= gettimeofday(&now, 0); if (r) goto x_gtod; + adns__search_next(ads, parent, now); + return; + } + + if (cans->status && cans->status != adns_s_nodata) + { err= cans->status; goto x_err; } + + assert(pans->rrsz == cans->rrsz); + err= append_addrs(parent, pans->rrsz, + &pans->rrs.addr, &pans->nrrs, + cans->rrs.addr, cans->nrrs); + if (err) goto x_err; + done_addr_type(parent, cans->type); + + if (parent->children.head) LIST_LINK_TAIL(ads->childw, parent); + else if (!pans->nrrs) adns__query_fail(parent, adns_s_nodata); + else adns__query_done(parent); + parent->flags |= adns__qf_addr_answer; + return; + +x_gtod: + /* We have our own error handling, because adns__must_gettimeofday + * handles errors by calling adns_globalsystemfailure, which would + * reenter the query processing logic. */ + adns__diag(ads, -1, parent, "gettimeofday failed: %s", strerror(errno)); + err= adns_s_systemfail; + goto x_err; + +x_err: + adns__query_fail(parent, err); +} + +static void qs_addr(adns_query qu, struct timeval now) { + if (!qu->ctx.tinfo.addr.want) { + qu->ctx.tinfo.addr.want= addr_rrtypes(qu->ads, qu->answer->type, + qu->flags); + qu->ctx.tinfo.addr.have= 0; + } + addr_subqueries(qu, now, 0, qu->query_dgram, qu->query_dglen); +} + /* * _domain (pap,csp,cs) * _dom_raw (pa) @@ -343,18 +776,18 @@ char **domain_r, parsedomain_flags flags) { adns_status st; char *dm; - + st= adns__parse_domain(pai->qu->ads, pai->serv, pai->qu, &pai->qu->vb, flags, pai->dgram,pai->dglen, cbyte_io, max); if (st) return st; if (!pai->qu->vb.used) return adns_s_invaliddata; - dm= adns__alloc_interim(pai->qu, (size_t) pai->qu->vb.used+1); + dm= adns__alloc_interim(pai->qu, pai->qu->vb.used+1); if (!dm) R_NOMEM; dm[pai->qu->vb.used]= 0; - memcpy(dm,pai->qu->vb.buf, (size_t) pai->qu->vb.used); - + memcpy(dm,pai->qu->vb.buf,pai->qu->vb.used); + *domain_r= dm; return adns_s_ok; } @@ -370,13 +803,14 @@ return csp_domain(vb,*domainp); } -static adns_status pa_dom_raw(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_dom_raw(const parseinfo *pai, int cbyte, + int max, void *datap) { char **rrp= datap; adns_status st; st= pap_domain(pai, &cbyte, max, rrp, pdf_quoteok); if (st) return st; - + if (cbyte != max) return adns_s_invaliddata; return adns_s_ok; } @@ -385,7 +819,8 @@ * _host_raw (pa) */ -static adns_status pa_host_raw(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_host_raw(const parseinfo *pai, int cbyte, + int max, void *datap) { char **rrp= datap; adns_status st; @@ -392,65 +827,88 @@ st= pap_domain(pai, &cbyte, max, rrp, pai->qu->flags & adns_qf_quoteok_anshost ? pdf_quoteok : 0); if (st) return st; - + if (cbyte != max) return adns_s_invaliddata; return adns_s_ok; } /* - * _hostaddr (pap,pa,dip,di,mfp,mf,csp,cs +icb_hostaddr, pap_findaddrs) + * _hostaddr (pap,pa,dip,di,mfp,mf,csp,cs +pap_findaddrs, icb_hostaddr) */ static adns_status pap_findaddrs(const parseinfo *pai, adns_rr_hostaddr *ha, + unsigned *want_io, size_t addrsz, int *cbyte_io, int count, int dmstart) { int rri, naddrs; - int type, class, rdlen, rdstart, ownermatched; + unsigned typef, want= *want_io, need= want; + int type, class, rdlen, rdend, rdstart, ownermatched; unsigned long ttl; adns_status st; - - for (rri=0, naddrs=-1; rriqu, pai->serv, pai->dgram, pai->dglen, cbyte_io, + + for (rri=0, naddrs=0; rriqu, pai->serv, pai->dgram, + pai->dglen, cbyte_io, &type, &class, &ttl, &rdlen, &rdstart, pai->dgram, pai->dglen, dmstart, &ownermatched); if (st) return st; - if (!ownermatched || class != DNS_CLASS_IN || type != adns_r_a) { - if (naddrs>0) break; else continue; - } - if (naddrs == -1) { - naddrs= 0; - } - if (!adns__vbuf_ensure(&pai->qu->vb, (int) ((naddrs+1)*sizeof(adns_rr_addr)))) R_NOMEM; + if (!ownermatched || class != DNS_CLASS_IN) continue; + typef= addr_rrtypeflag(type); + if (!(want & typef)) continue; + need &= ~typef; + if (!adns__vbuf_ensure(&pai->qu->vb, (naddrs+1)*addrsz)) R_NOMEM; adns__update_expires(pai->qu,ttl,pai->now); - st= pa_addr(pai, rdstart,rdstart+rdlen, - pai->qu->vb.buf + naddrs*sizeof(adns_rr_addr)); + rdend= rdstart + rdlen; + st= pap_addr(pai, type, addrsz, &rdstart, rdend, + (adns_rr_addr *)(pai->qu->vb.buf + naddrs*addrsz)); if (st) return st; + if (rdstart != rdend) return adns_s_invaliddata; naddrs++; } - if (naddrs >= 0) { - ha->addrs= adns__alloc_interim(pai->qu, naddrs*sizeof(adns_rr_addr)); - if (!ha->addrs) R_NOMEM; - memcpy(ha->addrs, pai->qu->vb.buf, naddrs*sizeof(adns_rr_addr)); - ha->naddrs= naddrs; + if (naddrs > 0) { + st= append_addrs(pai->qu, addrsz, &ha->addrs, &ha->naddrs, + (const adns_rr_addr *)pai->qu->vb.buf, naddrs); + if (st) return st; ha->astatus= adns_s_ok; - adns__isort(ha->addrs, naddrs, sizeof(adns_rr_addr), pai->qu->vb.buf, - div_addr, pai->ads); + if (!need) { + adns__isort(ha->addrs, naddrs, addrsz, pai->qu->vb.buf, + div_addr, pai->ads); + } } + *want_io= need; return adns_s_ok; } static void icb_hostaddr(adns_query parent, adns_query child) { adns_answer *cans= child->answer; - adns_rr_hostaddr *rrp= child->ctx.info.hostaddr; + adns_rr_hostaddr *rrp= child->ctx.pinfo.hostaddr; adns_state ads= parent->ads; adns_status st; + size_t addrsz= gsz_addr(0, parent->answer->type); - st= cans->status; + st= cans->status == adns_s_nodata ? adns_s_ok : cans->status; + if (st) goto done; + propagate_ttl(parent, child); + + assert(addrsz == cans->rrsz); + st= append_addrs(parent, addrsz, + &rrp->addrs, &rrp->naddrs, + cans->rrs.addr, cans->nrrs); + if (st) goto done; + if (!rrp->naddrs) { st= adns_s_nodata; goto done; } + + if (!adns__vbuf_ensure(&parent->vb, addrsz)) + { st= adns_s_nomemory; goto done; } + adns__isort(rrp->addrs, rrp->naddrs, addrsz, parent->vb.buf, + div_addr, ads); + +done: + if (st) { + adns__free_interim(parent, rrp->addrs); + rrp->naddrs= (st>0 && st<=adns_s_max_tempfail) ? -1 : 0; + } + rrp->astatus= st; - rrp->naddrs= (st>0 && st<=adns_s_max_tempfail) ? -1 : cans->nrrs; - rrp->addrs= cans->rrs.addr; - adns__transfer_interim(child, parent, rrp->addrs, rrp->naddrs*sizeof(adns_rr_addr)); - if (parent->children.head) { LIST_LINK_TAIL(ads->childw,parent); } else { @@ -466,6 +924,8 @@ int id; adns_query nqu; adns_queryflags nflags; + unsigned want; + size_t addrsz= gsz_addr(0, pai->qu->answer->type); dmstart= cbyte= *cbyte_io; st= pap_domain(pai, &cbyte, max, &rrp->host, @@ -474,18 +934,20 @@ *cbyte_io= cbyte; rrp->astatus= adns_s_ok; - rrp->naddrs= -1; + rrp->naddrs= 0; rrp->addrs= 0; cbyte= pai->nsstart; - st= pap_findaddrs(pai, rrp, &cbyte, pai->nscount, dmstart); + want= addr_rrtypes(pai->ads, pai->qu->answer->type, pai->qu->flags); + + st= pap_findaddrs(pai, rrp, &want, addrsz, &cbyte, pai->nscount, dmstart); if (st) return st; - if (rrp->naddrs != -1) return adns_s_ok; + if (!want) return adns_s_ok; - st= pap_findaddrs(pai, rrp, &cbyte, pai->arcount, dmstart); + st= pap_findaddrs(pai, rrp, &want, addrsz, &cbyte, pai->arcount, dmstart); if (st) return st; - if (rrp->naddrs != -1) return adns_s_ok; + if (!want) return adns_s_ok; st= adns__mkquery_frdgram(pai->ads, &pai->qu->vb, &id, pai->dgram, pai->dglen, dmstart, @@ -494,22 +956,21 @@ ctx.ext= 0; ctx.callback= icb_hostaddr; - ctx.info.hostaddr= rrp; - - nflags= adns_qf_quoteok_query; + ctx.pinfo.hostaddr= rrp; + + nflags= adns_qf_quoteok_query | (pai->qu->flags & (adns_qf_want_allaf | + adns_qf_ipv6_mapv4)); if (!(pai->qu->flags & adns_qf_cname_loose)) nflags |= adns_qf_cname_forbid; - - st= adns__internal_submit(pai->ads, &nqu, adns__findtype(adns_r_addr), - &pai->qu->vb, id, nflags, pai->now, &ctx); + + st= addr_submit(pai->qu, &nqu, &pai->qu->vb, id, want, + nflags, pai->now, &ctx); if (st) return st; - nqu->parent= pai->qu; - LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.); - return adns_s_ok; } -static adns_status pa_hostaddr(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_hostaddr(const parseinfo *pai, int cbyte, + int max, void *datap) { adns_rr_hostaddr *rrp= datap; adns_status st; @@ -520,18 +981,16 @@ return adns_s_ok; } -static int dip_hostaddr(adns_state ads, const adns_rr_hostaddr *ap, const adns_rr_hostaddr *bp) { +static int dip_hostaddr(adns_state ads, + const adns_rr_hostaddr *ap, const adns_rr_hostaddr *bp) { if (ap->astatus != bp->astatus) return ap->astatus; if (ap->astatus) return 0; - assert(ap->addrs[0].addr.sa.sa_family == AF_INET); - assert(bp->addrs[0].addr.sa.sa_family == AF_INET); - return dip_inaddr(ads, - ap->addrs[0].addr.inet.sin_addr, - bp->addrs[0].addr.inet.sin_addr); + return dip_sockaddr(ads, &ap->addrs[0].addr.sa, &bp->addrs[0].addr.sa); } -static int di_hostaddr(adns_state ads, const void *datap_a, const void *datap_b) { +static int di_hostaddr(adns_state ads, + const void *datap_a, const void *datap_b) { const adns_rr_hostaddr *ap= datap_a, *bp= datap_b; return dip_hostaddr(ads, ap,bp); @@ -539,10 +998,11 @@ static void mfp_hostaddr(adns_query qu, adns_rr_hostaddr *rrp) { void *tablev; + size_t addrsz= gsz_addr(0, qu->answer->type); adns__makefinal_str(qu,&rrp->host); tablev= rrp->addrs; - adns__makefinal_block(qu, &tablev, rrp->naddrs*sizeof(*rrp->addrs)); + adns__makefinal_block(qu, &tablev, rrp->naddrs*addrsz); rrp->addrs= tablev; } @@ -570,8 +1030,8 @@ CSP_ADDSTR(" "); errstr= adns_strerror(rrp->astatus); - st= csp_qstring(vb,errstr,(int)strlen(errstr)); if (st) return st; - + st= csp_qstring(vb,errstr,strlen(errstr)); if (st) return st; + if (rrp->naddrs >= 0) { CSP_ADDSTR(" ("); for (i=0; inaddrs; i++) { @@ -595,7 +1055,8 @@ * _mx_raw (pa,di) */ -static adns_status pa_mx_raw(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_mx_raw(const parseinfo *pai, int cbyte, + int max, void *datap) { const byte *dgram= pai->dgram; adns_rr_intstr *rrp= datap; adns_status st; @@ -607,7 +1068,7 @@ st= pap_domain(pai, &cbyte, max, &rrp->str, pai->qu->flags & adns_qf_quoteok_anshost ? pdf_quoteok : 0); if (st) return st; - + if (cbyte != max) return adns_s_invaliddata; return adns_s_ok; } @@ -624,7 +1085,8 @@ * _mx (pa,di) */ -static adns_status pa_mx(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_mx(const parseinfo *pai, int cbyte, + int max, void *datap) { const byte *dgram= pai->dgram; adns_rr_inthostaddr *rrp= datap; adns_status st; @@ -635,7 +1097,7 @@ rrp->i= pref; st= pap_hostaddr(pai, &cbyte, max, &rrp->ha); if (st) return st; - + if (cbyte != max) return adns_s_invaliddata; return adns_s_ok; } @@ -682,12 +1144,29 @@ } /* - * _ptr (pa, +icb_ptr) + * _ptr (ckl,pa +icb_ptr) */ +static adns_status ckl_ptr(adns_state ads, adns_queryflags flags, + union checklabel_state *cls, qcontext *ctx, + int labnum, const char *dgram, + int labstart, int lablen) { + if (lablen) { + if (!adns__revparse_label(&cls->ptr, labnum, dgram,labstart,lablen)) + return adns_s_querydomainwrong; + } else { + if (!adns__revparse_done(&cls->ptr, dgram, labnum, + &ctx->tinfo.ptr.rev_rrtype, + &ctx->tinfo.ptr.addr)) + return adns_s_querydomainwrong; + } + return adns_s_ok; +} + static void icb_ptr(adns_query parent, adns_query child) { adns_answer *cans= child->answer; - const adns_rr_addr *queried, *found; + const adns_sockaddr *queried; + const unsigned char *found; adns_state ads= parent->ads; int i; @@ -699,10 +1178,10 @@ return; } - queried= &parent->ctx.info.ptr_parent_addr; - for (i=0, found=cans->rrs.addr; inrrs; i++, found++) { - if (queried->len == found->len && - !memcmp(&queried->addr,&found->addr,(size_t) queried->len)) { + queried= &parent->ctx.tinfo.ptr.addr; + for (i=0, found=cans->rrs.bytes; inrrs; i++, found+=cans->rrsz) { + if (adns__addrs_equal_raw(&queried->sa, + parent->ctx.tinfo.ptr.addr.sa.sa_family,found)) { if (!parent->children.head) { adns__query_done(parent); return; @@ -716,17 +1195,12 @@ adns__query_fail(parent,adns_s_inconsistent); } -static adns_status pa_ptr(const parseinfo *pai, int dmstart, int max, void *datap) { - static const char *(expectdomain[])= { DNS_INADDR_ARPA }; - +static adns_status pa_ptr(const parseinfo *pai, int dmstart, + int max, void *datap) { char **rrp= datap; adns_status st; - adns_rr_addr *ap; - findlabel_state fls; - char *ep; - byte ipv[4]; - char labbuf[4]; - int cbyte, i, lablen, labstart, l, id; + adns_rrtype rrtype= pai->qu->ctx.tinfo.ptr.rev_rrtype; + int cbyte, id; adns_query nqu; qcontext ctx; @@ -736,50 +1210,21 @@ if (st) return st; if (cbyte != max) return adns_s_invaliddata; - ap= &pai->qu->ctx.info.ptr_parent_addr; - if (!ap->len) { - adns__findlabel_start(&fls, pai->ads, -1, pai->qu, - pai->qu->query_dgram, pai->qu->query_dglen, - pai->qu->query_dglen, DNS_HDRSIZE, 0); - for (i=0; i<4; i++) { - st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st); - if (lablen<=0 || lablen>3) return adns_s_querydomainwrong; - memcpy(labbuf, pai->qu->query_dgram + labstart, (size_t) lablen); labbuf[lablen]= 0; - ipv[3-i]= (unsigned char)strtoul(labbuf,&ep,10); if (*ep) return adns_s_querydomainwrong; - if (lablen>1 && pai->qu->query_dgram[labstart]=='0') - return adns_s_querydomainwrong; - } - for (i=0; i<(int)sizeof(expectdomain)/(int)sizeof(*expectdomain); i++) { - st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st); - l= strlen(expectdomain[i]); - if (lablen != l || memcmp(pai->qu->query_dgram + labstart, expectdomain[i], (size_t)l)) - return adns_s_querydomainwrong; - } - st= adns__findlabel_next(&fls,&lablen,0); assert(!st); - if (lablen) return adns_s_querydomainwrong; - - ap->len= sizeof(struct sockaddr_in); - memset(&ap->addr,0,sizeof(ap->addr.inet)); - ap->addr.inet.sin_family= AF_INET; - ap->addr.inet.sin_addr.s_addr= - htonl((u_long)(ipv[0]<<24) | (ipv[1]<<16) | (ipv[2]<<8) | (ipv[3])); - } - st= adns__mkquery_frdgram(pai->ads, &pai->qu->vb, &id, pai->dgram, pai->dglen, dmstart, - adns_r_addr, adns_qf_quoteok_query); + rrtype, adns_qf_quoteok_query); if (st) return st; ctx.ext= 0; ctx.callback= icb_ptr; - memset(&ctx.info,0,(size_t) sizeof(ctx.info)); - st= adns__internal_submit(pai->ads, &nqu, adns__findtype(adns_r_addr), - &pai->qu->vb, id, + memset(&ctx.pinfo,0,sizeof(ctx.pinfo)); + memset(&ctx.tinfo,0,sizeof(ctx.tinfo)); + st= adns__internal_submit(pai->ads, &nqu, pai->qu, + adns__findtype(rrtype), + rrtype, &pai->qu->vb, id, adns_qf_quoteok_query, pai->now, &ctx); if (st) return st; - nqu->parent= pai->qu; - LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.); return adns_s_ok; } @@ -809,7 +1254,8 @@ * _hinfo (pa) */ -static adns_status pa_hinfo(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_hinfo(const parseinfo *pai, int cbyte, + int max, void *datap) { adns_rr_intstrpair *rrp= datap; adns_status st; int i; @@ -820,16 +1266,16 @@ } if (cbyte != max) return adns_s_invaliddata; - + return adns_s_ok; } /* - * _mailbox (pap,cs) + * _mailbox (pap,cs +pap_mailbox822) */ -static adns_status pap_mailbox822(const parseinfo *pai, int *cbyte_io, int max, - char **mb_r) { +static adns_status pap_mailbox822(const parseinfo *pai, + int *cbyte_io, int max, char **mb_r) { int lablen, labstart, i, needquote, c, r, neednorm; const unsigned char *p; char *str; @@ -860,13 +1306,13 @@ if (needquote || neednorm) { r= adns__vbuf_ensure(vb, lablen+needquote+4); if (!r) R_NOMEM; - adns__vbuf_appendq(vb,(byte*)"\"",1); + adns__vbuf_appendq(vb,"\"",1); for (i=0, needquote=0, p= pai->dgram+labstart; idgram+labstart, lablen); if (!r) R_NOMEM; } @@ -877,8 +1323,8 @@ if (st) return st; x_ok: - str= adns__alloc_interim(pai->qu, (size_t) vb->used+1); if (!str) R_NOMEM; - memcpy(str,vb->buf,(size_t) vb->used); + str= adns__alloc_interim(pai->qu, vb->used+1); if (!str) R_NOMEM; + memcpy(str,vb->buf,vb->used); str[vb->used]= 0; *mb_r= str; return adns_s_ok; @@ -886,7 +1332,7 @@ static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max, char **mb_r) { - if (pai->qu->typei->type & adns__qtf_mail822) { + if (pai->qu->typei->typekey & adns__qtf_mail822) { return pap_mailbox822(pai, cbyte_io, max, mb_r); } else { return pap_domain(pai, cbyte_io, max, mb_r, pdf_quoteok); @@ -901,7 +1347,8 @@ * _rp (pa,cs) */ -static adns_status pa_rp(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_rp(const parseinfo *pai, int cbyte, + int max, void *datap) { adns_rr_strpair *rrp= datap; adns_status st; @@ -924,13 +1371,14 @@ st= csp_domain(vb,rrp->array[1]); if (st) return st; return adns_s_ok; -} +} /* * _soa (pa,mf,cs) */ -static adns_status pa_soa(const parseinfo *pai, int cbyte, int max, void *datap) { +static adns_status pa_soa(const parseinfo *pai, int cbyte, + int max, void *datap) { adns_rr_soa *rrp= datap; const byte *dgram= pai->dgram; adns_status st; @@ -944,7 +1392,7 @@ if (st) return st; if (cbyte+20 != max) return adns_s_invaliddata; - + for (i=0; i<5; i++) { GET_W(cbyte,msw); GET_W(cbyte,lsw); @@ -966,7 +1414,7 @@ char buf[20]; int i; adns_status st; - + st= csp_domain(vb,rrp->mname); if (st) return st; CSP_ADDSTR(" "); st= csp_mailbox(vb,rrp->rname); if (st) return st; @@ -980,6 +1428,220 @@ } /* + * _srv* (ckl,(pap),pa*2,mf*2,di,(csp),cs*2,postsort) + */ + +static adns_status ckl_srv(adns_state ads, adns_queryflags flags, + union checklabel_state *cls, qcontext *ctx, + int labnum, const char *dgram, + int labstart, int lablen) { + const char *label = dgram+labstart; + if (labnum < 2) { + if (flags & adns_qf_quoteok_query) return adns_s_ok; + if (!lablen || label[0] != '_') return adns_s_querydomaininvalid; + return adns_s_ok; + } + return adns__ckl_hostname(ads,flags, cls,ctx, labnum, dgram,labstart,lablen); +} + +static adns_status pap_srv_begin(const parseinfo *pai, int *cbyte_io, int max, + adns_rr_srvha *rrp + /* might be adns_rr_srvraw* */) { + const byte *dgram= pai->dgram; + int ti, cbyte; + + cbyte= *cbyte_io; + if ((*cbyte_io += 6) > max) return adns_s_invaliddata; + + rrp->priority= GET_W(cbyte, ti); + rrp->weight= GET_W(cbyte, ti); + rrp->port= GET_W(cbyte, ti); + return adns_s_ok; +} + +static adns_status pa_srvraw(const parseinfo *pai, int cbyte, + int max, void *datap) { + adns_rr_srvraw *rrp= datap; + adns_status st; + + st= pap_srv_begin(pai,&cbyte,max,datap); + if (st) return st; + + st= pap_domain(pai, &cbyte, max, &rrp->host, + pai->qu->flags & adns_qf_quoteok_anshost ? pdf_quoteok : 0); + if (st) return st; + + if (cbyte != max) return adns_s_invaliddata; + return adns_s_ok; +} + +static adns_status pa_srvha(const parseinfo *pai, int cbyte, + int max, void *datap) { + adns_rr_srvha *rrp= datap; + adns_status st; + + st= pap_srv_begin(pai,&cbyte,max,datap); if (st) return st; + st= pap_hostaddr(pai, &cbyte, max, &rrp->ha); if (st) return st; + if (cbyte != max) return adns_s_invaliddata; + return adns_s_ok; +} + +static void mf_srvraw(adns_query qu, void *datap) { + adns_rr_srvraw *rrp= datap; + adns__makefinal_str(qu, &rrp->host); +} + +static void mf_srvha(adns_query qu, void *datap) { + adns_rr_srvha *rrp= datap; + mfp_hostaddr(qu,&rrp->ha); +} + +static int di_srv(adns_state ads, const void *datap_a, const void *datap_b) { + const adns_rr_srvraw *ap= datap_a, *bp= datap_b; + /* might be const adns_rr_svhostaddr* */ + + if (ap->priority < bp->priority) return 0; + if (ap->priority > bp->priority) return 1; + return 0; +} + +static adns_status csp_srv_begin(vbuf *vb, const adns_rr_srvha *rrp + /* might be adns_rr_srvraw* */) { + char buf[30]; + sprintf(buf,"%u %u %u ", rrp->priority, rrp->weight, rrp->port); + CSP_ADDSTR(buf); + return adns_s_ok; +} + +static adns_status cs_srvraw(vbuf *vb, const void *datap) { + const adns_rr_srvraw *rrp= datap; + adns_status st; + + st= csp_srv_begin(vb,(const void*)rrp); if (st) return st; + return csp_domain(vb,rrp->host); +} + +static adns_status cs_srvha(vbuf *vb, const void *datap) { + const adns_rr_srvha *rrp= datap; + adns_status st; + + st= csp_srv_begin(vb,(const void*)datap); if (st) return st; + return csp_hostaddr(vb,&rrp->ha); +} + +static void postsort_srv(adns_state ads, void *array, int nrrs,int rrsz, + const struct typeinfo *typei) { + /* we treat everything in the array as if it were an adns_rr_srvha + * even though the array might be of adns_rr_srvraw. That's OK + * because they have the same prefix, which is all we access. + * We use rrsz, too, rather than naive array indexing, of course. + */ + char *workbegin, *workend, *search, *arrayend; + const adns_rr_srvha *rr; + union { adns_rr_srvha ha; adns_rr_srvraw raw; } rrtmp; + int cpriority, totalweight, runtotal; + long randval; + + assert(rrsz <= sizeof(rrtmp)); + for (workbegin= array, arrayend= workbegin + rrsz * nrrs; + workbegin < arrayend; + workbegin= workend) { + cpriority= (rr=(void*)workbegin)->priority; + + for (workend= workbegin, totalweight= 0; + workend < arrayend && (rr=(void*)workend)->priority == cpriority; + workend += rrsz) { + totalweight += rr->weight; + } + + /* Now workbegin..(workend-1) incl. are exactly all of the RRs of + * cpriority. From now on, workbegin points to the `remaining' + * records: we select one record at a time (RFC2782 `Usage rules' + * and `Format of the SRV RR' subsection `Weight') to place at + * workbegin (swapping with the one that was there, and then + * advance workbegin. */ + for (; + workbegin + rrsz < workend; /* don't bother if just one */ + workbegin += rrsz) { + + randval= nrand48(ads->rand48xsubi); + randval %= (totalweight + 1); + /* makes it into 0..totalweight inclusive; with 2^10 RRs, + * totalweight must be <= 2^26 so probability nonuniformity is + * no worse than 1 in 2^(31-26) ie 1 in 2^5, ie + * abs(log(P_intended(RR_i) / P_actual(RR_i)) <= log(2^-5). + */ + + for (search=workbegin, runtotal=0; + (runtotal += (rr=(void*)search)->weight) < randval; + search += rrsz); + assert(search < arrayend); + totalweight -= rr->weight; + if (search != workbegin) { + memcpy(&rrtmp, workbegin, rrsz); + memcpy(workbegin, search, rrsz); + memcpy(search, &rrtmp, rrsz); + } + } + } + /* tests: + * dig -t srv _srv._tcp.test.iwj.relativity.greenend.org.uk. + * ./adnshost_s -t srv- _sip._udp.voip.net.cam.ac.uk. + * ./adnshost_s -t srv- _jabber._tcp.jabber.org + */ +} + +/* + * _byteblock (mf) + */ + +static void mf_byteblock(adns_query qu, void *datap) { + adns_rr_byteblock *rrp= datap; + void *bytes= rrp->data; + adns__makefinal_block(qu,&bytes,rrp->len); + rrp->data= bytes; +} + +/* + * _opaque (pa,cs) + */ + +static adns_status pa_opaque(const parseinfo *pai, int cbyte, + int max, void *datap) { + adns_rr_byteblock *rrp= datap; + + rrp->len= max - cbyte; + rrp->data= adns__alloc_interim(pai->qu, rrp->len); + if (!rrp->data) R_NOMEM; + memcpy(rrp->data, pai->dgram + cbyte, rrp->len); + return adns_s_ok; +} + +static adns_status cs_opaque(vbuf *vb, const void *datap) { + const adns_rr_byteblock *rrp= datap; + char buf[10]; + int l; + unsigned char *p; + + sprintf(buf,"\\# %d",rrp->len); + CSP_ADDSTR(buf); + + for (l= rrp->len, p= rrp->data; + l>=4; + l -= 4, p += 4) { + sprintf(buf," %02x%02x%02x%02x",p[0],p[1],p[2],p[3]); + CSP_ADDSTR(buf); + } + for (; + l>0; + l--, p++) { + sprintf(buf," %02x",*p); + CSP_ADDSTR(buf); + } + return adns_s_ok; +} + +/* * _flat (mf) */ @@ -991,46 +1653,90 @@ #define TYPESZ_M(member) (sizeof(*((adns_answer*)0)->rrs.member)) -#define DEEP_MEMB(memb) TYPESZ_M(memb), mf_##memb, cs_##memb -#define FLAT_MEMB(memb) TYPESZ_M(memb), mf_flat, cs_##memb +#define DEEP_TYPE(code,rrt,fmt,memb,parser,comparer,/*printer*/...) \ + { adns_r_##code&adns_rrt_reprmask, rrt,fmt,TYPESZ_M(memb), mf_##memb, \ + GLUE(cs_, CAR(__VA_ARGS__)),pa_##parser,di_##comparer, \ + adns__ckl_hostname, 0, adns__getrrsz_default, adns__query_send, \ + CDR(__VA_ARGS__) } +#define FLAT_TYPE(code,rrt,fmt,memb,parser,comparer,/*printer*/...) \ + { adns_r_##code&adns_rrt_reprmask, rrt,fmt,TYPESZ_M(memb), mf_flat, \ + GLUE(cs_, CAR(__VA_ARGS__)),pa_##parser,di_##comparer, \ + adns__ckl_hostname, 0, adns__getrrsz_default, adns__query_send, \ + CDR(__VA_ARGS__) } -#define DEEP_TYPE(code,rrt,fmt,memb,parser,comparer,printer) \ - { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_##memb, printer, parser, comparer } -#define FLAT_TYPE(code,rrt,fmt,memb,parser,comparer,printer) \ - { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_flat, printer, parser, comparer } +#define di_0 0 static const typeinfo typeinfos[] = { /* Must be in ascending order of rrtype ! */ -/* mem-mgmt code rrt fmt member parser comparer printer */ +/* mem-mgmt code rrt fmt member parser comparer printer */ -FLAT_TYPE(a, "A", 0, inaddr, pa_inaddr, di_inaddr, cs_inaddr ), -DEEP_TYPE(ns_raw, "NS", "raw", str, pa_host_raw,0, cs_domain ), -DEEP_TYPE(cname, "CNAME", 0, str, pa_dom_raw, 0, cs_domain ), -DEEP_TYPE(soa_raw,"SOA", "raw", soa, pa_soa, 0, cs_soa ), -DEEP_TYPE(ptr_raw,"PTR", "raw", str, pa_host_raw,0, cs_domain ), -DEEP_TYPE(hinfo, "HINFO", 0, intstrpair, pa_hinfo, 0, cs_hinfo ), -DEEP_TYPE(mx_raw, "MX", "raw", intstr, pa_mx_raw, di_mx_raw, cs_inthost ), -DEEP_TYPE(txt, "TXT", 0, manyistr, pa_txt, 0, cs_txt ), -DEEP_TYPE(rp_raw, "RP", "raw", strpair, pa_rp, 0, cs_rp ), +FLAT_TYPE(a, "A", 0, inaddr, inaddr, inaddr,inaddr ), +DEEP_TYPE(ns_raw, "NS", "raw",str, host_raw,0, domain ), +DEEP_TYPE(cname, "CNAME", 0, str, dom_raw, 0, domain ), +DEEP_TYPE(soa_raw,"SOA", "raw",soa, soa, 0, soa ), +DEEP_TYPE(ptr_raw,"PTR", "raw",str, host_raw,0, domain ), +DEEP_TYPE(hinfo, "HINFO", 0, intstrpair,hinfo, 0, hinfo ), +DEEP_TYPE(mx_raw, "MX", "raw",intstr, mx_raw, mx_raw,inthost ), +DEEP_TYPE(txt, "TXT", 0, manyistr, txt, 0, txt ), +DEEP_TYPE(rp_raw, "RP", "raw",strpair, rp, 0, rp ), +#ifdef WITH_IPV6 +FLAT_TYPE(aaaa, "AAAA", 0, in6addr, in6addr, in6addr,in6addr ), +DEEP_TYPE(srv_raw,"SRV", "raw",srvraw , srvraw, srv, srvraw, + .checklabel= ckl_srv, .postsort= postsort_srv), -FLAT_TYPE(addr, "A", "addr", addr, pa_addr, di_addr, cs_addr ), -DEEP_TYPE(ns, "NS", "+addr", hostaddr, pa_hostaddr,di_hostaddr,cs_hostaddr ), -DEEP_TYPE(ptr, "PTR","checked",str, pa_ptr, 0, cs_domain ), -DEEP_TYPE(mx, "MX", "+addr", inthostaddr,pa_mx, di_mx, cs_inthostaddr), +FLAT_TYPE(addr, "A", "addr", addr, addr, addr, addr, + .getrrsz= gsz_addr, .query_send= qs_addr), +#else +DEEP_TYPE(srv_raw,"SRV", "raw",srvraw , srvraw, srv, srvraw ), -DEEP_TYPE(soa, "SOA","822", soa, pa_soa, 0, cs_soa ), -DEEP_TYPE(rp, "RP", "822", strpair, pa_rp, 0, cs_rp ), +FLAT_TYPE(addr, "A", "addr", addr, addr, addr, addr ), +#endif +DEEP_TYPE(ns, "NS", "+addr",hostaddr, hostaddr,hostaddr,hostaddr ), +#ifdef WITH_IPV6 +DEEP_TYPE(ptr, "PTR","checked",str, ptr, 0, domain, + .checklabel= ckl_ptr), +#else +DEEP_TYPE(ptr, "PTR","checked",str, ptr, 0, domain ), +#endif +DEEP_TYPE(mx, "MX", "+addr",inthostaddr,mx, mx, inthostaddr ), +#ifdef WITH_IPV6 +DEEP_TYPE(srv, "SRV","+addr",srvha, srvha, srv, srvha, + .checklabel= ckl_srv, .postsort= postsort_srv), +#else +DEEP_TYPE(srv, "SRV","+addr",srvha, srvha, srv, srvha ), +#endif + +DEEP_TYPE(soa, "SOA","822", soa, soa, 0, soa ), +DEEP_TYPE(rp, "RP", "822", strpair, rp, 0, rp ), }; +static const typeinfo tinfo_addrsub = +#ifdef WITH_IPV6 +FLAT_TYPE(none, "","sub",addr, addr, 0, addr, + .getrrsz= gsz_addr); +#else +FLAT_TYPE(none, "","sub",addr, addr, 0, addr ); +#endif + +static const typeinfo typeinfo_unknown= +DEEP_TYPE(unknown,0, "unknown",byteblock,opaque, 0, opaque ); + const typeinfo *adns__findtype(adns_rrtype type) { const typeinfo *begin, *end, *mid; + if (type & ~(adns_rrtype)0x63ffffff) + /* 0x60000000 is reserved for `harmless' future expansion */ + return 0; + + if (type & adns_r_unknown) return &typeinfo_unknown; + type &= adns_rrt_reprmask; + begin= typeinfos; end= typeinfos+(sizeof(typeinfos)/sizeof(typeinfo)); while (begin < end) { mid= begin + ((end-begin)>>1); - if (mid->type == type) return mid; - if (type > mid->type) begin= mid+1; + if (mid->typekey == type) return mid; + if (type > mid->typekey) begin= mid+1; else end= mid; } return 0; Index: sdk/lib/3rdparty/adns/TODO =================================================================== --- sdk/lib/3rdparty/adns/TODO (revision 72742) +++ sdk/lib/3rdparty/adns/TODO (working copy) @@ -8,4 +8,7 @@ * IPv6 transport. * Threadsafe version/mode. * Caching in the library. -* SRV RRs. +* Make port configurable in config file. +* `Nameserver sent bad response' should produce a hexdump in the log + (see eg mail to ian@davenant Mon, 25 Oct 2004 14:19:46 +0100 re + `compressed datagram contains loop')