summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.811
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c12
2 files changed, 19 insertions, 4 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.8 b/usr.sbin/pwd_mkdb/pwd_mkdb.8
index 9d47412..a29ab4e 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.8
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.8
@@ -43,6 +43,7 @@
.Op Fl C
.Op Fl N
.Op Fl p
+.Op Fl i
.Op Fl d Ar directory
.Op Fl s Ar cachesize
.Op Fl u Ar username
@@ -82,6 +83,16 @@ 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 .
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 5731aef..204a588 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -115,10 +115,10 @@ main(int argc, char *argv[])
char sbuf2[MAXPATHLEN];
char *username;
u_int method, methoduid;
- int Cflag;
+ int Cflag, dflag, iflag;
int nblock = 0;
- Cflag = 0;
+ iflag = dflag = Cflag = 0;
strcpy(prefix, _PATH_PWD);
makeold = 0;
username = NULL;
@@ -131,8 +131,12 @@ main(int argc, char *argv[])
nblock = LOCK_NB; /* will fail if locked */
break;
case 'd':
+ dflag++;
strlcpy(prefix, optarg, sizeof(prefix));
break;
+ case 'i':
+ iflag++;
+ break;
case 'p': /* create V7 "file.orig" */
makeold = 1;
break;
@@ -184,7 +188,7 @@ main(int argc, char *argv[])
if (!(fp = fopen(pname, "r")))
error(pname);
- if (flock(fileno(fp), LOCK_EX|nblock) < 0)
+ if (flock(fileno(fp), LOCK_EX|nblock) < 0 && !(dflag && iflag))
error("flock");
if (fstat(fileno(fp), &st) < 0)
error(pname);
@@ -752,6 +756,6 @@ usage()
{
(void)fprintf(stderr,
-"usage: pwd_mkdb [-C] [-N] [-p] [-d <dest dir>] [-s <cachesize>] [-u <local username>] file\n");
+"usage: pwd_mkdb [-C] [-N] [-i] [-p] [-d <dest dir>] [-s <cachesize>] [-u <local username>] file\n");
exit(1);
}
OpenPOWER on IntegriCloud