Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: jyke@pikkurastas.cs.tut.fi (Jyke Jokinen)
Subject: Bug or feature? syslog connection is lost after a chroot()
Date: 20 Jul 1994 17:26:15 GMT	[thread overview]
Message-ID: <JYKE.94Jul20202615@pikkurastas.cs.tut.fi> (raw)


- 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 <stdio.h>
#include <syslog.h>

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].


                 reply	other threads:[~1994-07-20 17:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox