Re: mutilog via fifo

Daryl Tester <[email protected]> Mon, 04 Aug 2008 07:11:13 +0930
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
richard lucassen wrote:

> It is an permission problem:
> 
> open("/dev/stderr", O_RDWR|O_APPEND|O_CREAT, 0666) = -1 EACCES
> (Permission denied)

(O_CREAT? O_RDWR? shudder).

Richard, what platform is this?  This result that you're seeing infers
that /dev/stderr isn't changing ownership after the process issues a
setuid().  I've just tried this on a Linux 2.6.24 box, and /dev/stderr
(which is symlink'd to /proc/self/fd/2) does change ownership after the
setuid(), and hence who can access it, which is what I would expect.

> So publicfile is started as root, and thus has access to /dev/stderr,
> and after that changes uid/gid. Right or wrong?

As Paul has pointed out, publicfile (and programs written the "elegant"
way) use the inherited file descriptor (2 = standard error).  This
opening of /dev/stderr is the not normal method.


Cheers,
  --dt