From bfc69caaf8ba078b5f894036735634372072935e Mon Sep 17 00:00:00 2001 From: wpaul Date: Mon, 4 Mar 1996 15:34:43 +0000 Subject: Fix small bug in get_yp_master(): this function is used to look for a master server and initialize the suser_override flag, but in a non-NIS environment is should be smart enough to just leave the flag cleared and return (unless forced with a command-line argument like -y). Otherwise, it will return an NIS-related error even if NIS isn't turned on. Pointed out by: ache --- usr.bin/chpass/pw_yp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/usr.bin/chpass/pw_yp.c b/usr.bin/chpass/pw_yp.c index 9493db8..c86e4de 100644 --- a/usr.bin/chpass/pw_yp.c +++ b/usr.bin/chpass/pw_yp.c @@ -35,7 +35,7 @@ * Center for Telecommunications Research * Columbia University, New York City * - * $Id: pw_yp.c,v 1.9 1996/02/23 04:20:19 wpaul Exp $ + * $Id: pw_yp.c,v 1.3 1996/02/23 16:08:58 wpaul Exp $ */ #ifdef YP @@ -336,6 +336,18 @@ char *get_yp_master(getserver) int rval, localport; struct stat st; + /* + * Sometimes we are called just to probe for rpc.yppasswdd and + * set the suser_override flag. Just return NULL and leave + * suser_override at 0 if _use_yp doesn't indicate that NIS is + * in use and we weren't called from use_yp() itself. + * Without this check, we might try probing and fail with an NIS + * error in non-NIS environments. + */ + if ((_use_yp == USER_UNKNOWN || _use_yp == USER_LOCAL_ONLY) && + getserver) + return(NULL); + /* Get default NIS domain. */ if (yp_domain == NULL && (rval = yp_get_default_domain(&yp_domain))) { -- cgit v1.1