summaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-08-26 03:28:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-08-26 03:28:31 +0000
commit3aa55c5fded04d24e49a5ef347143a81e77baa25 (patch)
tree7f23149ee747e1fa19de85a37c1c84dbf849dadd /lib/libutil
parent8eae4adcc3f2ca8d68e42305f860c7a0bfe53885 (diff)
Change the second arg to pw_mkdb() from a boolean flag to a set of
bit flags ORed together. Currently the only flags defined are _PASSWORD_SECUREONLY and _PASSWORD_OMITV7 but this is enough to cause pw_mkdb() to run pwd_mkdb with the options we want. With this change we no longer generate the old V7 passwd file when only the extra fields in master.passwd (or the encrypted password) have changed. There are other programs that could probably use the _PASSWORD_OMITV7 flag; they will be converted at a future date.
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/passwd.c12
-rw-r--r--lib/libutil/pw_lock.330
2 files changed, 26 insertions, 16 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index 6912f7adae9..a0f817ae9c7 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.27 2001/08/16 18:24:32 millert Exp $ */
+/* $OpenBSD: passwd.c,v 1.28 2001/08/26 03:28:30 millert Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: passwd.c,v 1.27 2001/08/16 18:24:32 millert Exp $";
+static char rcsid[] = "$OpenBSD: passwd.c,v 1.28 2001/08/26 03:28:30 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -273,9 +273,9 @@ pw_lock(retries)
}
int
-pw_mkdb(username, secureonly)
+pw_mkdb(username, flags)
char *username;
- int secureonly;
+ int flags;
{
int pstat, ac;
pid_t pid;
@@ -295,9 +295,9 @@ pw_mkdb(username, secureonly)
av[ac++] = "pwd_mkdb";
av[ac++] = "-d";
av[ac++] = pw_dir;
- if (secureonly)
+ if (flags & _PASSWORD_SECUREONLY)
av[ac++] = "-s";
- else
+ else if (!(flags & _PASSWORD_OMITV7))
av[ac++] = "-p";
if (username) {
av[ac++] = "-u";
diff --git a/lib/libutil/pw_lock.3 b/lib/libutil/pw_lock.3
index 3146d936bc3..78d42acba54 100644
--- a/lib/libutil/pw_lock.3
+++ b/lib/libutil/pw_lock.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pw_lock.3,v 1.7 2001/08/16 18:24:32 millert Exp $
+.\" $OpenBSD: pw_lock.3,v 1.8 2001/08/26 03:28:30 millert Exp $
.\"
.\" Copyright (c) 1995
.\" The Regents of the University of California. All rights reserved.
@@ -35,7 +35,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 15, 1995
+.Dd August 20, 2001
.Dt PW_LOCK 3
.Os
.Sh NAME
@@ -48,7 +48,7 @@
.Ft int
.Fn pw_lock "int retries"
.Ft int
-.Fn pw_mkdb "char *username" "int secureonly"
+.Fn pw_mkdb "char *username" "int pwflags"
.Ft void
.Fn pw_abort
.Sh DESCRIPTION
@@ -84,13 +84,23 @@ via
If a
.Fa username
is specified, only the record for the specified user will be updated.
-If the
-.Fa secureonly
-argument is non-zero, only the secure database file,
-.Pa /etc/spwd.db ,
-will be updated.
-This is useful for cases when the password field is the only part of the
-entry that has been modified.
+The
+.Fa pwflags
+are specified by
+.Tn OR Ns 'ing
+the following values:
+.Pp
+.Bl -tag -width _PASSWORD_SECUREONLY -offset "xxxx" -compact
+.It Dv _PASSWORD_SECUREONLY
+only update the secure database file
+.Po Pa /etc/spwd.db Pc .
+.It Dv _PASSWORD_OMITV7
+do not update the Version 7 format password file
+.Po Pa /etc/passwd Pc .
+.El
+.Pp
+By default the secure, insecure and Version 7 format password databases
+are updated.
You should finish writing to and close the file descriptor returned by
.Fn pw_lock
before calling