Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ypserv/ypserv PR/47615: Dr. W. Stukenbrock: Always ...
details: https://anonhg.NetBSD.org/src/rev/c981b164a90e
branches: trunk
changeset: 829108:c981b164a90e
user: christos <christos%NetBSD.org@localhost>
date: Wed Jan 17 03:16:10 2018 +0000
description:
PR/47615: Dr. W. Stukenbrock: Always zero out the result structs in the
svc procs to avoid returning stale request data to the client.
XXX: pullup-6,7,8
diffstat:
usr.sbin/ypserv/ypserv/ypserv_proc.c | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
diffs (106 lines):
diff -r accf0a92ebb8 -r c981b164a90e usr.sbin/ypserv/ypserv/ypserv_proc.c
--- a/usr.sbin/ypserv/ypserv/ypserv_proc.c Wed Jan 17 03:03:59 2018 +0000
+++ b/usr.sbin/ypserv/ypserv/ypserv_proc.c Wed Jan 17 03:16:10 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.18 2018/01/17 03:16:10 christos 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.18 2018/01/17 03:16:10 christos 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