From 508aee968143cb0eaea97fba706dcd2624c052e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sat, 25 Mar 2023 14:15:40 +0000 Subject: [PATCH] pwd_mkdb: Sort options and update usage message. Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D39266 --- usr.sbin/pwd_mkdb/pwd_mkdb.8 | 38 ++++++++++++++++++------------------ usr.sbin/pwd_mkdb/pwd_mkdb.c | 10 +++++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.8 b/usr.sbin/pwd_mkdb/pwd_mkdb.8 index 0a8b0143569c..52044f5b4364 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.8 +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.8 @@ -28,7 +28,7 @@ .\" @(#)pwd_mkdb.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd October 20, 2018 +.Dd March 25, 2023 .Dt PWD_MKDB 8 .Os .Sh NAME @@ -65,6 +65,19 @@ The options are as follows: Check if the password file is in the correct format. Do not change, add, or remove any files. +.It Fl d Ar directory +Store databases into specified destination directory instead of +.Pa /etc . +.It Fl i +Ignore locking failure of the +.Pa master.passwd +file. +This option is intended to be used to build password files in +the release process over NFS where no contention can happen. +A non-default directory must also be specified with the +.Fl d +option for locking to be ignored. +Other use of this option is strongly discouraged. .It Fl N Tell .Nm @@ -76,24 +89,6 @@ the rebuilding of the database. .It Fl p Create a Version 7 style password file and install it into .Pa /etc/passwd . -.It Fl i -Ignore locking failure of the -.Pa master.passwd -file. -This option is intended to be used to build password files in -the release process over NFS where no contention can happen. -A non-default directory must also be specified with the -.Fl d -option for locking to be ignored. -Other use of this option is strongly discouraged. -.It Fl d Ar directory -Store databases into specified destination directory instead of -.Pa /etc . -.It Fl u Ar username -Only update the record for the specified user. -Utilities that -operate on a single user can use this option to avoid the -overhead of rebuilding the entire database. .It Fl s Ar cachesize Specify in megabytes the size of the memory cache used by the hashing library. @@ -104,6 +99,11 @@ As a rough guide, the memory usage of in megabytes will be a little bit more than twice the figure specified here. The default is 2 megabytes. +.It Fl u Ar username +Only update the record for the specified user. +Utilities that +operate on a single user can use this option to avoid the +overhead of rebuilding the entire database. .El .Pp The two databases differ in that the secure version contains the user's diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 261e7951a126..f843b7eae376 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -123,14 +123,11 @@ main(int argc, char *argv[]) makeold = 0; username = NULL; oldfp = NULL; - while ((ch = getopt(argc, argv, "CNd:ips:u:v")) != -1) + while ((ch = getopt(argc, argv, "Cd:iNps:u:v")) != -1) switch(ch) { case 'C': /* verify only */ Cflag = 1; break; - case 'N': /* do not wait for lock */ - nblock = LOCK_NB; /* will fail if locked */ - break; case 'd': dflag++; strlcpy(prefix, optarg, sizeof(prefix)); @@ -138,6 +135,9 @@ main(int argc, char *argv[]) case 'i': iflag++; break; + case 'N': /* do not wait for lock */ + nblock = LOCK_NB; /* will fail if locked */ + break; case 'p': /* create V7 "file.orig" */ makeold = 1; break; @@ -675,6 +675,6 @@ usage(void) { (void)fprintf(stderr, -"usage: pwd_mkdb [-BCiLNp] [-d directory] [-s cachesize] [-u username] file\n"); +"usage: pwd_mkdb [-CiNp] [-d directory] [-s cachesize] [-u username] file\n"); exit(1); }