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/bin/irpd Pull up revision 1.4 (requested by i...



details:   https://anonhg.NetBSD.org/src/rev/5992da208250
branches:  netbsd-1-6
changeset: 528123:5992da208250
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:28:32 2002 +0000

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

diffstat:

 dist/bind/bin/irpd/irpd.c |  527 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 376 insertions(+), 151 deletions(-)

diffs (truncated from 1241 to 300 lines):

diff -r df6e1f782069 -r 5992da208250 dist/bind/bin/irpd/irpd.c
--- a/dist/bind/bin/irpd/irpd.c Fri Jun 28 11:28:22 2002 +0000
+++ b/dist/bind/bin/irpd/irpd.c Fri Jun 28 11:28:32 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irpd.c,v 1.3 2001/09/24 13:22:27 wiz Exp $     */
+/*     $NetBSD: irpd.c,v 1.3.2.1 2002/06/28 11:28:32 lukem Exp $       */
 
 /*
  * Copyright(c) 1999 by Internet Software Consortium.
@@ -39,7 +39,7 @@
 #endif
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "Id: irpd.c,v 1.10 2000/12/23 08:14:33 vixie Exp";
+static const char rcsid[] = "Id: irpd.c,v 1.13 2001/09/25 04:50:17 marka Exp";
 #endif /* LIBC_SCCS and not lint */
 
 /* Imports. */
@@ -116,7 +116,7 @@
        do{ if ((nd)->field == 0) {                                          \
                (nd)->field = (*(nd)->irs->field ## _map)(nd->irs);          \
                if ((nd)->field == 0) {                                      \
-                   char *msg = "net_data " #field " initialization failed"; \
+                   const char *msg = "net_data " #field " initialization failed"; \
                    ctl_response(sess, respcode, msg, CTL_EXIT, NULL,        \
                                 NULL, NULL, NULL, 0);                       \
                    return;                                                  \
@@ -151,103 +151,111 @@
 
 static void irpd_gethostbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
                               const struct ctl_verb *verb, const char *rest,
-                              u_int respflags, void *respctx, void *uctx);
+                              u_int respflags, const void *respctx,
+                              void *uctx);
 static void irpd_gethostbyname2(struct ctl_sctx *ctx, struct ctl_sess *sess,
                                const struct ctl_verb *verb, const char *rest,
-                               u_int respflags, void *respctx, void *uctx);
+                               u_int respflags, const void *respctx,
+                               void *uctx);
+                       
 static void irpd_gethostbyaddr(struct ctl_sctx *ctx, struct ctl_sess *sess,
                               const struct ctl_verb *verb, const char *rest,
-                              u_int respflags, void *respctx, void *uctx);
+                              u_int respflags, const void *respctx,
+                              void *uctx);
 static void irpd_gethostent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                            const struct ctl_verb *verb, const char *rest,
-                           u_int respflags, void *respctx, void *uctx);
+                           u_int respflags, const void *respctx, void *uctx);
 static void irpd_sethostent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                            const struct ctl_verb *verb, const char *rest,
-                           u_int respflags, void *respctx, void *uctx);
+                           u_int respflags, const void *respctx, void *uctx);
 static void irpd_getpwnam(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_getpwuid(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_getpwent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_setpwent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_getnetbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
                              const struct ctl_verb *verb, const char *rest,
-                             u_int respflags, void *respctx, void *uctx);
+                             u_int respflags, const void *respctx, void *uctx);
 static void irpd_getnetbyaddr(struct ctl_sctx *ctx, struct ctl_sess *sess,
                              const struct ctl_verb *verb, const char *rest,
-                             u_int respflags, void *respctx, void *uctx);
+                             u_int respflags, const void *respctx, void *uctx);
 static void irpd_getnetent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                           const struct ctl_verb *verb, const char *rest,
-                          u_int respflags, void *respctx, void *uctx);
+                          u_int respflags, const void *respctx, void *uctx);
 static void irpd_setnetent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                           const struct ctl_verb *verb, const char *rest,
-                          u_int respflags, void *respctx, void *uctx);
+                          u_int respflags, const void *respctx, void *uctx);
 static void irpd_getgrnam(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_getgrgid(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_getgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_setgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          const struct ctl_verb *verb, const char *rest,
-                         u_int respflags, void *respctx, void *uctx);
+                         u_int respflags, const void *respctx, void *uctx);
 static void irpd_getservbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
                               const struct ctl_verb *verb, const char *rest,
-                              u_int respflags, void *respctx, void *uctx);
+                              u_int respflags, const void *respctx,
+                              void *uctx);
 static void irpd_getservbyport(struct ctl_sctx *ctx, struct ctl_sess *sess,
                               const struct ctl_verb *verb, const char *rest,
-                              u_int respflags, void *respctx, void *uctx);
+                              u_int respflags, const void *respctx,
+                              void *uctx);
 static void irpd_getservent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                            const struct ctl_verb *verb, const char *rest,
-                           u_int respflags, void *respctx, void *uctx);
+                           u_int respflags, const void *respctx, void *uctx);
 static void irpd_setservent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                            const struct ctl_verb *verb, const char *rest,
-                           u_int respflags, void *respctx, void *uctx);
+                           u_int respflags, const void *respctx, void *uctx);
 static void irpd_getprotobyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
                                const struct ctl_verb *verb, const char *rest,
-                               u_int respflags, void *respctx, void *uctx);
+                               u_int respflags, const void *respctx,
+                               void *uctx);
 static void irpd_getprotobynumber(struct ctl_sctx *ctx, struct ctl_sess *sess,
                                  const struct ctl_verb *verb, const char *rest,
-                                 u_int respflags, void *respctx, void *uctx);
+                                 u_int respflags, const void *respctx,
+                                 void *uctx);
 static void irpd_getprotoent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                             const struct ctl_verb *verb, const char *rest,
-                            u_int respflags, void *respctx, void *uctx);
+                            u_int respflags, const void *respctx, void *uctx);
 static void irpd_setprotoent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                             const struct ctl_verb *verb, const char *rest,
-                            u_int respflags, void *respctx, void *uctx);
+                            u_int respflags, const void *respctx, void *uctx);
 static void irpd_getnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                             const struct ctl_verb *verb, const char *rest,
-                            u_int respflags, void *respctx, void *uctx);
+                            u_int respflags, const void *respctx, void *uctx);
 static void irpd_innetgr(struct ctl_sctx *ctx, struct ctl_sess *sess,
                         const struct ctl_verb *verb, const char *rest,
-                        u_int respflags, void *respctx, void *uctx);
+                        u_int respflags, const void *respctx, void *uctx);
 static void irpd_setnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                             const struct ctl_verb *verb, const char *rest,
-                            u_int respflags, void *respctx, void *uctx);
+                            u_int respflags, const void *respctx, void *uctx);
 static void irpd_endnetgrent(struct ctl_sctx *ctx, struct ctl_sess *sess,
                             const struct ctl_verb *verb, const char *rest,
-                            u_int respflags, void *respctx, void *uctx);
+                            u_int respflags, const void *respctx, void *uctx);
 static void irpd_quit(struct ctl_sctx *ctx, struct ctl_sess *sess,
                      const struct ctl_verb *verb, const char *rest,
-                     u_int respflags, void *respctx, void *uctx);
+                     u_int respflags, const void *respctx, void *uctx);
 static void irpd_help(struct ctl_sctx *ctx, struct ctl_sess *sess,
                      const struct ctl_verb *verb, const char *rest,
-                     u_int respflags, void *respctx, void *uctx);
+                     u_int respflags, const void *respctx, void *uctx);
 static void irpd_accept(struct ctl_sctx *ctx, struct ctl_sess *sess,
                        const struct ctl_verb *verb, const char *rest,
-                       u_int respflags, void *respctx, void *uctx);
+                       u_int respflags, const void *respctx, void *uctx);
 static void irpd_abort(struct ctl_sctx *ctx, struct ctl_sess *sess,
                       const struct ctl_verb *verb, const char *rest,
-                      u_int respflags, void *respctx, void *uctx);
+                      u_int respflags, const void *respctx, void *uctx);
 
 static void response_done(struct ctl_sctx *ctx, struct ctl_sess *sess,
                          void *uap);
@@ -268,59 +276,59 @@
 static evContext ev;
 
 struct ctl_verb verbs [] = {
-       { "gethostbyname", irpd_gethostbyname },
-       { "gethostbyname2", irpd_gethostbyname2 },
-       { "gethostbyaddr", irpd_gethostbyaddr },
-       { "gethostent", irpd_gethostent },
-       { "sethostent", irpd_sethostent },
+       { "gethostbyname", irpd_gethostbyname, NULL },
+       { "gethostbyname2", irpd_gethostbyname2, NULL },
+       { "gethostbyaddr", irpd_gethostbyaddr, NULL },
+       { "gethostent", irpd_gethostent, NULL },
+       { "sethostent", irpd_sethostent, NULL },
 #ifdef WANT_IRS_PW
-       { "getpwnam", irpd_getpwnam },
-       { "getpwuid", irpd_getpwuid },
-       { "getpwent", irpd_getpwent },
-       { "setpwent", irpd_setpwent },
+       { "getpwnam", irpd_getpwnam, NULL },
+       { "getpwuid", irpd_getpwuid, NULL },
+       { "getpwent", irpd_getpwent, NULL },
+       { "setpwent", irpd_setpwent, NULL },
 #endif
-       { "getnetbyname", irpd_getnetbyname },
-       { "getnetbyaddr", irpd_getnetbyaddr },
-       { "getnetent", irpd_getnetent },
-       { "setnetent", irpd_setnetent },
+       { "getnetbyname", irpd_getnetbyname, NULL },
+       { "getnetbyaddr", irpd_getnetbyaddr, NULL },
+       { "getnetent", irpd_getnetent, NULL },
+       { "setnetent", irpd_setnetent, NULL },
 #ifdef WANT_IRS_GR
-       { "getgrnam", irpd_getgrnam },
-       { "getgrgid", irpd_getgrgid },
-       { "getgrent", irpd_getgrent },
-       { "setgrent", irpd_setgrent },
+       { "getgrnam", irpd_getgrnam, NULL },
+       { "getgrgid", irpd_getgrgid, NULL },
+       { "getgrent", irpd_getgrent, NULL },
+       { "setgrent", irpd_setgrent, NULL },
 #endif
-       { "getservbyname", irpd_getservbyname },
-       { "getservbyport", irpd_getservbyport },
-       { "getservent", irpd_getservent },
-       { "setservent", irpd_setservent },
+       { "getservbyname", irpd_getservbyname, NULL },
+       { "getservbyport", irpd_getservbyport, NULL },
+       { "getservent", irpd_getservent, NULL },
+       { "setservent", irpd_setservent, NULL },
 
-       { "getprotobyname", irpd_getprotobyname },
-       { "getprotobynumber", irpd_getprotobynumber },
-       { "getprotoent", irpd_getprotoent },
-       { "setprotoent", irpd_setprotoent },
+       { "getprotobyname", irpd_getprotobyname, NULL },
+       { "getprotobynumber", irpd_getprotobynumber, NULL },
+       { "getprotoent", irpd_getprotoent, NULL },
+       { "setprotoent", irpd_setprotoent, NULL },
 
-       { "getnetgrent", irpd_getnetgrent },
-       { "innetgr", irpd_innetgr },
-       { "setnetgrent", irpd_setnetgrent },
-       { "endnetgrent", irpd_endnetgrent },
-       { "quit", irpd_quit },
-       { "help", irpd_help },
+       { "getnetgrent", irpd_getnetgrent, NULL },
+       { "innetgr", irpd_innetgr, NULL },
+       { "setnetgrent", irpd_setnetgrent, NULL },
+       { "endnetgrent", irpd_endnetgrent, NULL },
+       { "quit", irpd_quit, NULL },
+       { "help", irpd_help, NULL },
 
-       { "", irpd_accept },    /* For connection setups. */
+       { "", irpd_accept, NULL },      /* For connection setups. */
 
        /* abort is a verb expected by the ctl library. Is called when the
         * client drops the connection unexpectedly.
         */
-       { "abort", irpd_abort },
+       { "abort", irpd_abort, NULL },
 
-       { NULL, NULL }
+       { NULL, NULL, NULL }
 };
 
 /*
  * An empty string causes the library to use the compiled in
  * defaults and to ignore any external files.
  */
-char *conffile = "";                   
+const char *conffile = "";                     
 
 /* Public. */
 
@@ -334,7 +342,7 @@
        struct sockaddr_in iaddr;
        short port = IRPD_PORT;
        char *prog = argv[0];
-       char *sockname = IRPD_PATH;
+       const char *sockname = IRPD_PATH;
        char *p;
        int ch;
        size_t socksize;
@@ -422,11 +430,11 @@
 
 /*
  * static void
- * simple_response(struct ctl_sess *sess, u_int code, char *msg);
+ * simple_response(struct ctl_sess *sess, u_int code, const char *msg);
  *     Send back a simple, one-line response to the client.
  */
 static void
-simple_response(struct ctl_sess *sess, u_int code, char *msg) {
+simple_response(struct ctl_sess *sess, u_int code, const char *msg) {
        struct response_buff *b = newbuffer(strlen(msg) + 1);
 
        if (b == 0)
@@ -487,18 +495,24 @@
  * static void
  * irpd_gethostbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,
  *                   const struct ctl_verb *verb, const char *rest,
- *                   u_int respflags, void *respctx, void *uctx);
+ *                   u_int respflags, const void *respctx, void *uctx);
  *     Implementation of the GETHOSTBYNAME verb.
  */
 static void
 irpd_gethostbyname(struct ctl_sctx *ctx, struct ctl_sess *sess,



Home | Main Index | Thread Index | Old Index