From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,f2063aa1889bc05e,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-07-20 10:42:32 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!EU.net!sunic!news.funet.fi!news.cs.tut.fi!pikkurastas!jyke From: jyke@pikkurastas.cs.tut.fi (Jyke Jokinen) Newsgroups: comp.unix.osf.osf1 Subject: Bug or feature? syslog connection is lost after a chroot() Date: 20 Jul 1994 17:26:15 GMT Organization: Tampere University of Technology Distribution: comp Message-ID: NNTP-Posting-Host: pikkurastas.cs.tut.fi NNTP-Posting-User: jyke Originator: jyke@pikkurastas.cs.tut.fi - My problem: I'm running wu-ftpd v2.4 in OSF1/V2.0(240) environment. I noticed that the syslog messages generated by anonymous users were not the same as earlier on a SUN host. When I traced the code I noticed that all the syslog messages were lost after the ftpd does a call to chroot() system call. - Test: I wrote the following test program: ------------------------------------------------------------------------------ #include #include main() { openlog( "jyketest", LOG_ODELAY, LOG_DAEMON ); syslog( LOG_NOTICE, "first" ); fprintf( stderr, "first\n" ); fflush( stderr ); if( chroot( "/tmp" ) != 0 ) { perror( "chroot" ); exit( 1 ); } syslog( LOG_NOTICE, "second" ); fprintf( stderr, "second\n" ); fflush( stderr ); exit( 0 ); } ------------------------------------------------------------------------------ when I run it as root it displays both fprintfs but only the first syslog messages comes through. - What I think is happening? The syslogd daemon uses UNIX-domain socket /dev/log to get the messages from programs. Now that socket is opened BEFORE the chroot() call and I think that the chroot() CLOSES that descriptor because it references outside the new file-tree. This is not the case in SunOS4.x. The chroot() manual page doesn't mention anything about this. - Question: So my question is Does the OSF1/2.0 chroot() work correctly or is this a bug? (Someone should try out this test in their host). - And finally the solution: I have a workaround for this problem: I have a syslog-caster which listens a UNIX-domain socket (/tmp/dev/log with the test program) and resends all the syslog messages to the real syslog. *** Jyke *** -- Jyke Jokinen, Software Systems Laboratory, Tampere University of Technology, Finland. [email: jyke@cs.tut.fi or jyke@cc.tut.fi].