summaryrefslogtreecommitdiffstats
path: root/pw/pw.c
diff options
context:
space:
mode:
authorNate Williams <nate@FreeBSD.org>1998-08-04 22:20:11 +0000
committerNate Williams <nate@FreeBSD.org>1998-08-04 22:20:11 +0000
commitf3802fc8abf3a8258fd130fd247ac561ac66c8c0 (patch)
treeb7f704d35b1bd983cfb8a22119eec8e137817a33 /pw/pw.c
parent953e54b3c1853cbc2a959f96455184ffb137b124 (diff)
downloadpw-darwin-f3802fc8abf3a8258fd130fd247ac561ac66c8c0.tar.gz
pw-darwin-f3802fc8abf3a8258fd130fd247ac561ac66c8c0.tar.zst
pw-darwin-f3802fc8abf3a8258fd130fd247ac561ac66c8c0.zip
- Removed read-only lock from 'pw'. This removes portions of the FIX
from PR/6787, but allow non-root users to use pw to get password information. However, this should be safe since the fixes for disallowing multiple instances from modifying the DB are still intact. Bug noted by: dima@best.net (Dima Ruban)
Diffstat (limited to 'pw/pw.c')
-rw-r--r--pw/pw.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/pw/pw.c b/pw/pw.c
index 5daa213..184f5e2 100644
--- a/pw/pw.c
+++ b/pw/pw.c
@@ -31,7 +31,6 @@ static const char rcsid[] =
#include "pw.h"
#include <err.h>
-#include <fcntl.h>
#include <paths.h>
#include <sys/wait.h>
@@ -50,7 +49,6 @@ static struct cargs arglist;
static int getindex(const char *words[], const char *word);
static void cmdhelp(int mode, int which);
-static int filelock(const char *filename);
int
@@ -149,20 +147,7 @@ main(int argc, char *argv[])
* Now, let's do the common initialisation
*/
cnf = read_userconfig(getarg(&arglist, 'C') ? getarg(&arglist, 'C')->val : NULL);
-
-
- /*
- * Be pessimistic and lock the master passowrd and group
- * files right away. Keep it locked for the duration.
- */
- if (-1 == filelock(_PATH_GROUP) || -1 == filelock(_PATH_MASTERPASSWD))
- {
- ch = EX_IOERR;
- }
- else
- {
- ch = funcs[which] (cnf, mode, &arglist);
- }
+ ch = funcs[which] (cnf, mode, &arglist);
/*
* If everything went ok, and we've been asked to update
@@ -193,12 +178,6 @@ main(int argc, char *argv[])
}
static int
-filelock(const char *filename)
-{
- return open(filename, O_RDONLY | O_EXLOCK, 0);
-}
-
-static int
getindex(const char *words[], const char *word)
{
int i = 0;