Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add two arguments to pw_mkdb(), a la OpenBSD. This is to all...
details: https://anonhg.NetBSD.org/src/rev/0d42121f763d
branches: trunk
changeset: 513960:0d42121f763d
user: ad <ad%NetBSD.org@localhost>
date: Sat Aug 18 19:31:47 2001 +0000
description:
Add two arguments to pw_mkdb(), a la OpenBSD. This is to allow us to pass
the -u and -s options to pwd_mkdb.
diffstat:
include/util.h | 4 ++--
lib/libutil/passwd.c | 29 +++++++++++++++++++++++------
lib/libutil/pw_lock.3 | 16 +++++++++++-----
3 files changed, 36 insertions(+), 13 deletions(-)
diffs (125 lines):
diff -r c75e1bc21d88 -r 0d42121f763d include/util.h
--- a/include/util.h Sat Aug 18 19:29:31 2001 +0000
+++ b/include/util.h Sat Aug 18 19:31:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.h,v 1.20 2001/04/06 16:24:25 wiz Exp $ */
+/* $NetBSD: util.h,v 1.21 2001/08/18 19:31:47 ad Exp $ */
/*-
* Copyright (c) 1995
@@ -82,7 +82,7 @@
const char *pw_getprefix(void);
void pw_init(void);
int pw_lock(int);
-int pw_mkdb(void);
+int pw_mkdb(const char *, int);
void pw_prompt(void);
int pw_setprefix(const char *);
int secure_path(const char *);
diff -r c75e1bc21d88 -r 0d42121f763d lib/libutil/passwd.c
--- a/lib/libutil/passwd.c Sat Aug 18 19:29:31 2001 +0000
+++ b/lib/libutil/passwd.c Sat Aug 18 19:31:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: passwd.c,v 1.29 2001/01/03 15:41:19 lukem Exp $ */
+/* $NetBSD: passwd.c,v 1.30 2001/08/18 19:31:48 ad Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: passwd.c,v 1.29 2001/01/03 15:41:19 lukem Exp $");
+__RCSID("$NetBSD: passwd.c,v 1.30 2001/08/18 19:31:48 ad Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -137,9 +137,12 @@
}
int
-pw_mkdb(void)
+pw_mkdb(username, secureonly)
+ const char *username;
+ int secureonly;
{
- int pstat;
+ const char *args[9];
+ int pstat, i;
pid_t pid;
pid = vfork();
@@ -147,8 +150,22 @@
return (-1);
if (pid == 0) {
- execl(_PATH_PWD_MKDB, "pwd_mkdb", "-d", pw_prefix,
- "-p", pw_filename(_PATH_MASTERPASSWD_LOCK), NULL);
+ args[0] = "pwd_mkdb";
+ args[1] = "-d";
+ args[2] = pw_prefix;
+ args[3] = "-p";
+ i = 4;
+
+ if (secureonly)
+ args[i++] = "-s";
+ if (username != NULL) {
+ args[i++] = "-u";
+ args[i++] = username;
+ }
+
+ args[i++] = pw_filename(_PATH_MASTERPASSWD_LOCK);
+ args[i] = NULL;
+ execv(_PATH_PWD_MKDB, (char * const *)args);
_exit(1);
}
pid = waitpid(pid, &pstat, 0);
diff -r c75e1bc21d88 -r 0d42121f763d lib/libutil/pw_lock.3
--- a/lib/libutil/pw_lock.3 Sat Aug 18 19:29:31 2001 +0000
+++ b/lib/libutil/pw_lock.3 Sat Aug 18 19:31:47 2001 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pw_lock.3,v 1.6 2000/12/06 13:37:53 tron Exp $
+.\" $NetBSD: pw_lock.3,v 1.7 2001/08/18 19:31:48 ad 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 18, 2001
.Dt PW_LOCK 3
.Os
.Sh NAME
@@ -52,7 +52,7 @@
.Ft int
.Fn pw_lock "int retries"
.Ft int
-.Fn pw_mkdb "void"
+.Fn pw_mkdb "const char *username, int secureonly"
.Ft void
.Fn pw_abort "void"
.Ft void
@@ -95,7 +95,12 @@
.Fn pw_mkdb
fails and you do not wish to retry, you should make sure to call
.Fn pw_abort
-to clean up the lock file.
+to clean up the lock file. If the
+.Ar username
+argument is not NULL, only database entries pertaining to the specified user
+will be modified. If the
+.Ar secureonly
+argument is non-zero, only the secure database will be updated.
.Pp
The
.Fn pw_abort
@@ -129,4 +134,5 @@
.It Pa /etc/ptmp
.El
.Sh SEE ALSO
-.Xr pw_init 3
+.Xr pw_init 3 ,
+.Xr pwd_mkdb 8
\ No newline at end of file
Home |
Main Index |
Thread Index |
Old Index