Browse Source

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.

Crank the shlib major number due to the interface change.
OPENBSD_2_9
millert 23 years ago
parent
commit
2a2d694747
4 changed files with 21 additions and 12 deletions
  1. +12
    -6
      src/lib/libutil/passwd.c
  2. +5
    -2
      src/lib/libutil/pw_lock.3
  3. +2
    -2
      src/lib/libutil/shlib_version
  4. +2
    -2
      src/lib/libutil/util.h

+ 12
- 6
src/lib/libutil/passwd.c View File

@ -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 * Copyright (c) 1987, 1993, 1994, 1995
@ -34,7 +34,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -273,7 +273,8 @@ pw_lock(retries)
} }
int int
pw_mkdb()
pw_mkdb(username)
char *username;
{ {
int pstat; int pstat;
pid_t pid; pid_t pid;
@ -291,9 +292,14 @@ pw_mkdb()
if (pid == -1) if (pid == -1)
return (-1); return (-1);
if (pid == 0) { 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); _exit(1);
} }
pid = waitpid(pid, &pstat, 0); pid = waitpid(pid, &pstat, 0);


+ 5
- 2
src/lib/libutil/pw_lock.3 View File

@ -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 .\" Copyright (c) 1995
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -48,7 +48,7 @@
.Ft int .Ft int
.Fn pw_lock "int retries" .Fn pw_lock "int retries"
.Ft int .Ft int
.Fn pw_mkdb
.Fn pw_mkdb "char *username"
.Ft void .Ft void
.Fn pw_abort .Fn pw_abort
.Sh DESCRIPTION .Sh DESCRIPTION
@ -79,6 +79,9 @@ The
.Fn pw_mkdb .Fn pw_mkdb
function updates the passwd file from the contents of function updates the passwd file from the contents of
.Pa /etc/ptmp . .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 You should finish writing to and close the file descriptor returned by
.Fn pw_lock .Fn pw_lock
before calling before calling


+ 2
- 2
src/lib/libutil/shlib_version View File

@ -1,2 +1,2 @@
major=4
minor=5
major=5
minor=0

+ 2
- 2
src/lib/libutil/util.h View File

@ -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 $ */ /* $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 *)); void pw_setdir __P((const char *));
char *pw_file __P((const char *)); char *pw_file __P((const char *));
int pw_lock __P((int retries)); int pw_lock __P((int retries));
int pw_mkdb __P((void));
int pw_mkdb __P((char *));
int pw_abort __P((void)); int pw_abort __P((void));
void pw_init __P((void)); void pw_init __P((void));
void pw_edit __P((int, const char *)); void pw_edit __P((int, const char *));


Loading…
Cancel
Save