Source-Changes-HG archive

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

src: Pull up following revision(s) (requested by christos in tic...



details:   https://anonhg.NetBSD.org/src/rev/c3abda28205d
branches:  netbsd-6-0
changeset: 318029:c3abda28205d
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Apr 10 17:44:15 2018 +0000
description:
Pull up following revision(s) (requested by christos in ticket #1528):
        usr.sbin/ypserv/ypserv/ypserv_proc.c: 1.18 via patch
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 |  38 +++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diffs (108 lines):

diff -r 718eb39c8384 -r c3abda28205d usr.sbin/ypserv/ypserv/ypserv_proc.c
--- a/usr.sbin/ypserv/ypserv/ypserv_proc.c      Tue Apr 10 11:31:14 2018 +0000
+++ b/usr.sbin/ypserv/ypserv/ypserv_proc.c      Tue Apr 10 17:44:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypserv_proc.c,v 1.16 2011/08/30 17:06:22 plunky Exp $  */
+/*     $NetBSD: ypserv_proc.c,v 1.16.10.1 2018/04/10 17:44:15 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.16 2011/08/30 17:06:22 plunky Exp $");
+__RCSID("$NetBSD: ypserv_proc.c,v 1.16.10.1 2018/04/10 17:44:15 snj Exp $");
 #endif
 
 #include <sys/stat.h>
@@ -163,10 +163,11 @@
            "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
-               res = ypdb_get_record(k->domain, k->map, k->keydat, FALSE);
+       } 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