Subject: bin/4429: tftp does not syslog when run chrooted
To: None <gnats-bugs@gnats.netbsd.org>
From: None <andreas@planix.com>
List: netbsd-bugs
Date: 11/04/1997 21:03:16
>Number:         4429
>Category:       bin
>Synopsis:       tftp -l -s dir does not syslog
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov  4 18:05:02 1997
>Last-Modified:
>Originator:     Andreas Wrede
>Organization:
Planix, Inc.,  Toronto, Ontario, Canada
>Release:        <NetBSD-current source date>Oct 24/97
>Environment:
	
System: NetBSD woffi 1.3_ALPHA NetBSD 1.3_ALPHA (WOFFI) #2: Fri Oct 24 15:15:00 EDT 1997 root@woffi:/local1/src/netbsd-current/src/sys/arch/i386/compile/WOFFI i386

>Description:
	
tftpd cannot syslog request because the attempt to open /dev/log in the
chrooted  environment fails.
>How-To-Repeat:
	
configure tftpd with -l for sysloging and -s <dir> for chrooted operations.
observe absence of log entries for daemon.info when get/putting tftp files.
>Fix:
	
openlog with LOG_NDELAY to force the log open before we enter chrooted 
operation. Apply patch below:


*** src/libexec/tftpd/tftpd.c.orig	Tue Nov  4 20:51:16 1997
--- src/libexec/tftpd/tftpd.c	Tue Nov  4 20:51:39 1997
***************
*** 158,164 ****
  	int fd = 0;
  	struct sockaddr_in sin;
  
! 	openlog("tftpd", LOG_PID, LOG_DAEMON);
  
  	while ((ch = getopt(argc, argv, "lns:")) != -1)
  		switch (ch) {
--- 158,164 ----
  	int fd = 0;
  	struct sockaddr_in sin;
  
! 	openlog("tftpd", LOG_PID|LOG_NDELAY, LOG_DAEMON);
  
  	while ((ch = getopt(argc, argv, "lns:")) != -1)
  		switch (ch) {
>Audit-Trail:
>Unformatted: