[comp.unix.wizards] Strange syslog behavior in ftpd

ehrlich@psuvax1.psu.edu (Dan Ehrlich) (08/25/87)

I have been trying to track down why ftpd on BSD 4.3 UNIX will not log
any messages after the first call to yyparse().  I have not been able
to find any calls to closelog(3) in any of the modules.  I even added a
syslog call immediately before calling yyparse() inside the for(;;)
loop.  It gets logged exactly once and even though there are more calls
to syslog later on they never make it to the log file.  I am going on
the assumption that either the socket to the syslogd is being closed or
that some static data in lib/libc/syslog.c is being trashed by the parser.
I have not been able to find evidence of either.

The ftpd is being started by inetd.  The entry for ftpd in inetd.conf
is:

ftp	stream	tcp	nowait	root	/etc/ftpd	ftpd -l -d

Has anyone else seen this problem?  Does anyone know why it happens?
Does anyone have a fix?

Thanks in advance.

gww@beatnix.UUCP (Gary Winiger) (09/04/87)

In article <2872@psuvax1.psu.edu> ehrlich@psuvax1.psu.edu (Dan Ehrlich) writes:

>
>The ftpd is being started by inetd.  The entry for ftpd in inetd.conf
>is:
>
>ftp	stream	tcp	nowait	root	/etc/ftpd	ftpd -l -d

								^^^^
>
>Has anyone else seen this problem?  Does anyone know why it happens?
>Does anyone have a fix?
>
>Thanks in advance.

The problem deals with the use of the -d (debug) flag.  The person who
translated 4.2 ftpd to 4.3 screwed up the debugging output.  I've made
the fix locally, but not gotten around to posting to comp.4bsd.bugs.

Here's my bug fix:

*** /tmp/,RCSt1000591	Fri Jul 31 12:13:35 1987
--- ftpd.c	Fri Jul 31 12:12:48 1987
***************
*** 1,5 ****
--- 1,9 ----
  /*
   * $Log:	ftpd.c,v $
+  * Revision 1.3  87/07/31  12:10:39  gww
+  * Have debugging output through syslog work.
+  * Syslog(3) supports a maximum of 5 variables for the string NOT varargs!
+  * 
***************
*** 20,26 ****
  #endif not lint
  
  #ifndef lint
! static char *ERcsId = "$Header: ftpd.c,v 1.2 87/07/31 11:56:22 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)ftpd.c	5.7 (Berkeley) 5/28/86";
  #endif not lint
  
--- 24,30 ----
  #endif not lint
  
  #ifndef lint
! static char *ERcsId = "$Header: ftpd.c,v 1.3 87/07/31 12:10:39 gww Exp $ ENIX BSD";
  static char sccsid[] = "@(#)ftpd.c	5.7 (Berkeley) 5/28/86";
  #endif not lint
  
***************
*** 605,638 ****
  	dologout(0);
  }
  
! /*VARARGS2*/
! reply(n, s, args)
  	int n;
  	char *s;
  {
  
  	printf("%d ", n);
! 	_doprnt(s, &args, stdout);
  	printf("\r\n");
  	(void) fflush(stdout);
  	if (debug) {
  		syslog(LOG_DEBUG, "<--- %d ", n);
! 		syslog(LOG_DEBUG, s, &args);
  	}
  }
  
! /*VARARGS2*/
! lreply(n, s, args)
  	int n;
  	char *s;
  {
  	printf("%d-", n);
! 	_doprnt(s, &args, stdout);
  	printf("\r\n");
  	(void) fflush(stdout);
  	if (debug) {
  		syslog(LOG_DEBUG, "<--- %d- ", n);
! 		syslog(LOG_DEBUG, s, &args);
  	}
  }
  
--- 609,640 ----
  	dologout(0);
  }
  
! reply(n, s, p0, p1, p2, p3, p4)
  	int n;
  	char *s;
  {
  
  	printf("%d ", n);
! 	printf(s, p0, p1, p2, p3, p4);
  	printf("\r\n");
  	(void) fflush(stdout);
  	if (debug) {
  		syslog(LOG_DEBUG, "<--- %d ", n);
! 		syslog(LOG_DEBUG, s, p0, p1, p2, p3, p4);
  	}
  }
  
! lreply(n, s, p0, p1, p2, p3, p4)
  	int n;
  	char *s;
  {
  	printf("%d-", n);
! 	printf(s, p0, p1, p2, p3, p4);
  	printf("\r\n");
  	(void) fflush(stdout);
  	if (debug) {
  		syslog(LOG_DEBUG, "<--- %d- ", n);
! 		syslog(LOG_DEBUG, s, p0, p1, p2, p3, p4);
  	}
  }