summaryrefslogtreecommitdiffstats
path: root/usr.bin/passwd
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1997-07-29 15:45:36 +0000
committerwpaul <wpaul@FreeBSD.org>1997-07-29 15:45:36 +0000
commite0aba351e5f5cf95d028a7d0fbfab9ab45d2f580 (patch)
treebb641f606f43534b64b5ca825fb4f75e6d5591d5 /usr.bin/passwd
parente0bb173182a2eae0614ffe1de98139d5aaca70a9 (diff)
downloadFreeBSD-src-e0aba351e5f5cf95d028a7d0fbfab9ab45d2f580.zip
FreeBSD-src-e0aba351e5f5cf95d028a7d0fbfab9ab45d2f580.tar.gz
Modify passwd and chpass to use new AF_LOCAL RPC interface instead of
old kludged-up 'yppasswd_comm' support.
Diffstat (limited to 'usr.bin/passwd')
-rw-r--r--usr.bin/passwd/Makefile11
-rw-r--r--usr.bin/passwd/yp_passwd.c34
2 files changed, 25 insertions, 20 deletions
diff --git a/usr.bin/passwd/Makefile b/usr.bin/passwd/Makefile
index 49c303c..b2346b2 100644
--- a/usr.bin/passwd/Makefile
+++ b/usr.bin/passwd/Makefile
@@ -1,8 +1,8 @@
# From: @(#)Makefile 8.3 (Berkeley) 4/2/94
-# $Id: Makefile,v 1.23 1997/02/22 19:56:34 peter Exp $
+# $Id: Makefile,v 1.2 1997/07/28 18:31:45 wpaul Exp $
PROG= passwd
-SRCS= local_passwd.c yppasswd_private_xdr.c yppasswd_comm.c yp_passwd.c \
+SRCS= local_passwd.c yppasswd_private_xdr.c yp_passwd.c \
passwd.c pw_copy.c pw_util.c pw_yp.c
DPADD= ${LIBCRYPT} ${LIBRPCSVC} ${LIBUTIL}
@@ -18,10 +18,10 @@ CFLAGS+= -DLOGIN_CAP -DCRYPT -DYP -I. -I${.CURDIR} \
-I${.CURDIR}/../../usr.sbin/rpc.yppasswdd \
-Dyp_error=warnx -DLOGGING
-SRCS+= ypxfr_misc.c yp_clnt.c yppasswd_clnt.c
+SRCS+= ypxfr_misc.c yp_clnt.c yppasswd_clnt.c yppasswd_private_clnt.c
CLEANFILES= yp.h yp_clnt.c yppasswd.h yppasswd_clnt.c \
- yppasswd_private.h yppasswd_private_xdr.c
+ yppasswd_private.h yppasswd_private_xdr.c yppasswd_private_clnt.c
RPCGEN= rpcgen -C
RPCSRC= ${DESTDIR}/usr/include/rpcsvc/yp.x
@@ -46,6 +46,9 @@ yppasswd_private.h: ${RPCSRC_PRIV}
yppasswd_private_xdr.c: ${RPCSRC_PRIV} yppasswd_private.h
${RPCGEN} -c -o ${.TARGET} ${RPCSRC_PRIV}
+yppasswd_private_clnt.c: ${RPCSRC_PRIV} yppasswd_private.h
+ ${RPCGEN} -l -o ${.TARGET} ${RPCSRC_PRIV}
+
BINOWN= root
BINMODE=4555
MAN1=passwd.1
diff --git a/usr.bin/passwd/yp_passwd.c b/usr.bin/passwd/yp_passwd.c
index 3eab43a..8d9a648 100644
--- a/usr.bin/passwd/yp_passwd.c
+++ b/usr.bin/passwd/yp_passwd.c
@@ -45,7 +45,7 @@
#include <rpcsvc/ypclnt.h>
#include <rpcsvc/yppasswd.h>
#include <pw_yp.h>
-#include "yppasswd_comm.h"
+#include "yppasswd_private.h"
extern char *getnewpasswd __P(( struct passwd * , int ));
@@ -61,6 +61,7 @@ yp_passwd(char *user)
char *master;
int *status = NULL;
uid_t uid;
+ char *sockname = YP_SOCKNAME;
_use_yp = 1;
@@ -143,11 +144,12 @@ for other users");
}
if (suser_override) {
- if (senddat(&master_yppasswd)) {
- warnx("failed to send request to rpc.yppasswdd");
+ if ((clnt = clnt_create(sockname, MASTER_YPPASSWDPROG,
+ MASTER_YPPASSWDVERS, "unix")) == NULL) {
+ warnx("failed to contact rpc.yppasswdd on host %s: %s",
+ master, clnt_spcreateerror(""));
return(1);
}
- status = getresp();
} else {
if ((clnt = clnt_create(master, YPPASSWDPROG,
YPPASSWDVERS, "udp")) == NULL) {
@@ -155,32 +157,32 @@ for other users");
master, clnt_spcreateerror(""));
return(1);
}
+ }
/*
* The yppasswd.x file said `unix authentication required',
* so I added it. This is the only reason it is in here.
* My yppasswdd doesn't use it, but maybe some others out there
* do. --okir
*/
- clnt->cl_auth = authunix_create_default();
+ clnt->cl_auth = authunix_create_default();
+ if (suser_override)
+ status = yppasswdproc_update_master_1(&master_yppasswd, clnt);
+ else
status = yppasswdproc_update_1(&yppasswd, clnt);
- clnt_geterr(clnt, &err);
- auth_destroy(clnt->cl_auth);
- clnt_destroy(clnt);
- }
+ clnt_geterr(clnt, &err);
+
+ auth_destroy(clnt->cl_auth);
+ clnt_destroy(clnt);
- if ((!suser_override && err.re_status != RPC_SUCCESS) ||
- status == NULL || *status) {
+ if (err.re_status != RPC_SUCCESS || status == NULL || *status) {
errx(1, "Failed to change NIS password: %s",
- (err.re_status != RPC_SUCCESS && !suser_override) ?
- clnt_sperrno(err.re_status) :
- "rpc.yppasswdd returned error status");
+ clnt_sperrno(err.re_status));
}
printf("\nNIS password has%s been changed on %s.\n",
- ((err.re_status != RPC_SUCCESS && !suser_override)
- || status == NULL || *status) ?
+ (err.re_status != RPC_SUCCESS || status == NULL || *status) ?
" not" : "", master);
return ((err.re_status || status == NULL || *status));
OpenPOWER on IntegriCloud