From e685e07dfa9de08cd0b671e293b94efe116349fa Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 19 Jul 2000 22:03:58 +0000 Subject: Update. 2000-07-18 Mark Kettenis Update resolver code to BIND 8.2.3-T5B. * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and __res_nclose. [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, __res_mkquery, __res_nsend, __res_query, __res_querydomain and __res_search. * resolv/Banner: BIND-8.2.3-T5B. * resolv/base64.c: Update from BIND 8.2.3-T5B. * resolv/herror.c: Likewise. * resolv/inet_addr.c: Likewise. * resolv/inet_net_ntop.c: Likewise. * resolv/inet_net_pton.c: Likewise. * resolv/inet_neta.c: Likewise. * resolv/inet_ntop.c: Likewise. * resolv/nsap_addr.c: Likewise. * resolv/inet_pton.c: Likewise. Reject a few more more invalid IPv6 addresses (ISC bug #520). * resolv/ns_name.c: Avoid emitting RCS ID in object file. * resolv/ns_parse.c: Likewise. * resolv/ns_netint.c: Likewise. * resolv/ns_samedomain.c: Likewise. * resolv/ns_ttl.c: Likewise. * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting RCS ID in object file. * resolv/res_debug.c: Update from BIND 8.2.3-T5B. * resolv/res_mkquery.c: Likewise. * resolv/res_query.c: Likewise. * resolv/res_init.c: Likewise. (res_setoptions): Mark internal. * resolv/res_send.c: Likewise. [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit by using poll instead. * resolv/res_comp.c: Likewise. [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a weak alias for __dn_expand. * resolv/res_data.c: Likewise. (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set in _res.options. Avoids a potential security risk by avoiding a close (0). [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make res_mkquery, res_query, res_querydomain adn res_search weak aliases for __res_mkquery, __res_query, __res_querydomain and __res_search. * resolv/res_libc.c: (_res): Don't initialize. Fix res_close instead to avoid close(0). (res_init): Always use the static resolver context. [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak alias for __res_init. * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of RES_SET_H_ERRNO and accompanying comment to... * include/resolv.h: ... here. * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. * resolv/arpa/nameser_compat.h: Likewise. --- ChangeLog | 62 +++ include/resolv.h | 11 + linuxthreads/manager.c | 1 - resolv/Banner | 2 +- resolv/Versions | 9 +- resolv/arpa/nameser.h | 13 +- resolv/arpa/nameser_compat.h | 3 +- resolv/base64.c | 56 +-- resolv/herror.c | 69 ++- resolv/inet_addr.c | 79 ++-- resolv/inet_net_ntop.c | 8 +- resolv/inet_net_pton.c | 16 +- resolv/inet_neta.c | 4 +- resolv/inet_ntop.c | 27 +- resolv/inet_pton.c | 31 +- resolv/ns_name.c | 92 ++-- resolv/ns_netint.c | 4 +- resolv/ns_parse.c | 4 +- resolv/ns_print.c | 37 +- resolv/ns_samedomain.c | 4 +- resolv/ns_ttl.c | 5 +- resolv/nsap_addr.c | 8 +- resolv/res_comp.c | 30 +- resolv/res_data.c | 35 +- resolv/res_debug.c | 54 ++- resolv/res_init.c | 47 +- resolv/res_libc.c | 56 +-- resolv/res_mkquery.c | 10 +- resolv/res_query.c | 41 +- resolv/res_send.c | 1069 +++++++++++++++++++++--------------------- resolv/resolv.h | 273 +++++------ 31 files changed, 1150 insertions(+), 1010 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e9af83..244ab9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,65 @@ +2000-07-18 Mark Kettenis + + Update resolver code to BIND 8.2.3-T5B. + + * resolv/Versions [GLIBC_2.2] (libc): Add __res_init and + __res_nclose. + [GLIBC_2.2] (libresolv): Add __dn_expand, __ns_samename, + __res_mkquery, __res_nsend, __res_query, __res_querydomain and + __res_search. + * resolv/Banner: BIND-8.2.3-T5B. + + * resolv/base64.c: Update from BIND 8.2.3-T5B. + * resolv/herror.c: Likewise. + * resolv/inet_addr.c: Likewise. + * resolv/inet_net_ntop.c: Likewise. + * resolv/inet_net_pton.c: Likewise. + * resolv/inet_neta.c: Likewise. + * resolv/inet_ntop.c: Likewise. + * resolv/nsap_addr.c: Likewise. + * resolv/inet_pton.c: Likewise. Reject a few more more invalid + IPv6 addresses (ISC bug #520). + + * resolv/ns_name.c: Avoid emitting RCS ID in object file. + * resolv/ns_parse.c: Likewise. + * resolv/ns_netint.c: Likewise. + * resolv/ns_samedomain.c: Likewise. + * resolv/ns_ttl.c: Likewise. + * resolv/ns_print.c: Update from BIND 8.2.3-T5B. Avoid emitting + RCS ID in object file. + + * resolv/res_debug.c: Update from BIND 8.2.3-T5B. + * resolv/res_mkquery.c: Likewise. + * resolv/res_query.c: Likewise. + * resolv/res_init.c: Likewise. + (res_setoptions): Mark internal. + * resolv/res_send.c: Likewise. + [_LIBC]: Fully reinstate the code that avoids the FD_SETSIZE limit + by using poll instead. + * resolv/res_comp.c: Likewise. + [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make dn_expand a + weak alias for __dn_expand. + * resolv/res_data.c: Likewise. + (res_close) [_LIBC]: Don't call res_nclose if RES_INIT isn't set + in _res.options. Avoids a potential security risk by avoiding a + close (0). + [SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)]: Make + res_mkquery, res_query, res_querydomain adn res_search weak + aliases for __res_mkquery, __res_query, __res_querydomain and + __res_search. + * resolv/res_libc.c: (_res): Don't initialize. Fix res_close + instead to avoid close(0). + (res_init): Always use the static resolver context. + [SHLIB_COMPAT (libc, GLIBC_2.0, GLIBC_2_2)]: Make res_init a weak + alias for __res_init. + + * resolv/resolv.h: Update from BIND 8.2.3-T5B. Move definition of + RES_SET_H_ERRNO and accompanying comment to... + * include/resolv.h: ... here. + + * resolv/arpa/namser.h: Update from BIND 8.2.3-T5B. + * resolv/arpa/nameser_compat.h: Likewise. + 2000-07-18 Ulrich Drepper * nss/makedb.c (main): Compare result of load_db with diff --git a/include/resolv.h b/include/resolv.h index 95b9eeb..b416764 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -1 +1,12 @@ +#ifndef _RESOLV_H_ + +#define RES_SET_H_ERRNO(r,x) \ + do \ + { \ + (r)->res_h_errno = x; \ + __set_h_errno(x); \ + } \ + while (0) + #include +#endif diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index 76ef6cf..1139e2e 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -462,7 +462,6 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, new_thread->p_canceltype = PTHREAD_CANCEL_DEFERRED; new_thread->p_errnop = &new_thread->p_errno; new_thread->p_h_errnop = &new_thread->p_h_errno; - new_thread->p_res._sock = -1; new_thread->p_resp = &new_thread->p_res; new_thread->p_guardaddr = guardaddr; new_thread->p_guardsize = guardsize; diff --git a/resolv/Banner b/resolv/Banner index d05a4e3..e585ed8 100644 --- a/resolv/Banner +++ b/resolv/Banner @@ -1 +1 @@ -BIND-8.2.2-5 +BIND-8.2.3-T5B diff --git a/resolv/Versions b/resolv/Versions index 98fa762..0f9255d 100644 --- a/resolv/Versions +++ b/resolv/Versions @@ -20,7 +20,7 @@ libc { } GLIBC_2.2 { # r* - __res_state; __res_ninit; + __res_state; __res_init; __res_nclose; __res_ninit; } } @@ -51,8 +51,11 @@ libresolv { __ns_name_unpack; __ns_name_ntop; } GLIBC_2.2 { - __res_nmkquery; __res_nquery; __res_nquerydomain; __res_nsearch; - __ns_get16; __res_hostalias; + __dn_expand; + __ns_get16; __ns_samename; + __res_hostalias; __res_mkquery; __res_nmkquery; __res_nquery; + __res_nquerydomain; __res_nsearch; __res_nsend; __res_query; + __res_querydomain; __res_search; } libnss_dns { diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h index 6655f3b..6ae1bc6 100644 --- a/resolv/arpa/nameser.h +++ b/resolv/arpa/nameser.h @@ -45,7 +45,7 @@ */ /* - * $Id$ + * $BINDId: nameser.h,v 8.37 2000/03/30 21:16:49 vixie Exp $ */ #ifndef _ARPA_NAMESER_H_ @@ -53,9 +53,13 @@ #define BIND_4_COMPAT -#include #include -#include +#if (!defined(BSD)) || (BSD < 199306) +# include +#else +# include +#endif +#include /* * Revision information. This is the release date in YYYYMMDD format. @@ -481,6 +485,7 @@ typedef enum __ns_cert_types { #define ns_name_compress __ns_name_compress #define ns_name_uncompress __ns_name_uncompress #define ns_name_skip __ns_name_skip +#define ns_name_rollback __ns_name_rollback #define ns_sign __ns_sign #define ns_sign_tcp __ns_sign_tcp #define ns_sign_tcp_init __ns_sign_tcp_init @@ -522,6 +527,8 @@ int ns_name_uncompress __P((const u_char *, const u_char *, int ns_name_compress __P((const char *, u_char *, size_t, const u_char **, const u_char **)); int ns_name_skip __P((const u_char **, const u_char *)); +void ns_name_rollback __P((const u_char *, const u_char **, + const u_char **)); int ns_sign __P((u_char *, int *, int, int, void *, const u_char *, int, u_char *, int *, time_t)); int ns_sign_tcp __P((u_char *, int *, int, int, diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h index f67f5b3..43bcd3a 100644 --- a/resolv/arpa/nameser_compat.h +++ b/resolv/arpa/nameser_compat.h @@ -28,7 +28,7 @@ /* * from nameser.h 8.1 (Berkeley) 6/2/93 - * $Id$ + * $BINDId: nameser_compat.h,v 8.11 1999/01/02 08:00:58 vixie Exp $ */ #ifndef _ARPA_NAMESER_COMPAT_ @@ -36,7 +36,6 @@ #define __BIND 19950621 /* (DEAD) interface version stamp. */ -/* glibc always has byte order info in */ #include /* diff --git a/resolv/base64.c b/resolv/base64.c index 4e7e2a0..b7c7d1c 100644 --- a/resolv/base64.c +++ b/resolv/base64.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996 by Internet Software Consortium. + * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -40,9 +40,14 @@ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ +#if !defined(LINT) && !defined(CODECENTER) +static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $"; +#endif /* not lint */ + #include #include #include + #include #include #include @@ -50,13 +55,8 @@ #include #include #include - -#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6) -# include -# include -#else -# include "../conf/portability.h" -#endif +#include +#include #define Assert(Cond) if (!(Cond)) abort() @@ -112,9 +112,9 @@ static const char Pad64 = '='; end of the data is performed using the '=' character. Since all base64 input is an integral number of octets, only the - ------------------------------------------------- + ------------------------------------------------- following cases can arise: - + (1) the final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output will be an integral multiple of 4 characters @@ -128,12 +128,7 @@ static const char Pad64 = '='; */ int -b64_ntop(src, srclength, target, targsize) - u_char const *src; - size_t srclength; - char *target; - size_t targsize; -{ +b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; u_char input[3]; u_char output[4]; @@ -161,14 +156,14 @@ b64_ntop(src, srclength, target, targsize) target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } - + /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; - + output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); @@ -204,8 +199,7 @@ b64_pton(src, target, targsize) u_char *target; size_t targsize; { - size_t tarindex; - int state, ch; + int tarindex, state, ch; char *pos; state = 0; @@ -225,7 +219,7 @@ b64_pton(src, target, targsize) switch (state) { case 0: if (target) { - if (tarindex >= targsize) + if ((size_t)tarindex >= targsize) return (-1); target[tarindex] = (pos - Base64) << 2; } @@ -233,7 +227,7 @@ b64_pton(src, target, targsize) break; case 1: if (target) { - if (tarindex + 1 >= targsize) + if ((size_t)tarindex + 1 >= targsize) return (-1); target[tarindex] |= (pos - Base64) >> 4; target[tarindex+1] = ((pos - Base64) & 0x0f) @@ -244,7 +238,7 @@ b64_pton(src, target, targsize) break; case 2: if (target) { - if (tarindex + 1 >= targsize) + if ((size_t)tarindex + 1 >= targsize) return (-1); target[tarindex] |= (pos - Base64) >> 2; target[tarindex+1] = ((pos - Base64) & 0x03) @@ -255,7 +249,7 @@ b64_pton(src, target, targsize) break; case 3: if (target) { - if (tarindex >= targsize) + if ((size_t)tarindex >= targsize) return (-1); target[tarindex] |= (pos - Base64); } @@ -281,12 +275,7 @@ b64_pton(src, target, targsize) case 2: /* Valid, means one byte of info */ /* Skip any number of spaces. */ -#ifdef _LIBC - /* To avoid warnings. */ - for ( ; ch != '\0'; ch = *src++) -#else - for (NULL; ch != '\0'; ch = *src++) -#endif + for ((void)NULL; ch != '\0'; ch = *src++) if (!isspace(ch)) break; /* Make sure there is another trailing = sign. */ @@ -301,12 +290,7 @@ b64_pton(src, target, targsize) * We know this char is an =. Is there anything but * whitespace after it? */ -#ifdef _LIBC - /* To avoid warnings. */ - for ( ; ch != '\0'; ch = *src++) -#else - for (NULL; ch != '\0'; ch = *src++) -#endif + for ((void)NULL; ch != '\0'; ch = *src++) if (!isspace(ch)) return (-1); diff --git a/resolv/herror.c b/resolv/herror.c index 8ba0ebe..d53a0b5 100644 --- a/resolv/herror.c +++ b/resolv/herror.c @@ -1,9 +1,7 @@ /* - * ++Copyright++ 1987, 1993 - * - * Copyright (c) 1987, 1993 * 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: @@ -15,7 +13,7 @@ * 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 @@ -27,44 +25,43 @@ * 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. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. * * 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. + * copyright notice and this permission notice appear in all copies. * - * 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 + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM 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[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; +static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; +static const char rcsid[] = "$BINDId: herror.c,v 8.11 1999/10/13 16:39:39 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include #include + +#include +#include + #include +#include +#include +#include + #include -#if defined(BSD) && (BSD >= 199103) -# include -# include -#else -# include "../conf/portability.h" -#endif const char *h_errlist[] = { N_("Resolver Error 0 (no error)"), @@ -75,23 +72,17 @@ const char *h_errlist[] = { }; int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] }; -#ifndef h_errno -extern int h_errno; -#endif - /* * herror -- * print the error indicated by the h_errno value. */ void -herror(s) - const char *s; -{ - struct iovec iov[4]; - register struct iovec *v = iov; +herror(const char *s) { + struct iovec iov[4], *v = iov; + extern int * __h_errno(); - if (s && *s) { - v->iov_base = (char *)s; + if (s != NULL && *s != '\0') { + v->iov_base = (/*noconst*/ char *)s; v->iov_len = strlen(s); v++; v->iov_base = ": "; @@ -106,10 +97,12 @@ herror(s) __writev(STDERR_FILENO, iov, (v - iov) + 1); } +/* + * hstrerror -- + * return the string associated with a given "host" errno value. + */ const char * -hstrerror(err) - int err; -{ +hstrerror(int err) { if (err < 0) return _("Resolver internal error"); else if (err < h_nerr) diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c index 48373b2..59e160e 100644 --- a/resolv/inet_addr.c +++ b/resolv/inet_addr.c @@ -1,9 +1,7 @@ /* - * ++Copyright++ 1983, 1990, 1993 - * - * Copyright (c) 1983, 1990, 1993 * 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: @@ -15,7 +13,7 @@ * 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 @@ -27,16 +25,18 @@ * 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 @@ -45,20 +45,38 @@ * 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-- + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM 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. */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static char rcsid[] = "$Id$"; +static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; +static const char rcsid[] = "$BINDId: inet_addr.c,v 8.11 1999/10/13 16:39:25 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include + #include #include + #include + #ifdef _LIBC # include # include @@ -66,18 +84,13 @@ static char rcsid[] = "$Id$"; # include # include #endif -#include "../conf/portability.h" - -/* these are compatibility routines, not needed on recent BSD releases */ /* * Ascii internet address interpretation routine. * The value returned is in network order. */ in_addr_t -inet_addr(cp) - register const char *cp; -{ +inet_addr(const char *cp) { struct in_addr val; if (__inet_aton(cp, &val)) @@ -85,7 +98,7 @@ inet_addr(cp) return (INADDR_NONE); } -/* +/* * Check whether "cp" is a valid ascii representation * of an Internet address and convert to a binary address. * Returns 1 if the address is valid, 0 if not. @@ -93,21 +106,18 @@ inet_addr(cp) * cannot distinguish between failure and a local broadcast address. */ in_addr_t -__inet_aton(cp, addr) - const char *cp; - struct in_addr *addr; -{ +__inet_aton(const char *cp, struct in_addr *addr) { static const in_addr_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff }; - register in_addr_t val; + in_addr_t val; #ifndef _LIBC - register int base; + int base; #endif - register char c; + char c; union iaddr { uint8_t bytes[4]; uint32_t word; } res; - register uint8_t *pp = res.bytes; + uint8_t *pp = res.bytes; int digit; #ifdef _LIBC @@ -140,23 +150,28 @@ __inet_aton(cp, addr) } c = *cp; #else - base = 10; + val = 0; base = 10; digit = 0; if (c == '0') { c = *++cp; if (c == 'x' || c == 'X') base = 16, c = *++cp; - else + else { base = 8; + digit = 1 ; + } } - val = 0; for (;;) { if (isascii(c) && isdigit(c)) { + if (base == 8 && (c == '8' || c == '9')) + return (0); val = (val * base) + (c - '0'); c = *++cp; + digit = 1; } else if (base == 16 && isascii(c) && isxdigit(c)) { val = (val << 4) | (c + 10 - (islower(c) ? 'a' : 'A')); c = *++cp; + digit = 1; } else break; } @@ -168,8 +183,7 @@ __inet_aton(cp, addr) * a.b.c (with c treated as 16 bits) * a.b (with b treated as 24 bits) */ - if (pp > res.bytes + 3 - || val > 0xff) + if (pp > res.bytes + 3 || val > 0xff) goto ret_0; *pp++ = val; c = *++cp; @@ -181,7 +195,6 @@ __inet_aton(cp, addr) */ if (c != '\0' && (!isascii(c) || !isspace(c))) goto ret_0; - /* * Did we get a valid digit? */ @@ -193,7 +206,7 @@ __inet_aton(cp, addr) if (val > max[pp - res.bytes]) goto ret_0; - if (addr) + if (addr != NULL) addr->s_addr = res.word | htonl (val); #ifdef _LIBC diff --git a/resolv/inet_net_ntop.c b/resolv/inet_net_ntop.c index d012c53..ac71605 100644 --- a/resolv/inet_net_ntop.c +++ b/resolv/inet_net_ntop.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996 by Internet Software Consortium. + * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: inet_net_ntop.c,v 1.6 1999/01/08 19:23:42 vixie Exp $"; #endif #include @@ -74,7 +74,7 @@ inet_net_ntop(af, src, bits, dst, size) * pointer to dst, or NULL if an error occurred (check errno). * note: * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. + * 0b11110000 in its fourth octet. * author: * Paul Vixie (ISC), July 1996 */ @@ -98,7 +98,7 @@ inet_net_ntop_ipv4(src, bits, dst, size) if (size < sizeof "0") goto emsgsize; *dst++ = '0'; - --size; + size--; *dst = '\0'; } diff --git a/resolv/inet_net_pton.c b/resolv/inet_net_pton.c index 50ab9f8..a7e597a 100644 --- a/resolv/inet_net_pton.c +++ b/resolv/inet_net_pton.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996 by Internet Software Consortium. + * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: inet_net_pton.c,v 1.11 1999/01/08 19:23:44 vixie Exp $"; #endif #include @@ -81,7 +81,7 @@ inet_net_pton(af, src, dst, size) * not an IPv4 network specification. * note: * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. + * 0b11110000 in its fourth octet. * author: * Paul Vixie (ISC), June 1996 */ @@ -101,7 +101,7 @@ inet_net_pton_ipv4(src, dst, size) /* Hexadecimal: Eat nybble string. */ if (size <= 0) goto emsgsize; - *dst = 0, dirty = 0; + dirty = 0; tmp = 0; /* To calm down gcc. */ src++; /* skip x or X. */ while (isxdigit((ch = *src++))) { @@ -109,9 +109,9 @@ inet_net_pton_ipv4(src, dst, size) n = (const char *) __rawmemchr(xdigits, ch) - xdigits; assert(n >= 0 && n <= 15); if (dirty == 0) - tmp = n << 4; + tmp = n; else - tmp |= n; + tmp = (tmp << 4) | n; if (++dirty == 2) { if (size-- <= 0) goto emsgsize; @@ -119,10 +119,10 @@ inet_net_pton_ipv4(src, dst, size) dirty = 0; } } - if (dirty) { + if (dirty) { /* Odd trailing nybble? */ if (size-- <= 0) goto emsgsize; - *dst = (u_char) tmp; + *dst++ = (u_char) (tmp << 4); } } else if (isascii(ch) && isdigit(ch)) { /* Decimal: eat dotted digit string. */ diff --git a/resolv/inet_neta.c b/resolv/inet_neta.c index 5633ed1..349e6bd 100644 --- a/resolv/inet_neta.c +++ b/resolv/inet_neta.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996 by Internet Software Consortium. + * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: inet_neta.c,v 1.6 1999/01/08 19:23:45 vixie Exp $"; #endif #include diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c index a95f684..f99a69b 100644 --- a/resolv/inet_ntop.c +++ b/resolv/inet_ntop.c @@ -1,4 +1,5 @@ -/* Copyright (c) 1996 by Internet Software Consortium. +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,19 +16,20 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: inet_ntop.c,v 1.8 1999/10/13 16:39:28 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include #include + #include #include #include -#include + #include #include -#include "../conf/portability.h" +#include #ifdef SPRINTF_CHAR # define SPRINTF(x) strlen(sprintf/**/x) @@ -40,9 +42,9 @@ static char rcsid[] = "$Id$"; * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. */ -static const char *inet_ntop4 __P((const u_char *src, char *dst, socklen_t size)) +static const char *inet_ntop4 (const u_char *src, char *dst, socklen_t size) internal_function; -static const char *inet_ntop6 __P((const u_char *src, char *dst, socklen_t size)) +static const char *inet_ntop6 (const u_char *src, char *dst, socklen_t size) internal_function; /* char * @@ -74,7 +76,7 @@ inet_ntop(af, src, dst, size) /* const char * * inet_ntop4(src, dst, size) - * format an IPv4 address, more or less like inet_ntoa() + * format an IPv4 address * return: * `dst' (as a const) * notes: @@ -122,7 +124,7 @@ inet_ntop6(src, dst, size) */ char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; struct { int base, len; } best, cur; - u_int words[IN6ADDRSZ / INT16SZ]; + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; int i; /* @@ -131,11 +133,11 @@ inet_ntop6(src, dst, size) * Find the longest run of 0x00's in src[] for :: shorthanding. */ memset(words, '\0', sizeof words); - for (i = 0; i < IN6ADDRSZ; i += 2) + for (i = 0; i < NS_IN6ADDRSZ; i += 2) words[i / 2] = (src[i] << 8) | src[i + 1]; best.base = -1; cur.base = -1; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { if (words[i] == 0) { if (cur.base == -1) cur.base = i, cur.len = 1; @@ -160,7 +162,7 @@ inet_ntop6(src, dst, size) * Format the result. */ tp = tmp; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { /* Are we inside the best run of 0x00's? */ if (best.base != -1 && i >= best.base && i < (best.base + best.len)) { @@ -182,7 +184,8 @@ inet_ntop6(src, dst, size) tp += SPRINTF((tp, "%x", words[i])); } /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) *tp++ = ':'; *tp++ = '\0'; diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c index 4dcbad9..264278b 100644 --- a/resolv/inet_pton.c +++ b/resolv/inet_pton.c @@ -1,4 +1,5 @@ -/* Copyright (c) 1996 by Internet Software Consortium. +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: inet_pton.c,v 1.7 1999/10/13 16:39:28 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -27,7 +28,6 @@ static char rcsid[] = "$Id$"; #include #include #include -#include /* * WARNING: Don't even consider trying to compile this on a system where @@ -83,7 +83,7 @@ inet_pton4(src, dst) u_char *dst; { int saw_digit, octets, ch; - u_char tmp[INADDRSZ], *tp; + u_char tmp[NS_INADDRSZ], *tp; saw_digit = 0; octets = 0; @@ -111,8 +111,7 @@ inet_pton4(src, dst) } if (octets < 4) return (0); - - memcpy(dst, tmp, INADDRSZ); + memcpy(dst, tmp, NS_INADDRSZ); return (1); } @@ -136,13 +135,13 @@ inet_pton6(src, dst) u_char *dst; { static const char xdigits[] = "0123456789abcdef"; - u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp; + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; const char *curtok; int ch, saw_xdigit; u_int val; - tp = memset(tmp, '\0', IN6ADDRSZ); - endp = tp + IN6ADDRSZ; + tp = memset(tmp, '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; colonp = NULL; /* Leading :: requires some special handling. */ if (*src == ':') @@ -170,8 +169,10 @@ inet_pton6(src, dst) return (0); colonp = tp; continue; + } else if (*src == '\0') { + return (0); } - if (tp + INT16SZ > endp) + if (tp + NS_INT16SZ > endp) return (0); *tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (u_char) val & 0xff; @@ -179,16 +180,16 @@ inet_pton6(src, dst) val = 0; continue; } - if (ch == '.' && ((tp + INADDRSZ) <= endp) && + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && inet_pton4(curtok, tp) > 0) { - tp += INADDRSZ; + tp += NS_INADDRSZ; saw_xdigit = 0; break; /* '\0' was seen by inet_pton4(). */ } return (0); } if (saw_xdigit) { - if (tp + INT16SZ > endp) + if (tp + NS_INT16SZ > endp) return (0); *tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (u_char) val & 0xff; @@ -201,6 +202,8 @@ inet_pton6(src, dst) const int n = tp - colonp; int i; + if (tp == endp) + return (0); for (i = 1; i <= n; i++) { endp[- i] = colonp[n - i]; colonp[n - i] = 0; @@ -209,6 +212,6 @@ inet_pton6(src, dst) } if (tp != endp) return (0); - memcpy(dst, tmp, IN6ADDRSZ); + memcpy(dst, tmp, NS_IN6ADDRSZ); return (1); } diff --git a/resolv/ns_name.c b/resolv/ns_name.c index b75f731..cb63935 100644 --- a/resolv/ns_name.c +++ b/resolv/ns_name.c @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef lint -static const char rcsid[] = "$Id$"; +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_name.c,v 8.15 2000/03/30 22:53:46 vixie Exp $"; #endif #include @@ -375,7 +375,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz, u_char *dstp; const u_char **cpp, **lpp, *eob, *msg; const u_char *srcp; - int n, l; + int n, l, first = 1; srcp = src; dstp = dst; @@ -424,9 +424,10 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz, } /* Not found, save it. */ if (lastdnptr != NULL && cpp < lastdnptr - 1 && - (dstp - msg) < 0x4000) { + (dstp - msg) < 0x4000 && first) { *cpp++ = dstp; *cpp = NULL; + first = 0; } } /* copy label to buffer */ @@ -499,6 +500,23 @@ ns_name_compress(const char *src, u_char *dst, size_t dstsiz, } /* + * Reset dnptrs so that there are no active references to pointers at or + * after src. + */ +void +ns_name_rollback(const u_char *src, const u_char **dnptrs, + const u_char **lastdnptr) +{ + while (dnptrs < lastdnptr && *dnptrs != NULL) { + if (*dnptrs >= src) { + *dnptrs = NULL; + break; + } + dnptrs++; + } +} + +/* * ns_name_skip(ptrptr, eom) * Advance *ptrptr to skip over the compressed name it points at. * return: @@ -600,36 +618,48 @@ dn_find(const u_char *domain, const u_char *msg, u_int n; for (cpp = dnptrs; cpp < lastdnptr; cpp++) { - dn = domain; - sp = cp = *cpp; - while ((n = *cp++) != 0) { - /* - * check for indirection - */ - switch (n & NS_CMPRSFLGS) { - case 0: /* normal case, n == len */ - if (n != *dn++) - goto next; - for ((void)NULL; n > 0; n--) - if (mklower(*dn++) != mklower(*cp++)) + sp = *cpp; + /* + * terminate search on: + * root label + * compression pointer + * unusable offset + */ + while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 && + (sp - msg) < 0x4000) { + dn = domain; + cp = sp; + while ((n = *cp++) != 0) { + /* + * check for indirection + */ + switch (n & NS_CMPRSFLGS) { + case 0: /* normal case, n == len */ + if (n != *dn++) goto next; - /* Is next root for both ? */ - if (*dn == '\0' && *cp == '\0') - return (sp - msg); - if (*dn) - continue; - goto next; - - case NS_CMPRSFLGS: /* indirection */ - cp = msg + (((n & 0x3f) << 8) | *cp); - break; - - default: /* illegal type */ - __set_errno (EMSGSIZE); - return (-1); + for ((void)NULL; n > 0; n--) + if (mklower(*dn++) != + mklower(*cp++)) + goto next; + /* Is next root for both ? */ + if (*dn == '\0' && *cp == '\0') + return (sp - msg); + if (*dn) + continue; + goto next; + + case NS_CMPRSFLGS: /* indirection */ + cp = msg + (((n & 0x3f) << 8) | *cp); + break; + + default: /* illegal type */ + __set_errno (EMSGSIZE); + return (-1); + } } + next: + sp += *sp + 1; } - next: ; } __set_errno (ENOENT); return (-1); diff --git a/resolv/ns_netint.c b/resolv/ns_netint.c index 9dcf91c..ff24128 100644 --- a/resolv/ns_netint.c +++ b/resolv/ns_netint.c @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef lint -static const char rcsid[] = "$Id$"; +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_netint.c,v 8.4 1999/10/13 16:39:35 vixie Exp $"; #endif /* Import. */ diff --git a/resolv/ns_parse.c b/resolv/ns_parse.c index 7bbdc41..d305eae 100644 --- a/resolv/ns_parse.c +++ b/resolv/ns_parse.c @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef lint -static const char rcsid[] = "$Id$"; +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixie Exp $"; #endif /* Import. */ diff --git a/resolv/ns_print.c b/resolv/ns_print.c index cce3fb6..7a2ef70 100644 --- a/resolv/ns_print.c +++ b/resolv/ns_print.c @@ -15,11 +15,12 @@ * SOFTWARE. */ -#ifndef lint -static const char rcsid[] = "$Id$"; +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_print.c,v 8.18 2000/02/29 05:48:12 vixie Exp $"; #endif /* Import. */ + #include #include @@ -27,6 +28,7 @@ static const char rcsid[] = "$Id$"; #include #include +#include #include #include #include @@ -53,6 +55,7 @@ static int addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen); /* Proto. */ + #ifndef _LIBC u_int16_t dst_s_dns_key_id(const u_char *, const int); #endif @@ -122,9 +125,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen, T(addstr("@\t\t\t", 4, &buf, &buflen)); } else { T(addstr(name, len, &buf, &buflen)); - /* Origin not used and no trailing dot? */ - if ((!origin || !origin[0] || name[len] == '\0') && - name[len - 1] != '.') { + /* Origin not used or not root, and no trailing dot? */ + if (((origin == NULL || origin[0] == '\0') || + (origin[0] != '.' && origin[1] != '\0' && + name[len] == '\0')) && name[len - 1] != '.') { T(addstr(".", 1, &buf, &buflen)); len++; } @@ -480,6 +484,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen, n = SPRINTF((tmp, " ; key_tag= %u", key_id)); T(addstr(tmp, n, &buf, &buflen)); #endif /* !_LIBC */ + break; } @@ -749,20 +754,22 @@ addname(const u_char *msg, size_t msglen, if (n < 0) goto enospc; /* Guess. */ newlen = prune_origin(*buf, origin); - if ((origin == NULL || origin[0] == '\0' || (*buf)[newlen] == '\0') && - (newlen == 0 || (*buf)[newlen - 1] != '.')) { - /* No trailing dot. */ - if (newlen + 2 > *buflen) - goto enospc; /* No room for ".\0". */ - (*buf)[newlen++] = '.'; - (*buf)[newlen] = '\0'; - } if (newlen == 0) { /* Use "@" instead of name. */ if (newlen + 2 > *buflen) goto enospc; /* No room for "@\0". */ (*buf)[newlen++] = '@'; (*buf)[newlen] = '\0'; + } else { + if (((origin == NULL || origin[0] == '\0') || + (origin[0] != '.' && origin[1] != '\0' && + (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') { + /* No trailing dot. */ + if (newlen + 2 > *buflen) + goto enospc; /* No room for ".\0". */ + (*buf)[newlen++] = '.'; + (*buf)[newlen] = '\0'; + } } *pp += n; addlen(newlen, buf, buflen); @@ -777,9 +784,7 @@ addname(const u_char *msg, size_t msglen, static void addlen(size_t len, char **buf, size_t *buflen) { -#if 0 - INSIST(len <= *buflen); -#endif + assert(len <= *buflen); *buf += len; *buflen -= len; } diff --git a/resolv/ns_samedomain.c b/resolv/ns_samedomain.c index bac5a63..1fb1c55 100644 --- a/resolv/ns_samedomain.c +++ b/resolv/ns_samedomain.c @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef lint -static const char rcsid[] = "$Id$"; +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_samedomain.c,v 8.9 1999/10/15 21:06:51 vixie Exp $"; #endif #include diff --git a/resolv/ns_ttl.c b/resolv/ns_ttl.c index 6be2b0d..c5d5af2 100644 --- a/resolv/ns_ttl.c +++ b/resolv/ns_ttl.c @@ -15,11 +15,12 @@ * SOFTWARE. */ -#ifndef lint -static const char rcsid[] = "$Id$"; +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_ttl.c,v 8.8 1999/10/13 16:39:36 vixie Exp $"; #endif /* Import. */ + #include #include diff --git a/resolv/nsap_addr.c b/resolv/nsap_addr.c index c1c9a61..b3f2f77 100644 --- a/resolv/nsap_addr.c +++ b/resolv/nsap_addr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996 by Internet Software Consortium. + * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,15 +16,17 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: nsap_addr.c,v 8.10 1999/10/13 16:39:28 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include #include + #include #include #include + #include #include @@ -38,7 +40,7 @@ inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) { u_char c, nib; u_int len = 0; - while ((c = *ascii++) != '\0' && (int) len < maxlen) { + while ((c = *ascii++) != '\0' && len < (u_int)maxlen) { if (c == '.' || c == '+' || c == '/') continue; if (!isascii(c)) diff --git a/resolv/res_comp.c b/resolv/res_comp.c index e6f54ce..f227c4d 100644 --- a/resolv/res_comp.c +++ b/resolv/res_comp.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1985, 1993 * 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: @@ -13,7 +13,7 @@ * 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 @@ -25,16 +25,18 @@ * 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 @@ -64,23 +66,19 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$BINDId: res_comp.c,v 8.15 1999/10/13 16:39:39 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include #include #include - #include -#include #include #include - #include #include - /* * Expand compressed domain name 'comp_dn' to full domain name. * 'msg' is a pointer to the begining of the message, @@ -157,7 +155,7 @@ res_hnok(const char *dn) { int nch = *dn++; if (periodchar(ch)) { - /* NULL */; + (void)NULL; } else if (periodchar(pch)) { if (!borderchar(ch)) return (0); @@ -198,7 +196,7 @@ res_mailok(const char *dn) { /* "." is a valid missing representation */ if (*dn == '\0') - return(1); + return (1); /* otherwise