summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-02-04 05:39:35 +0000
committerwpaul <wpaul@FreeBSD.org>1996-02-04 05:39:35 +0000
commitcd85caa5378f4e4a5a64efff965d2104566a20cb (patch)
tree42b0fca5ed8a9c6286103014143ff602ada497b5 /usr.sbin
parent72273a5aae283c4ed3ec31fcc00cb228bdc1275c (diff)
downloadFreeBSD-src-cd85caa5378f4e4a5a64efff965d2104566a20cb.zip
FreeBSD-src-cd85caa5378f4e4a5a64efff965d2104566a20cb.tar.gz
Makefile.yp:
- Improve support for multiple domains. (In preparation for new rpc.yppasswdd.) yp_dblookup.c: - Improve error reporting: be more selective as to what error code we return when a (dbp->get) fails.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ypserv/Makefile.yp8
-rw-r--r--usr.sbin/ypserv/yp_dblookup.c37
2 files changed, 34 insertions, 11 deletions
diff --git a/usr.sbin/ypserv/Makefile.yp b/usr.sbin/ypserv/Makefile.yp
index a7a50db..198ffb7 100644
--- a/usr.sbin/ypserv/Makefile.yp
+++ b/usr.sbin/ypserv/Makefile.yp
@@ -1,7 +1,7 @@
#
# Makefile for the NIS databases
#
-# $Id: Makefile.yp,v 1.1.1.1 1995/12/16 20:54:17 wpaul Exp $
+# $Id: Makefile.yp,v 1.2 1996/01/12 07:07:18 wpaul Exp $
#
# This Makefile should only be run on the NIS master server of a domain.
# All updated maps will be pushed to all NIS slave servers listed in the
@@ -42,7 +42,11 @@ CAT = @$(RCAT)
DBLOAD = /usr/sbin/yp_mkdb -m `hostname`
MKNETID = /usr/libexec/mknetid
YPPUSH = /usr/sbin/yppush
+.if !defined(UPDATE_DOMAIN)
DOMAIN = `/bin/domainname`
+.else
+DOMAIN = $(UPDATE_DOMAIN)
+.endif
REVNETGROUP = /usr/libexec/revnetgroup
YPSRCDIR = /etc
@@ -90,7 +94,7 @@ PUBLICKEY = $(YPSRCDIR)/publickey
target:
@if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
- cd $(DOMAIN) ; echo "NIS Map update started on `date`" ; \
+ cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
make -f ../Makefile all; echo "NIS Map update completed."
# If you don't want some of these maps built, feel free to comment
diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c
index b35c64f..2969dec 100644
--- a/usr.sbin/ypserv/yp_dblookup.c
+++ b/usr.sbin/ypserv/yp_dblookup.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: yp_dblookup.c,v 1.1.1.1 1995/12/16 20:54:17 wpaul Exp $
+ * $Id: yp_dblookup.c,v 1.2 1995/12/23 21:35:28 wpaul Exp $
*
*/
#include <stdio.h>
@@ -117,6 +117,7 @@ int yp_get_record(domain,map,key,data,allow)
int allow;
{
DB *dbp;
+ int rval;
if (ypdb_debug)
yp_error("Looking up key [%.*s] in map [%s]",
@@ -134,9 +135,12 @@ int yp_get_record(domain,map,key,data,allow)
return(yp_errno);
}
- if ((dbp->get)(dbp,key,data,0)) {
+ if ((rval = (dbp->get)(dbp,key,data,0)) != 0) {
(void)(dbp->close)(dbp);
- return(YP_NOKEY);
+ if (rval == 1)
+ return(YP_NOKEY);
+ else
+ return(YP_BADDB);
}
(void)(dbp->close)(dbp);
@@ -153,17 +157,26 @@ int yp_first_record(dbp,key,data)
DBT *key;
DBT *data;
{
+ int rval;
if (ypdb_debug)
yp_error("Retrieving first key in map.");
- if ((dbp->seq)(dbp,key,data,R_FIRST))
- return(YP_BADDB);
+ if ((rval = (dbp->seq)(dbp,key,data,R_FIRST)) != 0) {
+ if (rval == 1)
+ return(YP_NOKEY);
+ else
+ return(YP_BADDB);
+ }
/* Avoid passing back magic "YP_*" records. */
while (!strncmp(key->data, "YP_", 3)) {
- if ((dbp->seq)(dbp,key,data,R_NEXT))
- return(YP_BADDB);
+ if ((rval = (dbp->seq)(dbp,key,data,R_NEXT)) != 0) {
+ if (rval == 1)
+ return(YP_NOKEY);
+ else
+ return(YP_BADDB);
+ }
}
if (ypdb_debug)
@@ -180,9 +193,15 @@ int yp_next_record(dbp,key,data,all)
int all;
{
DBT lkey, ldata;
+ int rval;
- if (key == NULL || key->data == NULL)
- return(yp_first_record(dbp,key,data));
+ if (key == NULL || key->data == NULL) {
+ rval = yp_first_record(dbp,key,data);
+ if (rval == YP_NOKEY)
+ return(YP_NOMORE);
+ else
+ return(rval);
+ }
if (ypdb_debug)
yp_error("Retreiving next key, previous was: [%.*s]",
OpenPOWER on IntegriCloud