summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-03-04 15:34:43 +0000
committerwpaul <wpaul@FreeBSD.org>1996-03-04 15:34:43 +0000
commitbfc69caaf8ba078b5f894036735634372072935e (patch)
tree05c19deb215ce9baccc674fc65414107a6151488
parentdedb21f798511324303d567dcd40050f5fd67e06 (diff)
downloadFreeBSD-src-bfc69caaf8ba078b5f894036735634372072935e.zip
FreeBSD-src-bfc69caaf8ba078b5f894036735634372072935e.tar.gz
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
-rw-r--r--usr.bin/chpass/pw_yp.c14
1 files changed, 13 insertions, 1 deletions
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))) {
OpenPOWER on IntegriCloud