summaryrefslogtreecommitdiffstats
path: root/chpass/pw_yp.c
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1999-03-01 16:11:13 +0000
committerBill Paul <wpaul@FreeBSD.org>1999-03-01 16:11:13 +0000
commitd103cd21c4fb6c24b725050e7dfa6ca3b603fb6f (patch)
tree56776f0e141dce5e413440f15f18ce933f3eb2bb /chpass/pw_yp.c
parentd00bfbe0b79d38db2147526fe835ffcaf0175971 (diff)
downloadpw-darwin-d103cd21c4fb6c24b725050e7dfa6ca3b603fb6f.tar.gz
pw-darwin-d103cd21c4fb6c24b725050e7dfa6ca3b603fb6f.tar.zst
pw-darwin-d103cd21c4fb6c24b725050e7dfa6ca3b603fb6f.zip
Close PR #10264. Don't bail directly out of passwd/chpass in my_yp_match().
Instead, treat the inability to retrieve a record from the server as a match failure and let things take its course. Part of the problem here is that NIS _is_ turned on, however the master server is actually not an NIS server: it's an NIS+ server. And the client is bound to an NIS+ replica server that's running in YP compat mode. The code which tries to figure out of the user is local or NIS gets confused by this.
Diffstat (limited to 'chpass/pw_yp.c')
-rw-r--r--chpass/pw_yp.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/chpass/pw_yp.c b/chpass/pw_yp.c
index 5754270..dbc262b 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.12 1997/12/18 15:27:43 bde Exp $
+ * $Id: pw_yp.c,v 1.13 1998/10/17 14:08:12 bde Exp $
*/
#ifdef YP
@@ -195,10 +195,19 @@ static int my_yp_match(server, domain, map, key, keylen, result, resultlen)
bzero((char *)buf, sizeof(buf));
+ /*
+ * Don't make this a fatal error. The inability to contact
+ * a server is, for our purposes, equivalent to not finding
+ * the record we were looking for. Letting use_yp() know
+ * that the lookup failed is sufficient.
+ */
if ((clnt = clnt_create(server, YPPROG,YPVERS,"udp")) == NULL) {
+ return(1);
+#ifdef notdef
warnx("failed to create UDP handle: %s",
clnt_spcreateerror(server));
pw_error(tempname, 0, 1);
+#endif
}
ypkey.domain = domain;
@@ -208,13 +217,19 @@ static int my_yp_match(server, domain, map, key, keylen, result, resultlen)
if ((ypval = ypproc_match_2(&ypkey, clnt)) == NULL) {
clnt_destroy(clnt);
+ return(1);
+#ifdef notdef
warnx("%s",clnt_sperror(clnt,"YPPROC_MATCH failed"));
pw_error(tempname, 0, 1);
+#endif
}
clnt_destroy(clnt);
if (ypval->stat != YP_TRUE) {
+ xdr_free(xdr_ypresp_val, (char *)ypval);
+ return(1);
+#ifdef notdef
int stat = ypval->stat;
xdr_free(xdr_ypresp_val, (char *)ypval);
if (stat == YP_NOMAP && strstr(map, "master.passwd"))
@@ -223,6 +238,7 @@ static int my_yp_match(server, domain, map, key, keylen, result, resultlen)
return(1);
warnx("ypmatch failed: %s", yperr_string(ypprot_err(stat)));
pw_error(tempname, 0, 1);
+#endif
}