bin/74823: ftpd should not use warn(x) more carefully when used from inetd [patch]

Alexander Melkov melkov at comptek.ru
Tue Dec 7 13:30:22 PST 2004


>Number:         74823
>Category:       bin
>Synopsis:       ftpd should not use warn(x) more carefully when used from inetd [patch]
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 07 21:30:13 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Melkov
>Release:        5.3
>Organization:
>Environment:
FreeBSD melkov.ru 5.3-RELEASE FreeBSD 5.3-RELEASE #1: Tue Nov  9 14:59:22 MSK 2004     spamtrap at melkov.ru:/usr/obj/usr/src/sys/MELKOV  i386
>Description:
When ftpd is invoked from inetd, every call to warn(x), err(x) functions produces an output that is not compliant with rfc959, etc.

This particularly happens when incorrect start-up parameters specified (that's silly, yet my internet service provider's ftp server is configured that way right now ;) ).
>How-To-Repeat:
Write
ftp    stream  tcp     nowait  root    /usr/libexec/ftpd ftpd -AWK
into /etc/inetd.conf and restart inetd

Run
ftp localhost
'ftp' program will fail to establish connection
Run
nc localhost 21
see
ftpd: illegal option -- K
ftpd: unknown flag -K ignored
220 ...... FTP server (Version 6.00LS) ready.

>Fix:
ftpd.c is 1.163
diff ftpd.c.1.163 ftpd.c
286a287
>       struct stat st;
290a292,296
>
>       if (fstat(0, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
>               extern char *__progname;
>               __progname = "220-";
>       }

- this is not a graceful solution, yet a warnx call from getopt function should be covered somehow.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list