Module Name: src
Committed By: chuck
Date: Thu Nov 5 21:26:25 UTC 2009
Modified Files:
src/usr.sbin/ypserv/ypxfr: ypxfr.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/ypserv/ypxfr/ypxfr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/ypserv/ypxfr/ypxfr.c
diff -u src/usr.sbin/ypserv/ypxfr/ypxfr.c:1.18 src/usr.sbin/ypserv/ypxfr/ypxfr.c:1.19
--- src/usr.sbin/ypserv/ypxfr/ypxfr.c:1.18 Thu Nov 5 15:23:55 2009
+++ src/usr.sbin/ypserv/ypxfr/ypxfr.c Thu Nov 5 21:26:25 2009
@@ -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 <[email protected]>
@@ -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;