Subject: bin/18934: ftpd (among others) complains too loudly about some unimportant errors
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 11/04/2002 18:21:32
>Number:         18934
>Category:       bin
>Synopsis:       ftpd (among others) complains too loudly about some unimportant errors
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 04 15:22:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        netbsd-1-6
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD 1.6
>Description:

	ftpd (among others) complains far too loudly if it fails just
	because the client disconnects before it gets going.

>How-To-Repeat:

	run the simple netsaint/nagios/etc. checks to test your ftp server

>Fix:

	here's an example fix for ftpd:

Index: ftpd.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/basesrc/libexec/ftpd/ftpd.c,v
retrieving revision 1.138.2.1
diff -c -c -r1.138.2.1 ftpd.c
*** ftpd.c	30 Sep 2002 13:07:15 -0000	1.138.2.1
--- ftpd.c	4 Nov 2002 23:08:48 -0000
***************
*** 380,386 ****
  	memset((char *)&his_addr, 0, sizeof(his_addr));
  	addrlen = sizeof(his_addr.si_su);
  	if (getpeername(0, (struct sockaddr *)&his_addr.si_su, &addrlen) < 0) {
! 		syslog(LOG_ERR, "getpeername (%s): %m",argv[0]);
  		exit(1);
  	}
  	his_addr.su_len = addrlen;
--- 380,386 ----
  	memset((char *)&his_addr, 0, sizeof(his_addr));
  	addrlen = sizeof(his_addr.si_su);
  	if (getpeername(0, (struct sockaddr *)&his_addr.si_su, &addrlen) < 0) {
! 		syslog((errno == ENOTCONN) ? LOG_NOTICE : LOG_ERR, "getpeername (%s): %m",argv[0]);
  		exit(1);
  	}
  	his_addr.su_len = addrlen;
>Release-Note:
>Audit-Trail:
>Unformatted: