Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/dist/bind/lib/isc Pull up revision 1.3 (requested by it...



details:   https://anonhg.NetBSD.org/src/rev/622cfe4c88af
branches:  netbsd-1-6
changeset: 528226:622cfe4c88af
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:54:58 2002 +0000

description:
Pull up revision 1.3 (requested by itojun in ticket #387):
Update to BIND 8.3.3.  Fixes buffer overrun in resolver code.

diffstat:

 dist/bind/lib/isc/ev_connects.c |  29 ++++++++++++++++++++++-------
 dist/bind/lib/isc/ev_files.c    |  23 +++++++++++++++++------
 2 files changed, 39 insertions(+), 13 deletions(-)

diffs (174 lines):

diff -r 25453af09ddd -r 622cfe4c88af dist/bind/lib/isc/ev_connects.c
--- a/dist/bind/lib/isc/ev_connects.c   Fri Jun 28 11:54:49 2002 +0000
+++ b/dist/bind/lib/isc/ev_connects.c   Fri Jun 28 11:54:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ev_connects.c,v 1.2 2001/01/27 07:22:04 itojun Exp $   */
+/*     $NetBSD: ev_connects.c,v 1.2.2.1 2002/06/28 11:54:58 lukem Exp $        */
 
 /*
  * Copyright (c) 1995-1999 by Internet Software Consortium
@@ -22,7 +22,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "Id: ev_connects.c,v 8.27 2000/11/14 01:10:37 vixie Exp";
+static const char rcsid[] = "Id: ev_connects.c,v 8.32 2001/07/03 13:26:35 marka Exp";
 #endif
 
 /* Import. */
@@ -32,6 +32,7 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/ioctl.h>
 
 #include <unistd.h>
 
@@ -79,7 +80,12 @@
         * incorrectly.
         */
        if ((mode & PORT_NONBLOCK) == 0) {
+#ifdef USE_FIONBIO_IOCTL
+               int on = 1;
+               OK(ioctl(fd, FIONBIO, (char *)&on));
+#else
                OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
                new->flags |= EV_CONN_BLOCK;
        }
        OK(listen(fd, maxconn));
@@ -105,7 +111,7 @@
 }
 
 int
-evConnect(evContext opaqueCtx, int fd, void *ra, int ralen,
+evConnect(evContext opaqueCtx, int fd, const void *ra, int ralen,
          evConnFunc func, void *uap, evConnID *id)
 {
        evContext_p *ctx = opaqueCtx.opaque;
@@ -162,8 +168,14 @@
                if (mode == -1) {
                        if (errno != EBADF)
                                return (-1);
-               } else
+               } else {
+#ifdef USE_FIONBIO_IOCTL
+                       int on = 1;
+                       OK(ioctl(this->fd, FIONBIO, (char *)&on));
+#else
                        OK(fcntl(this->fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
+               }
        }
        
        /* Unlink from ctx->conns. */
@@ -277,7 +289,8 @@
                struct sockaddr_un un;
 #endif
        } la, ra;
-       int new, lalen = 0, ralen;
+       int new; 
+       ISC_SOCKLEN_T lalen = 0, ralen;
 
        REQUIRE((evmask & EV_READ) != 0);
        ralen = sizeof ra;
@@ -311,13 +324,15 @@
                struct sockaddr_un un;
 #endif
        } la, ra;
-       int lalen, ralen;
+       ISC_SOCKLEN_T lalen, ralen;
        char buf[1];
        void *conn_uap;
        evConnFunc conn_func;
        evConnID id;
        int socket_errno = 0;
-       int optlen;
+       ISC_SOCKLEN_T optlen;
+
+       UNUSED(evmask);
 
        lalen = sizeof la;
        ralen = sizeof ra;
diff -r 25453af09ddd -r 622cfe4c88af dist/bind/lib/isc/ev_files.c
--- a/dist/bind/lib/isc/ev_files.c      Fri Jun 28 11:54:49 2002 +0000
+++ b/dist/bind/lib/isc/ev_files.c      Fri Jun 28 11:54:58 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ev_files.c,v 1.2 2000/10/08 20:03:13 is Exp $  */
+/*     $NetBSD: ev_files.c,v 1.2.2.1 2002/06/28 11:55:08 lukem Exp $   */
 
 /*
  * Copyright (c) 1995-1999 by Internet Software Consortium
@@ -22,7 +22,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "Id: ev_files.c,v 1.19 1999/10/07 20:44:04 vixie Exp";
+static const char rcsid[] = "Id: ev_files.c,v 1.21 2001/11/01 05:35:46 marka Exp";
 #endif
 
 #include "port_before.h"
@@ -30,6 +30,7 @@
 
 #include <sys/types.h>
 #include <sys/time.h>
+#include <sys/ioctl.h>
 
 #include <errno.h>
 #include <fcntl.h>
@@ -58,9 +59,9 @@
                 "evSelectFD(ctx %p, fd %d, mask 0x%x, func %p, uap %p)\n",
                 ctx, fd, eventmask, func, uap);
        if (eventmask == 0 || (eventmask & ~EV_MASK_ALL) != 0)
-               ERR(EINVAL);
+               EV_ERR(EINVAL);
        if (fd > ctx->highestFD)
-               ERR(EINVAL);
+               EV_ERR(EINVAL);
        OK(mode = fcntl(fd, F_GETFL, NULL));    /* side effect: validate fd. */
 
        /*
@@ -74,7 +75,12 @@
                if (mode & PORT_NONBLOCK)
                        FD_SET(fd, &ctx->nonblockBefore);
                else {
+#ifdef USE_FIONBIO_IOCTL
+                       int on = 1;
+                       OK(ioctl(fd, FIONBIO, (char *)&on));
+#else
                        OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
                        FD_CLR(fd, &ctx->nonblockBefore);
                }
        }
@@ -86,7 +92,7 @@
         * same context.
         */
        if (id != NULL && FindFD(ctx, fd, eventmask) != NULL)
-               ERR(ETOOMANYREFS);
+               EV_ERR(ETOOMANYREFS);
 
        /* Allocate and fill. */
        OKNEW(id);
@@ -168,7 +174,7 @@
        /* Get the mode.  Unless the file has been closed, errors are bad. */
        mode = fcntl(del->fd, F_GETFL, NULL);
        if (mode == -1 && errno != EBADF)
-               ERR(errno);
+               EV_ERR(errno);
 
        /* Remove from the list of files. */
        if (del->prev != NULL)
@@ -199,7 +205,12 @@
                 * this fcntl() fails since (a) we've already done the work
                 * and (b) the caller didn't ask us anything about O_NONBLOCK.
                 */
+#ifdef USE_FIONBIO_IOCTL
+               int off = 1;
+               (void) ioctl(del->fd, FIONBIO, (char *)&off);
+#else
                (void) fcntl(del->fd, F_SETFL, mode & ~PORT_NONBLOCK);
+#endif
        }
 
        /*



Home | Main Index | Thread Index | Old Index