diff options
author | downsj <downsj@openbsd.org> | 1996-09-28 05:44:32 +0000 |
---|---|---|
committer | downsj <downsj@openbsd.org> | 1996-09-28 05:44:32 +0000 |
commit | 67b7f406e6a986bdb46a87287c6a8dd400e7713f (patch) | |
tree | f07aaf6bd87ff7be659704b74fa84e0c25ecbeee /usr.sbin/pwd_mkdb | |
parent | Bye for now. (diff) | |
download | wireguard-openbsd-67b7f406e6a986bdb46a87287c6a8dd400e7713f.tar.xz wireguard-openbsd-67b7f406e6a986bdb46a87287c6a8dd400e7713f.zip |
Add -c flag from FreeBSD.
Diffstat (limited to 'usr.sbin/pwd_mkdb')
-rw-r--r-- | usr.sbin/pwd_mkdb/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/pwd_mkdb/pwd_mkdb.8 | 9 | ||||
-rw-r--r-- | usr.sbin/pwd_mkdb/pwd_mkdb.c | 17 |
3 files changed, 22 insertions, 6 deletions
diff --git a/usr.sbin/pwd_mkdb/Makefile b/usr.sbin/pwd_mkdb/Makefile index 90f5c280627..cc03f7cae62 100644 --- a/usr.sbin/pwd_mkdb/Makefile +++ b/usr.sbin/pwd_mkdb/Makefile @@ -1,5 +1,5 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $Id: Makefile,v 1.2 1996/05/22 11:35:51 deraadt Exp $ +# $OpenBSD: Makefile,v 1.3 1996/09/28 05:44:32 downsj Exp $ PROG= pwd_mkdb SRCS= pwd_mkdb.c getpwent.c diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.8 b/usr.sbin/pwd_mkdb/pwd_mkdb.8 index 1f08c38fcef..318b14ccb37 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.8 +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.8 @@ -1,3 +1,5 @@ +.\" $OpenBSD: pwd_mkdb.8,v 1.3 1996/09/28 05:44:32 downsj Exp $ +.\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -30,16 +32,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 -.\" $Id: pwd_mkdb.8,v 1.2 1996/08/02 01:15:02 millert Exp $ .\" .Dd June 6, 1993 .Dt PWD_MKDB 8 -.Os +.Os OpenBSD .Sh NAME .Nm pwd_mkdb .Nd "generate the password databases" .Sh SYNOPSIS .Nm pwd_mkdb +.Op Fl c .Op Fl p .Op Fl d Ar directory .Ar file @@ -62,6 +64,9 @@ different from the historic Version 7 style format. .Pp The options are as follows: .Bl -tag -width flag +.It Fl c +Check if the password file is in the correct format. Do not +change, add, or remove any files. .It Fl p Create a Version 7 style password file and install it into .Dq Pa /etc/passwd . diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index f5d0610e177..326729f6d8d 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -1,3 +1,4 @@ +/* $OpenBSD: pwd_mkdb.c,v 1.7 1996/09/28 05:44:33 downsj Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. @@ -40,7 +41,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94";*/ -static char *rcsid = "$Id: pwd_mkdb.c,v 1.6 1996/08/30 14:24:48 deraadt Exp $"; +static char *rcsid = "$Id: pwd_mkdb.c,v 1.7 1996/09/28 05:44:33 downsj Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -101,11 +102,15 @@ main(argc, argv) char *p, *t; char buf[MAX(MAXPATHLEN, LINE_MAX * 2)], tbuf[1024]; int hasyp = 0; + int cflag = 0; DBT ypdata, ypkey; makeold = 0; - while ((ch = getopt(argc, argv, "pvd:")) != EOF) + while ((ch = getopt(argc, argv, "cpvd:")) != EOF) switch(ch) { + case 'c': /* verify only */ + cflag = 1; + break; case 'p': /* create V7 "file.orig" */ makeold = 1; break; @@ -146,6 +151,12 @@ main(argc, argv) if (!(fp = fopen(pname, "r"))) error(pname); + /* check only if password database is valid */ + if (cflag) { + for (cnt = 1; scan(fp, &pwd, &flags); ++cnt); + exit(0); + } + /* Open the temporary insecure password database. */ (void)snprintf(buf, sizeof(buf), "%s.tmp", changedir(_PATH_MP_DB, basedir)); @@ -442,7 +453,7 @@ void usage() { - (void)fprintf(stderr, "usage: pwd_mkdb [-p] [-d basedir] file\n"); + (void)fprintf(stderr, "usage: pwd_mkdb [-cp] [-d basedir] file\n"); exit(1); } |