summaryrefslogtreecommitdiffstats
path: root/chpass
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1996-03-04 15:34:43 +0000
committerBill Paul <wpaul@FreeBSD.org>1996-03-04 15:34:43 +0000
commit2745dc1fdc8e2239ad54259fdb8541044f365013 (patch)
tree9b332f451b54f2f5866215c54e2bd2248baec0c1 /chpass
parent90f5691c249e4fb2fa539ba3475c45337080b2c7 (diff)
downloadpw-darwin-2745dc1fdc8e2239ad54259fdb8541044f365013.tar.gz
pw-darwin-2745dc1fdc8e2239ad54259fdb8541044f365013.tar.zst
pw-darwin-2745dc1fdc8e2239ad54259fdb8541044f365013.zip
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
Diffstat (limited to 'chpass')
-rw-r--r--chpass/pw_yp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/chpass/pw_yp.c b/chpass/pw_yp.c
index 9493db8..c86e4de 100644
--- a/chpass/pw_yp.c
+++ b/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))) {