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/named Pull up revisions 1.5-1.6 (requeste...



details:   https://anonhg.NetBSD.org/src/rev/ec42c92d8773
branches:  netbsd-1-6
changeset: 528136:ec42c92d8773
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:31:51 2002 +0000

description:
Pull up revisions 1.5-1.6 (requested by itojun in ticket #387):
Update to BIND 8.3.3.  Fixes buffer overrun in resolver code.

diffstat:

 dist/bind/bin/named/ns_ctl.c  |  292 +++++++++++++++++++++++++++++++++++------
 dist/bind/bin/named/ns_defs.h |   88 +++++++----
 2 files changed, 301 insertions(+), 79 deletions(-)

diffs (truncated from 794 to 300 lines):

diff -r 26288c83bbb2 -r ec42c92d8773 dist/bind/bin/named/ns_ctl.c
--- a/dist/bind/bin/named/ns_ctl.c      Fri Jun 28 11:31:41 2002 +0000
+++ b/dist/bind/bin/named/ns_ctl.c      Fri Jun 28 11:31:51 2002 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ns_ctl.c,v 1.4 2001/01/27 07:21:59 itojun Exp $        */
+/*     $NetBSD: ns_ctl.c,v 1.4.2.1 2002/06/28 11:31:51 lukem Exp $     */
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ns_ctl.c,v 8.39 2000/12/19 23:31:38 marka Exp";
+static const char rcsid[] = "Id: ns_ctl.c,v 8.47 2002/06/24 07:11:07 marka Exp";
 #endif /* not lint */
 
 /*
@@ -94,55 +94,60 @@
 static void            install_inet(control);
 static void            install_unix(control);
 static void            logger(enum ctl_severity, const char *fmt, ...)
-     __attribute__((__format__(__printf__, 2, 3)));
+                       ISC_FORMAT_PRINTF(2,3);
 static void            verb_connect(struct ctl_sctx *, struct ctl_sess *,
                                     const struct ctl_verb *,
-                                    const char *, u_int, void *, void *);
+                                    const char *, u_int, const void *, void *);
 static void            verb_getpid(struct ctl_sctx *, struct ctl_sess *,
                                    const struct ctl_verb *,
-                                   const char *, u_int, void *, void *);
+                                   const char *, u_int, const void *, void *);
 static void            getpid_closure(struct ctl_sctx *, struct ctl_sess *,
                                       void *);
 static void            verb_status(struct ctl_sctx *, struct ctl_sess *,
                                    const struct ctl_verb *,
-                                   const char *, u_int, void *, void *);
+                                   const char *, u_int, const void *, void *);
 static void            status_closure(struct ctl_sctx *, struct ctl_sess *,
                                       void *);
 static void            verb_stop(struct ctl_sctx *, struct ctl_sess *,
                                  const struct ctl_verb *,
-                                 const char *, u_int, void *, void *);
+                                 const char *, u_int, const void *, void *);
 static void            verb_exec(struct ctl_sctx *, struct ctl_sess *,
                                  const struct ctl_verb *,
-                                 const char *, u_int, void *, void *);
+                                 const char *, u_int, const void *, void *);
+static void            exec_closure(struct ctl_sctx *, struct ctl_sess *,
+                                    void *);
 static void            verb_reload(struct ctl_sctx *, struct ctl_sess *,
                                    const struct ctl_verb *,
-                                   const char *, u_int, void *, void *);
+                                   const char *, u_int, const void *, void *);
 static void            verb_reconfig(struct ctl_sctx *, struct ctl_sess *,
                                      const struct ctl_verb *,
-                                     const char *, u_int, void *, void *);
+                                     const char *, u_int, const void *, void *);
 static void            verb_dumpdb(struct ctl_sctx *, struct ctl_sess *,
                                    const struct ctl_verb *,
-                                   const char *, u_int, void *, void *);
+                                   const char *, u_int, const void *, void *);
 static void            verb_stats(struct ctl_sctx *, struct ctl_sess *,
                                   const struct ctl_verb *,
-                                  const char *, u_int, void *, void *);
+                                  const char *, u_int, const void *, void *);
 static void            verb_trace(struct ctl_sctx *, struct ctl_sess *,
                                   const struct ctl_verb *,
-                                  const char *, u_int, void *, void *);
+                                  const char *, u_int, const void *, void *);
 static void            trace_closure(struct ctl_sctx *, struct ctl_sess *,
                                       void *);
 static void            verb_notrace(struct ctl_sctx *, struct ctl_sess *,
                                     const struct ctl_verb *,
-                                    const char *, u_int, void *, void *);
+                                    const char *, u_int, const void *, void *);
 static void            verb_querylog(struct ctl_sctx *, struct ctl_sess *,
                                      const struct ctl_verb *,
-                                     const char *, u_int, void *, void *);
+                                     const char *, u_int, const void *, void *);
 static void            verb_help(struct ctl_sctx *, struct ctl_sess *,
                                  const struct ctl_verb *,
-                                 const char *, u_int, void *, void *);
+                                 const char *, u_int, const void *, void *);
 static void            verb_quit(struct ctl_sctx *, struct ctl_sess *,
                                  const struct ctl_verb *,
-                                 const char *, u_int, void *, void *);
+                                 const char *, u_int, const void *, void *);
+static void            verb_args(struct ctl_sctx *, struct ctl_sess *,
+                                 const struct ctl_verb *,
+                                 const char *, u_int, const void *, void *);
 
 /* Private data. */
 
@@ -164,6 +169,7 @@
        { "qrylog",     verb_querylog,  "qrylog"},
        { "help",       verb_help,      "help"},
        { "quit",       verb_quit,      "quit"},
+       { "args",       verb_args,      "args"},
        { NULL,         NULL,           NULL}
 };
 
@@ -229,7 +235,7 @@
 
 #ifndef NO_SOCKADDR_UN
 control
-ns_ctl_new_unix(char *path, mode_t mode, uid_t owner, gid_t group) {
+ns_ctl_new_unix(const char *path, mode_t mode, uid_t owner, gid_t group) {
        control new = new_control();
 
        INIT_LINK(new, link);
@@ -528,11 +534,11 @@
                if (slash != path)
                        *slash = '\0';
                else {
-                       freestr(path);
+                       (void)freestr(path);
                        path = savestr("/", 1);
                }
        } else {
-               freestr(path);
+               (void)freestr(path);
                path = savestr(".", 1);
        }
        if (mkdir(path, ctl->var.v_unix.mode) < 0) {
@@ -570,7 +576,7 @@
                }
        }
 #ifdef NEED_SECURE_DIRECTORY
-       freestr(path);
+       (void)freestr(path);
 #endif
 }
 #endif
@@ -584,7 +590,8 @@
        case ctl_debug:         logsev = log_debug(5);  break;
        case ctl_warning:       logsev = log_warning;   break;
        case ctl_error:         logsev = log_error;     break;
-       default:                panic("invalid ctlsev in logger", NULL);
+       default:                logsev = 0;
+                               panic("invalid ctlsev in logger", NULL);
        }
        if (!log_ctx_valid)
                return;
@@ -596,13 +603,18 @@
 static void
 verb_connect(struct ctl_sctx *ctl, 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)
 {
-       const struct sockaddr *sa = (struct sockaddr *)respctx;
+       const struct sockaddr *sa = (const struct sockaddr *)respctx;
        control nsctl = (control)uctx;
 
+       UNUSED(ctl);
+       UNUSED(verb);
+       UNUSED(rest);
+       UNUSED(respflags);
+
        if (sa->sa_family == AF_INET) {
-               const struct sockaddr_in *in = (struct sockaddr_in *)sa;
+               const struct sockaddr_in *in = (const struct sockaddr_in *)sa;
                const ip_match_list acl = nsctl->var.v_inet.allow;
 
                if (!ip_address_allowed(acl, in->sin_addr)) {
@@ -618,10 +630,17 @@
 static void
 verb_getpid(struct ctl_sctx *ctl, 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)
 {
        char *msg = memget(MAX_STR_LEN);
 
+       UNUSED(ctl);
+       UNUSED(verb);
+       UNUSED(rest);
+       UNUSED(respflags);
+       UNUSED(respctx);
+       UNUSED(uctx);
+
        if (msg == NULL) {
                ctl_response(sess, 503, "(out of memory)", 0,
                             NULL, NULL, NULL, NULL, 0);
@@ -635,6 +654,9 @@
 getpid_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
        char *msg = uap;
 
+       UNUSED(sctx);
+       UNUSED(sess);
+
        memput(msg, MAX_STR_LEN);
 }
 
@@ -659,10 +681,17 @@
 static void
 verb_status(struct ctl_sctx *ctl, 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)
 {
        struct pvt_status *pvt = ctl_getcsctx(sess);
 
+       UNUSED(ctl);
+       UNUSED(verb);
+       UNUSED(rest);
+       UNUSED(respflags);
+       UNUSED(respctx);
+       UNUSED(uctx);
+
        if (pvt == NULL) {
                pvt = memget(sizeof *pvt);
                if (pvt == NULL) {
@@ -720,6 +749,9 @@
 status_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
        struct pvt_status *pvt = ctl_getcsctx(sess);
 
+       UNUSED(sctx);
+       UNUSED(uap);
+
        memput(pvt, sizeof *pvt);
        ctl_setcsctx(sess, NULL);
 }
@@ -727,8 +759,15 @@
 static void
 verb_stop(struct ctl_sctx *ctl, 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)
 {
+       UNUSED(ctl);
+       UNUSED(verb);
+       UNUSED(rest);
+       UNUSED(respflags);
+       UNUSED(respctx);
+       UNUSED(uctx);
+
        ns_need(main_need_exit);
        ctl_response(sess, 250, "Shutdown initiated.", 0, NULL, NULL, NULL,
                     NULL, 0);
@@ -737,10 +776,16 @@
 static void
 verb_exec(struct ctl_sctx *ctl, 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)
 {
        struct stat sb;
 
+       UNUSED(ctl);
+       UNUSED(verb);
+       UNUSED(respflags);
+       UNUSED(respctx);
+       UNUSED(uctx);
+
        if (rest != NULL && *rest != '\0') {
                if (stat(rest, &sb) < 0) {
                        ctl_response(sess, 503, strerror(errno),
@@ -757,24 +802,43 @@
                           saved_argv[0], save);
                ctl_response(sess, 502, save, 0, NULL, NULL, NULL,
                             NULL, 0);
+       } else if (user_name != NULL || group_name != NULL) {
+               ctl_response(sess, 502,
+                            "can't exec as user or group was specified",
+                            0, NULL, NULL, NULL, NULL, 0);
        } else {
-               ns_need(main_need_restart);
                ctl_response(sess, 250, "Restart initiated.", 0, NULL,
-                            NULL, NULL, NULL, 0);
+                            exec_closure, NULL, NULL, 0);
        }
 }
 
 static void
+exec_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
+
+       UNUSED(sctx);
+       UNUSED(sess);
+       UNUSED(uap);
+       ns_need(main_need_restart);
+}
+
+static void
 verb_reload(struct ctl_sctx *ctl, 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 const char spaces[] = " \t";
        struct zoneinfo *zp;
        char *tmp = NULL, *x;
+       const char *cl;
        const char *msg;
        int class, code, success;
 
+       UNUSED(ctl);
+       UNUSED(verb);
+       UNUSED(respflags);
+       UNUSED(respctx);
+       UNUSED(uctx);
+
        /* If there are no args, this is a classic reload of the config. */
        if (rest == NULL || *rest == '\0') {



Home | Main Index | Thread Index | Old Index