Re: mutilog via fifo

[email protected] (Paul Jarc) Sun, 03 Aug 2008 22:03:57 -0400
Newsgroups gmane.comp.djb.syslog
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Daryl Tester <[email protected]> wrote:
> tcpdaemon listens on a socket.  When a connection establishes, it
> forks, sets sets up fd 0 & 1 onto the incoming connection, setuid to
> the UID supplied, then execs the elhttp process.

Almost.  tcpserver changes its uid/gid after opening the listening
socket (since that's the part that requires root access, for
low-numbered ports), but before entering the loop where it accepts
incoming connections.

For ports above 1024, tcpserver never needs root access, so you could
just as well use setuidgid instead of envuidgid and -U.

>> I think elhttp is writing to its "own" stderr, and that's
>> a different pipe.
>
> Through inheritance, it should be the same descriptor as was passed
> into tcpserver (which we now know was passed in as fd 1 to the run
> script).

Yes.

> /dev/stderr should return this file descriptor upon opening,

No, it would be a new descriptor, but connected to the same underlying
pipe.  (I would say "as if by dup()", but I don't know if that's
entirely true - descriptor flags and positioning might be kept
separate, FAIK.)


paul