Date: Sat, 8 Sep 2001 01:10:02 -0700 (PDT) From: Peter Pentchev <roam@ringlet.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/30424: Generalization of vipw to lock pwdb while being edited by a script Message-ID: <200109080810.f888A2Y27121@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/30424; it has been noted by GNATS.
From: Peter Pentchev <roam@ringlet.net>
To: alan@batie.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/30424: Generalization of vipw to lock pwdb while being edited by a script
Date: Sat, 8 Sep 2001 11:08:06 +0300
On Fri, Sep 07, 2001 at 03:34:37PM -0700, alan@batie.org wrote:
>
> >Number: 30424
> >Category: bin
> >Synopsis: Generalization of vipw to lock pwdb while being edited by a script
> >Originator: Alan Batie
> >Release: FreeBSD 4.3-STABLE i386
> >Organization:
> RainDrop Laboratories
> >Environment:
> System: FreeBSD aggie.rdrop.com 4.3-STABLE FreeBSD 4.3-STABLE #3: Wed Sep 5 13:36:38 PDT 2001 root@aggie.rdrop.com:/usr/src/freebsd/sys/compile/AGORA i386
>
>
> >Description:
> I have scripts to update accounts, and need to have the password
> file locked while they run to avoid having a user change their
> password at the same time and losing one of the updates. Since
> vipw already does most of what needs to be done, I've modified it
> so that when invoked as "pw_lock", instead of running vi, it runs
> the specified command, but still does all the locking and database
> updating.
Good idea!
[snip]
> + if (!(pid = vfork())) {
> + execl(argv[0], progname, tempname, (char *)NULL);
> + warn("Command '%s' failed", argv[0]);
> + pw_error((char *)NULL, 0, 0);
> + }
I think you should check pid for -1 here, though..
> ***************
> *** 83,88 ****
> --- 85,95 ----
> at very large sites could take several minutes. Until this update
> is completed, the password file is unavailable for other updates
> and the new information is not available to programs.
> + .Pp
> + If invoked as
> + .Nm pw_lock
> + , the user database ...
This might be written better as
If invoked as
.Nm pw_lock ,
the user database ...
Other than that, good work!
G'luck,
Peter
--
If there were no counterfactuals, this sentence would not have been paradoxical.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109080810.f888A2Y27121>
