Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jun 2002 13:19:02 -0700 (PDT)
From:      Paul Herman <pherman@frenchfries.net>
To:        "Matthew D. Fuller" <fullermd@over-yonder.net>
Cc:        "Geoffrey C. Speicher" <geoff@sea-incorporated.com>, <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: bug in pw, -STABLE [patch]
Message-ID:  <20020623124243.H38673-100000@mammoth.eat.frenchfries.net>
In-Reply-To: <20020623192457.GJ81018@over-yonder.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 23 Jun 2002, Matthew D. Fuller wrote:

> On Sun, Jun 23, 2002 at 11:32:54AM -0700 I heard the voice of
> Paul Herman, and lo! it spake thus:
> >
> > In fact, if you look at fileupdate(), you see that it already gains
> > an exclusive lock on the temp file, but not the original
> > "/etc/master.passwd" (if you will.)  I think this is a bug, because
> > the original is getting modified (at least in name space), so that
> > should be locked while pw(8) is operating.
>
> I think that MAY prevent some of the corruption cases.  On the other
> hand, we're really addressing a broader spectrum of issues here.  The was
> pw(8) manipulates the passwd database is rather different from how
> chpass(1) or vipw(8) do it; this unifies it all (well, starts the
> process).  Also, looking down, it seems that pw(8) will ALWAYS try to do
> a line-by-line copy of the temp file back into the main file, which would
> be Bad Bad Bad (tm);

I think you might have your infp confused with your outfp.  It's
not writing to the original "live" file, it's just writing the new
temp file.  That part of the code is OK.

As for the giant lock, it would be like closing down the entire
airport after someone finds a knife in the snack bar, and in my
opinion an this is an unwise and brutal thing to do.

Not to mention stale /var/run/ files that might be lying around...

I do appreciate your work, but please don't commit this until the
real issue is solved, and the dust settles.  There still may be
some use for it... plenty of time until the next release cycle.

Geoff:  Does the patch for fileupd.c in the last mail hinder the
file corruption you are seeing?

> (I suggest tabstop=4 or even =2; that file is *DEEP*)

Yeeeess!  :-)

-Paul.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020623124243.H38673-100000>