[3904] in Athena Bugs

home help back first fref pref prev next nref lref last post

chroot and syslog

daemon@ATHENA.MIT.EDU (marc@MIT.EDU)
Sat Jan 6 05:30:34 1990

From: marc@MIT.EDU
To: bugs@MIT.EDU
Cc: watchmakers@MIT.EDU
Reply-To: marc@MIT.EDU
Date: Sat, 06 Jan 90 05:29:35 EST
Code fragment:
--cut--
#include <syslog.h>
#include <stdio.h>

main()
{
   printf("opening syslog...\n");
   openlog("chroot_test",LOG_PID|LOG_NDELAY,LOG_USER);

   printf("syslog opened.\n\nsending syslog 1...\n");
   syslog(LOG_INFO,"syslog number 1");

   printf("syslog 1 sent.\n\nchrooting...\n");
   chroot("/tmp");

   printf("chrooted.\n\nsending syslog 2...\n");
   syslog(LOG_INFO,"syslog number 2");

   printf("syslog 2 sent.\n\nDone.\n");
}
--cut--
Symptom: the second syslog is never logged.

What Happens:
	the openlog function uses socket() to create the socket.
	Because syslog() uses sendto() to send the information,
	the packets are forwarded without a permanent connection
	ever being made.  After the chroot, sendto can no longer
	find the socket which syslogd is listening on, so syslog()
	fails silently (SOCK_DGRAM is an unreliable protocol).

What Should Happen:
	I should be able to syslog, even after a chroot.  I see no
	obvious fix to this problem.

Why I Care:
	I am trying to log all anonymous ftp's on my workstation,
	but after the chroot (the interesting part), none of my
	syslogs are received.

The above code fragment demonstrates this problem.

Is there any way to get around this problem?  I am sending this to
bugs because I think it is a bug and to watchmakers because someone on
that list may be able to help.

		Marc

	

home help back first fref pref prev next nref lref last post