diff options
author | Roland McGrath <roland@gnu.org> | 1995-07-26 10:14:02 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-07-26 10:14:02 +0000 |
commit | 3d61b63cc722951e3a5261e6bc3f0488eb35d441 (patch) | |
tree | 19195b08df7f3f992f0d539205df60ff690cd0f6 | |
parent | 958f803fc021993cc2ee1d4157d0092b830368aa (diff) | |
download | glibc-3d61b63cc722951e3a5261e6bc3f0488eb35d441.tar.gz |
* asia, backward, europe, leapseconds, southamerica: New data from
ADO's 95e.
* inet/Makefile (routines): Removed inet_addr.
* inet/inet_addr.c: Moved to resolv/ subdirectory.
* resolv/Makefile (routines): Added inet_addr.
* resolv/inet_addr.c: Incorporated from BIND 4.9.3-BETA24 release.
* resolv/gethnamaddr.c: Likewise.
* resolv/getnetbyaddr.c: Likewise.
* resolv/getnetbyname.c: Likewise.
* resolv/getnetent.c: Likewise.
* resolv/getnetnamadr.c: Likewise.
* resolv/herror.c: Likewise.
* resolv/nsap_addr.c: Likewise.
* resolv/res_comp.c: Likewise.
* resolv/res_debug.c: Likewise.
* resolv/res_init.c: Likewise.
* resolv/res_mkquery.c: Likewise.
* resolv/res_query.c: Likewise.
* resolv/res_send.c: Likewise.
* resolv/resolv.h: Likewise.
* resolv/sethostent.c: Likewise.
* resolv/arpa/nameser.h: Likewise.
* inet/netdb.h: Incorporated from BIND 4.9.3-BETA24 release.
[__GNU_LIBRARY__]: Include <rpc/netdb.h> instead of repeating
its declarations (and doing so only #ifdef sun!).
* posix/sys/types.h [__USE_BSD] (__BIT_TYPES_DEFINED__): New macro.
[__USE_BSD] [__GNUC__] (int64_t, u_int64_t, register_t): New typedefs.
-rw-r--r-- | ChangeLog | 30 | ||||
-rw-r--r-- | inet/Makefile | 2 | ||||
-rw-r--r-- | inet/netdb.h | 44 | ||||
-rw-r--r-- | posix/sys/types.h | 19 | ||||
-rw-r--r-- | resolv/Makefile | 4 | ||||
-rw-r--r-- | resolv/arpa/nameser.h | 8 | ||||
-rw-r--r-- | resolv/gethnamaddr.c | 23 | ||||
-rw-r--r-- | resolv/getnetbyname.c | 4 | ||||
-rw-r--r-- | resolv/getnetnamadr.c | 19 | ||||
-rw-r--r-- | resolv/herror.c | 6 | ||||
-rw-r--r-- | resolv/inet_addr.c (renamed from inet/inet_addr.c) | 83 | ||||
-rw-r--r-- | resolv/nsap_addr.c | 1 | ||||
-rw-r--r-- | resolv/res_comp.c | 6 | ||||
-rw-r--r-- | resolv/res_debug.c | 70 | ||||
-rw-r--r-- | resolv/res_init.c | 67 | ||||
-rw-r--r-- | resolv/res_mkquery.c | 12 | ||||
-rw-r--r-- | resolv/res_query.c | 7 | ||||
-rw-r--r-- | resolv/res_send.c | 42 | ||||
-rw-r--r-- | resolv/resolv.h | 9 | ||||
-rw-r--r-- | resolv/sethostent.c | 36 | ||||
-rw-r--r-- | time/asia | 49 | ||||
-rw-r--r-- | time/backward | 3 | ||||
-rw-r--r-- | time/europe | 9 | ||||
-rw-r--r-- | time/leapseconds | 3 | ||||
-rw-r--r-- | time/southamerica | 54 |
25 files changed, 405 insertions, 205 deletions
@@ -1,5 +1,35 @@ Wed Jul 26 02:00:29 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + * asia, backward, europe, leapseconds, southamerica: New data from + ADO's 95e. + + * inet/Makefile (routines): Removed inet_addr. + * inet/inet_addr.c: Moved to resolv/ subdirectory. + * resolv/Makefile (routines): Added inet_addr. + * resolv/inet_addr.c: Incorporated from BIND 4.9.3-BETA24 release. + * resolv/gethnamaddr.c: Likewise. + * resolv/getnetbyaddr.c: Likewise. + * resolv/getnetbyname.c: Likewise. + * resolv/getnetent.c: Likewise. + * resolv/getnetnamadr.c: Likewise. + * resolv/herror.c: Likewise. + * resolv/nsap_addr.c: Likewise. + * resolv/res_comp.c: Likewise. + * resolv/res_debug.c: Likewise. + * resolv/res_init.c: Likewise. + * resolv/res_mkquery.c: Likewise. + * resolv/res_query.c: Likewise. + * resolv/res_send.c: Likewise. + * resolv/resolv.h: Likewise. + * resolv/sethostent.c: Likewise. + * resolv/arpa/nameser.h: Likewise. + * inet/netdb.h: Incorporated from BIND 4.9.3-BETA24 release. + [__GNU_LIBRARY__]: Include <rpc/netdb.h> instead of repeating + its declarations (and doing so only #ifdef sun!). + + * posix/sys/types.h [__USE_BSD] (__BIT_TYPES_DEFINED__): New macro. + [__USE_BSD] [__GNUC__] (int64_t, u_int64_t, register_t): New typedefs. + * malloc/memalign.c: Allocate (SIZE + ALIGNMENT - 1) and then trim if possible. diff --git a/inet/Makefile b/inet/Makefile index 6a308c9b4b..069485b903 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -24,7 +24,7 @@ subdir := inet headers := netinet/in.h $(wildcard arpa/*.h protocols/*.h) netdb.h routines := ntohl ntohs htonl htons \ - inet_addr inet_lnaof inet_mkadr \ + inet_lnaof inet_mkadr \ inet_netof inet_ntoa inet_net \ getproto getprtent getprtname \ getsrvbynm getsrvbypt getservent \ diff --git a/inet/netdb.h b/inet/netdb.h index 21caa894f9..a568e2d6a5 100644 --- a/inet/netdb.h +++ b/inet/netdb.h @@ -1,4 +1,6 @@ -/*- +/* + * ++Copyright++ 1980, 1983, 1988, 1993 + * - * Copyright (c) 1980, 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * @@ -29,19 +31,16 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)netdb.h 8.1 (Berkeley) 6/2/93 - * $Id$ * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -54,15 +53,28 @@ * --Copyright-- */ +/* + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * $Id$ + */ + #ifndef _NETDB_H_ #define _NETDB_H_ +#include <sys/param.h> +#if (!defined(BSD)) || (BSD < 199306) +# include <sys/bitypes.h> +#endif +#include <sys/cdefs.h> + #define _PATH_HEQUIV "/etc/hosts.equiv" #define _PATH_HOSTS "/etc/hosts" #define _PATH_NETWORKS "/etc/networks" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" +extern int h_errno; + /* * Structures returned by network data base library. All addresses are * supplied in host order, and returned in network order (suitable for @@ -106,8 +118,6 @@ struct protoent { * (left in extern int h_errno). */ -extern int h_errno; - #define NETDB_INTERNAL -1 /* see errno */ #define NETDB_SUCCESS 0 /* no problem */ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ @@ -116,8 +126,6 @@ extern int h_errno; #define NO_DATA 4 /* Valid name, no data record of requested type */ #define NO_ADDRESS NO_DATA /* no address, look for MX record */ -#include <sys/cdefs.h> - __BEGIN_DECLS void endhostent __P((void)); void endnetent __P((void)); @@ -136,7 +144,7 @@ struct servent *getservbyname __P((const char *, const char *)); struct servent *getservbyport __P((int, const char *)); struct servent *getservent __P((void)); void herror __P((const char *)); -char *hstrerror __P((int)); +const char *hstrerror __P((int)); void sethostent __P((int)); /* void sethostfile __P((const char *)); */ void setnetent __P((int)); @@ -144,4 +152,18 @@ void setprotoent __P((int)); void setservent __P((int)); __END_DECLS +/* This is nec'y to make this include file properly replace the sun version. */ +#ifdef __GNU_LIBRARY__ +#include <rpc/netdb.h> +#else +#ifdef sun +struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ + int r_number; /* rpc program number */ +}; +struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); +#endif /* sun */ +#endif /* __GNU_LIBRARY__ */ + #endif /* !_NETDB_H_ */ diff --git a/posix/sys/types.h b/posix/sys/types.h index b231de93c5..8178303c66 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -71,12 +71,21 @@ typedef unsigned int uint; #ifdef __USE_BSD /* These size-specific names are used by some of the inet code. */ -typedef int int32_t; -typedef short int int16_t; typedef char int8_t; -typedef unsigned int u_int32_t; -typedef unsigned short int u_int16_t; typedef unsigned char u_int8_t; +typedef short int int16_t; +typedef unsigned short int u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +#ifdef __GNUC__ +typedef long long int int64_t; +typedef unsigned long long int u_int64_t; +typedef int register_t __attribute__ ((__mode__ (word))); +#endif + +/* Some code from BIND tests this macro to see if the types above are + defined. */ +#define __BIT_TYPES_DEFINED__ 1 #endif diff --git a/resolv/Makefile b/resolv/Makefile index 510f16c179..e07cfb0b15 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1994 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -26,6 +26,6 @@ distribute := ../conf/portability.h routines := gethnamaddr getnetbyaddr getnetbyname getnetent getnetnamadr \ herror nsap_addr res_comp res_debug res_init res_mkquery \ - res_query res_send sethostent + res_query res_send sethostent inet_addr include ../Rules diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h index 1a660ade63..3792b7963c 100644 --- a/resolv/arpa/nameser.h +++ b/resolv/arpa/nameser.h @@ -83,7 +83,7 @@ * is new enough to contain a certain feature. */ -#define __BIND 19940417 /* interface version stamp */ +#define __BIND 19950621 /* interface version stamp */ /* * Define constants based on rfc883 @@ -258,8 +258,7 @@ typedef struct { unsigned rd: 1; /* recursion desired */ /* fields in fourth byte */ unsigned ra: 1; /* recursion available */ - unsigned pr: 1; /* primary server req'd (!standard) */ - unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */ unsigned rcode :4; /* response code */ #endif #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN @@ -271,8 +270,7 @@ typedef struct { unsigned qr :1; /* response flag */ /* fields in fourth byte */ unsigned rcode :4; /* response code */ - unsigned unused :2; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned pr :1; /* primary server req'd (!standard) */ + unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */ unsigned ra :1; /* recursion available */ #endif /* remaining bytes */ diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 55a3fb09a4..d3b68f7d95 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -250,10 +250,12 @@ getanswer(answer, anslen, qname, qclass, qtype) continue; } if (type != qtype) { - syslog(LOG_NOTICE|LOG_AUTH, + /* CNAME->PTR should not cause a log message. */ + if (!(qtype == T_PTR && type == T_CNAME)) + syslog(LOG_NOTICE|LOG_AUTH, "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"", - qname, p_class(qclass), p_type(qtype), - p_type(type)); + qname, p_class(qclass), p_type(qtype), + p_type(type)); cp += n; continue; /* XXX - had_error++ ? */ } @@ -380,6 +382,11 @@ gethostbyname(name) int n; extern struct hostent *_gethtbyname(); + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } + /* * if there aren't any dots, it could be a user-level alias. * this is also done in res_query() since we are not the only @@ -406,7 +413,9 @@ gethostbyname(name) h_errno = HOST_NOT_FOUND; return (NULL); } - host.h_name = (char *)name; + strncpy(hostbuf, name, MAXDNAME); + hostbuf[MAXDNAME] = '\0'; + host.h_name = hostbuf; host.h_aliases = host_aliases; host_aliases[0] = NULL; host.h_addrtype = AF_INET; @@ -451,6 +460,10 @@ gethostbyaddr(addr, len, type) #endif /*SUNSECURITY*/ extern struct hostent *_gethtbyaddr(); + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } if (type != AF_INET) { errno = EAFNOSUPPORT; h_errno = NETDB_INTERNAL; @@ -480,7 +493,7 @@ gethostbyaddr(addr, len, type) old_options = _res.options; _res.options &= ~RES_DNSRCH; _res.options |= RES_DEFNAMES; - if (!(rhp = gethostbyname(hp->h_name))) { + if (!(rhp = gethostbyname(hname2))) { syslog(LOG_NOTICE|LOG_AUTH, "gethostbyaddr: No A record for %s (verifying [%s])", hname2, inet_ntoa(*((struct in_addr *)addr))); diff --git a/resolv/getnetbyname.c b/resolv/getnetbyname.c index 1d2029fe6c..cc3f281c5d 100644 --- a/resolv/getnetbyname.c +++ b/resolv/getnetbyname.c @@ -44,11 +44,7 @@ extern int _net_stayopen; struct netent * _getnetbyname(name) -#if (defined(sun) || defined(DGUX)) - register char *name; -#else register const char *name; -#endif { register struct netent *p; register char **cp; diff --git a/resolv/getnetnamadr.c b/resolv/getnetnamadr.c index 19a31afee8..e5cc505d04 100644 --- a/resolv/getnetnamadr.c +++ b/resolv/getnetnamadr.c @@ -56,7 +56,6 @@ static char rcsid[] = "$Id$"; #include <ctype.h> #include <errno.h> #include <string.h> -#include "conf/portability.h" extern int h_errno; @@ -65,11 +64,7 @@ extern int errno; #endif struct netent *_getnetbyaddr __P((long net, int type)); -#if defined(sun) -struct netent *_getnetbyname __P((char *name)); -#else struct netent *_getnetbyname __P((const char *name)); -#endif #define BYADDR 0 #define BYNAME 1 @@ -102,8 +97,7 @@ getnetanswer(answer, anslen, net_i) register u_char *cp; register int n; u_char *eom; - int type, class, buflen, ancount, qdcount, haveanswer, i, nchar, - getclass = C_ANY, net_length = 0; + int type, class, buflen, ancount, qdcount, haveanswer, i, nchar; char aux1[30], aux2[30], ans[30], *in, *st, *pauxt, *bp, **ap, *paux1 = &aux1[0], *paux2 = &aux2[0], flag = 0; static struct netent net_entry; @@ -264,19 +258,18 @@ getnetbyaddr(net, net_type) struct netent * getnetbyname(net) -#if defined(sun) - register char *net; -#else register const char *net; -#endif { - unsigned int netbr[4]; int anslen; querybuf buf; char qbuf[MAXDNAME]; struct netent *net_entry; - strcpy(&qbuf[0],net); + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } + strcpy(&qbuf[0], net); anslen = res_search(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf)); if (anslen < 0) { #ifdef DEBUG diff --git a/resolv/herror.c b/resolv/herror.c index 872a009a18..988e52cbd9 100644 --- a/resolv/herror.c +++ b/resolv/herror.c @@ -68,7 +68,7 @@ static char rcsid[] = "$Id$"; # include "../conf/portability.h" #endif -char *h_errlist[] = { +const char *h_errlist[] = { "Resolver Error 0 (no error)", "Unknown host", /* 1 HOST_NOT_FOUND */ "Host name lookup failure", /* 2 TRY_AGAIN */ @@ -98,7 +98,7 @@ herror(s) v->iov_len = 2; v++; } - v->iov_base = hstrerror(h_errno); + v->iov_base = (char *)hstrerror(h_errno); v->iov_len = strlen(v->iov_base); v++; v->iov_base = "\n"; @@ -106,7 +106,7 @@ herror(s) writev(STDERR_FILENO, iov, (v - iov) + 1); } -char * +const char * hstrerror(err) int err; { diff --git a/inet/inet_addr.c b/resolv/inet_addr.c index 246a418a95..2a15067b07 100644 --- a/inet/inet_addr.c +++ b/resolv/inet_addr.c @@ -1,7 +1,9 @@ /* + * ++Copyright++ 1983, 1990, 1993 + * - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * + * The Regents of the University of California. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,12 +14,12 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -29,16 +31,44 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; +static char rcsid[] = "$Id$"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> #include <netinet/in.h> #include <arpa/inet.h> #include <ctype.h> +#include "../conf/portability.h" + +/* these are compatibility routines, not needed on recent BSD releases */ + +#ifndef NEED_INETADDR +int __inet_addr_unneeded__; +#else /* * Ascii internet address interpretation routine. @@ -54,6 +84,11 @@ inet_addr(cp) return (val.s_addr); return (INADDR_NONE); } +#endif /*NEED_INETADDR*/ + +#ifndef NEED_INETATON +int __inet_aton_unneeded__; +#else /* * Check whether "cp" is a valid ascii representation @@ -73,6 +108,7 @@ inet_aton(cp, addr) u_int parts[4]; register u_int *pp = parts; + c = *cp; for (;;) { /* * Collect number up to ``.''. @@ -80,43 +116,42 @@ inet_aton(cp, addr) * 0x=hex, 0=octal, other=decimal. */ val = 0; base = 10; - if (*cp == '0') { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; + if (c == '0') { + c = *++cp; + if (c == 'x' || c == 'X') + base = 16, c = *++cp; else base = 8; } - while ((c = *cp) != '\0') { + while (c != '\0') { if (isascii(c) && isdigit(c)) { val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isascii(c) && isxdigit(c)) { - val = (val << 4) + + c = *++cp; + } else if (base == 16 && isascii(c) && isxdigit(c)) { + val = (val << 4) | (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; + c = *++cp; + } else + break; } - if (*cp == '.') { + if (c == '.') { /* * Internet format: * a.b.c.d - * a.b.c (with c treated as 16-bits) + * a.b.c (with c treated as 16 bits) * a.b (with b treated as 24 bits) */ if (pp >= parts + 3 || val > 0xff) return (0); - *pp++ = val, cp++; + *pp++ = val; + c = *++cp; } else break; } /* * Check for trailing characters. */ - if (*cp && (!isascii(*cp) || !isspace(*cp))) + if (c && (!isascii(c) || (!isspace(c) && !ispunct(c)))) return (0); /* * Concoct the address according to @@ -125,6 +160,9 @@ inet_aton(cp, addr) n = pp - parts + 1; switch (n) { + case 0: + return (0); /* initial nondigit */ + case 1: /* a -- 32 bits */ break; @@ -150,3 +188,4 @@ inet_aton(cp, addr) addr->s_addr = htonl(val); return (1); } +#endif /*NEED_INETATON*/ diff --git a/resolv/nsap_addr.c b/resolv/nsap_addr.c index ea1850132a..6a8b75c0de 100644 --- a/resolv/nsap_addr.c +++ b/resolv/nsap_addr.c @@ -34,7 +34,6 @@ inet_nsap_addr(ascii, binary, maxlen) int maxlen; { register u_char c, nib; - u_char *start = binary; u_int len = 0; while ((c = *ascii++) != '\0' && len < maxlen) { diff --git a/resolv/res_comp.c b/resolv/res_comp.c index ad24a984a1..aa6afa39eb 100644 --- a/resolv/res_comp.c +++ b/resolv/res_comp.c @@ -340,11 +340,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr) } /* - * Routines to insert/extract short/long's. Must account for byte - * order and non-alignment problems. This code at least has the - * advantage of being portable. - * - * used by sendmail. + * Routines to insert/extract short/long's. */ u_int16_t diff --git a/resolv/res_debug.c b/resolv/res_debug.c index 254e1efc39..602042e198 100644 --- a/resolv/res_debug.c +++ b/resolv/res_debug.c @@ -64,6 +64,7 @@ static char rcsid[] = "$Id$"; #include <arpa/nameser.h> #include <stdio.h> +#include <netdb.h> #include <resolv.h> #if defined(BSD) && (BSD >= 199103) # include <string.h> @@ -113,12 +114,13 @@ const char *_res_resultcodes[] = { "NOCHANGE", }; -static char retbuf[16]; - +/* XXX: we should use getservbyport() instead. */ static const char * dewks(wks) int wks; { + static char nbuf[20]; + switch (wks) { case 5: return "rje"; case 7: return "echo"; @@ -166,14 +168,17 @@ dewks(wks) case 161: return "snmp"; case 162: return "snmp-trap"; case 170: return "print-srv"; - default: (void) sprintf(retbuf, "%d", wks); return (retbuf); + default: (void) sprintf(nbuf, "%d", wks); return (nbuf); } } +/* XXX: we should use getprotobynumber() instead. */ static const char * deproto(protonum) int protonum; { + static char nbuf[20]; + switch (protonum) { case 1: return "icmp"; case 2: return "igmp"; @@ -187,13 +192,13 @@ deproto(protonum) case 12: return "pup"; case 16: return "chaos"; case 17: return "udp"; - default: (void) sprintf(retbuf, "%d", protonum); return (retbuf); + default: (void) sprintf(nbuf, "%d", protonum); return (nbuf); } } static const u_char * -do_rrset(msg, cp, cnt, pflag, file, hs) - int cnt, pflag; +do_rrset(msg, len, cp, cnt, pflag, file, hs) + int cnt, pflag, len; const u_char *cp, *msg; const char *hs; FILE *file; @@ -222,7 +227,7 @@ do_rrset(msg, cp, cnt, pflag, file, hs) cp += INT16SZ; cp += dlen; } - if ((cp - msg) > PACKETSZ) + if ((cp - msg) > len) return (NULL); } if ((!_res.pfcode) || @@ -285,6 +290,9 @@ __fp_nquery(msg, len, file) register const HEADER *hp; register int n; + if ((_res.options & RES_INIT) == 0 && res_init() == -1) + return; + #define TruncTest(x) if (x >= endMark) goto trunc #define ErrorTest(x) if (x == NULL) goto error @@ -314,8 +322,6 @@ __fp_nquery(msg, len, file) fprintf(file, " rd"); if (hp->ra) fprintf(file, " ra"); - if (hp->pr) - fprintf(file, " pr"); } if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD1)) { fprintf(file, "; Ques: %d", ntohs(hp->qdcount)); @@ -336,7 +342,7 @@ __fp_nquery(msg, len, file) while (--n >= 0) { fprintf(file, ";;\t"); TruncTest(cp); - cp = p_cdname(cp, msg, file); + cp = p_cdnname(cp, msg, len, file); ErrorTest(cp); TruncTest(cp); if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES)) @@ -355,7 +361,7 @@ __fp_nquery(msg, len, file) * Print authoritative answer records */ TruncTest(cp); - cp = do_rrset(msg, cp, hp->ancount, RES_PRF_ANS, file, + cp = do_rrset(msg, len, cp, hp->ancount, RES_PRF_ANS, file, ";; ANSWERS:\n"); ErrorTest(cp); @@ -363,7 +369,7 @@ __fp_nquery(msg, len, file) * print name server records */ TruncTest(cp); - cp = do_rrset(msg, cp, hp->nscount, RES_PRF_AUTH, file, + cp = do_rrset(msg, len, cp, hp->nscount, RES_PRF_AUTH, file, ";; AUTHORITY RECORDS:\n"); ErrorTest(cp); @@ -371,7 +377,7 @@ __fp_nquery(msg, len, file) /* * print additional records */ - cp = do_rrset(msg, cp, hp->arcount, RES_PRF_ADD, file, + cp = do_rrset(msg, len, cp, hp->arcount, RES_PRF_ADD, file, ";; ADDITIONAL RECORDS:\n"); ErrorTest(cp); return; @@ -425,7 +431,7 @@ __p_fqname(cp, msg, file) FILE *file; { char name[MAXDNAME]; - int n, len; + int n; if ((n = dn_expand(msg, cp + MAXCDNAME, cp, name, sizeof name)) < 0) return (NULL); @@ -453,6 +459,10 @@ __p_rr(cp, msg, file) u_int32_t tmpttl, t; int lcnt; + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (NULL); + } if ((cp = p_fqname(cp, msg, file)) == NULL) return (NULL); /* compression error */ type = _getshort((u_char*)cp); @@ -465,7 +475,7 @@ __p_rr(cp, msg, file) cp += INT16SZ; cp1 = cp; if ((!_res.pfcode) || (_res.pfcode & RES_PRF_TTLID)) - fprintf(file, "\t%lu", tmpttl); + fprintf(file, "\t%lu", (u_long)tmpttl); if ((!_res.pfcode) || (_res.pfcode & RES_PRF_CLASS)) fprintf(file, "\t%s", __p_class(class)); fprintf(file, "\t%s", __p_type(type)); @@ -534,15 +544,19 @@ __p_rr(cp, msg, file) return (NULL); fputs(" (\n", file); t = _getlong((u_char*)cp); cp += INT32SZ; - fprintf(file, "\t\t\t%lu\t; serial\n", t); + fprintf(file, "\t\t\t%lu\t; serial\n", (u_long)t); t = _getlong((u_char*)cp); cp += INT32SZ; - fprintf(file, "\t\t\t%lu\t; refresh (%s)\n", t, __p_time(t)); + fprintf(file, "\t\t\t%lu\t; refresh (%s)\n", + (u_long)t, __p_time(t)); t = _getlong((u_char*)cp); cp += INT32SZ; - fprintf(file, "\t\t\t%lu\t; retry (%s)\n", t, __p_time(t)); + fprintf(file, "\t\t\t%lu\t; retry (%s)\n", + (u_long)t, __p_time(t)); t = _getlong((u_char*)cp); cp += INT32SZ; - fprintf(file, "\t\t\t%lu\t; expire (%s)\n", t, __p_time(t)); + fprintf(file, "\t\t\t%lu\t; expire (%s)\n", + (u_long)t, __p_time(t)); t = _getlong((u_char*)cp); cp += INT32SZ; - fprintf(file, "\t\t\t%lu )\t; minimum (%s)", t, __p_time(t)); + fprintf(file, "\t\t\t%lu )\t; minimum (%s)", + (u_long)t, __p_time(t)); break; case T_MX: @@ -673,8 +687,6 @@ __p_rr(cp, msg, file) return (cp); } -static char nbuf[40]; - /* * Return a string for the type */ @@ -682,6 +694,8 @@ const char * __p_type(type) int type; { + static char nbuf[20]; + switch (type) { case T_A: return "A"; case T_NS: return "NS"; @@ -731,6 +745,8 @@ const char * __p_class(class) int class; { + static char nbuf[20]; + switch (class) { case C_IN: return "IN"; case C_HS: return "HS"; @@ -746,12 +762,14 @@ const char * __p_option(option) u_long option; { + static char nbuf[40]; + switch (option) { case RES_INIT: return "init"; case RES_DEBUG: return "debug"; - case RES_AAONLY: return "aaonly"; + case RES_AAONLY: return "aaonly(unimpl)"; case RES_USEVC: return "usevc"; - case RES_PRIMARY: return "primry"; + case RES_PRIMARY: return "primry(unimpl)"; case RES_IGNTC: return "igntc"; case RES_RECURSE: return "recurs"; case RES_DEFNAMES: return "defnam"; @@ -759,7 +777,8 @@ __p_option(option) case RES_DNSRCH: return "dnsrch"; case RES_INSECURE1: return "insecure1"; case RES_INSECURE2: return "insecure2"; - default: sprintf(nbuf, "?0x%x?", option); return (nbuf); + default: sprintf(nbuf, "?0x%lx?", (u_long)option); + return (nbuf); } } @@ -770,6 +789,7 @@ char * __p_time(value) u_int32_t value; { + static char nbuf[40]; int secs, mins, hours, days; register char *p; diff --git a/resolv/res_init.c b/resolv/res_init.c index 98807ff771..42c7c2ef8c 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -60,6 +60,7 @@ static char rcsid[] = "$Id$"; #include <sys/param.h> #include <sys/socket.h> +#include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h> @@ -75,7 +76,7 @@ static char rcsid[] = "$Id$"; # include "../conf/portability.h" #endif -/* +/*-------------------------------------- info about "sortlist" -------------- * Marc Majka 1994/04/16 * Allan Nathanson 1994/10/29 (BIND 4.9.3.x) * @@ -93,10 +94,9 @@ static char rcsid[] = "$Id$"; * "search" property. * - The sortlist comprised of IP address netmask pairs are stored as * values of the "sortlist" property. The IP address and optional netmask - * should be seperated by a slash (/) character. + * should be seperated by a slash (/) or ampersand (&) character. * - Internal resolver variables can be set from the value of the "options" * property. - * */ #if defined(NeXT) # include <netinfo/ni.h> @@ -112,6 +112,8 @@ static int netinfo_res_init __P((int *haveenv, int *havesearch)); static void res_setoptions __P((char *, char *)); #ifdef RESOLVSORT +static const char sort_mask[] = "/&"; +#define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL) static u_int32_t net_mask __P((struct in_addr)); #endif @@ -146,11 +148,12 @@ struct __res_state _res; * * Return 0 if completes successfully, -1 on error */ +int res_init() { register FILE *fp; register char *cp, **pp; - register int n, dots; + register int n; char buf[BUFSIZ]; int nserv = 0; /* number of nameserver records read from file */ int haveenv = 0; @@ -159,6 +162,9 @@ res_init() int nsort = 0; char *net; #endif +#ifndef RFC1535 + int dots; +#endif /* * These three fields used to be statically initialized. This made @@ -172,13 +178,26 @@ res_init() * will follow. Zero for any of these fields would make no sense, * so one can safely assume that the applications were already getting * unexpected results. + * + * _res.options is tricky since some apps were known to diddle the bits + * before res_init() was first called. We can't replicate that semantic + * with dynamic initialization (they may have turned bits off that are + * set in RES_DEFAULT). Our solution is to declare such applications + * "broken". They could fool us by setting RES_INIT but none do (yet). */ if (!_res.retrans) _res.retrans = RES_TIMEOUT; if (!_res.retry) _res.retry = 4; if (!(_res.options & RES_INIT)) - _res.options |= RES_DEFAULT; + _res.options = RES_DEFAULT; + + /* + * This one used to initialize implicitly to zero, so unless the app + * has set it to something in particular, we can randomize it now. + */ + if (!_res.id) + _res.id = res_randomid(); #ifdef USELOOPBACK _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); @@ -317,17 +336,18 @@ res_init() if (*cp == '\0' || *cp == '\n' || *cp == ';') break; net = cp; - while (*cp && *cp != '/' && + while (*cp && !ISSORTMASK(*cp) && *cp != ';' && isascii(*cp) && !isspace(*cp)) cp++; n = *cp; *cp = 0; if (inet_aton(net, &a)) { _res.sort_list[nsort].addr = a; - if (n == '/') { + if (ISSORTMASK(n)) { *cp++ = n; net = cp; - while (*cp && isascii(*cp) && !isspace(*cp)) + while (*cp && *cp != ';' && + isascii(*cp) && !isspace(*cp)) cp++; n = *cp; *cp = 0; @@ -343,7 +363,7 @@ res_init() } nsort++; } - *cp++ = n; + *cp = n; } continue; } @@ -448,6 +468,7 @@ res_setoptions(options, source) } #ifdef RESOLVSORT +/* XXX - should really support CIDR which means explicit masks always. */ static u_int32_t net_mask(in) /* XXX - should really use system's version of this */ struct in_addr in; @@ -556,17 +577,26 @@ netinfo_res_init(haveenv, havesearch) n++) { char ch; char *cp; + const char *sp; struct in_addr a; - cp = strchr(nl.ni_namelist_val[n], '/'); + cp = NULL; + for (sp = sort_mask; *sp; sp++) { + char *cp1; + cp1 = strchr(nl.ni_namelist_val[n], *sp); + if (cp && cp1) + cp = (cp < cp1)? cp : cp1; + else if (cp1) + cp = cp1; + } if (cp != NULL) { - ch = *cp; - *cp = '\0'; + ch = *cp; + *cp = '\0'; + break; } - if (inet_aton(nl.ni_namelist_val[n], &a)) { _res.sort_list[nsort].addr = a; - if (*cp && ch == '/') { + if (*cp && ISSORTMASK(ch)) { *cp++ = ch; if (inet_aton(cp, &a)) { _res.sort_list[nsort].mask = a.s_addr; @@ -607,3 +637,12 @@ netinfo_res_init(haveenv, havesearch) return(0); /* if not using DNS configuration from NetInfo */ } #endif /* NeXT */ + +u_int16_t +res_randomid() +{ + struct timeval now; + + gettimeofday(&now, NULL); + return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid())); +} diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c index 0695670925..33f788eb2f 100644 --- a/resolv/res_mkquery.c +++ b/resolv/res_mkquery.c @@ -63,6 +63,7 @@ static char rcsid[] = "$Id$"; #include <arpa/nameser.h> #include <stdio.h> +#include <netdb.h> #include <resolv.h> #if defined(BSD) && (BSD >= 199103) # include <string.h> @@ -92,18 +93,20 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) register HEADER *hp; register u_char *cp; register int n; +#ifdef ALLOW_UPDATES struct rrec *newrr = (struct rrec *) newrr_in; +#endif u_char *dnptrs[20], **dpp, **lastdnptr; + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (-1); + } #ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type); #endif - if (!(_res.options & RES_INIT)) { - if (res_init() == -1) - return (-1); - } /* * Initialize header fields. */ @@ -113,7 +116,6 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) hp = (HEADER *) buf; hp->id = htons(++_res.id); hp->opcode = op; - hp->pr = (_res.options & RES_PRIMARY) != 0; hp->rd = (_res.options & RES_RECURSE) != 0; hp->rcode = NOERROR; cp = buf + HFIXEDSZ; diff --git a/resolv/res_query.c b/resolv/res_query.c index 0d11889595..eb0301ff06 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -324,6 +324,10 @@ res_querydomain(name, domain, class, type, answer, anslen) const char *longname = nbuf; int n; + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + h_errno = NETDB_INTERNAL; + return (-1); + } #ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_querydomain(%s, %s, %d, %d)\n", @@ -356,9 +360,12 @@ __hostalias(name) char buf[BUFSIZ]; static char abuf[MAXDNAME]; + if (_res.options & RES_NOALIASES) + return (NULL); file = getenv("HOSTALIASES"); if (file == NULL || (fp = fopen(file, "r")) == NULL) return (NULL); + setbuf(fp, NULL); buf[sizeof(buf) - 1] = '\0'; while (fgets(buf, sizeof(buf), fp)) { for (cp1 = buf; *cp1 && !isspace(*cp1); ++cp1) diff --git a/resolv/res_send.c b/resolv/res_send.c index 03055d3619..4ee52b438b 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -78,11 +78,13 @@ static char rcsid[] = "$Id$"; #include <arpa/inet.h> #include <stdio.h> +#include <netdb.h> #include <errno.h> #include <resolv.h> #if defined(BSD) && (BSD >= 199306) # include <stdlib.h> # include <string.h> +# include <unistd.h> #else # include "../conf/portability.h" #endif @@ -109,14 +111,14 @@ static int vc = 0; /* is the socket a virtual ciruit? */ #ifndef DEBUG # define Dprint(cond, args) /*empty*/ -# define DprintQ(cond, args, query) /*empty*/ +# define DprintQ(cond, args, query, size) /*empty*/ # define Aerror(file, string, error, address) /*empty*/ # define Perror(file, string, error) /*empty*/ #else # define Dprint(cond, args) if (cond) {fprintf args;} else {} -# define DprintQ(cond, args, query) if (cond) {\ +# define DprintQ(cond, args, query, size) if (cond) {\ fprintf args;\ - __p_query(query);\ + __fp_nquery(query, size, stdout);\ } else {} static void Aerror(file, string, error, address) @@ -230,7 +232,7 @@ res_nameinquery(name, type, class, buf, eom) if (n < 0) return (-1); cp += n; - ttype = _getshort(cp); cp += INT16SZ; + ttype = _getshort(cp); cp += INT16SZ; tclass = _getshort(cp); cp += INT16SZ; if (ttype == type && tclass == class && @@ -290,10 +292,12 @@ res_send(buf, buflen, ans, anssiz) register int n; u_int badns; /* XXX NSMAX can't exceed #/bits in this var */ - DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_QUERY), - (stdout, ";; res_send()\n"), buf); - if (!(_res.options & RES_INIT) && res_init() == -1) + if ((_res.options & RES_INIT) == 0 && res_init() == -1) { + /* errno should have been set by res_init() in this case. */ return (-1); + } + DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_QUERY), + (stdout, ";; res_send()\n"), buf, buflen); v_circuit = (_res.options & RES_USEVC) || buflen > PACKETSZ; gotsomewhere = 0; connreset = 0; @@ -362,12 +366,13 @@ res_send(buf, buflen, ans, anssiz) if (s >= 0) _res_close(); - s = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); + s = socket(PF_INET, SOCK_STREAM, 0); if (s < 0) { terrno = errno; Perror(stderr, "socket(vc)", errno); return (-1); } + errno = 0; if (connect(s, (struct sockaddr *)nsap, sizeof(struct sockaddr)) < 0) { terrno = errno; @@ -477,9 +482,12 @@ res_send(buf, buflen, ans, anssiz) if ((s < 0) || vc) { if (vc) _res_close(); - s = socket(AF_INET, SOCK_DGRAM, PF_UNSPEC); + s = socket(PF_INET, SOCK_DGRAM, 0); if (s < 0) { - bad_dg_sock: terrno = errno; +#if !defined(BSD) || (BSD < 199103) + bad_dg_sock: +#endif + terrno = errno; Perror(stderr, "socket(dg)", errno); return (-1); } @@ -541,8 +549,7 @@ res_send(buf, buflen, ans, anssiz) &no_addr, sizeof(no_addr)); #else - int s1 = socket(AF_INET, SOCK_DGRAM, - PF_UNSPEC); + int s1 = socket(PF_INET, SOCK_DGRAM,0); if (s1 < 0) goto bad_dg_sock; (void) dup2(s1, s); @@ -593,6 +600,7 @@ res_send(buf, buflen, ans, anssiz) _res_close(); goto next_ns; } + errno = 0; fromlen = sizeof(struct sockaddr_in); resplen = recvfrom(s, (char*)ans, anssiz, 0, (struct sockaddr *)&from, &fromlen); @@ -611,7 +619,7 @@ res_send(buf, buflen, ans, anssiz) DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_REPLY), (stdout, ";; old answer:\n"), - ans); + ans, resplen); goto wait; } #if CHECK_SRVR_ADDR @@ -625,7 +633,7 @@ res_send(buf, buflen, ans, anssiz) DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_REPLY), (stdout, ";; not our server:\n"), - ans); + ans, resplen); goto wait; } #endif @@ -640,7 +648,7 @@ res_send(buf, buflen, ans, anssiz) DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_REPLY), (stdout, ";; wrong query name:\n"), - ans); + ans, resplen); goto wait; } if (anhp->rcode == SERVFAIL || @@ -648,7 +656,7 @@ res_send(buf, buflen, ans, anssiz) anhp->rcode == REFUSED) { DprintQ(_res.options & RES_DEBUG, (stdout, "server rejected query:\n"), - ans); + ans, resplen); badns |= (1 << ns); _res_close(); /* don't retry if called from dig */ @@ -670,7 +678,7 @@ res_send(buf, buflen, ans, anssiz) DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_REPLY), (stdout, ";; got answer:\n"), - ans); + ans, resplen); /* * If using virtual circuits, we assume that the first server * is preferred over the rest (i.e. it is on the local diff --git a/resolv/resolv.h b/resolv/resolv.h index d62bdf8ef9..af92be4c05 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -78,7 +78,7 @@ * is new enough to contain a certain feature. */ -#define __RES 19941130 +#define __RES 19950621 /* * Resolver configuration file. @@ -128,9 +128,9 @@ struct __res_state { */ #define RES_INIT 0x00000001 /* address initialized */ #define RES_DEBUG 0x00000002 /* print debug messages */ -#define RES_AAONLY 0x00000004 /* authoritative answers only */ +#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ #define RES_USEVC 0x00000008 /* use virtual circuit */ -#define RES_PRIMARY 0x00000010 /* query primary server only */ +#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ #define RES_IGNTC 0x00000020 /* ignore trucation errors */ #define RES_RECURSE 0x00000040 /* recursion desired */ #define RES_DEFNAMES 0x00000080 /* use default domain name */ @@ -138,6 +138,7 @@ struct __res_state { #define RES_DNSRCH 0x00000200 /* search up local domain tree */ #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) @@ -196,6 +197,7 @@ extern struct __res_state _res; #define p_fqname __p_fqname #define p_rr __p_rr #define p_option __p_option +#define res_randomid __res_randomid #define res_isourserver __res_isourserver #define res_nameinquery __res_nameinquery #define res_queriesmatch __res_queriesmatch @@ -220,6 +222,7 @@ int dn_comp __P((const char *, u_char *, int, u_char **, u_char **)); int dn_expand __P((const u_char *, const u_char *, const u_char *, char *, int)); int res_init __P((void)); +u_int16_t res_randomid __P((void)); int res_query __P((const char *, int, int, u_char *, int)); int res_search __P((const char *, int, int, u_char *, int)); int res_querydomain __P((const char *, const char *, int, int, diff --git a/resolv/sethostent.c b/resolv/sethostent.c index 709b518a40..e7a59dd75a 100644 --- a/resolv/sethostent.c +++ b/resolv/sethostent.c @@ -1,9 +1,7 @@ /* - * ++Copyright++ 1985, 1993 - * - * Copyright (c) 1985, 1993 - * The Regents of the University of California. All rights reserved. - * + * The Regents of the University of California. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,12 +12,12 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,26 +29,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - - * --Copyright-- */ #if defined(LIBC_SCCS) && !defined(lint) @@ -64,10 +42,14 @@ static char rcsid[] = "$Id$"; #include <netdb.h> #include <resolv.h> +void _res_close __P((void)); + void sethostent(stayopen) int stayopen; { + if ((_res.options & RES_INIT) == 0 && res_init() == -1) + return; if (stayopen) _res.options |= RES_STAYOPEN | RES_USEVC; } @@ -1,4 +1,4 @@ -# @(#)asia 7.12 +# @(#)asia 7.13 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to @@ -48,7 +48,7 @@ # 8:00 PST PDT Philippines* # 8:00 SGT Singapore # 8:00 UST UDT Ulan Bator* -# 9:00 JST Japan +# 9:00 JST JDT Japan # 9:00 KST KDT Korea # 9:00 MLT Moluccas* # 9:30 CST Australian Central Standard Time @@ -461,7 +461,14 @@ Rule Zion 1993 only - Sep 5 0:00 0:00 S Rule Zion 1994 only - Apr 1 0:00 1:00 D Rule Zion 1994 only - Aug 28 0:00 0:00 S Rule Zion 1995 only - Mar 31 0:00 1:00 D -Rule Zion 1995 only - Aug 27 0:00 0:00 S +# On 1995-03-13 Ephraim Silverberg corrected the next line from Aug 27 to Sep 3. +Rule Zion 1995 only - Sep 3 0:00 0:00 S + +# From Ephraim Silverberg (1995-03-13): +# The Spokeswoman's office confirmed that there are not yet any dates +# for the timezone conversion for the years 1996 and beyond yet +# and this is one of the things the newly-appointed Minister of Interior +# will have to decide sometime this year. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tel_Aviv 2:19:04 - LMT 1880 @@ -475,20 +482,44 @@ Zone Asia/Tel_Aviv 2:19:04 - LMT 1880 # `9:00' and `JST' is from Guy Harris. -# From Paul Eggert <eggert@twinsun.com> (November 18, 1993): -# Shanks says that the far southern Ryukyu Is (Nansei-Shoto) are 8:00, -# but we don't have a good location name for them; -# we don't even know the name of the principal town. -# There is no information for Marcus. -# Other Japanese possessions are probably like Asia/Tokyo. +# From Paul Eggert <eggert@twinsun.com> (1995-03-06): +# Today's _Asahi Evening News_ (page 4) reports that Japan had +# daylight saving between 1948 and 1951, but ``the system was discontinued +# because the public believed it would lead to longer working hours.'' +# Shanks writes that daylight saving in Japan during those years was as follows: +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Japan 1948 only - May Sun>=1 2:00 1:00 D +#Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S +#Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D +#Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D +# but the only locations using it were US military bases. +# We go with Shanks and omit daylight saving in those years for Asia/Tokyo. +# +# The same news article also reports that Japan is likely to go on DST in 1996 +# as follows, where I've guessed the AT and LETTER/S columns: +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Japan 1996 max - Apr Sun>=1 2:00 1:00 D +#Rule Japan 1996 max - Oct lastSun 2:00 0 S # From Shanks (1991): # Japan switched from the Japanese calendar on 1893 Jan 1. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tokyo 9:19:04 - LMT 1896 9:00 - JST +# If Japan adopts DST in 1996, replace the above line with the following lines: +# 9:00 - JST 1996 +# 9:00 Japan J%sT +# and uncomment the two `Rule' lines commented out above. + +# From Paul Eggert <eggert@twinsun.com> (November 18, 1993): +# Shanks says that the far southern Ryukyu Is (Nansei-Shoto) are 8:00, +# but we don't have a good location name for them; +# we don't even know the name of the principal town. +# Zone NAME GMTOFF RULES FORMAT [UNTIL] #Zone Asia/South_Ryukyu 8:14:44 - LMT 1896 # Amitori # 8:00 - CST +# There is no information for Marcus. +# Other Japanese possessions are probably like Asia/Tokyo. # Jordan # From Paul Eggert <eggert@twinsun.com> (November 18, 1993): diff --git a/time/backward b/time/backward index d4d8ff082f..ff9784a190 100644 --- a/time/backward +++ b/time/backward @@ -1,4 +1,4 @@ -# @(#)backward 7.8 +# @(#)backward 7.9 # This file provides links between current names for time zones # and their old names. Many names changed in late 1993. @@ -73,4 +73,5 @@ Link America/Los_Angeles US/Pacific Link Pacific/Samoa US/Samoa Link Etc/UTC UTC Link Etc/Universal Universal +Link Europe/Moscow W-SU Link Etc/Zulu Zulu diff --git a/time/europe b/time/europe index c5d4a572aa..a01124b6a4 100644 --- a/time/europe +++ b/time/europe @@ -714,11 +714,10 @@ Rule GB-Eire 1961 1967 - Oct Sun>=23 2:00s 0 GMT Rule GB-Eire 1971 only - Oct 31 3:00 0 GMT Rule GB-Eire 1972 1980 - Oct Sun>=23 2:00s 0 GMT # 1981 on -Rule GB-Eire 1981 max - Mar lastSun 1:00u 1:00 BST +Rule GB-Eire 1981 1995 - Mar lastSun 1:00u 1:00 BST Rule GB-Eire 1981 1989 - Oct Sun>=23 1:00u 0 GMT Rule GB-Eire 1990 1995 - Oct Sun>=22 1:00u 0 GMT -Rule GB-Eire 1996 max - Oct lastSun 1:00u 0 GMT -# Also see EC, which (starting 1996) differs only in LETTER/S. +# See EC for rules starting in 1996. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/London -0:01:15 - LMT 1847 Sep 22 @@ -760,7 +759,6 @@ Rule EC 1978 only - Oct 1 1:00u 0 - Rule EC 1979 1995 - Sep lastSun 1:00u 0 - Rule EC 1981 max - Mar lastSun 1:00u 1:00 " DST" Rule EC 1996 max - Oct lastSun 1:00u 0 - -# Also see GB-Eire, which (starting 1996) differs only in LETTER/S. # W-Eur differs from EC only in that W-Eur uses standard time. Rule W-Eur 1800 only - Jan 1 0:00 0 - @@ -824,7 +822,6 @@ Rule Russia 1985 max - Mar lastSun 2:00s 1:00 D Zone WET 0:00 EC WET%s Zone MET 1:00 M-Eur MET%s Zone EET 2:00 EC EET%s -Zone W-SU 3:00 M-Eur ???? # Tom Hoffman says that MET is also known as Central European Time @@ -1789,7 +1786,7 @@ Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2 12:00 - ASK 1992 Jan 19 2:00s 13:00 Russia AS%s -# Serbia +# Yugoslavia (what's left of it -- mostly Serbia) # They switched from the Julian to the Gregorian calendar on 1918 Mar 18. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Belgrade 1:22:00 - LMT 1884 diff --git a/time/leapseconds b/time/leapseconds index d610692f94..c48e495344 100644 --- a/time/leapseconds +++ b/time/leapseconds @@ -1,4 +1,4 @@ -# @(#)leapseconds 7.7 +# @(#)leapseconds 7.8 # Allowance for leapseconds added to each timezone file. @@ -39,3 +39,4 @@ Leap 1990 Dec 31 23:59:60 + S Leap 1992 Jun 30 23:59:60 + S Leap 1993 Jun 30 23:59:60 + S Leap 1994 Jun 30 23:59:60 + S +Leap 1995 Dec 31 23:59:60 + S diff --git a/time/southamerica b/time/southamerica index b40ce559a3..52da58f4f2 100644 --- a/time/southamerica +++ b/time/southamerica @@ -1,4 +1,4 @@ -# @(#)southamerica 7.6 +# @(#)southamerica 7.8 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to @@ -14,17 +14,18 @@ # the rest are from earlier versions of this file, or from other sources. # Some of these are just plausible excuses for common English abbreviations. # Corrections are welcome! -# std dst -# LMT Local Mean Time -# -2:00 FST FDT Fernando de Noronha -# -3:00 EST EDT Eastern South America (conflicts with -5:00) -# -4:00 AST ADT Andes*, Antilles*, Asuncion*, Atlantic -# -4:00 CST CDT Chile (conflicts with -6:00) -# -4:00 WST WDT Western Brazil -# -5:00 AST ADT Acre (conflicts with -4:00) -# -5:00 EST EDT Eastern, Ecuador* -# -6:00 CST CDT Archipelago of Columbus*, Central -# -7:00 MST MDT Mataveri*, Mountain +# std dst +# LMT Local Mean Time +# -2:00 FST FDT Fernando de Noronha +# -3:00 EST EDT Eastern South America (conflicts with -5:00) +# -3:00 ARST ARDT Argentina +# -4:00 AST ADT Andes*, Antilles*, Asuncion*, Atlantic +# -4:00 CST CDT Chile (conflicts with -6:00) +# -4:00 WST WDT Western Brazil +# -5:00 AST ADT Acre (conflicts with -4:00) +# -5:00 EST EDT Eastern, Ecuador* +# -6:00 CST CDT Archipelago of Columbus*, Central +# -7:00 MST MDT Mataveri*, Mountain # # See the `africa' file for Zone naming conventions. @@ -49,6 +50,10 @@ # From U. S. Naval Observatory (January 19, 19889): # ARGENTINA 3 H BEHIND UTC +# From Hernan G. Otero <hernan@isoft.com.ar> (June 26, 1995): +# I am sending modifications to the Argentinian time zone table... +# AR was chosen because they are the ISO letters that represent Argentina. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Arg 1930 only - Dec 1 0:00 1:00 D Rule Arg 1931 only - Apr 1 0:00 0 S @@ -79,19 +84,28 @@ Rule Arg 1986 1987 - Oct 25 0:00 1:00 D Rule Arg 1987 only - Feb 13 0:00 0 S Rule Arg 1988 only - Feb 7 0:00 0 S Rule Arg 1988 only - Dec 1 0:00 1:00 D -Rule Arg 1989 only - Mar 16 0:00 0 S -Rule Arg 1989 only - Oct 15 0:00 1:00 D -Rule Arg 1990 only - Mar 4 0:00 0 S -# _The Economist_ (8 Jan 1994, p 42) reports that Argentina -# had DST in 1991-2 and 1992-3, but not in 1990-1 or in 1993-4. -# It has something to do with electricity companies meeting demand in summer. -# We don't know the 1991-3 transition times, unfortunately. +# +# From Hernan G. Otero <hernan@isoft.com.ar> (June 26, 1995): +# These corrections were contributed by InterSoft Argentina S.A., +# obtaining the data from the: +# Talleres de Hidrografia Naval Argentina +# (Argentinian Naval Hydrography Institute) +# +# Shanks gives 1989 Mar 16 and stops after 1990 Mar 4; go with Otero. +Rule Arg 1989 1993 - Mar Sun>=1 0:00 0 S +Rule Arg 1989 1992 - Oct Sun>=15 0:00 1:00 D +# +# From Hernan G. Otero <hernan@isoft.com.ar> (June 26, 1995): +# From this moment on, the law that mandated the daylight saving +# time corrections was derogated and no more modifications +# to the time zones (for daylight saving) are now made. +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Buenos_Aires -3:53:48 - LMT 1894 Nov -4:17 - CMT 1920 May # Cordoba Mean Time -4:00 - AST 1930 Dec -4:00 Arg A%sT 1969 Oct 5 - -3:00 Arg E%sT + -3:00 Arg AR%sT # Bolivia # Zone NAME GMTOFF RULES FORMAT [UNTIL] |