gww@marduk.UUCP (Gary Winiger) (09/05/87)
Subject: ftpd in debug mode doesn't log +Fix Index: etc/ftpd/ftpd.c 4.3BSD +Fix Description: When ftpd was translated from 4.2 to 4.3, the calls to syslog for outputting debugging information were incorrectly translated. Repeat-By: Run the ftp daemon (ftpd) in debugging mode and not the lack of logged messages. Fix: Correct the calls to syslog. The attached code solves this problem at Elxsi. Gary.. {ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww --------- cut --------- snip --------- :.,$w diff ------------- *** /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); } }
chris@mimsy.UUCP (Chris Torek) (09/05/87)
Ftpd should, when it becomes available, use vsyslog(), which is (`will be') called as vsyslog(int level, char *fmt, va_list arginfo); hence ftpd's reply() should become /*VARARGS2*/ reply(n, s, va_alist) int n; char *s; va_dcl /* nb. this assumes that va_alist need not be first */ { va_list l; va_start(l); (void) printf("%d ", n); (void) vprintf(s, l); (void) printf("\r\n"); (void) fflush(stdout); va_end(l); if (debug) { va_start(l); syslog(LOG_DEBUG, "<--- %d ", n); vsyslog(LOG_DEBUG, s, l); va_end(l); } } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris