diff options
author | Alfred Perlstein <alfred@FreeBSD.org> | 2002-02-05 19:26:04 +0000 |
---|---|---|
committer | Alfred Perlstein <alfred@FreeBSD.org> | 2002-02-05 19:26:04 +0000 |
commit | 165f1fbe1f9b2398abf9f07c3beaebcceb9aada2 (patch) | |
tree | 0fe79cb9a7dee5b6b9b46e9efead9d00ab4dc2ea /chpass | |
parent | 075a65466171f5c2bcb5cd8fb6533277a9513ef7 (diff) | |
download | pw-darwin-165f1fbe1f9b2398abf9f07c3beaebcceb9aada2.tar.gz pw-darwin-165f1fbe1f9b2398abf9f07c3beaebcceb9aada2.tar.zst pw-darwin-165f1fbe1f9b2398abf9f07c3beaebcceb9aada2.zip |
The clnt_create(KEYSERVSOCK, CRYPT_PROG, CRYPT_VERS, "unix") hacks
were removed and replaced them with clnt_tp_create, now the af_local
support is fixed.
I also removed the hack how rpcinfo contacted rpcbind, now we can
relay on clnt_tp_create create the client-handle for us. Only
rpcbind itself needs a hardcoded socket-path.
Submitted by: mbr
Also add $FreeBSD
Diffstat (limited to 'chpass')
-rw-r--r-- | chpass/pw_yp.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/chpass/pw_yp.c b/chpass/pw_yp.c index d6cfaeb..1c523ae 100644 --- a/chpass/pw_yp.c +++ b/chpass/pw_yp.c @@ -354,7 +354,6 @@ char *get_yp_master(getserver) char *mastername; int rval, localport; struct stat st; - char *sockname = YP_SOCKNAME; /* * Sometimes we are called just to probe for rpc.yppasswdd and @@ -407,7 +406,7 @@ char *get_yp_master(getserver) /* See if _we_ are the master server. */ if (!force_old && !getuid() && (localport = getrpcport("localhost", YPPASSWDPROG, YPPASSWDPROC_UPDATE, IPPROTO_UDP)) != 0) { - if (localport == rval && stat(sockname, &st) != -1) { + if (localport == rval) { suser_override = 1; mastername = "localhost"; } @@ -433,12 +432,14 @@ void yp_submit(pw) { struct yppasswd yppasswd; struct master_yppasswd master_yppasswd; + struct netconfig *nconf; + void *localhandle; CLIENT *clnt; char *master, *password; int *status = NULL; struct rpc_err err; - char *sockname = YP_SOCKNAME; + nconf = NULL; _use_yp = 1; /* Get NIS master server name */ @@ -490,13 +491,26 @@ void yp_submit(pw) if (suser_override) { /* Talk to server via AF_UNIX socket. */ - clnt = clnt_create(sockname, MASTER_YPPASSWDPROG, - MASTER_YPPASSWDVERS, "unix"); + localhandle = setnetconfig(); + while ((nconf = getnetconfig(localhandle)) != NULL) { + if (nconf->nc_protofmly != NULL && + strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0) + break; + } + if (nconf == NULL) { + warnx("getnetconfig: %s", nc_sperror()); + pw_error(tempname, 0, 1); + } + + clnt = clnt_tp_create(NULL, MASTER_YPPASSWDPROG, + MASTER_YPPASSWDVERS, nconf); if (clnt == NULL) { warnx("failed to contact rpc.yppasswdd: %s", clnt_spcreateerror(master)); + endnetconfig(localhandle); pw_error(tempname, 0, 1); } + endnetconfig(localhandle); } else { /* Create a handle to yppasswdd. */ |