summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2000-11-26 01:25:33 +0000
committermillert <millert@openbsd.org>2000-11-26 01:25:33 +0000
commitd8bef6977c6a6bb414de7cbf06a49918f2dab6c7 (patch)
tree86f7833f51bf30b421ecc9efae131f16f3f887b6 /lib/libutil
parentSupport -u username option. Loosely based on FreeBSD's changes. (diff)
downloadwireguard-openbsd-d8bef6977c6a6bb414de7cbf06a49918f2dab6c7.tar.xz
wireguard-openbsd-d8bef6977c6a6bb414de7cbf06a49918f2dab6c7.zip
Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/passwd.c18
-rw-r--r--lib/libutil/pw_lock.37
-rw-r--r--lib/libutil/shlib_version4
-rw-r--r--lib/libutil/util.h4
4 files changed, 21 insertions, 12 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index 7d43a4eed98..f1b37e08bec 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.22 2000/08/01 22:10:16 provos Exp $ */
+/* $OpenBSD: passwd.c,v 1.23 2000/11/26 01:25:33 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.22 2000/08/01 22:10:16 provos Exp $";
+static char rcsid[] = "$OpenBSD: passwd.c,v 1.23 2000/11/26 01:25:33 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -273,7 +273,8 @@ pw_lock(retries)
}
int
-pw_mkdb()
+pw_mkdb(username)
+ char *username;
{
int pstat;
pid_t pid;
@@ -291,9 +292,14 @@ pw_mkdb()
if (pid == -1)
return (-1);
if (pid == 0) {
- if (pw_lck)
- execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d", pw_dir,
- pw_lck, NULL);
+ if (pw_lck) {
+ if (username)
+ execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d",
+ pw_dir, "-u", username, pw_lck, NULL);
+ else
+ execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-d",
+ pw_dir, pw_lck, NULL);
+ }
_exit(1);
}
pid = waitpid(pid, &pstat, 0);
diff --git a/lib/libutil/pw_lock.3 b/lib/libutil/pw_lock.3
index b444709bd3d..1f9a234f392 100644
--- a/lib/libutil/pw_lock.3
+++ b/lib/libutil/pw_lock.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pw_lock.3,v 1.5 1999/09/21 04:52:46 csapuntz Exp $
+.\" $OpenBSD: pw_lock.3,v 1.6 2000/11/26 01:25:33 millert Exp $
.\"
.\" Copyright (c) 1995
.\" The Regents of the University of California. All rights reserved.
@@ -48,7 +48,7 @@
.Ft int
.Fn pw_lock "int retries"
.Ft int
-.Fn pw_mkdb
+.Fn pw_mkdb "char *username"
.Ft void
.Fn pw_abort
.Sh DESCRIPTION
@@ -79,6 +79,9 @@ The
.Fn pw_mkdb
function updates the passwd file from the contents of
.Pa /etc/ptmp .
+If a
+.Fa username
+is specified, only the record for the specified user will be updated.
You should finish writing to and close the file descriptor returned by
.Fn pw_lock
before calling
diff --git a/lib/libutil/shlib_version b/lib/libutil/shlib_version
index 197ea4aed40..3066b9771e7 100644
--- a/lib/libutil/shlib_version
+++ b/lib/libutil/shlib_version
@@ -1,2 +1,2 @@
-major=4
-minor=5
+major=5
+minor=0
diff --git a/lib/libutil/util.h b/lib/libutil/util.h
index a1eee32b110..b8082ae4acd 100644
--- a/lib/libutil/util.h
+++ b/lib/libutil/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.10 2000/04/30 18:44:44 millert Exp $ */
+/* $OpenBSD: util.h,v 1.11 2000/11/26 01:25:33 millert Exp $ */
/* $NetBSD: util.h,v 1.2 1996/05/16 07:00:22 thorpej Exp $ */
/*-
@@ -72,7 +72,7 @@ int opendev __P((char *, int, int, char **));
void pw_setdir __P((const char *));
char *pw_file __P((const char *));
int pw_lock __P((int retries));
-int pw_mkdb __P((void));
+int pw_mkdb __P((char *));
int pw_abort __P((void));
void pw_init __P((void));
void pw_edit __P((int, const char *));