Source-Changes-HG archive

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

[src/netbsd-8]: src/usr.sbin/ypserv/ypserv Pull up following revision(s) (req...



details:   https://anonhg.NetBSD.org/src/rev/ebbe1d680a05
branches:  netbsd-8
changeset: 434625:ebbe1d680a05
user:      snj <snj%NetBSD.org@localhost>
date:      Sun Feb 11 21:52:54 2018 +0000

description:
Pull up following revision(s) (requested by christos in ticket #542):
        usr.sbin/ypserv/ypserv/ypserv_proc.c: 1.18
PR/47615: Dr. W. Stukenbrock: Always zero out the result structs in the
svc procs to avoid returning stale request data to the client.

diffstat:

 usr.sbin/ypserv/ypserv/ypserv_proc.c |  36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diffs (106 lines):

diff -r 26b67d43355c -r ebbe1d680a05 usr.sbin/ypserv/ypserv/ypserv_proc.c
--- a/usr.sbin/ypserv/ypserv/ypserv_proc.c      Sun Feb 11 21:48:41 2018 +0000
+++ b/usr.sbin/ypserv/ypserv/ypserv_proc.c      Sun Feb 11 21:52:54 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypserv_proc.c,v 1.17 2015/07/17 15:58:01 christos Exp $        */
+/*     $NetBSD: ypserv_proc.c,v 1.17.8.1 2018/02/11 21:52:54 snj Exp $ */
 
 /*
  * Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ypserv_proc.c,v 1.17 2015/07/17 15:58:01 christos Exp $");
+__RCSID("$NetBSD: ypserv_proc.c,v 1.17.8.1 2018/02/11 21:52:54 snj Exp $");
 #endif
 
 #include <sys/stat.h>
@@ -163,9 +163,10 @@
            "key %.*s", clientstr, TORF(secure), k->domain, k->map,
            k->keydat.dsize, k->keydat.dptr));
 
-       if (secure && securecheck(caller))
+       if (secure && securecheck(caller)) {
+               memset(&res, 0, sizeof(res));
                res.status = YP_YPERR;
-       else
+       } else
                res = ypdb_get_record(k->domain, k->map, k->keydat, secure);
 
        return ((void *)&res);
@@ -190,9 +191,10 @@
            "first_2: request from %.500s, secure %s, domain %s, map %s",
            clientstr, TORF(secure), k->domain, k->map));
 
-       if (secure && securecheck(caller))
+       if (secure && securecheck(caller)) {
+               memset(&res, 0, sizeof(res));
                res.status = YP_YPERR;
-       else
+       } else
                res = ypdb_get_first(k->domain, k->map, FALSE);
 
        return ((void *)&res);
@@ -218,9 +220,10 @@
            "key %.*s", clientstr, TORF(secure), k->domain, k->map,
            k->keydat.dsize, k->keydat.dptr));
 
-       if (secure && securecheck(caller))
+       if (secure && securecheck(caller)) {
+               memset(&res, 0, sizeof(res));
                res.status = YP_YPERR;
-       else
+       } else
                res = ypdb_get_next(k->domain, k->map, k->keydat, FALSE);
 
        return ((void *)&res);
@@ -326,6 +329,7 @@
        (void)memset(&res, 0, sizeof(res));
 
        if (secure && securecheck(caller)) {
+               memset(&res, 0, sizeof(res));
                res.ypresp_all_u.val.status = YP_YPERR;
                return (&res);
        }
@@ -368,9 +372,10 @@
            "master_2: request from %.500s, secure %s, domain %s, map %s",
            clientstr, TORF(secure), k->domain, k->map));
 
-       if (secure && securecheck(caller))
+       if (secure && securecheck(caller)) {
+               memset(&res, 0, sizeof(res));
                res.status = YP_YPERR;
-       else
+       } else
                res = ypdb_get_master(k->domain, k->map);
 
        /*
@@ -409,12 +414,15 @@
            "order_2: request from %.500s, secure %s, domain %s, map %s",
            clientstr, TORF(secure), k->domain, k->map));
 
-       if (secure && securecheck(caller))
+       if (secure && securecheck(caller)) {
+               memset(&res, 0, sizeof(res));
                res.status = YP_YPERR;
-       else if (_yp_invalid_map(k->map))
+       } else if (_yp_invalid_map(k->map)) {
+               memset(&res, 0, sizeof(res));
                res.status = YP_NOMAP;
-       else
+       } else {
                res = ypdb_get_order(k->domain, k->map);
+       }
 
        return ((void *)&res);
 }
@@ -446,7 +454,7 @@
        (void)snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH,
            domain);
 
-       res.list = NULL;
+       memset(&res, 0, sizeof(res));
        status = YP_TRUE;
 
        if ((stat(domain_path, &finfo) != 0) || !S_ISDIR(finfo.st_mode)) {



Home | Main Index | Thread Index | Old Index