Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ypserv/ypxfr rev 1.18 un-covered some bugs:
details: https://anonhg.NetBSD.org/src/rev/29177f796047
branches: trunk
changeset: 748815:29177f796047
user: chuck <chuck%NetBSD.org@localhost>
date: Thu Nov 05 21:26:25 2009 +0000
description:
rev 1.18 un-covered some bugs:
1. add_interdomain and add_secure are optional... not all maps use these
keys. if we are unable to add them due to a YPERR_KEY (meaning they
are not being used), then we should not flag this as a general error.
2. if we have a failure (status <= 0) we unlink_db() the temp database
as part of error handling. but we should not overwrite our error
status code with the return value from unlink_db() because if the
unlink_db() works (likely true) than that success will wipe out our
error code and the calling yppush will think we worked.
diffstat:
usr.sbin/ypserv/ypxfr/ypxfr.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (51 lines):
diff -r b1d2e1b3be33 -r 29177f796047 usr.sbin/ypserv/ypxfr/ypxfr.c
--- a/usr.sbin/ypserv/ypxfr/ypxfr.c Thu Nov 05 21:11:53 2009 +0000
+++ b/usr.sbin/ypserv/ypxfr/ypxfr.c Thu Nov 05 21:26:25 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ypxfr.c,v 1.18 2009/11/05 15:23:55 chuck Exp $ */
+/* $NetBSD: ypxfr.c,v 1.19 2009/11/05 21:26:25 chuck Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ypxfr.c,v 1.18 2009/11/05 15:23:55 chuck Exp $");
+__RCSID("$NetBSD: ypxfr.c,v 1.19 2009/11/05 21:26:25 chuck Exp $");
#endif
#include <sys/param.h>
@@ -241,7 +241,7 @@
if (status > 0)
status = install_db(domain, map, temp_map);
else
- status = unlink_db(domain, map, temp_map);
+ (void) unlink_db(domain, map, temp_map);
}
punt:
@@ -521,7 +521,10 @@
status = yp_match_host(client, domain, map,
k.dptr, k.dsize, &value, &vallen);
- if (status == 0 && value) {
+ if (status == YPERR_KEY) {
+ /* this is an optional key/val, so it may not be present */
+ status = YPPUSH_SUCC;
+ } else if (status == 0 && value) {
v.dptr = value;
v.dsize = vallen;
@@ -555,7 +558,10 @@
status = yp_match_host(client, domain, map,
k.dptr, k.dsize, &value, &vallen);
- if (status == 0 && value != 0) {
+ if (status == YPERR_KEY) {
+ /* this is an optional key/val, so it may not be present */
+ status = YPPUSH_SUCC;
+ } else if (status == 0 && value != 0) {
v.dptr = value;
v.dsize = vallen;
Home |
Main Index |
Thread Index |
Old Index