[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: chmod/chown -R - maybe an ITP



On Mon, Dec 13, 1999 at 05:13:36PM +0100, Russell Coker was heard to say:
> >  Maybe I'm being dense, but it looks to me like this has the same race
> >condition, although it's harder to exploit since the time gap is small.
> 
> My message wasn't clear on that, the comment "check contents..." should be
> replaced with C code to do so.  Then we can be absolutely sure that we are
> changing the Inode we want to change.

  (slaps self)  Doh. :)  You call it on the fd.  Of course.  Ok, I see now :)

> >  I'd like to suggest, unless there's a really good reason, that you not build
> >recursion into your programs -- that is, that you just implement a single-file
> >'safe chown' operation, which checks that the owner is what it's expecting and
> >then changes it.  This will be easier to write and probably more flexible, and
> >I don't see any reason that find can't do the recursion for you. (though I
> >could be missing something obvious..)
> 
> If you have to run find every time then the user will be encouraged to use
> the program which doesn't require all the extra typing of find, and run the
> old chmod/chown programs.

  I don't think that's a "really good reason" :)
  If you want you can write the atomic-test-and-set program, and ship a one-line
shell script with it (which uses find and xargs to do the recursion).  Or you
can just ignore me, that works too ;-)

  Anyway, it looks like you'll be right either way..

  Daniel

-- 
  Fate always wins...at least, when people stick to the rules.

             -- Terry Pratchett, _Interesting Times_


Reply to: