summaryrefslogtreecommitdiffstats
path: root/usr.bin/passwd
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-02-05 19:26:04 +0000
committeralfred <alfred@FreeBSD.org>2002-02-05 19:26:04 +0000
commit4b6dfb0371e69053a084f9be4527d00c21ff21b2 (patch)
treed0bfae22d41f9e22feb21e5677a4049209d6314a /usr.bin/passwd
parent903f014bc1c0d907f00f5ee5cd8d683b823d9081 (diff)
downloadFreeBSD-src-4b6dfb0371e69053a084f9be4527d00c21ff21b2.zip
FreeBSD-src-4b6dfb0371e69053a084f9be4527d00c21ff21b2.tar.gz
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 'usr.bin/passwd')
-rw-r--r--usr.bin/passwd/yp_passwd.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.bin/passwd/yp_passwd.c b/usr.bin/passwd/yp_passwd.c
index 92688ed..fb39c76 100644
--- a/usr.bin/passwd/yp_passwd.c
+++ b/usr.bin/passwd/yp_passwd.c
@@ -27,6 +27,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#ifdef YP
@@ -55,14 +57,16 @@ yp_passwd(char *user)
{
struct yppasswd yppasswd;
struct master_yppasswd master_yppasswd;
+ struct netconfig *nconf;
+ void *localhandle;
struct passwd *pw;
CLIENT *clnt;
struct rpc_err err;
char *master;
int *status = NULL;
uid_t uid;
- char *sockname = YP_SOCKNAME;
+ nconf = NULL;
_use_yp = 1;
uid = getuid();
@@ -144,12 +148,24 @@ for other users");
}
if (suser_override) {
- if ((clnt = clnt_create(sockname, MASTER_YPPASSWDPROG,
- MASTER_YPPASSWDVERS, "unix")) == NULL) {
+ 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());
+ return(1);
+ }
+ if ((clnt = clnt_tp_create(NULL, MASTER_YPPASSWDPROG,
+ MASTER_YPPASSWDVERS, nconf)) == NULL) {
warnx("failed to contact rpc.yppasswdd on host %s: %s",
master, clnt_spcreateerror(""));
+ endnetconfig(localhandle);
return(1);
}
+ endnetconfig(localhandle);
} else {
if ((clnt = clnt_create(master, YPPASSWDPROG,
YPPASSWDVERS, "udp")) == NULL) {
OpenPOWER on IntegriCloud