summaryrefslogtreecommitdiff
path: root/usr.sbin/rpc.yppasswdd
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2009-02-18 22:27:46 +0000
committerWarner Losh <imp@FreeBSD.org>2009-02-18 22:27:46 +0000
commit02da3f22808caaea10a1a0e004cd893d709cf4a0 (patch)
tree431549b251c3afc333b4410eb2224cf32fa09ba9 /usr.sbin/rpc.yppasswdd
parent04ff88ceacbae3403626dadc743cfa23ea3a4002 (diff)
downloadsrc-test2-02da3f22808caaea10a1a0e004cd893d709cf4a0.tar.gz
src-test2-02da3f22808caaea10a1a0e004cd893d709cf4a0.zip
Notes
Diffstat (limited to 'usr.sbin/rpc.yppasswdd')
-rw-r--r--usr.sbin/rpc.yppasswdd/yppasswdd_server.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
index 04adf31ed85f..446b13040be3 100644
--- a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
+++ b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
@@ -70,6 +70,22 @@ struct dom_binding;
static struct passwd yp_password;
static void
+xlate_passwd(struct x_master_passwd *xpwd, struct passwd *pwd)
+{
+ pwd->pw_name = xpwd->pw_name;
+ pwd->pw_passwd = xpwd->pw_passwd;
+ pwd->pw_uid = xpwd->pw_uid;
+ pwd->pw_gid = xpwd->pw_gid;
+ pwd->pw_change = xpwd->pw_change;
+ pwd->pw_class = xpwd->pw_class;
+ pwd->pw_gecos = xpwd->pw_gecos;
+ pwd->pw_dir = xpwd->pw_dir;
+ pwd->pw_shell = xpwd->pw_shell;
+ pwd->pw_expire = xpwd->pw_expire;
+ pwd->pw_fields = xpwd->pw_fields;
+}
+
+static void
copy_yp_pass(char *p, int x, int m)
{
char *t, *s = p;
@@ -709,6 +725,7 @@ yppasswdproc_update_master_1_svc(master_yppasswd *argp,
char passfile_hold_buf[MAXPATHLEN + 2];
struct sockaddr_in *rqhost;
SVCXPRT *transp;
+ struct passwd newpasswd;
result = 1;
transp = rqstp->rq_xprt;
@@ -820,7 +837,8 @@ allow additions to be made to the password database");
yp_error("pw_tmp() failed");
return &result;
}
- if (pw_copy(pfd, tfd, (struct passwd *)&argp->newpw, NULL) == -1) {
+ xlate_passwd(&argp->newpw, &newpasswd);
+ if (pw_copy(pfd, tfd, &newpasswd, NULL) == -1) {
pw_fini();
yp_error("pw_copy() failed");
return &result;
@@ -858,8 +876,8 @@ allow additions to be made to the password database");
pw_fini();
if (inplace) {
- if ((rval = update_inplace((struct passwd *)&argp->newpw,
- argp->domain))) {
+ xlate_passwd(&argp->newpw, &newpasswd);
+ if ((rval = update_inplace(&newpasswd, argp->domain))) {
yp_error("inplace update failed -- rebuilding maps");
}
}