aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog84
-rw-r--r--INSTALL2
-rw-r--r--Makerules3
-rwxr-xr-xconfigure17
-rw-r--r--inet/arpa/inet.h11
-rw-r--r--io/getwd.c23
-rw-r--r--manual/maint.texi2
-rw-r--r--nss/nss_dns/dns-host.c39
-rw-r--r--nss/nsswitch.c12
-rw-r--r--resolv/Makefile3
-rw-r--r--resolv/arpa/nameser.h105
-rw-r--r--resolv/base64.c321
-rw-r--r--resolv/gethnamaddr.c7
-rw-r--r--resolv/getnetnamadr.c1
-rw-r--r--resolv/herror.c1
-rw-r--r--resolv/inet_addr.c1
-rw-r--r--resolv/inet_net_ntop.c139
-rw-r--r--resolv/inet_net_pton.c201
-rw-r--r--resolv/inet_neta.c82
-rw-r--r--resolv/inet_ntop.c6
-rw-r--r--resolv/inet_pton.c9
-rw-r--r--resolv/nsap_addr.c18
-rw-r--r--resolv/res_comp.c48
-rw-r--r--resolv/res_data.c9
-rw-r--r--resolv/res_debug.c419
-rw-r--r--resolv/res_init.c1
-rw-r--r--resolv/res_mkquery.c9
-rw-r--r--resolv/res_query.c9
-rw-r--r--resolv/res_send.c9
-rw-r--r--resolv/resolv.h27
-rw-r--r--stdlib/canonicalize.c6
-rw-r--r--stdlib/strtod.c2
32 files changed, 1431 insertions, 195 deletions
diff --git a/ChangeLog b/ChangeLog
index a4b7271..5159d8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,70 @@
+Wed Aug 14 21:36:16 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdlib/strtod.c (STRTOD): Correct assertion about size of
+ wint_t and wchar_t. Reported by David Mosberger-Tang.
+
+Mon Aug 12 22:40:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * elf/dl-lookup.c (_dl_lookup_symbol): Remove fifth parameter
+ RELOC_ADDR and make NOPLT a set of flags. All callers
+ changed. Delete condition that checks for resolving to the
+ location being filled in. Add condition to skip the
+ executable's symbols if requested.
+ * elf/link.h: Change declaration of _dl_lookup_symbol
+ accordingly.
+ (DL_LOOKUP_NOEXEC, DL_LOOKUP_NOPLT): New definitions.
+ * elf/dl-reloc.c (RESOLVE): Remove second parameter and rename
+ NOPLT to FLAGS.
+ * elf/dl-runtime.c (RESOLVE): Likewise.
+ * elf/rtld.c (RESOLVE): Likewise.
+ * sysdeps/m68k/dl-machine.h (elf_machine_rela): Pass
+ DL_LOOKUP_NOEXEC as second argument to the RESOLVE macro if
+ processing a copy reloc, DL_LOOKUP_NOPLT for a jump slot
+ reloc, zero otherwise.
+ * sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise.
+ * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
+ * sysdeps/mips/dl-machine.h (elf_machine_rel): Likewise.
+
+Wed Aug 14 17:57:08 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * MakeTAGS: Clean up use of --omit-header and -n for xgettext.
+ * po/header.pot: Add empty line at end.
+
+Sun Aug 11 13:45:33 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * MakeTAGS (all-pot): Remove $P/errlist.pot, all error messages
+ are now in $P/stdio-common.pot.
+ (XGETTEXTFLAGS-errlist.pot): Variable removed.
+
+Mon Aug 12 19:25:03 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makerules (do-ar, o-iterator-doit): Compute path to autolock
+ script at run time, not configure time.
+ * config.make.in, configure.in: Undo previous change.
+
+Wed Aug 14 13:20:02 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/sysv/linux/i386/close.S: Push return value of thread
+ on stack as argument for `_exit'. Reported by Andreas Schwab.
+
+Mon Aug 12 19:36:25 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/m68k/clone.S: New file.
+
+Wed Aug 14 04:22:35 1996 Richard Henderson <rth@tamu.edu>
+
+ * elf/dl-load.c (_dl_map_object): Save name in malloced memory.
+ (_dl_map_object_from_fd): Free name on error.
+
+Wed Aug 14 13:00:09 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * string/strdup.c: Use result of memcpy to avoid reloading.
+
+Tue Aug 13 00:55:03 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * shadow/sgetspent_r.c (__sgetspent_r): Copy string to buffer, not
+ the other way round.
+
Tue Aug 13 20:51:21 1996 Ulrich Drepper <drepper@cygnus.com>
* stdlib/canonicalize.c (canonicalize): Add cast to prevent
@@ -11,9 +78,8 @@ Tue Aug 13 18:26:45 1996 Ulrich Drepper <drepper@cygnus.com>
sorted.
Update from bind-4.9.5-T1A.
- * resolv/Makefile (routines): Add inet_net_ntop, inet_net_pton,
- inet_net.
- (libresolv-routines): Add base64.
+ * resolv/Makefile (libresolv-routines): Add base64, inet_net_ntop,
+ inet_net_pton, inet_net.
* resolv/gethnamaddr.c: Include <sys/types.h>.
* resolv/getnetnamadr.c: Likewise.
@@ -58,7 +124,7 @@ Tue Aug 13 18:26:45 1996 Ulrich Drepper <drepper@cygnus.com>
Declare sym_ntos, sym_ntop, b64_ntop, b64_pton, __p_fqnname,
__p_secstodate, dn_count_labels.
- * resolv/arpa/nameser.h (__BIND): Update verison number.
+ * resolv/arpa/nameser.h (__BIND): Update version number.
Add KEYFLAG_* and ALGORITHM_* symbols.
(HEADER): Add `ad' and `cd' flags.
@@ -68,6 +134,16 @@ Tue Aug 13 18:26:45 1996 Ulrich Drepper <drepper@cygnus.com>
* manual/maint.texi: Document that we use bind-4.9.5.
* INSTALL: Ditto.
+Mon Aug 12 19:03:22 1996 Thomas Bushnell n/BSG <thomas@psilocin.gnu.ai.mit.edu>
+
+ * sysdeps/generic/gnu/types.h: Declare __fd_mask as `unsigned long'.
+
+ * mach/Makefile (mach/mach_host.uh): Depend on
+ $(objpfx)/mach-syscalls.mk.
+ ($(objpfx)mach-shortcuts.h): Depend on $(objpfx)mach/mach_host.h.
+ (This fixes a make loop; thanks to Marcus Daniels
+ <marcus@sysc.pdx.edu> for the patch.)
+
Mon Aug 12 16:41:52 1996 Thomas Bushnell n/BSG <thomas@gnu.ai.mit.edu>
* io/getwd.c (getwd) [! PATH_MAX]: Don't assume that the user's
diff --git a/INSTALL b/INSTALL
index 581f392..6664aad 100644
--- a/INSTALL
+++ b/INSTALL
@@ -824,7 +824,7 @@ parts of the library were contributed or worked on by other people.
changes to fit into the GNU C library and to fit the ANSI C
standard, but the functional code is Berkeley's.
- * The Internet resolver code is taken directly from BIND 4.9.4,
+ * The Internet resolver code is taken directly from BIND 4.9.5,
which is under both the Berkeley copyright above and also:
Portions Copyright (C) 1993 by Digital Equipment Corporation.
diff --git a/Makerules b/Makerules
index 4248dad..14f5b5b 100644
--- a/Makerules
+++ b/Makerules
@@ -474,7 +474,8 @@ define o-iterator-doit
$(common-objpfx)$(patsubst %,$(libtype$o),c)($(ar-symtab-name)): \
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
$(patsubst $(objpfx)%,%,$(o-objects))) $(subdirs-stamp-o); \
- $$(RANLIB) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c)
+ $(AUTOLOCK) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c).lck \
+ $$(RANLIB) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c)
endef
ifndef subdir
subdirs-stamps := $(foreach d,$(subdirs),\
diff --git a/configure b/configure
index 2332868..1882a6c 100755
--- a/configure
+++ b/configure
@@ -1273,8 +1273,6 @@ else
fi
fi
-AUTOLOCK="`(cd $srcdir; pwd)`/autolock.sh"
-
echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
@@ -1304,7 +1302,7 @@ if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1308 "configure"
+#line 1306 "configure"
#include "confdefs.h"
#define __need_size_t
#define __need_wchar_t
@@ -1320,7 +1318,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort ();
; return 0; }
EOF
-if { (eval echo configure:1324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_friendly_stddef=yes
else
@@ -1427,7 +1425,7 @@ if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1431 "configure"
+#line 1429 "configure"
#include "confdefs.h"
int main() { return 0; }
@@ -1437,7 +1435,7 @@ asm (".section .init");
asm (".text");
; return 0; }
EOF
-if { (eval echo configure:1441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
@@ -1465,7 +1463,7 @@ if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1469 "configure"
+#line 1467 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() { return 0; }
@@ -1473,7 +1471,7 @@ int t() {
glibc_foobar ();
; return 0; }
EOF
-if { (eval echo configure:1477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+if { (eval echo configure:1475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
@@ -1565,7 +1563,7 @@ _start () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive
- -o conftest conftest.c'; { (eval echo configure:1569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c'; { (eval echo configure:1567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_ld_no_whole_archive=yes
else
libc_cv_ld_no_whole_archive=no
@@ -1839,7 +1837,6 @@ s%@BUILD_CC@%$BUILD_CC%g
s%@CPP@%$CPP%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
-s%@AUTOLOCK@%$AUTOLOCK%g
s%@libc_cv_have_initfini@%$libc_cv_have_initfini%g
s%@libc_cv_ld_no_whole_archive@%$libc_cv_ld_no_whole_archive%g
s%@uname_sysname@%$uname_sysname%g
diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h
index b0a9131..5619943 100644
--- a/inet/arpa/inet.h
+++ b/inet/arpa/inet.h
@@ -46,13 +46,16 @@ u_long inet_addr __P((const char *));
int inet_aton __P((const char *, struct in_addr *));
u_int32_t inet_lnaof __P((struct in_addr));
struct in_addr inet_makeaddr __P((u_int32_t , u_int32_t));
+char * inet_neta __P((u_long, char *, size_t));
u_int32_t inet_netof __P((struct in_addr));
u_int32_t inet_network __P((const char *));
+char *inet_net_ntop __P((int, const void *, int, char *, size_t));
+int inet_net_pton __P((int, const char *, void *, size_t));
char *inet_ntoa __P((struct in_addr));
-int inet_pton __P((int af, const char *src, void *dst));
-const char *inet_ntop __P((int af, const void *src, char *dst, size_t s));
-u_int inet_nsap_addr __P((const char *, u_char *, int maxlen));
-char *inet_nsap_ntoa __P((int, const u_char *, char *ascii));
+int inet_pton __P((int, const char *, void *));
+const char *inet_ntop __P((int, const void *, char *, size_t));
+u_int inet_nsap_addr __P((const char *, u_char *, int));
+char *inet_nsap_ntoa __P((int, const u_char *, char *));
__END_DECLS
#endif /* !_INET_H_ */
diff --git a/io/getwd.c b/io/getwd.c
index fdda1ca..8a8d01a 100644
--- a/io/getwd.c
+++ b/io/getwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996 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
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#include <ansidecl.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
@@ -26,22 +25,30 @@ Cambridge, MA 02139, USA. */
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
char *
-DEFUN(getwd, (buf), char *buf)
+getwd (buf)
+ char *buf;
{
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+ char fetchbuf[PATH_MAX];
+#else
+#define fetchbuf buf
+#endif
+
if (buf == NULL)
{
errno = EINVAL;
return NULL;
}
-#ifndef PATH_MAX
-#define PATH_MAX 1024 /* Arbitrary; this function is unreliable. */
-#endif
- if (getcwd (buf, PATH_MAX) == NULL)
+ if (getcwd (fetchbuf, PATH_MAX) == NULL)
{
- (void) strncpy (buf, strerror (errno), PATH_MAX);
+ strncpy (buf, strerror (errno), PATH_MAX);
return NULL;
}
+ if (fetchbuf != buf)
+ strcpy (buf, fetchbuf);
+
return buf;
}
diff --git a/manual/maint.texi b/manual/maint.texi
index cd6c996..975de53 100644
--- a/manual/maint.texi
+++ b/manual/maint.texi
@@ -967,7 +967,7 @@ changes to fit into the GNU C library and to fit the ANSI C standard,
but the functional code is Berkeley's.@refill
@item
-The Internet resolver code is taken directly from BIND 4.9.4, which is
+The Internet resolver code is taken directly from BIND 4.9.5, which is
under both the Berkeley copyright above and also:
@quotation
diff --git a/nss/nss_dns/dns-host.c b/nss/nss_dns/dns-host.c
index eaa9e81..f8116fe 100644
--- a/nss/nss_dns/dns-host.c
+++ b/nss/nss_dns/dns-host.c
@@ -17,19 +17,14 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Parts of this file are plain copies of the file `getnetnamadr.c' from
+/* Parts of this file are plain copies of the file `gethtnamadr.c' from
the bind package and it has the following copyright. */
-/* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
- * Dep. Matematica Universidade de Coimbra, Portugal, Europe
- *
- * 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.
- */
/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
+ * ++Copyright++ 1985, 1988, 1993
+ * -
+ * Copyright (c) 1985, 1988, 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
@@ -41,8 +36,8 @@ Boston, MA 02111-1307, USA. */
* 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.
@@ -58,6 +53,26 @@ Boston, MA 02111-1307, USA. */
* 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--
*/
#include <ctype.h>
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 69b1be5..099f405 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -189,8 +189,16 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
size_t cnt;
for (cnt = 0; cnt < sizeof databases; ++cnt)
- if (strcmp (dbname, databases[cnt].name) == 0)
- break;
+ {
+ int cmp = strcmp (dbname, databases[cnt].name);
+ if (cmp == 0)
+ break;
+ if (cmp > 0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ }
if (cnt == sizeof databases)
{
diff --git a/resolv/Makefile b/resolv/Makefile
index a09f87d..51257a5 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -28,7 +28,8 @@ routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init
extra-libs := libresolv
libresolv-routines := gethnamaddr res_comp res_debug res_data res_mkquery \
- res_query res_send
+ res_query res_send inet_net_ntop inet_net_pton \
+ inet_neta base64
include ../Rules
diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h
index 0fb04a1..f2b251b 100644
--- a/resolv/arpa/nameser.h
+++ b/resolv/arpa/nameser.h
@@ -50,6 +50,28 @@
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
* --Copyright--
*/
@@ -83,7 +105,7 @@
* is new enough to contain a certain feature.
*/
-#define __BIND 19950621 /* interface version stamp */
+#define __BIND 19960801 /* interface version stamp */
/*
* Define constants based on rfc883
@@ -92,12 +114,12 @@
#define MAXDNAME 256 /* maximum domain name */
#define MAXCDNAME 255 /* maximum compressed domain name */
#define MAXLABEL 63 /* maximum length of domain label */
-#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
+#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
-#define INT32SZ 4 /* for systems without 32-bit ints */
-#define INT16SZ 2 /* for systems without 16-bit ints */
-#define INADDRSZ 4 /* IPv4 T_A */
+#define INT32SZ 4 /* for systems without 32-bit ints */
+#define INT16SZ 2 /* for systems without 16-bit ints */
+#define INADDRSZ 4 /* IPv4 T_A */
#define IN6ADDRSZ 16 /* IPv6 T_AAAA */
/*
@@ -112,7 +134,7 @@
#define IQUERY 0x1 /* inverse query */
#define STATUS 0x2 /* nameserver status query */
/*#define xxx 0x3*/ /* 0x3 reserved */
-#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
+#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
#ifdef ALLOW_UPDATES
/* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
# define UPDATEA 0x9 /* add resource record */
@@ -157,19 +179,20 @@
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
-#define T_RP 17 /* responsible person */
+#define T_RP 17 /* responsible person */
#define T_AFSDB 18 /* AFS cell database */
#define T_X25 19 /* X_25 calling address */
#define T_ISDN 20 /* ISDN calling address */
#define T_RT 21 /* router */
#define T_NSAP 22 /* NSAP address */
#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
-#define T_SIG 24 /* security signature */
-#define T_KEY 25 /* security key */
-#define T_PX 26 /* X.400 mail mapping */
-#define T_GPOS 27 /* geographical position (withdrawn) */
-#define T_AAAA 28 /* IP6 Address */
-#define T_LOC 29 /* Location Information */
+#define T_SIG 24 /* security signature */
+#define T_KEY 25 /* security key */
+#define T_PX 26 /* X.400 mail mapping */
+#define T_GPOS 27 /* geographical position (withdrawn) */
+#define T_AAAA 28 /* IP6 Address */
+#define T_LOC 29 /* Location Information */
+#define T_NXT 30 /* Next Valid Name in Zone */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
@@ -192,6 +215,48 @@
#define C_ANY 255 /* wildcard match */
/*
+ * Flags field of the KEY RR rdata
+ */
+#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */
+#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
+#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
+#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
+#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
+/* The type bits can also be interpreted independently, as single bits: */
+#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */
+#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */
+
+#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */
+#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */
+#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */
+#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */
+#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */
+#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */
+#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/
+#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */
+#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */
+#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */
+#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */
+
+#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
+ KEYFLAG_RESERVED4 | \
+ KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
+
+/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
+#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */
+#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */
+#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg */
+
+/* Signatures */
+ /* Size of a mod or exp in bits */
+#define MIN_MD5RSA_KEY_PART_BITS 512
+#define MAX_MD5RSA_KEY_PART_BITS 2552
+ /* Total of binary mod and exp, bytes */
+#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
+ /* Max length of text sig block */
+#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
+
+/*
* Status return codes for T_UNSPEC conversion routines
*/
#define CONV_SUCCESS 0
@@ -207,9 +272,9 @@
#ifdef linux
# include <endian.h>
#else
-#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
-#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
-#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
+#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
+#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
@@ -259,7 +324,9 @@ typedef struct {
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
- unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned ad: 1; /* authentic data from named */
+ unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
@@ -271,7 +338,9 @@ typedef struct {
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
- unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned cd: 1; /* checking disabled by resolver */
+ unsigned ad: 1; /* authentic data from named */
+ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
#endif
/* remaining bytes */
diff --git a/resolv/base64.c b/resolv/base64.c
new file mode 100644
index 0000000..98983e0
--- /dev/null
+++ b/resolv/base64.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 1996 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.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <resolv.h>
+#include <stdio.h>
+
+#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
+# include <stdlib.h>
+# include <string.h>
+#else
+# include "../conf/portability.h"
+#endif
+
+#define Assert(Cond) if (!(Cond)) abort()
+
+static const char Base64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+ The following encoding technique is taken from RFC 1521 by Borenstein
+ and Freed. It is reproduced here in a slightly edited form for
+ convenience.
+
+ A 65-character subset of US-ASCII is used, enabling 6 bits to be
+ represented per printable character. (The extra 65th character, "=",
+ is used to signify a special processing function.)
+
+ The encoding process represents 24-bit groups of input bits as output
+ strings of 4 encoded characters. Proceeding from left to right, a
+ 24-bit input group is formed by concatenating 3 8-bit input groups.
+ These 24 bits are then treated as 4 concatenated 6-bit groups, each
+ of which is translated into a single digit in the base64 alphabet.
+
+ Each 6-bit group is used as an index into an array of 64 printable
+ characters. The character referenced by the index is placed in the
+ output string.
+
+ Table 1: The Base64 Alphabet
+
+ Value Encoding Value Encoding Value Encoding Value Encoding
+ 0 A 17 R 34 i 51 z
+ 1 B 18 S 35 j 52 0
+ 2 C 19 T 36 k 53 1
+ 3 D 20 U 37 l 54 2
+ 4 E 21 V 38 m 55 3
+ 5 F 22 W 39 n 56 4
+ 6 G 23 X 40 o 57 5
+ 7 H 24 Y 41 p 58 6
+ 8 I 25 Z 42 q 59 7
+ 9 J 26 a 43 r 60 8
+ 10 K 27 b 44 s 61 9
+ 11 L 28 c 45 t 62 +
+ 12 M 29 d 46 u 63 /
+ 13 N 30 e 47 v
+ 14 O 31 f 48 w (pad) =
+ 15 P 32 g 49 x
+ 16 Q 33 h 50 y
+
+ Special processing is performed if fewer than 24 bits are available
+ at the end of the data being encoded. A full encoding quantum is
+ always completed at the end of a quantity. When fewer than 24 input
+ bits are available in an input group, zero bits are added (on the
+ right) to form an integral number of 6-bit groups. Padding at the
+ 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
+ with no "=" padding,
+ (2) the final quantum of encoding input is exactly 8 bits;
+ here, the final unit of encoded output will be two
+ characters followed by two "=" padding characters, or
+ (3) the final quantum of encoding input is exactly 16 bits;
+ here, the final unit of encoded output will be three
+ characters followed by one "=" padding character.
+ */
+
+ssize_t
+b64_ntop(src, srclength, target, targsize)
+ u_char const *src;
+ size_t srclength;
+ char *target;
+ size_t targsize;
+{
+ size_t datalength = 0;
+ u_char input[3];
+ u_char output[4];
+ int i;
+
+ while (2 < srclength) {
+ input[0] = *src++;
+ input[1] = *src++;
+ input[2] = *src++;
+ srclength -= 3;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ output[3] = input[2] & 0x3f;
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+ Assert(output[3] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ 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);
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ if (srclength == 1)
+ target[datalength++] = Pad64;
+ else
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Pad64;
+ }
+ if (datalength >= targsize)
+ return (-1);
+ target[datalength] = '\0'; /* Returned value doesn't count \0. */
+ return (datalength);
+}
+
+/* skips all whitespace anywhere.
+ converts characters, four at a time, starting at (or after)
+ src from base - 64 numbers into three 8 bit bytes in the target area.
+ it returns the number of data bytes stored at the target, or -1 on error.
+ */
+
+ssize_t
+b64_pton(src, target, targsize)
+ char const *src;
+ u_char *target;
+ size_t targsize;
+{
+ int tarindex, state, ch;
+ char *pos;
+
+ state = 0;
+ tarindex = 0;
+
+ while ((ch = *src++) != '\0') {
+ if (isspace(ch)) /* Skip whitespace anywhere. */
+ continue;
+
+ if (ch == Pad64)
+ break;
+
+ pos = strchr(Base64, ch);
+ if (pos == 0) /* A non-base64 character. */
+ return (-1);
+
+ switch (state) {
+ case 0:
+ if (target) {
+ if (tarindex >= targsize)
+ return (-1);
+ target[tarindex] = (pos - Base64) << 2;
+ }
+ state = 1;
+ break;
+ case 1:
+ if (target) {
+ if (tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 4;
+ target[tarindex+1] = ((pos - Base64) & 0x0f)
+ << 4 ;
+ }
+ tarindex++;
+ state = 2;
+ break;
+ case 2:
+ if (target) {
+ if (tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 2;
+ target[tarindex+1] = ((pos - Base64) & 0x03)
+ << 6;
+ }
+ tarindex++;
+ state = 3;
+ break;
+ case 3:
+ if (target) {
+ if (tarindex >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64);
+ }
+ tarindex++;
+ state = 0;
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /*
+ * We are done decoding Base-64 chars. Let's see if we ended
+ * on a byte boundary, and/or with erroneous trailing characters.
+ */
+
+ if (ch == Pad64) { /* We got a pad char. */
+ ch = *src++; /* Skip it, get next. */
+ switch (state) {
+ case 0: /* Invalid = in first position */
+ case 1: /* Invalid = in second position */
+ return (-1);
+
+ case 2: /* Valid, means one byte of info */
+ /* Skip any number of spaces. */
+ for (NULL; ch != '\0'; ch = *src++)
+ if (!isspace(ch))
+ break;
+ /* Make sure there is another trailing = sign. */
+ if (ch != Pad64)
+ return (-1);
+ ch = *src++; /* Skip the = */
+ /* Fall through to "single trailing =" case. */
+ /* FALLTHROUGH */
+
+ case 3: /* Valid, means two bytes of info */
+ /*
+ * We know this char is an =. Is there anything but
+ * whitespace after it?
+ */
+ for (NULL; ch != '\0'; ch = *src++)
+ if (!isspace(ch))
+ return (-1);
+
+ /*
+ * Now make sure for cases 2 and 3 that the "extra"
+ * bits that slopped past the last full byte were
+ * zeros. If we don't check them, they become a
+ * subliminal channel.
+ */
+ if (target && target[tarindex] != 0)
+ return (-1);
+ }
+ } else {
+ /*
+ * We ended by seeing the end of the string. Make sure we
+ * have no partial bytes lying around.
+ */
+ if (state != 0)
+ return (-1);
+ }
+
+ return (tarindex);
+}
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index d3c45d0..755fc52 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -78,10 +79,12 @@ static char rcsid[] = "$Id$";
#define MULTI_PTRS_ARE_ALIASES 1 /* XXX - experimental */
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
+# include <stdlib.h>
# include <string.h>
#else
# include "../conf/portability.h"
#endif
+
#if defined(USE_OPTIONS_H)
# include <../conf/options.h>
#endif
@@ -89,7 +92,7 @@ static char rcsid[] = "$Id$";
#ifdef SPRINTF_CHAR
# define SPRINTF(x) strlen(sprintf/**/x)
#else
-# define SPRINTF(x) sprintf x
+# define SPRINTF(x) ((size_t)sprintf x)
#endif
#define MAXALIASES 35
@@ -99,7 +102,6 @@ static const char AskedForGot[] =
"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
static char *h_addr_ptrs[MAXADDRS + 1];
-static struct hostent *gethostbyname_ipv4 __P((const char *));
static struct hostent host;
static char *host_aliases[MAXALIASES];
@@ -369,6 +371,7 @@ getanswer(answer, anslen, qname, qtype)
}
bcopy(cp, *hap++ = bp, n);
bp += n;
+ buflen -= n;
cp += n;
break;
default:
diff --git a/resolv/getnetnamadr.c b/resolv/getnetnamadr.c
index 9739995..8e503da 100644
--- a/resolv/getnetnamadr.c
+++ b/resolv/getnetnamadr.c
@@ -44,6 +44,7 @@ static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/resolv/herror.c b/resolv/herror.c
index f36126a..70f13c3 100644
--- a/resolv/herror.c
+++ b/resolv/herror.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/uio.h>
#include <netdb.h>
diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c
index 2caf747..3452672 100644
--- a/resolv/inet_addr.c
+++ b/resolv/inet_addr.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/resolv/inet_net_ntop.c b/resolv/inet_net_ntop.c
new file mode 100644
index 0000000..80abefc
--- /dev/null
+++ b/resolv/inet_net_ntop.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 1996 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 const char rcsid[] = "$Id$";
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
+ char *dst, size_t size));
+
+/*
+ * char *
+ * inet_net_ntop(af, src, bits, dst, size)
+ * convert network number from network to presentation format.
+ * generates CIDR style result always.
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * author:
+ * Paul Vixie (ISC), July 1996
+ */
+char *
+inet_net_ntop(af, src, bits, dst, size)
+ int af;
+ const void *src;
+ int bits;
+ char *dst;
+ size_t size;
+{
+ switch (af) {
+ case AF_INET:
+ return (inet_net_ntop_ipv4(src, bits, dst, size));
+ default:
+ errno = EAFNOSUPPORT;
+ return (NULL);
+ }
+}
+
+/*
+ * static char *
+ * inet_net_ntop_ipv4(src, bits, dst, size)
+ * convert IPv4 network number from network to presentation format.
+ * generates CIDR style result always.
+ * return:
+ * 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.
+ * author:
+ * Paul Vixie (ISC), July 1996
+ */
+static char *
+inet_net_ntop_ipv4(src, bits, dst, size)
+ const u_char *src;
+ int bits;
+ char *dst;
+ size_t size;
+{
+ char *odst = dst;
+ char *t;
+ u_int m;
+ int b;
+
+ if (bits < 0 || bits > 32) {
+ errno = EINVAL;
+ return (NULL);
+ }
+ if (bits == 0) {
+ if (size < sizeof "0")
+ goto emsgsize;
+ *dst++ = '0';
+ *dst = '\0';
+ }
+
+ /* Format whole octets. */
+ for (b = bits / 8; b > 0; b--) {
+ if (size < sizeof "255.")
+ goto emsgsize;
+ t = dst;
+ dst += SPRINTF((dst, "%u", *src++));
+ if (b > 1) {
+ *dst++ = '.';
+ *dst = '\0';
+ }
+ size -= (size_t)(dst - t);
+ }
+
+ /* Format partial octet. */
+ b = bits % 8;
+ if (b > 0) {
+ if (size < sizeof ".255")
+ goto emsgsize;
+ t = dst;
+ if (dst != odst)
+ *dst++ = '.';
+ m = ((1 << b) - 1) << (8 - b);
+ dst += SPRINTF((dst, "%u", *src & m));
+ size -= (size_t)(dst - t);
+ }
+
+ /* Format CIDR /width. */
+ if (size < sizeof "/32")
+ goto emsgsize;
+ dst += SPRINTF((dst, "/%u", bits));
+ return (odst);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (NULL);
+}
diff --git a/resolv/inet_net_pton.c b/resolv/inet_net_pton.c
new file mode 100644
index 0000000..ea9b2d4
--- /dev/null
+++ b/resolv/inet_net_pton.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 1996 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 const char rcsid[] = "$Id$";
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+static int inet_net_pton_ipv4 __P((const char *src, u_char *dst,
+ size_t size));
+
+/*
+ * static int
+ * inet_net_pton(af, src, dst, size)
+ * convert network number from presentation to network format.
+ * accepts hex octets, hex strings, decimal octets, and /CIDR.
+ * "size" is in bytes and describes "dst".
+ * return:
+ * number of bits, either imputed classfully or specified with /CIDR,
+ * or -1 if some failure occurred (check errno). ENOENT means it was
+ * not a valid network specification.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+int
+inet_net_pton(af, src, dst, size)
+ int af;
+ const char *src;
+ void *dst;
+ size_t size;
+{
+ switch (af) {
+ case AF_INET:
+ return (inet_net_pton_ipv4(src, dst, size));
+ default:
+ errno = EAFNOSUPPORT;
+ return (-1);
+ }
+}
+
+/*
+ * static int
+ * inet_net_pton_ipv4(src, dst, size)
+ * convert IPv4 network number from presentation to network format.
+ * accepts hex octets, hex strings, decimal octets, and /CIDR.
+ * "size" is in bytes and describes "dst".
+ * return:
+ * number of bits, either imputed classfully or specified with /CIDR,
+ * or -1 if some failure occurred (check errno). ENOENT means it was
+ * not an IPv4 network specification.
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0x11110000 in its fourth octet.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+static int
+inet_net_pton_ipv4(src, dst, size)
+ const char *src;
+ u_char *dst;
+ size_t size;
+{
+ static const char
+ xdigits[] = "0123456789abcdef",
+ digits[] = "0123456789";
+ int n, ch, tmp, dirty, bits;
+ const u_char *odst = dst;
+
+ bits = -1;
+ ch = *src++;
+
+ if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
+ && isascii(src[1]) && isxdigit(src[1])) {
+ /* Hexadecimal: Eat nybble string. */
+ if (size <= 0)
+ goto emsgsize;
+ *dst = 0, dirty = 0;
+ src++; /* skip x or X. */
+ while ((ch = *src++) != '\0' &&
+ isascii(ch) && isxdigit(ch)) {
+ if (isupper(ch))
+ ch = tolower(ch);
+ n = strchr(xdigits, ch) - xdigits;
+ assert(n >= 0 && n <= 15);
+ *dst |= n;
+ if (!dirty++)
+ *dst <<= 4;
+ else if (size-- > 0)
+ *++dst = 0, dirty = 0;
+ else
+ goto emsgsize;
+ }
+ if (dirty)
+ size--;
+ } else if (isascii(ch) && isdigit(ch)) {
+ /* Decimal: eat dotted digit string. */
+ for (;;) {
+ tmp = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ assert(n >= 0 && n <= 9);
+ tmp *= 10;
+ tmp += n;
+ if (tmp > 255)
+ goto enoent;
+ } while ((ch = *src++) != '\0' &&
+ isascii(ch) && isdigit(ch));
+ if (size-- <= 0)
+ goto emsgsize;
+ *dst++ = (u_char) tmp;
+ if (ch == '\0' || ch == '/')
+ break;
+ if (ch != '.')
+ goto enoent;
+ ch = *src++;
+ if (!isascii(ch) || !isdigit(ch))
+ goto enoent;
+ }
+ } else
+ goto enoent;
+
+ if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
+ /* CIDR width specifier. Nothing can follow it. */
+ ch = *src++; /* Skip over the /. */
+ bits = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ assert(n >= 0 && n <= 9);
+ bits *= 10;
+ bits += n;
+ } while ((ch = *src++) != '\0' &&
+ isascii(ch) && isdigit(ch));
+ if (ch != '\0')
+ goto enoent;
+ }
+
+ /* Firey death and destruction unless we prefetched EOS. */
+ if (ch != '\0')
+ goto enoent;
+
+ /* If nothing was written to the destination, we found no address. */
+ if (dst == odst)
+ goto enoent;
+ /* If no CIDR spec was given, infer width from net class. */
+ if (bits == -1) {
+ if (*odst >= 224)
+ bits = 4;
+ else if (*odst >= 192)
+ bits = 24;
+ else if (*odst >= 128)
+ bits = 16;
+ else
+ bits = 8;
+ }
+ /* Extend network to cover the actual mask. */
+ while (bits > ((dst - odst) * 8)) {
+ if (size-- <= 0)
+ goto emsgsize;
+ *dst++ = '\0';
+ }
+ return (bits);
+
+ enoent:
+ errno = ENOENT;
+ return (-1);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
diff --git a/resolv/inet_neta.c b/resolv/inet_neta.c
new file mode 100644
index 0000000..ff92d5f
--- /dev/null
+++ b/resolv/inet_neta.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1996 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 const char rcsid[] = "$Id$";
+#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <stdio.h>
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/*
+ * char *
+ * inet_neta(src, dst, size)
+ * format a u_long network number into presentation format.
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * note:
+ * format of ``src'' is as for inet_network().
+ * author:
+ * Paul Vixie (ISC), July 1996
+ */
+char *
+inet_neta(src, dst, size)
+ u_long src;
+ char *dst;
+ size_t size;
+{
+ char *odst = dst;
+ char *tp;
+
+ while (src & 0xffffffff) {
+ u_char b = (src & 0xff000000) >> 24;
+
+ src <<= 8;
+ if (b) {
+ if (size < sizeof "255.")
+ goto emsgsize;
+ tp = dst;
+ dst += SPRINTF((dst, "%u", b));
+ if (src != 0L) {
+ *dst++ = '.';
+ *dst = '\0';
+ }
+ size -= (size_t)(dst - tp);
+ }
+ }
+ if (dst == odst) {
+ if (size < sizeof "0.0.0.0")
+ goto emsgsize;
+ strcpy(dst, "0.0.0.0");
+ }
+ return (odst);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (NULL);
+}
diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c
index 3b5795f..a378f3a 100644
--- a/resolv/inet_ntop.c
+++ b/resolv/inet_ntop.c
@@ -32,7 +32,7 @@ static char rcsid[] = "$Id$";
#ifdef SPRINTF_CHAR
# define SPRINTF(x) strlen(sprintf/**/x)
#else
-# define SPRINTF(x) sprintf x
+# define SPRINTF(x) ((size_t)sprintf x)
#endif
/*
@@ -127,7 +127,7 @@ inet_ntop6(src, dst, size)
* Copy the input (bytewise) array into a wordwise array.
* Find the longest run of 0x00's in src[] for :: shorthanding.
*/
- bzero(words, sizeof words);
+ memset(words, '\0', sizeof words);
for (i = 0; i < IN6ADDRSZ; i++)
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
best.base = -1;
@@ -186,7 +186,7 @@ inet_ntop6(src, dst, size)
/*
* Check for overflow, copy, and we're done.
*/
- if ((tp - tmp) > size) {
+ if ((size_t)(tp - tmp) > size) {
errno = ENOSPC;
return (NULL);
}
diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c
index d0d45ae..2315de5 100644
--- a/resolv/inet_pton.c
+++ b/resolv/inet_pton.c
@@ -67,7 +67,7 @@ inet_pton(af, src, dst)
/* int
* inet_pton4(src, dst)
- * like inet_pton() but without all the hexadecimal and shorthand.
+ * like inet_aton() but without all the hexadecimal and shorthand.
* return:
* 1 if `src' is a valid dotted quad, else 0.
* notice:
@@ -111,7 +111,8 @@ inet_pton4(src, dst)
}
if (octets < 4)
return (0);
- bcopy(tmp, dst, INADDRSZ);
+
+ memcpy(dst, tmp, INADDRSZ);
return (1);
}
@@ -140,7 +141,7 @@ inet_pton6(src, dst)
int ch, saw_xdigit;
u_int val;
- bzero((tp = tmp), IN6ADDRSZ);
+ memset((tp = tmp), '\0', IN6ADDRSZ);
endp = tp + IN6ADDRSZ;
colonp = NULL;
/* Leading :: requires some special handling. */
@@ -209,6 +210,6 @@ inet_pton6(src, dst)
}
if (tp != endp)
return (0);
- bcopy(tmp, dst, IN6ADDRSZ);
+ memcpy(dst, tmp, IN6ADDRSZ);
return (1);
}
diff --git a/resolv/nsap_addr.c b/resolv/nsap_addr.c
index 6a8b75c..2f8ffae 100644
--- a/resolv/nsap_addr.c
+++ b/resolv/nsap_addr.c
@@ -1,7 +1,25 @@
+/*
+ * Copyright (c) 1996 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 rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/resolv/res_comp.c b/resolv/res_comp.c
index 103ebd9..7da1c3e 100644
--- a/resolv/res_comp.c
+++ b/resolv/res_comp.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
@@ -340,34 +341,6 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
* Verify that a domain name uses an acceptable character set.
*/
-/****
-To: "Lawrence R. Rogers" <lrr@cert.org>
-cc: cert@cert.org, pvm@home.net
-Subject: Re: VU#14542
-In-reply-to: Your message of "Mon, 19 Feb 1996 17:16:27 PST."
-Date: Tue, 20 Feb 1996 22:37:21 -0800
-From: Paul A Vixie <vixie@wisdom.home.vix.com>
-
-in retrospect,
-
- hostname = firstlabel ( "." otherlabel )+
- firstchar = [a-zA-Z0-9_]
- otherchar = [a-zA-Z0-9_-/]
- firstlabel = firstchar otherchar*
- otherlabel = otherchar+
-
-should have been
-
- hostname = label ( "." label )+
- firstchar = [a-zA-Z0-9]
- otherchar = [a-zA-Z0-9_-]
- label = firstchar otherchar*
-
-i know of no example of a real host name that needs the looser rule i sent
-earlier. since i'm only trying to bend the spec to fit actual known uses,
-i should not have widened the rules as far as i did earlier.
-****/
-
/*
* Note the conspicuous absence of ctype macros in these definitions. On
* non-ASCII hosts, we can't depend on string literals or ctype macros to
@@ -434,17 +407,26 @@ int
res_mailok(dn)
const char *dn;
{
- int ch, pch;
+ int ch, escaped = 0;
- pch = '\0';
+ /* "." is a valid missing representation */
+ if (*dn == '\0')
+ return(1);
+
+ /* otherwise <label>.<hostname> */
while ((ch = *dn++) != '\0') {
if (!domainchar(ch))
return (0);
- if (periodchar(ch) && !bslashchar(pch))
+ if (!escaped && periodchar(ch))
break;
- pch = ch;
+ if (escaped)
+ escaped = 0;
+ else if (bslashchar(ch))
+ escaped = 1;
}
- return (res_hnok(dn));
+ if (periodchar(ch))
+ return (res_hnok(dn));
+ return(0);
}
/*
diff --git a/resolv/res_data.c b/resolv/res_data.c
index 18dbc83..fb50eb8 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -3,7 +3,7 @@
* -
* Copyright (c) 1995
* 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:
@@ -19,7 +19,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
@@ -33,14 +33,14 @@
* 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
@@ -57,6 +57,7 @@
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 62cd81c..dfb3b47 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -50,6 +50,28 @@
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
* --Copyright--
*/
@@ -65,11 +87,14 @@ static char rcsid[] = "$Id$";
#include <arpa/inet.h>
#include <arpa/nameser.h>
-#include <stdio.h>
#include <ctype.h>
#include <netdb.h>
#include <resolv.h>
+#include <stdio.h>
+#include <time.h>
+
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
+# include <stdlib.h>
# include <string.h>
#else
# include "../conf/portability.h"
@@ -291,6 +316,12 @@ __fp_nquery(msg, len, file)
fprintf(file, " rd");
if (hp->ra)
fprintf(file, " ra");
+ if (hp->unused)
+ fprintf(file, " UNUSED-BIT-ON");
+ if (hp->ad)
+ fprintf(file, " ad");
+ if (hp->cd)
+ fprintf(file, " cd");
}
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD1)) {
fprintf(file, "; Ques: %d", ntohs(hp->qdcount));
@@ -404,6 +435,30 @@ __p_cdname(cp, msg, file)
return (p_cdnname(cp, msg, PACKETSZ, file));
}
+
+/* Return a fully-qualified domain name from a compressed name (with
+ length supplied). */
+
+const u_char *
+__p_fqnname(cp, msg, msglen, name, namelen)
+ const u_char *cp, *msg;
+ int msglen;
+ char *name;
+ int namelen;
+{
+ int n, newlen;
+
+ if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0)
+ return (NULL);
+ newlen = strlen (name);
+ if (newlen == 0 || name[newlen - 1] != '.')
+ if (newlen+1 >= namelen) /* Lack space for final dot */
+ return (NULL);
+ else
+ strcpy(name + newlen, ".");
+ return (cp + n);
+}
+
/* XXX: the rest of these functions need to become length-limited, too. (vix)
*/
@@ -413,18 +468,13 @@ __p_fqname(cp, msg, file)
FILE *file;
{
char name[MAXDNAME];
- int n;
+ const u_char *n;
- if ((n = dn_expand(msg, cp + MAXCDNAME, cp, name, sizeof name)) < 0)
+ n = __p_fqnname(cp, msg, MAXCDNAME, name, sizeof name);
+ if (n == NULL)
return (NULL);
- if (name[0] == '\0') {
- putc('.', file);
- } else {
- fputs(name, file);
- if (name[strlen(name) - 1] != '.')
- putc('.', file);
- }
- return (cp + n);
+ fputs(name, file);
+ return (n);
}
/*
@@ -440,13 +490,19 @@ __p_rr(cp, msg, file)
const u_char *cp1, *cp2;
u_int32_t tmpttl, t;
int lcnt;
+ u_int16_t keyflags;
+ char rrname[MAXDNAME]; /* The fqdn of this RR */
+ char base64_key[MAX_KEY_BASE64];
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
h_errno = NETDB_INTERNAL;
return (NULL);
}
- if ((cp = p_fqname(cp, msg, file)) == NULL)
+ cp = __p_fqnname(cp, msg, MAXCDNAME, rrname, sizeof rrname);
+ if (!cp)
return (NULL); /* compression error */
+ fputs(rrname, file);
+
type = _getshort((u_char*)cp);
cp += INT16SZ;
class = _getshort((u_char*)cp);
@@ -481,7 +537,7 @@ __p_rr(cp, msg, file)
address = inet_ntoa(inaddr);
cp += INADDRSZ;
protocol = *(u_char*)cp;
- cp += sizeof(u_char);
+ cp += sizeof (u_char);
port = _getshort((u_char*)cp);
cp += INT16SZ;
fprintf(file, "\t%s\t; proto %d, port %d",
@@ -505,16 +561,16 @@ __p_rr(cp, msg, file)
case T_HINFO:
case T_ISDN:
- (void) fputs("\t\"", file);
cp2 = cp + dlen;
+ (void) fputs("\t\"", file);
if ((n = (unsigned char) *cp++) != 0) {
for (c = n; c > 0 && cp < cp2; c--) {
if (strchr("\n\"\\", *cp))
(void) putc('\\', file);
(void) putc(*cp++, file);
}
- putc('"', file);
}
+ putc('"', file);
if (cp < cp2 && (n = (unsigned char) *cp++) != 0) {
(void) fputs ("\t\"", file);
for (c = n; c > 0 && cp < cp2; c--) {
@@ -572,11 +628,24 @@ __p_rr(cp, msg, file)
return (NULL);
break;
- case T_TXT:
case T_X25:
+ cp2 = cp + dlen;
(void) fputs("\t\"", file);
+ if ((n = (unsigned char) *cp++) != 0) {
+ for (c = n; c > 0 && cp < cp2; c--) {
+ if (strchr("\n\"\\", *cp))
+ (void) putc('\\', file);
+ (void) putc(*cp++, file);
+ }
+ }
+ putc('"', file);
+ break;
+
+ case T_TXT:
+ (void) putc('\t', file);
cp2 = cp1 + dlen;
while (cp < cp2) {
+ putc('"', file);
if (n = (unsigned char) *cp++) {
for (c = n; c > 0 && cp < cp2; c--) {
if (strchr("\n\"\\", *cp))
@@ -584,8 +653,10 @@ __p_rr(cp, msg, file)
(void) putc(*cp++, file);
}
}
+ putc('"', file);
+ if (cp < cp2)
+ putc(' ', file);
}
- putc('"', file);
break;
case T_NSAP:
@@ -641,7 +712,7 @@ __p_rr(cp, msg, file)
fprintf(file, "\t%s %s ( ",
inet_ntoa(inaddr),
deproto((int) *cp));
- cp += sizeof(u_char);
+ cp += sizeof (u_char);
n = 0;
lcnt = 0;
while (cp < cp1 + dlen) {
@@ -662,6 +733,72 @@ __p_rr(cp, msg, file)
putc(')', file);
break;
+ case T_KEY:
+ putc('\t', file);
+ keyflags = _getshort(cp);
+ cp += 2;
+ fprintf(file,"0x%04x", keyflags ); /* flags */
+ fprintf(file," %u", *cp++); /* protocol */
+ fprintf(file," %u (", *cp++); /* algorithm */
+
+ n = b64_ntop(cp, (cp1 + dlen) - cp,
+ base64_key, sizeof base64_key);
+ for (c = 0; c < n; ++c) {
+ if (0 == (c & 0x3F))
+ fprintf(file, "\n\t");
+ putc(base64_key[c], file); /* public key data */
+ }
+
+ fprintf(file, " )");
+ if (n < 0)
+ fprintf(file, "\t; BAD BASE64");
+ fflush(file);
+ cp = cp1 + dlen;
+ break;
+
+ case T_SIG:
+ type = _getshort((u_char*)cp);
+ cp += INT16SZ;
+ fprintf(file, " %s", p_type(type));
+ fprintf(file, "\t%d", *cp++); /* algorithm */
+ /* Check label value and print error if wrong. */
+ n = *cp++;
+ c = dn_count_labels (rrname);
+ if (n != c)
+ fprintf(file, "\t; LABELS WRONG (%d should be %d)\n\t",
+ n, c);
+ /* orig ttl */
+ n = _getlong((u_char*)cp);
+ if (n != tmpttl)
+ fprintf(file, " %u", n);
+ cp += INT32SZ;
+ /* sig expire */
+ fprintf(file, " (\n\t%s",
+ __p_secstodate(_getlong((u_char*)cp)));
+ cp += INT32SZ;
+ /* time signed */
+ fprintf(file, " %s", __p_secstodate(_getlong((u_char*)cp)));
+ cp += INT32SZ;
+ /* sig footprint */
+ fprintf(file," %u ", _getshort((u_char*)cp));
+ cp += INT16SZ;
+ /* signer's name */
+ cp = p_fqname(cp, msg, file);
+ n = b64_ntop(cp, (cp1 + dlen) - cp,
+ base64_key, sizeof base64_key);
+ for (c = 0; c < n; c++) {
+ if (0 == (c & 0x3F))
+ fprintf (file, "\n\t");
+ putc(base64_key[c], file); /* signature */
+ }
+ /* Clean up... */
+ fprintf(file, " )");
+ if (n < 0)
+ fprintf(file, "\t; BAD BASE64");
+ fflush(file);
+ cp = cp1+dlen;
+ break;
+
#ifdef ALLOW_T_UNSPEC
case T_UNSPEC:
{
@@ -698,54 +835,151 @@ __p_rr(cp, msg, file)
}
/*
+ * Names of RR classes and qclasses. Classes and qclasses are the same, except
+ * that C_ANY is a qclass but not a class. (You can ask for records of class
+ * C_ANY, but you can't have any records of that class in the database.)
+ */
+const struct res_sym __p_class_syms[] = {
+ {C_IN, "IN"},
+ {C_CHAOS, "CHAOS"},
+ {C_HS, "HS"},
+ {C_HS, "HESIOD"},
+ {C_ANY, "ANY"},
+ {C_IN, (char *)0}
+};
+
+/*
+ * Names of RR types and qtypes. Types and qtypes are the same, except
+ * that T_ANY is a qtype but not a type. (You can ask for records of type
+ * T_ANY, but you can't have any records of that type in the database.)
+ */
+const struct res_sym __p_type_syms[] = {
+ {T_A, "A", "address"},
+ {T_NS, "NS", "name server"},
+ {T_CNAME, "CNAME", "canonical name"},
+ {T_SOA, "SOA", "start of authority"},
+ {T_MB, "MB", "mailbox"},
+ {T_MG, "MG", "mail group member"},
+ {T_MR, "MR", "mail rename"},
+ {T_NULL, "NULL", "null"},
+ {T_WKS, "WKS", "well-known service"},
+ {T_PTR, "PTR", "domain name pointer"},
+ {T_HINFO, "HINFO", "host information"},
+ {T_MINFO, "MINFO", "mailbox information"},
+ {T_MX, "MX", "mail exchanger"},
+ {T_TXT, "TXT", "text"},
+ {T_RP, "RP", "responsible person"},
+ {T_AFSDB, "AFSDB", "DCE or AFS server"},
+ {T_X25, "X25", "X25 address"},
+ {T_ISDN, "ISDN", "ISDN address"},
+ {T_RT, "RT", "router"},
+ {T_NSAP, "NSAP", "nsap address"},
+ {T_NSAP_PTR, "NSAP_PTR", "domain name pointer"},
+ {T_SIG, "SIG", "signature"},
+ {T_KEY, "KEY", "key"},
+ {T_NXT, "NXT", "next valid name"},
+ {T_PX, "PX", "mapping information"},
+ {T_GPOS, "GPOS", "geographical position"},
+ {T_AAAA, "AAAA", "IPv6 address"},
+ {T_LOC, "LOC", "location"},
+ {T_AXFR, "AXFR", "zone transfer"},
+ {T_MAILB, "MAILB", "mailbox-related data"},
+ {T_MAILA, "MAILA", "mail agent"},
+ {T_UINFO, "UINFO", "user information"},
+ {T_UID, "UID", "user ID"},
+ {T_GID, "GID", "group ID"},
+#ifdef ALLOW_T_UNSPEC
+ {T_UNSPEC, "UNSPEC", "unspecified data"},
+#endif /* ALLOW_T_UNSPEC */
+ {T_ANY, "ANY", "\"any\""},
+ {0, (char *)0, (char *)0}
+};
+
+int
+__sym_ston(syms, name, success)
+ const struct res_sym *syms;
+ char *name;
+ int *success;
+{
+#ifdef _LIBC
+ /* Changed to prevent warning. --drepper@gnu */
+ for (; syms->name != 0; syms++) {
+#else
+ for (NULL; syms->name != 0; syms++) {
+#endif
+ if (strcasecmp (name, syms->name) == 0) {
+ if (success)
+ *success = 1;
+ return (syms->number);
+ }
+ }
+ if (success)
+ *success = 0;
+ return (syms->number); /* The default value. */
+}
+
+const char *
+__sym_ntos(syms, number, success)
+ const struct res_sym *syms;
+ int number;
+ int *success;
+{
+ static char unname[20];
+
+#ifdef _LIBC
+ /* Changed to prevent warning. --drepper@gnu */
+ for (; syms->name != 0; syms++) {
+#else
+ for (NULL; syms->name != 0; syms++) {
+#endif
+ if (number == syms->number) {
+ if (success)
+ *success = 1;
+ return (syms->name);
+ }
+ }
+
+ sprintf (unname, "%d", number);
+ if (success)
+ *success = 0;
+ return (unname);
+}
+
+
+const char *
+__sym_ntop(syms, number, success)
+ const struct res_sym *syms;
+ int number;
+ int *success;
+{
+ static char unname[20];
+
+#ifdef _LIBC
+ /* Changed to prevent warning. --drepper@gnu */
+ for (; syms->name != 0; syms++) {
+#else
+ for (NULL; syms->name != 0; syms++) {
+#endif
+ if (number == syms->number) {
+ if (success)
+ *success = 1;
+ return (syms->humanname);
+ }
+ }
+ sprintf(unname, "%d", number);
+ if (success)
+ *success = 0;
+ return (unname);
+}
+
+/*
* Return a string for the type
*/
const char *
__p_type(type)
int type;
{
- static char nbuf[20];
-
- switch (type) {
- case T_A: return "A";
- case T_NS: return "NS";
- case T_CNAME: return "CNAME";
- case T_SOA: return "SOA";
- case T_MB: return "MB";
- case T_MG: return "MG";
- case T_MR: return "MR";
- case T_NULL: return "NULL";
- case T_WKS: return "WKS";
- case T_PTR: return "PTR";
- case T_HINFO: return "HINFO";
- case T_MINFO: return "MINFO";
- case T_MX: return "MX";
- case T_TXT: return "TXT";
- case T_RP: return "RP";
- case T_AFSDB: return "AFSDB";
- case T_X25: return "X25";
- case T_ISDN: return "ISDN";
- case T_RT: return "RT";
- case T_NSAP: return "NSAP";
- case T_NSAP_PTR: return "NSAP_PTR";
- case T_SIG: return "SIG";
- case T_KEY: return "KEY";
- case T_PX: return "PX";
- case T_GPOS: return "GPOS";
- case T_AAAA: return "AAAA";
- case T_LOC: return "LOC";
- case T_AXFR: return "AXFR";
- case T_MAILB: return "MAILB";
- case T_MAILA: return "MAILA";
- case T_ANY: return "ANY";
- case T_UINFO: return "UINFO";
- case T_UID: return "UID";
- case T_GID: return "GID";
-#ifdef ALLOW_T_UNSPEC
- case T_UNSPEC: return "UNSPEC";
-#endif /* ALLOW_T_UNSPEC */
- default: (void)sprintf(nbuf, "%d", type); return (nbuf);
- }
+ return (__sym_ntos (__p_type_syms, type, (int *)0));
}
/*
@@ -755,14 +989,7 @@ const char *
__p_class(class)
int class;
{
- static char nbuf[20];
-
- switch (class) {
- case C_IN: return "IN";
- case C_HS: return "HS";
- case C_ANY: return "ANY";
- default: (void)sprintf(nbuf, "%d", class); return (nbuf);
- }
+ return (__sym_ntos (__p_class_syms, class, (int *)0));
}
/*
@@ -857,7 +1084,7 @@ static const char *
precsize_ntoa(prec)
u_int8_t prec;
{
- static char retbuf[sizeof("90000000.00")];
+ static char retbuf[sizeof "90000000.00"];
unsigned long val;
int mantissa, exponent;
@@ -1044,11 +1271,11 @@ loc_aton(ascii, binary)
longit = lltemp1;
latit = lltemp2;
} else { /* some kind of brokenness */
- return 0;
+ return (0);
}
break;
default: /* we didn't get one of each */
- return 0;
+ return (0);
}
/* altitude */
@@ -1224,3 +1451,53 @@ loc_ntoa(binary, ascii)
return (ascii);
}
+
+
+/* Return the number of DNS hierarchy levels in the name. */
+int
+__dn_count_labels(name)
+ char *name;
+{
+ int i, len, count;
+
+ len = strlen(name);
+
+ for(i = 0, count = 0; i < len; i++) {
+ if (name[i] == '.')
+ count++;
+ }
+
+ /* don't count initial wildcard */
+ if (name[0] == '*')
+ if (count)
+ count--;
+
+ /* don't count the null label for root. */
+ /* if terminating '.' not found, must adjust */
+ /* count to include last label */
+ if (len > 0 && name[len-1] != '.')
+ count++;
+ return (count);
+}
+
+
+/*
+ * Make dates expressed in seconds-since-Jan-1-1970 easy to read.
+ * SIG records are required to be printed like this, by the Secure DNS RFC.
+ */
+char *
+__p_secstodate (secs)
+ unsigned long secs;
+{
+ static char output[15]; /* YYYYMMDDHHMMSS and null */
+ time_t clock = secs;
+ struct tm *time;
+
+ time = gmtime(&clock);
+ time->tm_year += 1900;
+ time->tm_mon += 1;
+ sprintf(output, "%04d%02d%02d%02d%02d%02d",
+ time->tm_year, time->tm_mon, time->tm_mday,
+ time->tm_hour, time->tm_min, time->tm_sec);
+ return (output);
+}
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 305dabf..8d87b8c 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 33f788e..feaf0ef 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -3,7 +3,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:
@@ -19,7 +19,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
@@ -33,14 +33,14 @@
* 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
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
diff --git a/resolv/res_query.c b/resolv/res_query.c
index eb0301f..7ee6be7 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -3,7 +3,7 @@
* -
* Copyright (c) 1988, 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:
@@ -19,7 +19,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
@@ -33,14 +33,14 @@
* 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
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$Id$";
#endif /* LIBC_SCCS and not lint */
+#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/resolv/res_send.c b/resolv/res_send.c
index bf8158a..841baa6 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -3,7 +3,7 @@
* -
* Copyright (c) 1985, 1989, 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:
@@ -19,7 +19,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
@@ -33,14 +33,14 @@
* 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
@@ -69,6 +69,7 @@ static char rcsid[] = "$Id$";
* Send query to name server and wait for reply.
*/
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
diff --git a/resolv/resolv.h b/resolv/resolv.h
index a0afb2c..fd38fca 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -78,7 +78,7 @@
* is new enough to contain a certain feature.
*/
-#define __RES 19960229
+#define __RES 19960801
/*
* Resolver configuration file.
@@ -182,13 +182,26 @@ typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns,
int anssiz,
int *resplen));
+struct res_sym {
+ int number; /* Identifying number, like T_MX */
+ char * name; /* Its symbolic name, like "MX" */
+ char * humanname; /* Its fun name, like "mail exchanger" */
+};
+
extern struct __res_state _res;
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
/* Private routines shared between libc/net, named, nslookup and others. */
#define res_hnok __res_hnok
#define res_ownok __res_ownok
#define res_mailok __res_mailok
#define res_dnok __res_dnok
+#define sym_ston __sym_ston
+#define sym_ntos __sym_ntos
+#define sym_ntop __sym_ntop
+#define b64_ntop __b64_ntop
+#define b64_pton __b64_pton
#define loc_ntoa __loc_ntoa
#define loc_aton __loc_aton
#define dn_skipname __dn_skipname
@@ -202,9 +215,12 @@ extern struct __res_state _res;
#define p_type __p_type
#define p_cdnname __p_cdnname
#define p_cdname __p_cdname
+#define p_fqnname __p_fqnname
#define p_fqname __p_fqname
#define p_rr __p_rr
#define p_option __p_option
+#define p_secstodate __p_secstodate
+#define dn_count_labels __dn_count_labels
#define res_randomid __res_randomid
#define res_isourserver __res_isourserver
#define res_nameinquery __res_nameinquery
@@ -214,6 +230,11 @@ int __res_hnok __P((const char *));
int __res_ownok __P((const char *));
int __res_mailok __P((const char *));
int __res_dnok __P((const char *));
+int sym_ston __P((const struct res_sym *, char *, int *));
+const char *sym_ntos __P((const struct res_sym *, int, int *));
+const char *sym_ntop __P((const struct res_sym *, int, int *));
+ssize_t b64_ntop __P((u_char const *, size_t, char *, size_t));
+ssize_t b64_pton __P((char const *, u_char *, size_t));
int __loc_aton __P((const char *ascii, u_char *binary));
char * __loc_ntoa __P((const u_char *binary, char *ascii));
int __dn_skipname __P((const u_char *, const u_char *));
@@ -227,11 +248,15 @@ char *__p_time __P((u_int32_t));
void __p_query __P((const u_char *));
const u_char *__p_cdnname __P((const u_char *, const u_char *, int, FILE *));
const u_char *__p_cdname __P((const u_char *, const u_char *, FILE *));
+const u_char *__p_fqnname __P((const u_char *cp, const u_char *msg,
+ int, char *, int));
const u_char *__p_fqname __P((const u_char *, const u_char *, FILE *));
const u_char *__p_rr __P((const u_char *, const u_char *, FILE *));
const char *__p_type __P((int));
const char *__p_class __P((int));
const char *__p_option __P((u_long option));
+char * __p_secstodate __P((unsigned long));
+int dn_count_labels __P((char *));
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));
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index a65b7f1..356c619 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -73,7 +73,7 @@ canonicalize (const char *name, char *resolved)
/* find end of path component: */
for (end = start; *end && *end != '/'; ++end);
-
+
if (end - start == 0)
break;
else if (strncmp (start, ".", end - start) == 0)
@@ -110,7 +110,7 @@ canonicalize (const char *name, char *resolved)
memcpy (dest, start, end - start);
dest += end - start;
*dest = '\0';
-
+
if (__lstat (rpath, &st) < 0)
goto error;
@@ -132,7 +132,7 @@ canonicalize (const char *name, char *resolved)
if (!extra_buf)
extra_buf = __alloca (path_max);
- if (n + strlen (end) >= path_max)
+ if ((long int) (n + strlen (end)) >= path_max)
{
errno = ENAMETOOLONG;
goto error;
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 6f3ea26..8269010 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -378,6 +378,8 @@ INTERNAL (STRTOF) (nptr, endptr, group)
in the format described in <locale.h>. */
const char *grouping;
+ assert (sizeof (wchar_t) <= sizeof (wint_t));
+
if (group)
{
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);