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

Re: chmod/chown -R - maybe an ITP

On Mon, 13 Dec 1999, Ben Collins wrote:
>On Mon, Dec 13, 1999 at 03:37:14PM +0100, Russell Coker wrote:
>> unlink("/home/user/.rhosts");
>> link("/etc/passwd", "/home/user/.rhosts");
>> sleep(60);
>> unlink("/home/user/.rhosts");
>> exit(0);
>Then you write a simple C program that opens with O_EXCL and then fchown's
>or fchgrp's the files. It's very simple.

According to the man pages O_EXCL only makes sense for creating files.

The solution is to write a program which does a readdir stat()'ing all the
files, when it finds one it thinks should be changed it does:
fd = open(filename);
if(fd > -1)
  fstat(fd, buf);
  // check contents of buf and log an error if we don't like them
  fchown(fd, owner group);

Not overly hard to do, but the sort of thing that should be done once and
done right, not done at every site.
I think that I could write a usable program performing the function of any
program in fileutils in 30 minutes or less.  However such programs wouldn't
be as functional as the fileutils ones, and I wouldn't want to write and
maintain them seperately for different sites.

The ultimate result is that some innovations that would truly benefit
consumers never occur for the sole reason that they do not coincide with
Microsoft's self-interest.
-- Judge Thomas Penfield Jackson, U.S. District Judge

Reply to: