From 2a2d6947472de06c8120edd2ba89f01921a300a5 Mon Sep 17 00:00:00 2001 From: millert <> Date: Sun, 26 Nov 2000 01:25:33 +0000 Subject: [PATCH] Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'. Crank the shlib major number due to the interface change. --- src/lib/libutil/passwd.c | 18 ++++++++++++------ src/lib/libutil/pw_lock.3 | 7 +++++-- src/lib/libutil/shlib_version | 4 ++-- src/lib/libutil/util.h | 4 ++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/lib/libutil/passwd.c b/src/lib/libutil/passwd.c index 7d43a4ee..f1b37e08 100644 --- a/src/lib/libutil/passwd.c +++ b/src/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 @@ -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/src/lib/libutil/pw_lock.3 b/src/lib/libutil/pw_lock.3 index b444709b..1f9a234f 100644 --- a/src/lib/libutil/pw_lock.3 +++ b/src/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/src/lib/libutil/shlib_version b/src/lib/libutil/shlib_version index 197ea4ae..3066b977 100644 --- a/src/lib/libutil/shlib_version +++ b/src/lib/libutil/shlib_version @@ -1,2 +1,2 @@ -major=4 -minor=5 +major=5 +minor=0 diff --git a/src/lib/libutil/util.h b/src/lib/libutil/util.h index a1eee32b..b8082ae4 100644 --- a/src/lib/libutil/util.h +++ b/src/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 *));