Update for pw_mkdb() change: restrict updates to one user's records and/or
the secure database where appropriate.
This commit is contained in:
parent
cf24a0936c
commit
1e8e78ed07
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chpass.c,v 1.21 2001/02/13 00:11:45 cgd Exp $ */
|
||||
/* $NetBSD: chpass.c,v 1.22 2001/08/18 19:35:34 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
|
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: chpass.c,v 1.21 2001/02/13 00:11:45 cgd Exp $");
|
||||
__RCSID("$NetBSD: chpass.c,v 1.22 2001/08/18 19:35:34 ad Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -267,7 +267,7 @@ main(argc, argv)
|
|||
pw_copy(pfd, tfd, pw, (op == LOADENTRY) ? NULL : &old_pw);
|
||||
|
||||
/* Now finish the passwd file update. */
|
||||
if (pw_mkdb() < 0)
|
||||
if (pw_mkdb(username, 0) < 0)
|
||||
pw_error(NULL, 0, 1);
|
||||
|
||||
exit(0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: local_passwd.c,v 1.22 2000/10/09 11:14:17 ad Exp $ */
|
||||
/* $NetBSD: local_passwd.c,v 1.23 2001/08/18 19:35:35 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "from: @(#)local_passwd.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: local_passwd.c,v 1.22 2000/10/09 11:14:17 ad Exp $");
|
||||
__RCSID("$NetBSD: local_passwd.c,v 1.23 2001/08/18 19:35:35 ad Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -216,7 +216,7 @@ local_chpw(uname)
|
|||
|
||||
pw_copy(pfd, tfd, pw, &old_pw);
|
||||
|
||||
if (pw_mkdb() < 0)
|
||||
if (pw_mkdb(uname, pw_expiry == 0) < 0)
|
||||
pw_error((char *)NULL, 0, 1);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: yppasswdd_mkpw.c,v 1.8 2000/12/08 22:23:14 tron Exp $ */
|
||||
/* $NetBSD: yppasswdd_mkpw.c,v 1.9 2001/08/18 19:35:32 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Jason R. Thorpe <thorpej@NetBSD.ORG>
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: yppasswdd_mkpw.c,v 1.8 2000/12/08 22:23:14 tron Exp $");
|
||||
__RCSID("$NetBSD: yppasswdd_mkpw.c,v 1.9 2001/08/18 19:35:32 ad Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -130,7 +130,7 @@ make_passwd(yppasswd *argp, struct svc_req *rqstp, SVCXPRT *transp)
|
|||
|
||||
pw_copy(pfd, tfd, pw, NULL);
|
||||
|
||||
if (pw_mkdb() < 0) {
|
||||
if (pw_mkdb(pw->pw_name, 0) < 0) {
|
||||
warnx("pw_mkdb failed");
|
||||
pw_abort();
|
||||
RETURN(1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: user.c,v 1.40 2001/08/17 08:29:00 joda Exp $ */
|
||||
/* $NetBSD: user.c,v 1.41 2001/08/18 19:35:33 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
|
@ -35,7 +35,7 @@
|
|||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1999 \
|
||||
The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: user.c,v 1.40 2001/08/17 08:29:00 joda Exp $");
|
||||
__RCSID("$NetBSD: user.c,v 1.41 2001/08/18 19:35:33 ad Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -992,7 +992,7 @@ adduser(char *login, user_t *up)
|
|||
errx(EXIT_FAILURE, "can't append `%s' to new groups", login);
|
||||
}
|
||||
(void) close(ptmpfd);
|
||||
if (pw_mkdb() < 0) {
|
||||
if (pw_mkdb(login, 0) < 0) {
|
||||
err(EXIT_FAILURE, "pw_mkdb failed");
|
||||
}
|
||||
return 1;
|
||||
|
@ -1012,6 +1012,7 @@ moduser(char *login, char *newlogin, user_t *up)
|
|||
char *buf, *colon, *line;
|
||||
int masterfd;
|
||||
int ptmpfd;
|
||||
int error;
|
||||
|
||||
if (!valid_login(newlogin)) {
|
||||
errx(EXIT_FAILURE, "`%s' is not a valid login name", login);
|
||||
|
@ -1159,9 +1160,15 @@ moduser(char *login, char *newlogin, user_t *up)
|
|||
}
|
||||
}
|
||||
(void) close(ptmpfd);
|
||||
if (pw_mkdb() < 0) {
|
||||
if (up != NULL && strcmp(login, newlogin) == 0) {
|
||||
error = pw_mkdb(login, 0);
|
||||
} else {
|
||||
error = pw_mkdb(NULL, 0);
|
||||
}
|
||||
if (error < 0) {
|
||||
err(EXIT_FAILURE, "pw_mkdb failed");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vipw.c,v 1.8 2001/02/19 23:22:49 cgd Exp $ */
|
||||
/* $NetBSD: vipw.c,v 1.9 2001/08/18 19:35:33 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
|
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)vipw.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: vipw.c,v 1.8 2001/02/19 23:22:49 cgd Exp $");
|
||||
__RCSID("$NetBSD: vipw.c,v 1.9 2001/08/18 19:35:33 ad Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -123,7 +123,7 @@ main(int argc, char *argv[])
|
|||
warnx("no changes made");
|
||||
pw_error((char *)NULL, 0, 0);
|
||||
}
|
||||
if (pw_mkdb() == 0)
|
||||
if (pw_mkdb(NULL, 0) == 0)
|
||||
break;
|
||||
pw_prompt();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue