]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
sync w/ bind8
authorMark Andrews <marka@isc.org>
Thu, 28 Jul 2005 06:54:10 +0000 (06:54 +0000)
committerMark Andrews <marka@isc.org>
Thu, 28 Jul 2005 06:54:10 +0000 (06:54 +0000)
27 files changed:
lib/bind/Makefile.in
lib/bind/configure
lib/bind/configure.in
lib/bind/dst/dst_api.c
lib/bind/dst/hmac_link.c
lib/bind/dst/md5.h
lib/bind/dst/md5_dgst.c
lib/bind/dst/support.c
lib/bind/include/isc/eventlib.h
lib/bind/include/resolv_mt.h [new file with mode: 0644]
lib/bind/inet/inet_pton.c
lib/bind/inet/nsap_addr.c
lib/bind/irs/getaddrinfo.c
lib/bind/irs/hesiod.c
lib/bind/isc/ev_files.c
lib/bind/isc/eventlib.c
lib/bind/isc/eventlib_p.h
lib/bind/isc/memcluster.c
lib/bind/nameser/ns_ttl.c
lib/bind/port_before.h.in
lib/bind/resolv/Makefile.in
lib/bind/resolv/mtctxres.c [new file with mode: 0644]
lib/bind/resolv/res_comp.c
lib/bind/resolv/res_debug.c
lib/bind/resolv/res_init.c
lib/bind/resolv/res_send.c
lib/bind/resolv/res_sendsigned.c

index 1745a2ee0c8a89216956c0a6aa4872b924069330..f6ca40397531408961f984bc895b7c4edcd502ba 100644 (file)
@@ -13,7 +13,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: Makefile.in,v 1.25 2004/12/09 01:40:57 marka Exp $
+# $Id: Makefile.in,v 1.26 2005/07/28 06:51:45 marka Exp $
 
 srcdir =        @srcdir@
 VPATH =         @srcdir@
@@ -85,10 +85,11 @@ NAMESEROBJS= nameser/ns_date.@O@ nameser/ns_name.@O@ nameser/ns_netint.@O@ \
        nameser/ns_parse.@O@ nameser/ns_print.@O@  nameser/ns_samedomain.@O@ \
        nameser/ns_sign.@O@ nameser/ns_ttl.@O@ nameser/ns_verify.@O@
 
-RESOLVOBJS= resolv/herror.@O@ resolv/res_comp.@O@ resolv/res_data.@O@ \
-       resolv/res_debug.@O@ resolv/res_findzonecut.@O@ resolv/res_init.@O@ \
-       resolv/res_mkquery.@O@ resolv/res_mkupdate.@O@ resolv/res_query.@O@ \
-       resolv/res_send.@O@ resolv/res_sendsigned.@O@ resolv/res_update.@O@
+RESOLVOBJS= resolv/herror.@O@ resolv/mtctxres.@O@ resolv/res_comp.@O@ \
+       resolv/res_data.@O@ resolv/res_debug.@O@ resolv/res_findzonecut.@O@ \
+       resolv/res_init.@O@ resolv/res_mkquery.@O@ resolv/res_mkupdate.@O@ \
+       resolv/res_query.@O@ resolv/res_send.@O@ resolv/res_sendsigned.@O@ \
+       resolv/res_update.@O@
 
 SUBDIRS = bsd dst include inet irs isc nameser resolv @PORT_INCLUDE@
 
index 8c956e83bf7c400cd46148ab10cf8b684ee12d26..5f6ec80f56923d7b6d3dbbd1097b507149cf599b 100644 (file)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.107 .
+# From configure.in Revision: 1.108 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -464,7 +464,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_PLATFORM_NEEDSYSSELECTH WANT_IRS_GR WANT_IRS_GR_OBJS WANT_IRS_PW WANT_IRS_PW_OBJS WANT_IRS_NIS WANT_IRS_NIS_OBJS WANT_IRS_NISGR_OBJS WANT_IRS_NISPW_OBJS WANT_IRS_DBPW_OBJS ALWAYS_DEFINES DO_PTHREADS WANT_IRS_THREADSGR_OBJS WANT_IRS_THREADSPW_OBJS WANT_IRS_THREADS_OBJS WANT_THREADS_OBJS USE_IFNAMELINKID ISC_THREAD_DIR DAEMON_OBJS NEED_DAEMON STRSEP_OBJS NEED_STRSEP NEED_STRERROR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY LN_S ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK HAS_INET6_STRUCTS ISC_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H HAS_IN_ADDR6 NEED_IN6ADDR_ANY ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C HAVE_SIN6_SCOPE_ID HAVE_SOCKADDR_STORAGE ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON HAVE_SA_LEN HAVE_MINIMUM_IFREQ BSD_COMP SOLARIS_BITTYPES USE_FIONBIO_IOCTL PORT_NONBLOCK PORT_DIR PORT_INCLUDE ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO NEED_PSELECT NEED_GETTIMEOFDAY HAVE_STRNDUP ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS USE_SYSERROR_LIST ISC_PLATFORM_QUADFORMAT ISC_SOCKLEN_T GETGROUPLIST_ARGS NET_R_ARGS NET_R_BAD NET_R_COPY NET_R_COPY_ARGS NET_R_OK NET_R_SETANSWER NET_R_RETURN GETNETBYADDR_ADDR_T NETENT_DATA NET_R_ENT_ARGS NET_R_SET_RESULT NET_R_SET_RETURN NET_R_END_RESULT NET_R_END_RETURN GROUP_R_ARGS GROUP_R_BAD GROUP_R_OK GROUP_R_RETURN GROUP_R_END_RESULT GROUP_R_END_RETURN GROUP_R_ENT_ARGS GROUP_R_SET_RESULT GROUP_R_SET_RETURN HOST_R_ARGS HOST_R_BAD HOST_R_COPY HOST_R_COPY_ARGS HOST_R_ERRNO HOST_R_OK HOST_R_RETURN HOST_R_SETANSWER HOSTENT_DATA HOST_R_END_RESULT HOST_R_END_RETURN HOST_R_ENT_ARGS HOST_R_SET_RESULT HOST_R_SET_RETURN SETPWENT_VOID SETGRENT_VOID NGR_R_ARGS NGR_R_BAD NGR_R_COPY NGR_R_COPY_ARGS NGR_R_OK NGR_R_RETURN NGR_R_PRIVATE NGR_R_END_RESULT NGR_R_END_RETURN NGR_R_ENT_ARGS NGR_R_SET_RESULT NGR_R_SET_RETURN PROTO_R_ARGS PROTO_R_BAD PROTO_R_COPY PROTO_R_COPY_ARGS PROTO_R_OK PROTO_R_SETANSWER PROTO_R_RETURN PROTO_R_END_RESULT PROTO_R_END_RETURN PROTO_R_ENT_ARGS PROTO_R_SET_RESULT PROTO_R_SET_RETURN PASS_R_ARGS PASS_R_BAD PASS_R_COPY PASS_R_COPY_ARGS PASS_R_OK PASS_R_RETURN PASS_R_END_RESULT PASS_R_END_RETURN PASS_R_ENT_ARGS PASS_R_SET_RESULT PASS_R_SET_RETURN SERV_R_ARGS SERV_R_BAD SERV_R_COPY SERV_R_COPY_ARGS SERV_R_OK SERV_R_SETANSWER SERV_R_RETURN SERV_R_END_RESULT SERV_R_END_RETURN SERV_R_ENT_ARGS SERV_R_SET_RESULT SERV_R_SET_RETURN SETNETGRENT_ARGS INNETGR_ARGS BIND9_TOP_BUILDDIR BIND9_VERSION LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_PLATFORM_NEEDSYSSELECTH WANT_IRS_GR WANT_IRS_GR_OBJS WANT_IRS_PW WANT_IRS_PW_OBJS WANT_IRS_NIS WANT_IRS_NIS_OBJS WANT_IRS_NISGR_OBJS WANT_IRS_NISPW_OBJS WANT_IRS_DBPW_OBJS ALWAYS_DEFINES DO_PTHREADS WANT_IRS_THREADSGR_OBJS WANT_IRS_THREADSPW_OBJS WANT_IRS_THREADS_OBJS WANT_THREADS_OBJS USE_IFNAMELINKID ISC_THREAD_DIR DAEMON_OBJS NEED_DAEMON STRSEP_OBJS NEED_STRSEP NEED_STRERROR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY LN_S ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK HAS_INET6_STRUCTS ISC_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H HAS_IN_ADDR6 NEED_IN6ADDR_ANY ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C HAVE_SIN6_SCOPE_ID HAVE_SOCKADDR_STORAGE ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON HAVE_SA_LEN HAVE_MINIMUM_IFREQ BSD_COMP SOLARIS_BITTYPES USE_FIONBIO_IOCTL PORT_NONBLOCK PORT_DIR USE_POLL HAVE_MD5 PORT_INCLUDE ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO NEED_PSELECT NEED_GETTIMEOFDAY HAVE_STRNDUP ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS USE_SYSERROR_LIST ISC_PLATFORM_QUADFORMAT ISC_SOCKLEN_T GETGROUPLIST_ARGS NET_R_ARGS NET_R_BAD NET_R_COPY NET_R_COPY_ARGS NET_R_OK NET_R_SETANSWER NET_R_RETURN GETNETBYADDR_ADDR_T NETENT_DATA NET_R_ENT_ARGS NET_R_SET_RESULT NET_R_SET_RETURN NET_R_END_RESULT NET_R_END_RETURN GROUP_R_ARGS GROUP_R_BAD GROUP_R_OK GROUP_R_RETURN GROUP_R_END_RESULT GROUP_R_END_RETURN GROUP_R_ENT_ARGS GROUP_R_SET_RESULT GROUP_R_SET_RETURN HOST_R_ARGS HOST_R_BAD HOST_R_COPY HOST_R_COPY_ARGS HOST_R_ERRNO HOST_R_OK HOST_R_RETURN HOST_R_SETANSWER HOSTENT_DATA HOST_R_END_RESULT HOST_R_END_RETURN HOST_R_ENT_ARGS HOST_R_SET_RESULT HOST_R_SET_RETURN SETPWENT_VOID SETGRENT_VOID NGR_R_ARGS NGR_R_BAD NGR_R_COPY NGR_R_COPY_ARGS NGR_R_OK NGR_R_RETURN NGR_R_PRIVATE NGR_R_END_RESULT NGR_R_END_RETURN NGR_R_ENT_ARGS NGR_R_SET_RESULT NGR_R_SET_RETURN PROTO_R_ARGS PROTO_R_BAD PROTO_R_COPY PROTO_R_COPY_ARGS PROTO_R_OK PROTO_R_SETANSWER PROTO_R_RETURN PROTO_R_END_RESULT PROTO_R_END_RETURN PROTO_R_ENT_ARGS PROTO_R_SET_RESULT PROTO_R_SET_RETURN PASS_R_ARGS PASS_R_BAD PASS_R_COPY PASS_R_COPY_ARGS PASS_R_OK PASS_R_RETURN PASS_R_END_RESULT PASS_R_END_RETURN PASS_R_ENT_ARGS PASS_R_SET_RESULT PASS_R_SET_RETURN SERV_R_ARGS SERV_R_BAD SERV_R_COPY SERV_R_COPY_ARGS SERV_R_OK SERV_R_SETANSWER SERV_R_RETURN SERV_R_END_RESULT SERV_R_END_RETURN SERV_R_ENT_ARGS SERV_R_SET_RESULT SERV_R_SET_RETURN SETNETGRENT_ARGS INNETGR_ARGS BIND9_TOP_BUILDDIR BIND9_VERSION LIBOBJS LTLIBOBJS'
 ac_subst_files='BIND9_INCLUDES BIND9_MAKE_RULES LIBBIND_API'
 
 # Initialize some variables set by options.
@@ -23151,6 +23151,8 @@ SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES"
 BSD_COMP="#undef BSD_COMP"
 USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL"
 PORT_NONBLOCK="#define PORT_NONBLOCK O_NONBLOCK"
+HAVE_MD5="#undef HAVE_MD5"
+USE_POLL="#undef HAVE_POLL"
 case "$host" in
        *aix3.2*)       PORT_DIR="port/aix32";;
        *aix4*)         PORT_DIR="port/aix4";;
@@ -23188,7 +23190,12 @@ case "$host" in
                        BSD_COMP="#define BSD_COMP 1"
                        SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"
                        PORT_DIR="port/solaris";;
+       *-solaris2.[67])
+                       BSD_COMP="#define BSD_COMP 1"
+                       PORT_DIR="port/solaris";;
        *-solaris2*)    BSD_COMP="#define BSD_COMP 1"
+                       USE_POLL="#define USE_POLL 1"
+                       HAVE_MD5="#define HAVE_MD5 1"
                        PORT_DIR="port/solaris";;
        *-ultrix*)      PORT_DIR="port/ultrix";;
        *-sco-sysv*uw2.0*)      PORT_DIR="port/unixware20";;
@@ -23200,10 +23207,12 @@ esac
 
 
 
-PORT_INCLUDE=${PORT_DIR}/include
 
 
 
+PORT_INCLUDE=${PORT_DIR}/include
+
+
 #
 # Look for a 4.4BSD or 4.3BSD struct msghdr
 #
@@ -31455,6 +31464,8 @@ s,@SOLARIS_BITTYPES@,$SOLARIS_BITTYPES,;t t
 s,@USE_FIONBIO_IOCTL@,$USE_FIONBIO_IOCTL,;t t
 s,@PORT_NONBLOCK@,$PORT_NONBLOCK,;t t
 s,@PORT_DIR@,$PORT_DIR,;t t
+s,@USE_POLL@,$USE_POLL,;t t
+s,@HAVE_MD5@,$HAVE_MD5,;t t
 s,@PORT_INCLUDE@,$PORT_INCLUDE,;t t
 s,@ISC_PLATFORM_MSGHDRFLAVOR@,$ISC_PLATFORM_MSGHDRFLAVOR,;t t
 s,@ISC_PLATFORM_NEEDPORTT@,$ISC_PLATFORM_NEEDPORTT,;t t
index 91208ac9180216d5fa7d53d841de9c0a13a94736..f9d2c72817b6ff7930b30e8cff7a4da167e97e14 100644 (file)
@@ -13,7 +13,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-AC_REVISION($Revision: 1.107 $)
+AC_REVISION($Revision: 1.108 $)
 
 AC_INIT(resolv/herror.c)
 AC_PREREQ(2.13)
@@ -998,6 +998,8 @@ SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES"
 BSD_COMP="#undef BSD_COMP"
 USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL"
 PORT_NONBLOCK="#define PORT_NONBLOCK O_NONBLOCK"
+HAVE_MD5="#undef HAVE_MD5"
+USE_POLL="#undef HAVE_POLL"
 case "$host" in
        *aix3.2*)       PORT_DIR="port/aix32";;
        *aix4*)         PORT_DIR="port/aix4";;
@@ -1035,22 +1037,29 @@ case "$host" in
                        BSD_COMP="#define BSD_COMP 1"
                        SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"
                        PORT_DIR="port/solaris";;
+       *-solaris2.[[67]])
+                       BSD_COMP="#define BSD_COMP 1"
+                       PORT_DIR="port/solaris";;
        *-solaris2*)    BSD_COMP="#define BSD_COMP 1"
+                       USE_POLL="#define USE_POLL 1"
+                       HAVE_MD5="#define HAVE_MD5 1"
                        PORT_DIR="port/solaris";;
        *-ultrix*)      PORT_DIR="port/ultrix";;
        *-sco-sysv*uw2.0*)      PORT_DIR="port/unixware20";;
        *-sco-sysv*uw2.1.2*)    PORT_DIR="port/unixware212";;
        *-sco-sysv*uw7*)        PORT_DIR="port/unixware7";;
 esac
+
 AC_SUBST(BSD_COMP)
 AC_SUBST(SOLARIS_BITTYPES)
 AC_SUBST(USE_FIONBIO_IOCTL)
 AC_SUBST(PORT_NONBLOCK)
 AC_SUBST(PORT_DIR)
+AC_SUBST(USE_POLL)
+AC_SUBST(HAVE_MD5)
 PORT_INCLUDE=${PORT_DIR}/include
 AC_SUBST(PORT_INCLUDE)
 
-
 #
 # Look for a 4.4BSD or 4.3BSD struct msghdr
 #
index ced4aede874d38c7a8040293b9d8096442224f4a..7476ff4e5d9f6299de4f6cdf24c4b9ce96dde65f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef LINT
-static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/dst_api.c,v 1.12 2005/04/27 04:56:13 sra Exp $";
+static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/dst_api.c,v 1.13 2005/07/28 06:51:46 marka Exp $";
 #endif
 
 /*
@@ -333,7 +333,10 @@ dst_read_key(const char *in_keyname, const u_int16_t in_id,
        if (in_keyname == NULL) {
                EREPORT(("dst_read_private_key(): Null key name passed in\n"));
                return (NULL);
-       } else
+       } else if (strlen(in_keyname) >= sizeof(keyname)) {
+               EREPORT(("dst_read_private_key(): keyname too big\n"));
+               return (NULL);
+       } else 
                strcpy(keyname, in_keyname);
 
        /* before I read in the public key, check if it is allowed to sign */
@@ -344,7 +347,7 @@ dst_read_key(const char *in_keyname, const u_int16_t in_id,
                return pubkey; 
 
        if (!(dg_key = dst_s_get_key_struct(keyname, pubkey->dk_alg,
-                                        pubkey->dk_flags, pubkey->dk_proto,
+                                           pubkey->dk_flags, pubkey->dk_proto,
                                            0)))
                return (dg_key);
        /* Fill in private key and some fields in the general key structure */
index aab94c57ae5068248ccb94c177a819166916663a..3987a84c08941cfccb0485aea4a9d53160404452 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef HMAC_MD5
 #ifndef LINT
-static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.4 2005/04/27 04:56:13 sra Exp $";
+static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.5 2005/07/28 06:51:46 marka Exp $";
 #endif
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -36,8 +36,15 @@ static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/
 #include <resolv.h>
 
 #include "dst_internal.h"
+
 #ifdef USE_MD5
-# include "md5.h"
+# ifndef HAVE_MD5
+#  include "md5.h"
+# else
+#  ifdef SOLARIS2
+#   include <sys/md5.h>
+#  endif
+# endif
 # ifndef _MD5_H_
 #  define _MD5_H_ 1    /*%< make sure we do not include rsaref md5.h file */
 # endif
@@ -437,7 +444,11 @@ dst_hmac_md5_generate_key(DST_KEY *key, const int nothing)
  *        related functions 
  */
 int
+#ifdef SUNW_LIBMD5
+dst_md5_hmac_init()
+#else
 dst_hmac_md5_init()
+#endif
 {
        if (dst_t_func[KEY_HMAC_MD5] != NULL)
                return (1);
index f1e2ae1eeb389dfbb3c35a2c0045c8c6052c6f56..b1ed9e13fdaf57919db113fe42a3c5947dd8d258 100644 (file)
@@ -59,6 +59,8 @@
 #ifndef HEADER_MD5_H
 #define HEADER_MD5_H
 
+#ifndef        HAVE_MD5
+
 #ifdef  __cplusplus
 extern "C" {
 #endif
@@ -99,5 +101,8 @@ unsigned char *MD5();
 #endif
 
 #endif
+#else 
+#include <sys/md5.h>
+#endif /* HAVE_MD5 */
 
 /*! \file */
index d839087b036235c6b4e9610a44d0a35939d76539..76b0505760e79372d7892325ee9d8c9bf2e88f37 100644 (file)
@@ -58,6 +58,7 @@
 
 #ifdef USE_MD5 /*%< Added by ogud@tis.com 1998/1/26 */
 #include <port_before.h>
+#ifndef HAVE_MD5
 #include <stdio.h>
 #include "md5_locl.h"
 #include <port_after.h>
@@ -369,4 +370,5 @@ unsigned long *l;
                }
        }
 #endif
+#endif /* HAVE_MD5 */
 #endif /* USE_MD5 */
index b6dab01e530b8011b8665b1b3571df56e4fb7c2f..7905365a435342dd1abad68e12835b103136e6db 100644 (file)
@@ -1,4 +1,4 @@
-static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/support.c,v 1.4 2005/04/27 04:56:14 sra Exp $";
+static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/support.c,v 1.5 2005/07/28 06:51:47 marka Exp $";
 
 
 /*
@@ -305,19 +305,15 @@ dst_s_fopen(const char *filename, const char *mode, int perm)
 {
        FILE *fp;
        char pathname[PATH_MAX];
-       size_t plen = sizeof(pathname);
+
+       if (strlen(filename) + strlen(dst_path) >= sizeof(pathname))
+               return (NULL);
 
        if (*dst_path != '\0') {
                strcpy(pathname, dst_path);
-               plen -= strlen(pathname);
-       }
-       else 
-               pathname[0] = '\0';
-
-       if (plen > strlen(filename))
-               strncpy(&pathname[PATH_MAX - plen], filename, plen-1);
-       else 
-               return (NULL);
+               strcat(pathname, filename);
+       } else
+               strcpy(pathname, filename);
        
        fp = fopen(pathname, mode);
        if (perm)
index 62b443aafed8b16f57fabf21b133d594b415af38..ac5d6de3d67486d0f6932cbf28b0443009e45307 100644 (file)
@@ -18,7 +18,7 @@
 /* eventlib.h - exported interfaces for eventlib
  * vix 09sep95 [initial]
  *
- * $Id: eventlib.h,v 1.4 2005/04/27 04:56:17 sra Exp $
+ * $Id: eventlib.h,v 1.5 2005/07/28 06:51:47 marka Exp $
  */
 
 #ifndef _EVENTLIB_H
@@ -76,6 +76,8 @@ typedef       struct { unsigned char mask[256/8]; } evByteMask;
 #define        EV_WRITE        2
 #define        EV_EXCEPT       4
 
+#define EV_WASNONBLOCKING 8    /* Internal library use. */
+
 /* eventlib.c */
 #define evCreate       __evCreate
 #define evSetDebug     __evSetDebug
diff --git a/lib/bind/include/resolv_mt.h b/lib/bind/include/resolv_mt.h
new file mode 100644 (file)
index 0000000..27963a1
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef _RESOLV_MT_H
+#define _RESOLV_MT_H
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+/* Access functions for the libresolv private interface */
+
+int    __res_enable_mt(void);
+int    __res_disable_mt(void);
+
+/* Per-thread context */
+
+typedef struct {
+int    no_hosts_fallback_private;
+int    retry_save;
+int    retry_private;
+char   inet_nsap_ntoa_tmpbuf[255*3];
+char   sym_ntos_unname[20];
+char   sym_ntop_unname[20];
+char   p_option_nbuf[40];
+char   p_time_nbuf[40];
+char   precsize_ntoa_retbuf[sizeof "90000000.00"];
+char   loc_ntoa_tmpbuf[sizeof
+"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"];
+char   p_secstodate_output[15];
+} mtctxres_t;
+
+/* Thread-specific data (TSD) */
+
+mtctxres_t     *___mtctxres(void);
+#define mtctxres       (___mtctxres())
+
+/* Various static data that should be TSD */
+
+#define sym_ntos_unname                (mtctxres->sym_ntos_unname)
+#define sym_ntop_unname                (mtctxres->sym_ntop_unname)
+#define inet_nsap_ntoa_tmpbuf  (mtctxres->inet_nsap_ntoa_tmpbuf)
+#define p_option_nbuf          (mtctxres->p_option_nbuf)
+#define p_time_nbuf            (mtctxres->p_time_nbuf)
+#define precsize_ntoa_retbuf   (mtctxres->precsize_ntoa_retbuf)
+#define loc_ntoa_tmpbuf                (mtctxres->loc_ntoa_tmpbuf)
+#define p_secstodate_output    (mtctxres->p_secstodate_output)
+
+#endif /* _RESOLV_MT_H */
index 5f654ae635b9e5df522164067ff118cb67d0b85a..2c516c798a3cf4b6ec6c66c4539c5b6f51123218 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_pton.c,v 1.4 2005/04/27 04:56:21 sra Exp $";
+static const char rcsid[] = "$Id: inet_pton.c,v 1.5 2005/07/28 06:51:47 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -141,7 +141,7 @@ inet_pton6(src, dst)
                          xdigits_u[] = "0123456789ABCDEF";
        u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
        const char *xdigits, *curtok;
-       int ch, saw_xdigit;
+       int ch, seen_xdigits;
        u_int val;
 
        memset((tp = tmp), '\0', NS_IN6ADDRSZ);
@@ -152,7 +152,7 @@ inet_pton6(src, dst)
                if (*++src != ':')
                        return (0);
        curtok = src;
-       saw_xdigit = 0;
+       seen_xdigits = 0;
        val = 0;
        while ((ch = *src++) != '\0') {
                const char *pch;
@@ -162,14 +162,13 @@ inet_pton6(src, dst)
                if (pch != NULL) {
                        val <<= 4;
                        val |= (pch - xdigits);
-                       if (val > 0xffff)
+                       if (++seen_xdigits > 4)
                                return (0);
-                       saw_xdigit = 1;
                        continue;
                }
                if (ch == ':') {
                        curtok = src;
-                       if (!saw_xdigit) {
+                       if (!seen_xdigits) {
                                if (colonp)
                                        return (0);
                                colonp = tp;
@@ -181,19 +180,19 @@ inet_pton6(src, dst)
                                return (0);
                        *tp++ = (u_char) (val >> 8) & 0xff;
                        *tp++ = (u_char) val & 0xff;
-                       saw_xdigit = 0;
+                       seen_xdigits = 0;
                        val = 0;
                        continue;
                }
                if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
                    inet_pton4(curtok, tp) > 0) {
                        tp += NS_INADDRSZ;
-                       saw_xdigit = 0;
+                       seen_xdigits = 0;
                        break;  /*%< '\\0' was seen by inet_pton4(). */
                }
                return (0);
        }
-       if (saw_xdigit) {
+       if (seen_xdigits) {
                if (tp + NS_INT16SZ > endp)
                        return (0);
                *tp++ = (u_char) (val >> 8) & 0xff;
index e2c2ccf9a5d163f319ff9a4d4bf15c18322bd4f8..b6432e1e49ccbbacdb0a7db5d1d6caf2211566a7 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: nsap_addr.c,v 1.4 2005/04/27 04:56:21 sra Exp $";
+static const char rcsid[] = "$Id: nsap_addr.c,v 1.5 2005/07/28 06:51:48 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -31,6 +31,7 @@ static const char rcsid[] = "$Id: nsap_addr.c,v 1.4 2005/04/27 04:56:21 sra Exp
 
 #include <ctype.h>
 #include <resolv.h>
+#include <resolv_mt.h>
 
 #include "port_after.h"
 
@@ -79,7 +80,7 @@ char *
 inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
        int nib;
        int i;
-       static char tmpbuf[2+255*3];
+       char *tmpbuf = inet_nsap_ntoa_tmpbuf;
        char *start;
 
        if (ascii)
index 23b06c39696e82b4c466d8207e309746375894e9..fe04f0903a970d394bbe4765138605aa2ef250b4 100644 (file)
@@ -248,6 +248,7 @@ do { \
                goto free; \
 } while (/*CONSTCOND*/0)
 
+#ifndef SOLARIS2
 #define ERR(err) \
 do { \
        /* external reference: error, and label bad */ \
@@ -255,6 +256,16 @@ do { \
        goto bad; \
        /*NOTREACHED*/ \
 } while (/*CONSTCOND*/0)
+#else
+#define ERR(err) \
+do { \
+       /* external reference: error, and label bad */ \
+       error = (err); \
+       if (error == error) \
+               goto bad; \
+} while (/*CONSTCOND*/0)
+#endif
+
 
 #define MATCH_FAMILY(x, y, w) \
        ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC)))
@@ -325,6 +336,15 @@ getaddrinfo(hostname, servname, hints, res)
        pai->ai_family = PF_UNSPEC;
        pai->ai_socktype = ANY;
        pai->ai_protocol = ANY;
+#ifdef __sparcv9
+       /*
+        * clear _ai_pad to preserve binary
+        * compatibility with previously compiled 64-bit
+        * applications in a pre-SUSv3 environment by
+        * guaranteeing the upper 32-bits are empty.
+        */
+       pai->_ai_pad = 0;
+#endif /* __sparcv9 */
        pai->ai_addrlen = 0;
        pai->ai_canonname = NULL;
        pai->ai_addr = NULL;
@@ -349,6 +369,13 @@ getaddrinfo(hostname, servname, hints, res)
                }
                memcpy(pai, hints, sizeof(*pai));
 
+#ifdef __sparcv9
+               /*
+                * We need to clear _ai_pad to preserve binary
+                * compatibility.  See prior comment.
+                */
+               pai->_ai_pad = 0;
+#endif
                /*
                 * if both socktype/protocol are specified, check if they
                 * are meaningful combination.
index f4e7cfa97201741547196cfb05cf5fb3b78a215f..80d669dbe0acd52e9588982b11fdb5bd0adf2514 100644 (file)
@@ -1,5 +1,5 @@
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: hesiod.c,v 1.6 2005/04/27 04:56:27 sra Exp $";
+static const char rcsid[] = "$Id: hesiod.c,v 1.7 2005/07/28 06:51:48 marka Exp $";
 #endif
 
 /*
@@ -83,9 +83,7 @@ hesiod_init(void **context) {
                return (-1);
        }
 
-       ctx->LHS = NULL;
-       ctx->RHS = NULL;
-       ctx->res = NULL;
+       memset(ctx, 0, sizeof (*ctx));
 
        if (parse_config_file(ctx, _PATH_HESIOD_CONF) < 0) {
 #ifdef DEF_RHS
index 9db59a90dfd9aa6b416bd7e74df28d735d2fc2f3..b12baf1aaa2985601a36fc945d9bc6ddad9c11e0 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_files.c,v 1.7 2005/07/08 04:30:21 marka Exp $";
+static const char rcsid[] = "$Id: ev_files.c,v 1.8 2005/07/28 06:51:48 marka Exp $";
 #endif
 
 #include "port_before.h"
@@ -58,8 +58,10 @@ evSelectFD(evContext opaqueCtx,
                 ctx, fd, eventmask, func, uap);
        if (eventmask == 0 || (eventmask & ~EV_MASK_ALL) != 0)
                EV_ERR(EINVAL);
+#ifndef USE_POLL
        if (fd > ctx->highestFD)
                EV_ERR(EINVAL);
+#endif
        OK(mode = fcntl(fd, F_GETFL, NULL));    /*%< side effect: validate fd. */
        /*
         * The first time we touch a file descriptor, we need to check to see
@@ -67,6 +69,11 @@ evSelectFD(evContext opaqueCtx,
         * of our deselect()'s have to leave it in O_NONBLOCK.  If not, then
         * all but our last deselect() has to leave it in O_NONBLOCK.
         */
+#ifdef USE_POLL
+       /* Make sure both ctx->pollfds[] and ctx->fdTable[] are large enough */
+       if (fd >= ctx->maxnfds && evPollfdRealloc(ctx, 1, fd) != 0)
+               EV_ERR(ENOMEM);
+#endif /* USE_POLL */
        id = FindFD(ctx, fd, EV_MASK_ALL);
        if (id == NULL) {
                if (mode & PORT_NONBLOCK)
@@ -142,13 +149,6 @@ evSelectFD(evContext opaqueCtx,
        if (opaqueID)
                opaqueID->opaque = id;
 
-       evPrintf(ctx, 5,
-               "evSelectFD(fd %d, mask 0x%x): new masks: 0x%lx 0x%lx 0x%lx\n",
-                fd, eventmask,
-                (u_long)ctx->rdNext.fds_bits[0],
-                (u_long)ctx->wrNext.fds_bits[0],
-                (u_long)ctx->exNext.fds_bits[0]);
-
        return (0);
 }
 
@@ -258,13 +258,6 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) {
        if (del == ctx->fdNext)
                ctx->fdNext = del->next;
 
-       evPrintf(ctx, 5,
-             "evDeselectFD(fd %d, mask 0x%x): new masks: 0x%lx 0x%lx 0x%lx\n",
-                del->fd, eventmask,
-                (u_long)ctx->rdNext.fds_bits[0],
-                (u_long)ctx->wrNext.fds_bits[0],
-                (u_long)ctx->exNext.fds_bits[0]);
-
        /* Couldn't free it before now since we were using fields out of it. */
        FREE(del);
 
index 1a01dd8fcf52b31add52363f04f574bde80d9f69..37f3789c8ce007034e979fb9c56eac48fb2b8be9 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: eventlib.c,v 1.8 2005/04/27 04:56:36 sra Exp $";
+static const char rcsid[] = "$Id: eventlib.c,v 1.9 2005/07/28 06:51:49 marka Exp $";
 #endif
 
 #include "port_before.h"
@@ -29,6 +29,9 @@ static const char rcsid[] = "$Id: eventlib.c,v 1.8 2005/04/27 04:56:36 sra Exp $
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
+#ifdef SOLARIS2
+#include <limits.h>
+#endif /* SOLARIS2 */
 
 #include <errno.h>
 #include <signal.h>
@@ -44,9 +47,13 @@ static const char rcsid[] = "$Id: eventlib.c,v 1.8 2005/04/27 04:56:36 sra Exp $
 
 int      __evOptMonoTime;
 
+#ifdef USE_POLL
+#define        pselect Pselect
+#endif /* USE_POLL */
+
 /* Forward. */
 
-#ifdef NEED_PSELECT
+#if defined(NEED_PSELECT) || defined(USE_POLL)
 static int             pselect(int, void *, void *, void *,
                                struct timespec *,
                                const sigset_t *);
@@ -79,6 +86,18 @@ evCreate(evContext *opaqueCtx) {
 
        /* Files. */
        ctx->files = NULL;
+#ifdef USE_POLL
+        ctx->pollfds = NULL;
+       ctx->maxnfds = 0;
+       ctx->firstfd = 0;
+       emulMaskInit(ctx, rdLast, EV_READ, 1);
+       emulMaskInit(ctx, rdNext, EV_READ, 0);
+       emulMaskInit(ctx, wrLast, EV_WRITE, 1);
+       emulMaskInit(ctx, wrNext, EV_WRITE, 0);
+       emulMaskInit(ctx, exLast, EV_EXCEPT, 1);
+       emulMaskInit(ctx, exNext, EV_EXCEPT, 0);
+       emulMaskInit(ctx, nonblockBefore, EV_WASNONBLOCKING, 0);
+#endif /* USE_POLL */
        FD_ZERO(&ctx->rdNext);
        FD_ZERO(&ctx->wrNext);
        FD_ZERO(&ctx->exNext);
@@ -86,11 +105,16 @@ evCreate(evContext *opaqueCtx) {
        ctx->fdMax = -1;
        ctx->fdNext = NULL;
        ctx->fdCount = 0;       /*%< Invalidate {rd,wr,ex}Last. */
+#ifndef USE_POLL
        ctx->highestFD = FD_SETSIZE - 1;
+       memset(ctx->fdTable, 0, sizeof ctx->fdTable);
+#else   
+       ctx->highestFD = INT_MAX / sizeof(struct pollfd);
+       ctx->fdTable = NULL;
+#endif /* USE_POLL */
 #ifdef EVENTLIB_TIME_CHECKS
        ctx->lastFdCount = 0;
 #endif
-       memset(ctx->fdTable, 0, sizeof ctx->fdTable);
 
        /* Streams. */
        ctx->streams = NULL;
@@ -283,34 +307,37 @@ evGetNext(evContext opaqueCtx, evEvent *opaqueEv, int options) {
                }
 #endif
                do {
-                       /* XXX need to copy only the bits we are using. */
-                       ctx->rdLast = ctx->rdNext;
-                       ctx->wrLast = ctx->wrNext;
-                       ctx->exLast = ctx->exNext;
-
+#ifndef USE_POLL
+                        /* XXX need to copy only the bits we are using. */
+                        ctx->rdLast = ctx->rdNext;
+                        ctx->wrLast = ctx->wrNext;
+                        ctx->exLast = ctx->exNext;
+#else
+                       /*
+                        * The pollfd structure uses separate fields for
+                        * the input and output events (corresponding to
+                        * the ??Next and ??Last fd sets), so there's no
+                        * need to copy one to the other.
+                        */
+#endif /* USE_POLL */
                        if (m == Timer) {
                                INSIST(tp == &t);
                                t = evSubTime(nextTime, ctx->lastEventTime);
                        }
 
-                       evPrintf(ctx, 4,
-                               "pselect(%d, 0x%lx, 0x%lx, 0x%lx, %ld.%09ld)\n",
-                                ctx->fdMax+1,
-                                (u_long)ctx->rdLast.fds_bits[0],
-                                (u_long)ctx->wrLast.fds_bits[0],
-                                (u_long)ctx->exLast.fds_bits[0],
-                                tp ? (long)tp->tv_sec : -1L,
-                                tp ? tp->tv_nsec : -1);
-
                        /* XXX should predict system's earliness and adjust. */
                        x = pselect(ctx->fdMax+1,
                                    &ctx->rdLast, &ctx->wrLast, &ctx->exLast,
                                    tp, NULL);
                        pselect_errno = errno;
 
+#ifndef USE_POLL
                        evPrintf(ctx, 4, "select() returns %d (err: %s)\n",
                                 x, (x == -1) ? strerror(errno) : "none");
-
+#else
+                       evPrintf(ctx, 4, "poll() returns %d (err: %s)\n",
+                               x, (x == -1) ? strerror(errno) : "none");
+#endif /* USE_POLL */
                        /* Anything but a poll can change the time. */
                        if (m != JustPoll)
                                ctx->lastEventTime = evNowTime();
@@ -703,7 +730,7 @@ evGetOption(evContext *opaqueCtx, const char *option, int *value) {
        return (-1);
 }
 
-#ifdef NEED_PSELECT
+#if defined(NEED_PSELECT) || defined(USE_POLL)
 /* XXX needs to move to the porting library. */
 static int
 pselect(int nfds, void *rfds, void *wfds, void *efds,
@@ -713,15 +740,69 @@ pselect(int nfds, void *rfds, void *wfds, void *efds,
        struct timeval tv, *tvp;
        sigset_t sigs;
        int n;
+#ifdef USE_POLL
+       int     polltimeout = INFTIM;
+       evContext_p     *ctx;
+       struct pollfd   *fds;
+       nfds_t          pnfds;
+
+       UNUSED(nfds);
+#endif /* USE_POLL */
 
        if (tsp) {
                tvp = &tv;
                tv = evTimeVal(*tsp);
+#ifdef USE_POLL
+               polltimeout = 1000 * tv.tv_sec + tv.tv_usec / 1000;
+#endif /* USE_POLL */
        } else
                tvp = NULL;
        if (sigmask)
                sigprocmask(SIG_SETMASK, sigmask, &sigs);
-       n = select(nfds, rfds, wfds, efds, tvp);
+#ifndef USE_POLL
+        n = select(nfds, rfds, wfds, efds, tvp);
+#else
+        /*
+        * rfds, wfds, and efds should all be from the same evContext_p,
+        * so any of them will do. If they're all NULL, the caller is
+        * presumably calling us to block.
+        */
+       if (rfds != NULL)
+               ctx = ((__evEmulMask *)rfds)->ctx;
+       else if (wfds != NULL)
+               ctx = ((__evEmulMask *)wfds)->ctx;
+       else if (efds != NULL)
+               ctx = ((__evEmulMask *)efds)->ctx;
+       else
+               ctx = NULL;
+       if (ctx != NULL && ctx->fdMax != -1) {
+               fds = &(ctx->pollfds[ctx->firstfd]);
+               pnfds = ctx->fdMax - ctx->firstfd + 1;
+       } else {
+               fds = NULL;
+               pnfds = 0;
+       }
+       n = poll(fds, pnfds, polltimeout);
+       /*
+        * pselect() should return the total number of events on the file
+        * desriptors, not just the count of fd:s with activity. Hence,
+        * traverse the pollfds array and count the events.
+        */
+       if (n > 0) {
+               int     i, e;
+               for (e = 0, i = ctx->firstfd; i <= ctx->fdMax; i++) {
+                       if (ctx->pollfds[i].fd < 0)
+                               continue;
+                       if (FD_ISSET(i, &ctx->rdLast))
+                               e++;
+                       if (FD_ISSET(i, &ctx->wrLast))
+                               e++;
+                       if (FD_ISSET(i, &ctx->exLast))
+                               e++;
+               }
+               n = e;
+       }
+#endif /* USE_POLL */
        if (sigmask)
                sigprocmask(SIG_SETMASK, &sigs, NULL);
        if (tsp)
@@ -730,4 +811,126 @@ pselect(int nfds, void *rfds, void *wfds, void *efds,
 }
 #endif
 
+#ifdef USE_POLL
+int
+evPollfdRealloc(evContext_p *ctx, int pollfd_chunk_size, int fd) {
+       int     i, maxnfds;
+       void    *pollfds, *fdTable;
+       if (fd < ctx->maxnfds)
+               return (0);
+       /* Don't allow ridiculously small values for pollfd_chunk_size */
+       if (pollfd_chunk_size < 20)
+               pollfd_chunk_size = 20;
+       maxnfds = (1 + (fd/pollfd_chunk_size)) * pollfd_chunk_size;
+       pollfds = realloc(ctx->pollfds, maxnfds * sizeof(*ctx->pollfds));
+       if (pollfds != NULL)
+               ctx->pollfds = pollfds;
+       fdTable = realloc(ctx->fdTable, maxnfds * sizeof(*ctx->fdTable));
+       if (fdTable != NULL)
+               ctx->fdTable = fdTable;
+       if (pollfds == NULL || fdTable == NULL) {
+               evPrintf(ctx, 2, "pollfd() realloc (%ld) failed\n",
+                        (long)maxnfds*sizeof(struct pollfd));
+               return (-1);
+       }
+       for (i = ctx->maxnfds; i < maxnfds; i++) {
+               ctx->pollfds[i].fd = -1;
+               ctx->pollfds[i].events = 0;
+               ctx->fdTable[i] = 0;
+       }
+
+       ctx->maxnfds = maxnfds;
+
+       return (0);
+}
+/* Find the appropriate 'events' or 'revents' field in the pollfds array */
+short *
+__fd_eventfield(int fd, __evEmulMask *maskp) {
+       evContext_p     *ctx = (evContext_p *)maskp->ctx;
+       if (!maskp->result || maskp->type == EV_WASNONBLOCKING)
+               return (&(ctx->pollfds[fd].events));
+       else
+               return (&(ctx->pollfds[fd].revents));
+}
+/* Translate to poll(2) event */
+short
+__poll_event(__evEmulMask *maskp) {
+       switch ((maskp)->type) {
+       case EV_READ:
+               return (POLLRDNORM);
+       case EV_WRITE:
+               return (POLLWRNORM);
+       case EV_EXCEPT:
+               return (POLLRDBAND | POLLPRI | POLLWRBAND);
+       case EV_WASNONBLOCKING:
+               return (POLLHUP);
+       default:
+               return (0);
+       }
+}
+/*
+ * Clear the events corresponding to the specified mask. If this leaves
+ * the events mask empty (apart from the POLLHUP bit), set the fd field
+ * to -1 so that poll(2) will ignore this fd.
+ */
+void
+__fd_clr(int fd, __evEmulMask *maskp) {
+       evContext_p     *ctx = maskp->ctx;
+       *__fd_eventfield(fd, maskp) &= ~__poll_event(maskp);
+       if ((ctx->pollfds[fd].events & ~POLLHUP) == 0) {
+               ctx->pollfds[fd].fd = -1;
+               if (fd == ctx->fdMax)
+                       while (ctx->fdMax > ctx->firstfd &&
+                              ctx->pollfds[ctx->fdMax].fd < 0)
+                               ctx->fdMax--;
+               if (fd == ctx->firstfd)
+                       while (ctx->firstfd <= ctx->fdMax &&
+                              ctx->pollfds[ctx->firstfd].fd < 0)
+                               ctx->firstfd++;
+               /*
+                * Do we have a empty set of descriptors?
+                */
+               if (ctx->firstfd > ctx->fdMax) {
+                       ctx->fdMax = -1;
+                       ctx->firstfd = 0;
+               }
+       }
+}
+/*
+ * Set the events bit(s) corresponding to the specified mask. If the events
+ * field has any other bits than POLLHUP set, also set the fd field so that
+ * poll(2) will watch this fd.
+ */
+void
+__fd_set(int fd, __evEmulMask *maskp) {
+       evContext_p     *ctx = maskp->ctx;
+
+       *__fd_eventfield(fd, maskp) |= __poll_event(maskp);
+       if ((ctx->pollfds[fd].events & ~POLLHUP) != 0) {
+               ctx->pollfds[fd].fd = fd;
+               if (fd < ctx->firstfd || ctx->fdMax == -1)
+                       ctx->firstfd = fd;
+               if (fd > ctx->fdMax)
+                       ctx->fdMax = fd;
+       }
+}
+#endif /* USE_POLL */
+
 /*! \file */
index 8244087efaff9bcf778e1e778aa1c66c49f4be67..9eedff93837dd10a22482ee9baf7147f7c53a02a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2005 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-1999 by Internet Software Consortium
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -19,7 +19,7 @@
  * \brief private interfaces for eventlib
  * \author vix 09sep95 [initial]
  *
- * $Id: eventlib_p.h,v 1.7 2005/04/27 04:56:38 sra Exp $
+ * $Id: eventlib_p.h,v 1.8 2005/07/28 06:51:49 marka Exp $
  */
 
 #ifndef _EVENTLIB_P_H
 #define FILL(p)
 #endif
 
+#ifdef USE_POLL
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+#include <poll.h>
+#endif /* USE_POLL */
+
 typedef struct evConn {
        evConnFunc      func;
        void *          uap;
@@ -167,6 +174,40 @@ typedef struct evEvent_p {
        } u;
 } evEvent_p;
 
+#ifdef USE_POLL
+typedef struct { 
+       void            *ctx;   /* pointer to the evContext_p   */ 
+       uint32_t        type;   /* READ, WRITE, EXCEPT, nonblk  */ 
+       uint32_t        result; /* 1 => revents, 0 => events    */ 
+} __evEmulMask; 
+
+#define emulMaskInit(ctx, field, ev, lastnext) \
+       ctx->field.ctx = ctx; \
+       ctx->field.type = ev; \
+       ctx->field.result = lastnext; 
+  
+extern short   *__fd_eventfield(int fd, __evEmulMask *maskp); 
+extern short   __poll_event(__evEmulMask *maskp); 
+extern void            __fd_clr(int fd, __evEmulMask *maskp); 
+extern void            __fd_set(int fd, __evEmulMask *maskp); 
+
+#undef  FD_ZERO 
+#define FD_ZERO(maskp) 
+  
+#undef  FD_SET 
+#define FD_SET(fd, maskp) \
+       __fd_set(fd, maskp) 
+
+#undef  FD_CLR 
+#define FD_CLR(fd, maskp) \
+       __fd_clr(fd, maskp) 
+
+#undef  FD_ISSET 
+#define FD_ISSET(fd, maskp) \
+       ((*__fd_eventfield(fd, maskp) & __poll_event(maskp)) != 0) 
+
+#endif /* USE_POLL */
+
 typedef struct {
        /* Global. */
        const evEvent_p *cur;
@@ -178,12 +219,26 @@ typedef struct {
        LIST(evAccept)  accepts;
        /* Files. */
        evFile          *files, *fdNext;
+#ifndef USE_POLL
        fd_set          rdLast, rdNext;
        fd_set          wrLast, wrNext;
        fd_set          exLast, exNext;
        fd_set          nonblockBefore;
        int             fdMax, fdCount, highestFD;
        evFile          *fdTable[FD_SETSIZE];
+#else
+       struct pollfd   *pollfds;       /* Allocated as needed  */ 
+       evFile          **fdTable;      /* Ditto                */ 
+       int             maxnfds;        /* # elements in above  */ 
+       int             firstfd;        /* First active fd      */ 
+       int             fdMax;          /* Last active fd       */ 
+       int             fdCount;        /* # fd:s with I/O      */ 
+       int             highestFD;      /* max fd allowed by OS */ 
+       __evEmulMask    rdLast, rdNext; 
+       __evEmulMask    wrLast, wrNext; 
+       __evEmulMask    exLast, exNext; 
+       __evEmulMask    nonblockBefore; 
+#endif /* USE_POLL */
 #ifdef EVENTLIB_TIME_CHECKS
        struct timespec lastSelectTime;
        int             lastFdCount;
@@ -204,6 +259,10 @@ typedef struct {
 void evPrintf(const evContext_p *ctx, int level, const char *fmt, ...)
      ISC_FORMAT_PRINTF(3, 4);
 
+#ifdef USE_POLL
+extern int evPollfdRealloc(evContext_p *ctx, int pollfd_chunk_size, int fd);
+#endif /* USE_POLL */
+
 /* ev_timers.c */
 #define evCreateTimers __evCreateTimers
 heap_context evCreateTimers(const evContext_p *);
index 8e25886e30dd63be34d1ad2d7043c3dc034f6d4a..5fd88e3a801a074ea24064646e8fbdffce6b1b2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2005 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1997,1999 by Internet Software Consortium.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -24,7 +24,7 @@
 
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: memcluster.c,v 1.7 2005/04/27 04:56:39 sra Exp $";
+static const char rcsid[] = "$Id: memcluster.c,v 1.8 2005/07/28 06:51:49 marka Exp $";
 #endif /* not lint */
 
 #include "port_before.h"
@@ -90,6 +90,20 @@ struct stats {
        u_long                  freefrags;
 };
 
+#ifdef DO_PTHREADS
+#include <pthread.h>
+static pthread_mutex_t memlock = PTHREAD_MUTEX_INITIALIZER;
+#define MEMLOCK                (void)pthread_mutex_lock(&memlock)
+#define MEMUNLOCK      (void)pthread_mutex_unlock(&memlock)
+#else
+/*
+ * Catch bad lock usage in non threaded build.
+ */
+static unsigned int    memlock = 0;
+#define MEMLOCK                do { INSIST(memlock == 0); memlock = 1; } while (0)
+#define MEMUNLOCK      do { INSIST(memlock == 1); memlock = 0; } while (0)
+#endif  /* DO_PTHEADS */
+
 /* Private data. */
 
 static size_t                  max_size;
@@ -173,14 +187,19 @@ __memget_record(size_t size, const char *file, int line) {
 #endif
        void *ret;
 
+       MEMLOCK;
+
 #if !defined(MEMCLUSTER_RECORD)
        UNUSED(file);
        UNUSED(line);
 #endif
-       if (freelists == NULL)
+       if (freelists == NULL) {
+               MEMUNLOCK;
                if (meminit(0, 0) == -1)
                        return (NULL);
+       }
        if (size == 0U) {
+               MEMUNLOCK;
                errno = EINVAL;
                return (NULL);
        }
@@ -191,6 +210,7 @@ __memget_record(size_t size, const char *file, int line) {
 #if defined(DEBUGGING_MEMCLUSTER)
                e = malloc(new_size);
                if (e == NULL) {
+                       MEMUNLOCK;
                        errno = ENOMEM;
                        return (NULL);
                }
@@ -202,11 +222,13 @@ __memget_record(size_t size, const char *file, int line) {
                e->next = activelists[max_size];
                activelists[max_size] = e;
 #endif
+               MEMUNLOCK;
                e->fencepost = FRONT_FENCEPOST;
                p = (char *)e + sizeof *e + size;
                memcpy(p, &fp, sizeof fp);
                return ((char *)e + sizeof *e);
 #else
+               MEMUNLOCK;
                return (malloc(size));
 #endif
        }
@@ -226,6 +248,7 @@ __memget_record(size_t size, const char *file, int line) {
                if (basic_blocks == NULL) {
                        new = malloc(NUM_BASIC_BLOCKS * mem_target);
                        if (new == NULL) {
+                               MEMUNLOCK;
                                errno = ENOMEM;
                                return (NULL);
                        }
@@ -253,6 +276,7 @@ __memget_record(size_t size, const char *file, int line) {
                        total_size = mem_target;
                new = malloc(total_size);
                if (new == NULL) {
+                       MEMUNLOCK;
                        errno = ENOMEM;
                        return (NULL);
                }
@@ -318,6 +342,7 @@ __memget_record(size_t size, const char *file, int line) {
        stats[size].gets++;
        stats[size].totalgets++;
        stats[new_size].freefrags--;
+       MEMUNLOCK;
 #if defined(DEBUGGING_MEMCLUSTER)
        return ((char *)e + sizeof *e);
 #else
@@ -347,6 +372,8 @@ __memput_record(void *mem, size_t size, const char *file, int line) {
        char *p;
 #endif
 
+       MEMLOCK;
+
 #if !defined (MEMCLUSTER_RECORD)
        UNUSED(file);
        UNUSED(line);
@@ -355,6 +382,7 @@ __memput_record(void *mem, size_t size, const char *file, int line) {
        REQUIRE(freelists != NULL);
 
        if (size == 0U) {
+               MEMUNLOCK;
                errno = EINVAL;
                return;
        }
@@ -398,6 +426,7 @@ __memput_record(void *mem, size_t size, const char *file, int line) {
 
                INSIST(stats[max_size].gets != 0U);
                stats[max_size].gets--;
+               MEMUNLOCK;
                return;
        }
 
@@ -436,6 +465,7 @@ __memput_record(void *mem, size_t size, const char *file, int line) {
        INSIST(stats[size].gets != 0U);
        stats[size].gets--;
        stats[new_size].freefrags++;
+       MEMUNLOCK;
 }
 
 void *
@@ -464,8 +494,12 @@ memstats(FILE *out) {
        memcluster_element *e;
 #endif
 
-       if (freelists == NULL)
+       MEMLOCK;
+
+       if (freelists == NULL) {
+               MEMUNLOCK;
                return;
+       }
        for (i = 1; i <= max_size; i++) {
                const struct stats *s = &stats[i];
 
@@ -492,6 +526,7 @@ memstats(FILE *out) {
                        }
        }
 #endif
+       MEMUNLOCK;
 }
 
 int
index 4f36b596dd897c6e9b3a1680ab7014ff7d6255f7..69c2f83f57756bf1158bdee6f67af655f3f79699 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ns_ttl.c,v 1.3 2005/04/27 04:56:40 sra Exp $";
+static const char rcsid[] = "$Id: ns_ttl.c,v 1.4 2005/07/28 06:51:49 marka Exp $";
 #endif
 
 /* Import. */
@@ -133,7 +133,8 @@ ns_parse_ttl(const char *src, u_long *dst) {
                        goto einval;
                else
                        ttl += tmp;
-       }
+       } else if (!dirty)
+               goto einval;
        *dst = ttl;
        return (0);
 
index edf3542cf75fb9dda2659b39e0500a4f0d457a6d..01469f0dc3e59222af0cc33a4eedba0b912e32da 100644 (file)
@@ -18,6 +18,8 @@ struct timezone;        /* silence warning */
 @WANT_IRS_PW@
 
 @BSD_COMP@
+@USE_POLL@
+@HAVE_MD5@
 
 @DO_PTHREADS@
 @GETGROUPLIST_ARGS@
index fe3a2aebdc5cfff2c84edb08dfa0149bc7111635..f3e2f6e857ffea70e9f9dbcb75bec6a59e7fbc08 100644 (file)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: Makefile.in,v 1.4 2004/03/16 05:22:30 marka Exp $
+# $Id: Makefile.in,v 1.5 2005/07/28 06:51:50 marka Exp $
 
 srcdir=                @srcdir@
 VPATH =         @srcdir@
 
-OBJS=  herror.@O@ res_comp.@O@ res_data.@O@ res_debug.@O@ \
+OBJS=  herror.@O@ mtctxres.@O@ res_comp.@O@ res_data.@O@ res_debug.@O@ \
        res_findzonecut.@O@ res_init.@O@ res_mkquery.@O@ res_mkupdate.@O@ \
        res_query.@O@ res_send.@O@ res_sendsigned.@O@ res_update.@O@
 
-SRCS=  herror.c res_comp.c res_data.c res_debug.c \
+SRCS=  herror.c mtctxres.c res_comp.c res_data.c res_debug.c \
        res_findzonecut.c res_init.c res_mkquery.c res_mkupdate.c \
        res_query.c res_send.c res_sendsigned.c res_update.c
 
diff --git a/lib/bind/resolv/mtctxres.c b/lib/bind/resolv/mtctxres.c
new file mode 100644 (file)
index 0000000..2a9c63a
--- /dev/null
@@ -0,0 +1,128 @@
+#include <port_before.h>
+#ifdef DO_PTHREADS
+#include <pthread.h>
+#endif
+#include <errno.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <string.h>
+#include <resolv_mt.h>
+#include <irs.h>
+#include <port_after.h>
+
+#ifdef DO_PTHREADS
+static pthread_key_t   key;
+static int             mt_key_initialized = 0;
+
+static int             __res_init_ctx(void);
+static void            __res_destroy_ctx(void *);
+
+#ifdef sun
+#pragma init   (_mtctxres_init)
+#endif
+#endif
+
+static mtctxres_t      sharedctx;
+
+#ifdef DO_PTHREADS
+/*
+ * Initialize the TSD key. By doing this at library load time, we're
+ * implicitly running without interference from other threads, so there's
+ * no need for locking.
+ */
+static void
+_mtctxres_init(void) {
+       int pthread_keycreate_ret;
+
+       pthread_keycreate_ret = pthread_key_create(&key, __res_destroy_ctx);
+       if (pthread_keycreate_ret == 0)
+               mt_key_initialized = 1;
+}
+#endif
+
+/*
+ * To support binaries that used the private MT-safe interface in
+ * Solaris 8, we still need to provide the __res_enable_mt()
+ * and __res_disable_mt() entry points. They're do-nothing routines.
+ */
+int
+__res_enable_mt(void) {
+       return (-1);
+}
+
+int
+__res_disable_mt(void) {
+       return (0);
+}
+
+#ifdef DO_PTHREADS
+static int
+__res_init_ctx(void) {
+
+       mtctxres_t      *mt;
+       int             ret;
+
+
+       if (pthread_getspecific(key) != 0) {
+               /* Already exists */
+               return (0);
+       }
+
+       if ((mt = malloc(sizeof (mtctxres_t))) == 0) {
+               errno = ENOMEM;
+               return (-1);
+       }
+
+       memset(mt, 0, sizeof (mtctxres_t));
+
+       if ((ret = pthread_setspecific(key, mt)) != 0) {
+               free(mt);
+               errno = ret;
+               return (-1);
+       }
+
+       return (0);
+}
+
+static void
+__res_destroy_ctx(void *value) {
+
+       mtctxres_t      *mt = (mtctxres_t *)value;
+
+       if (mt != 0)
+               free(mt);
+}
+#endif
+
+mtctxres_t *
+___mtctxres(void) {
+#ifdef DO_PTHREADS
+       mtctxres_t      *mt;
+
+       /*
+        * This if clause should only be executed if we are linking
+        * statically.  When linked dynamically _mtctxres_init() should
+        * be called at binding time due the #pragma above.
+        */
+       if (!mt_key_initialized) {
+               static pthread_mutex_t keylock = PTHREAD_MUTEX_INITIALIZER;
+                pthread_mutex_lock(&keylock);
+               _mtctxres_init();
+                pthread_mutex_unlock(&keylock);
+       }
+
+       /*
+        * If we have already been called in this thread return the existing
+        * context.  Otherwise recreat a new context and return it.  If
+        * that fails return a global context.
+        */
+       if (mt_key_initialized) {
+               if (((mt = pthread_getspecific(key)) != 0) ||
+                   (__res_init_ctx() == 0 &&
+                    (mt = pthread_getspecific(key)) != 0)) {
+                       return (mt);
+               }
+       }
+#endif
+       return (&sharedctx);
+}
index 96a20f7c076f54842fad1b615b23fa087e8c7546..08a66b21c53723a7df94895ab204ac7801534980 100644 (file)
@@ -70,7 +70,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_comp.c   8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_comp.c,v 1.4 2005/04/27 04:56:41 sra Exp $";
+static const char rcsid[] = "$Id: res_comp.c,v 1.5 2005/07/28 06:51:50 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -242,6 +242,18 @@ res_dnok(const char *dn) {
  *     __getshort
  * Note that one _ comes from C and the others come from us.
  */
+
+#ifdef SOLARIS2
+#ifdef  __putlong
+#undef  __putlong
+#endif
+#ifdef  __putshort
+#undef  __putshort
+#endif
+#pragma weak    putlong         =       __putlong
+#pragma weak    putshort        =       __putshort
+#endif /* SOLARIS2 */
+
 void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); }
 void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); }
 #ifndef __ultrix__
index 06da2dfa39bbbe78f5b08c38b32f957868e402b1..b12a112ff0dfcadbc9e04e2e52035bb7990baba0 100644 (file)
@@ -95,7 +95,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_debug.c  8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 1.14 2005/04/27 04:56:41 sra Exp $";
+static const char rcsid[] = "$Id: res_debug.c,v 1.15 2005/07/28 06:51:50 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -113,6 +113,7 @@ static const char rcsid[] = "$Id: res_debug.c,v 1.14 2005/04/27 04:56:41 sra Exp
 #include <math.h>
 #include <netdb.h>
 #include <resolv.h>
+#include <resolv_mt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -505,7 +506,7 @@ sym_ston(const struct res_sym *syms, const char *name, int *success) {
 
 const char *
 sym_ntos(const struct res_sym *syms, int number, int *success) {
-       static char unname[20];
+       char *unname = sym_ntos_unname;
 
        for ((void)NULL; syms->name != 0; syms++) {
                if (number == syms->number) {
@@ -523,7 +524,7 @@ sym_ntos(const struct res_sym *syms, int number, int *success) {
 
 const char *
 sym_ntop(const struct res_sym *syms, int number, int *success) {
-       static char unname[20];
+       char *unname = sym_ntop_unname;
 
        for ((void)NULL; syms->name != 0; syms++) {
                if (number == syms->number) {
@@ -597,7 +598,7 @@ p_class(int class) {
  */
 const char *
 p_option(u_long option) {
-       static char nbuf[40];
+       char *nbuf = p_option_nbuf;
 
        switch (option) {
        case RES_INIT:          return "init";
@@ -640,7 +641,8 @@ p_option(u_long option) {
  */
 const char *
 p_time(u_int32_t value) {
-       static char nbuf[40];           /*%< XXX nonreentrant */
+       char *nbuf = p_time_nbuf;
+
        if (ns_format_ttl(value, nbuf, sizeof nbuf) < 0)
                sprintf(nbuf, "%u", value);
        return (nbuf);
@@ -695,7 +697,7 @@ static const char *
 precsize_ntoa(prec)
        u_int8_t prec;
 {
-       static char retbuf[sizeof "90000000.00"];       /*%< XXX nonreentrant */
+       char *retbuf = precsize_ntoa_retbuf;
        unsigned long val;
        int mantissa, exponent;
 
@@ -1096,8 +1098,7 @@ dn_count_labels(const char *name) {
  */
 char *
 p_secstodate (u_long secs) {
-       /* XXX nonreentrant */
-       static char output[15];         /*%< YYYYMMDDHHMMSS and null */
+       char *output = p_secstodate_output;
        time_t clock = secs;
        struct tm *time;
 #ifdef HAVE_TIME_R
index 22aee1305064f40c3d915c6323077c680a89b1fd..50fc8c4d72973f5a425de36a5248ce17602a4dca 100644 (file)
@@ -70,7 +70,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_init.c   8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.17 2005/04/27 04:56:42 sra Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 1.18 2005/07/28 06:51:51 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -102,6 +102,10 @@ static const char rcsid[] = "$Id: res_init.c,v 1.17 2005/04/27 04:56:42 sra Exp
 #define RESOLVSORT
 #define DEBUG
 
+#ifdef SOLARIS2
+#include <sys/systeminfo.h>
+#endif
+
 static void res_setoptions __P((res_state, const char *, const char *));
 
 #ifdef RESOLVSORT
@@ -218,6 +222,35 @@ __res_vinit(res_state statp, int preinit) {
 #endif
        res_setservers(statp, u, nserv);
 
+#ifdef SOLARIS2
+       /*
+        * The old libresolv derived the defaultdomain from NIS/NIS+.
+        * We want to keep this behaviour
+        */
+       {
+               char buf[sizeof(statp->defdname)], *cp;
+               int ret;
+
+               if ((ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf))) > 0 &&
+                       (unsigned int)ret <= sizeof(buf)) {
+                       if (buf[0] == '+')
+                               buf[0] = '.';
+                       cp = strchr(buf, '.');
+                       if (cp == NULL) {
+                               if (strlcpy(statp->defdname, buf,
+                                       sizeof(statp->defdname))
+                                       >= sizeof(statp->defdname))
+                                       return (-1);
+                       } else {
+                               if (strlcpy(statp->defdname, cp+1,
+                                       sizeof(statp->defdname))
+                                        >= sizeof(statp->defdname))
+                                       return (-1);
+                       }
+               }
+       }
+#endif /* SOLARIS2 */
+
        /* Allow user to override the local domain definition */
        if ((cp = getenv("LOCALDOMAIN")) != NULL) {
                (void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
@@ -495,6 +528,22 @@ res_setoptions(res_state statp, const char *options, const char *source)
                        if (statp->options & RES_DEBUG)
                                printf(";;\ttimeout=%d\n", statp->retrans);
 #endif
+#ifdef SOLARIS2
+               } else if (!strncmp(cp, "retrans:", sizeof("retrans:") - 1)) {
+                       /*
+                        * For backward compatibility, 'retrans' is
+                        * supported as an alias for 'timeout', though
+                        * without an imposed maximum.
+                        */
+                       statp->retrans = atoi(cp + sizeof("retrans:") - 1);
+               } else if (!strncmp(cp, "retry:", sizeof("retry:") - 1)){
+                       /*
+                        * For backward compatibility, 'retry' is
+                        * supported as an alias for 'attempts', though
+                        * without an imposed maximum.
+                        */
+                       statp->retry = atoi(cp + sizeof("retry:") - 1);
+#endif /* SOLARIS2 */
                } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
                        i = atoi(cp + sizeof("attempts:") - 1);
                        if (i <= RES_MAXRETRY)
index 16a312931fcdcc72c30c3b9c28900667321f7072..d0f125bc3fdad367af4eb8cdcb654962bf8cae6e 100644 (file)
@@ -52,7 +52,7 @@
  */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2005 by Internet Systems Consortium, Inc. ("ISC")
  * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -70,7 +70,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_send.c   8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 1.13 2005/04/27 04:56:42 sra Exp $";
+static const char rcsid[] = "$Id: res_send.c,v 1.14 2005/07/28 06:51:51 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 /*! \file
@@ -104,6 +104,14 @@ static const char rcsid[] = "$Id: res_send.c,v 1.13 2005/04/27 04:56:42 sra Exp
 
 #include "port_after.h"
 
+#ifdef USE_POLL
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+#include <poll.h>
+#define pselect Pselect
+#endif /* USE_POLL */
+
 /* Options.  Leave them on. */
 #define DEBUG
 #include "res_debug.h"
@@ -111,7 +119,11 @@ static const char rcsid[] = "$Id: res_send.c,v 1.13 2005/04/27 04:56:42 sra Exp
 
 #define EXT(res) ((res)->_u._ext)
 
+#ifndef USE_POLL
 static const int highestFD = FD_SETSIZE - 1;
+#else
+static int highestFD = 0;
+#endif
 
 /* Forward. */
 
@@ -285,6 +297,10 @@ res_nsend(res_state statp,
        int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
        char abuf[NI_MAXHOST];
 
+#ifdef USE_POLL
+       highestFD = sysconf(_SC_OPEN_MAX) - 1;
+#endif
+
        if (statp->nscount == 0) {
                errno = ESRCH;
                return (-1);
@@ -765,10 +781,15 @@ send_dg(res_state statp,
        const struct sockaddr *nsap;
        int nsaplen;
        struct timespec now, timeout, finish;
-       fd_set dsmask;
        struct sockaddr_storage from;
        ISC_SOCKLEN_T fromlen;
        int resplen, seconds, n, s;
+#ifdef USE_POLL
+       int     polltimeout;
+       struct pollfd   pollfd;
+#else
+       fd_set dsmask;
+#endif
 
        nsap = get_nsaddr(statp, ns);
        nsaplen = get_salen(nsap);
@@ -846,6 +867,7 @@ send_dg(res_state statp,
  wait:
        now = evNowTime();
  nonow:
+#ifndef USE_POLL
        FD_ZERO(&dsmask);
        FD_SET(s, &dsmask);
        if (evCmpTime(finish, now) > 0)
@@ -853,6 +875,17 @@ send_dg(res_state statp,
        else
                timeout = evConsTime(0, 0);
        n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL);
+#else
+       timeout = evSubTime(finish, now);
+       if (timeout.tv_sec < 0)
+               timeout = evConsTime(0, 0);
+       polltimeout = 1000*timeout.tv_sec +
+               timeout.tv_nsec/1000000;
+       pollfd.fd = s;
+       pollfd.events = POLLRDNORM;
+       n = poll(&pollfd, 1, polltimeout);
+#endif /* USE_POLL */
+
        if (n == 0) {
                Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
                *gotsomewhere = 1;
@@ -861,7 +894,11 @@ send_dg(res_state statp,
        if (n < 0) {
                if (errno == EINTR)
                        goto wait;
+#ifndef USE_POLL
                Perror(statp, stderr, "select", errno);
+#else
+               Perror(statp, stderr, "poll", errno);
+#endif /* USE_POLL */
                res_nclose(statp);
                return (0);
        }
index fcfaae25ef306f880b50b0df8402e1a30d21a275..2a4a6efd5e001957703c315482703d463106d5ed 100644 (file)
@@ -122,8 +122,16 @@ retry:
                        (stdout, "%s", ""),
                        answer, (anslen > len) ? len : anslen);
 
-               Dprint(statp->pfcode & RES_PRF_REPLY,
-                      (stdout, ";; TSIG invalid (%s)\n", p_rcode(ret)));
+               if (ret > 0) {
+                       Dprint(statp->pfcode & RES_PRF_REPLY,
+                              (stdout, ";; server rejected TSIG (%s)\n",
+                               p_rcode(ret)));
+               } else {
+                       Dprint(statp->pfcode & RES_PRF_REPLY,
+                              (stdout, ";; TSIG invalid (%s)\n",
+                               p_rcode(-ret)));
+               }
+
                free (nstatp);
                free (newmsg);
                dst_free_key(dstkey);