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/irs Pull up revision 1.2 (requested by it...



details:   https://anonhg.NetBSD.org/src/rev/a87329dfb78e
branches:  netbsd-1-6
changeset: 528201:a87329dfb78e
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:47:27 2002 +0000

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

diffstat:

 dist/bind/lib/irs/gen_ho.c |  52 ++++++++++++++++++++++++++++++++++++++++++++-
 dist/bind/lib/irs/gen_ng.c |  11 ++++++---
 dist/bind/lib/irs/gen_p.h  |   6 ++--
 3 files changed, 60 insertions(+), 9 deletions(-)

diffs (153 lines):

diff -r 382ce8a7aefc -r a87329dfb78e dist/bind/lib/irs/gen_ho.c
--- a/dist/bind/lib/irs/gen_ho.c        Fri Jun 28 11:47:09 2002 +0000
+++ b/dist/bind/lib/irs/gen_ho.c        Fri Jun 28 11:47:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gen_ho.c,v 1.1.1.1 1999/11/20 18:54:08 veego Exp $     */
+/*     $NetBSD: gen_ho.c,v 1.1.1.1.10.1 2002/06/28 11:47:27 lukem Exp $        */
 
 /*
  * Copyright (c) 1996,1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "Id: gen_ho.c,v 1.15 1999/10/13 16:39:29 vixie Exp";
+static const char rcsid[] = "Id: gen_ho.c,v 1.16 2001/05/29 05:48:36 marka Exp";
 #endif /* LIBC_SCCS and not lint */
 
 /* Imports */
@@ -70,6 +70,8 @@
 static void            ho_res_set(struct irs_ho *this,
                                   struct __res_state *res,
                                   void (*free_res)(void *));
+static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,
+                                    const struct addrinfo *pai);
 
 static int             init(struct irs_ho *this);
 
@@ -104,6 +106,7 @@
        ho->minimize = ho_minimize;
        ho->res_get = ho_res_get;
        ho->res_set = ho_res_set;
+       ho->addrinfo = ho_addrinfo;
        return (ho);
 }
 
@@ -330,6 +333,51 @@
        }
 }
 
+static struct addrinfo *
+ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
+{
+       struct pvt *pvt = (struct pvt *)this->private;
+       struct irs_rule *rule;
+       struct addrinfo *rval = NULL;
+       struct irs_ho *ho;
+       int therrno = NETDB_INTERNAL;
+       int softerror = 0;
+
+       if (init(this) == -1)
+               return (NULL);
+
+       for (rule = pvt->rules; rule; rule = rule->next) {
+               ho = rule->inst->ho;
+               RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+               errno = 0;
+               if (ho->addrinfo == NULL) /* for safety */
+                       continue;
+               rval = (*ho->addrinfo)(ho, name, pai);
+               if (rval != NULL)
+                       return (rval);
+               if (softerror == 0 &&
+                   pvt->res->res_h_errno != HOST_NOT_FOUND &&
+                   pvt->res->res_h_errno != NETDB_INTERNAL) {
+                       softerror = 1;
+                       therrno = pvt->res->res_h_errno;
+               }
+               if (rule->flags & IRS_CONTINUE)
+                       continue;
+               /*
+                * See the comments in ho_byname() explaining
+                * the interpretation of TRY_AGAIN and ECONNREFUSED.
+                */
+               if (pvt->res->res_h_errno != TRY_AGAIN ||
+                   errno != ECONNREFUSED)
+                       break;
+       }
+       if (softerror != 0 && pvt->res->res_h_errno == HOST_NOT_FOUND)
+               RES_SET_H_ERRNO(pvt->res, therrno);
+       if (rval)
+               freeaddrinfo(rval);
+       return (NULL);
+}
+
 static int
 init(struct irs_ho *this) {
        struct pvt *pvt = (struct pvt *)this->private;
diff -r 382ce8a7aefc -r a87329dfb78e dist/bind/lib/irs/gen_ng.c
--- a/dist/bind/lib/irs/gen_ng.c        Fri Jun 28 11:47:09 2002 +0000
+++ b/dist/bind/lib/irs/gen_ng.c        Fri Jun 28 11:47:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gen_ng.c,v 1.1.1.1 1999/11/20 18:54:08 veego Exp $     */
+/*     $NetBSD: gen_ng.c,v 1.1.1.1.10.1 2002/06/28 11:47:36 lukem Exp $        */
 
 /*
  * Copyright (c) 1996,1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "Id: gen_ng.c,v 1.14 1999/10/13 16:39:29 vixie Exp";
+static const char rcsid[] = "Id: gen_ng.c,v 1.15 2001/05/29 05:48:38 marka Exp";
 #endif
 
 /* Imports */
@@ -54,7 +54,8 @@
 /* Forward */
 
 static void            ng_close(struct irs_ng *);
-static int             ng_next(struct irs_ng *, char **, char **, char **);
+static int             ng_next(struct irs_ng *, const char **,
+                               const char **, const char **);
 static int             ng_test(struct irs_ng *, const char *,
                                const char *, const char *,
                                const char *);
@@ -105,7 +106,9 @@
 }
 
 static int
-ng_next(struct irs_ng *this, char **host, char **user, char **domain) {
+ng_next(struct irs_ng *this, const char **host, const char **user,
+       const char **domain)
+{
        struct pvt *pvt = (struct pvt *)this->private;
        struct irs_ng *ng;
        
diff -r 382ce8a7aefc -r a87329dfb78e dist/bind/lib/irs/gen_p.h
--- a/dist/bind/lib/irs/gen_p.h Fri Jun 28 11:47:09 2002 +0000
+++ b/dist/bind/lib/irs/gen_p.h Fri Jun 28 11:47:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gen_p.h,v 1.1.1.1 1999/11/20 18:54:08 veego Exp $      */
+/*     $NetBSD: gen_p.h,v 1.1.1.1.10.1 2002/06/28 11:47:44 lukem Exp $ */
 
 /*
  * Copyright (c) 1996,1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
  */
 
 /*
- * Id: gen_p.h,v 1.10 1999/01/18 07:46:50 vixie Exp
+ * Id: gen_p.h,v 1.11 2001/05/29 05:48:39 marka Exp
  */
 
 /* Notes:
@@ -92,7 +92,7 @@
  * This is the private data for a search access class.
  */
 struct gen_p {
-       const char *            options;
+       char *                  options;
        struct irs_rule *       map_rules[(int)irs_nmap];
        struct irs_inst         accessors[(int)irs_nacc];
        struct __res_state *    res;



Home | Main Index | Thread Index | Old Index