ports/61221: [maintainer update] ftp/bsdftpd-ssl: the problem with sendfile(2)

Nick Leuta skynick at mail.sc.ru
Sun Jan 11 22:50:21 UTC 2004


>Number:         61221
>Category:       ports
>Synopsis:       [maintainer update] ftp/bsdftpd-ssl: the problem with sendfile(2)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 11 14:50:13 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Nick Leuta
>Release:        FreeBSD 4.9-RC i386
>Organization:
Lipetsk State Technical University
>Environment:
System: FreeBSD skynick.stu.lipetsk.ru 4.9-RC FreeBSD 4.9-RC #0: Sun Nov 23 19:53:55 MSK 2003 root at skynick.stu.lipetsk.ru:/usr/src/sys/compile/CORSAIR i386
>Description:

A bug in the sendfile(2) system call has been fixed in FreeBSD at
1 December 2003. The synopsis of the bug is: the data sent with help of
sendfile(2) would be corrupted due to sendfile(2) being erroneously
automatically restarted after a signal is delivered. The fixed sendfile(2)
system call returns the EINTR error, which was not documented earlier.

BSDftpd-ssl 1.0.0 will send the corrupted data in all FreeBSD versions before
1 December 2003 (include RELENG_4_9 and RELENG_5_1 Security Branches). In
FreeBSD versions after 1 December 2003 the data transfer may be aborted with
the next message, because the EINTR error isn't handled:
"426 Data connection: Interrupted system call".

References:
CVS log for src/sys/kern/uipc_syscalls.c:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/uipc_syscalls.c
URL for BSDftpd-ssl's Bug Fix Advisory:
http://bsdftpd-ssl.sc.ru/news/bfa_20040112.txt

>How-To-Repeat:
>Fix:

diff -urN bsdftpd-ssl.ORI/Makefile bsdftpd-ssl/Makefile
--- bsdftpd-ssl.ORI/Makefile	Sat Jan 10 02:37:31 2004
+++ bsdftpd-ssl/Makefile	Mon Jan 12 00:40:32 2004
@@ -7,6 +7,7 @@
 
 PORTNAME=	bsdftpd-ssl
 PORTVERSION=	1.0.0
+PORTREVISION=	1
 CATEGORIES=	ftp
 MASTER_SITES=	http://bsdftpd-ssl.sc.ru/files/bsdftpd-ssl/archive/1.0/src/
 DISTNAME=	bsdftpd-ssl-${PORTVERSION}
diff -urN bsdftpd-ssl.ORI/files/patch-aa bsdftpd-ssl/files/patch-aa
--- bsdftpd-ssl.ORI/files/patch-aa	Thu Jan  1 03:00:00 1970
+++ bsdftpd-ssl/files/patch-aa	Mon Jan 12 00:38:19 2004
@@ -0,0 +1,40 @@
+--- ftpd/Makefile.FreeBSD.ORI	Wed Oct  8 00:59:49 2003
++++ ftpd/Makefile.FreeBSD	Mon Jan 12 00:33:53 2004
+@@ -44,7 +44,7 @@
+ CFLAGS+=-Wall
+ ## Feature flags
+ CFLAGS+=-DSETPROCTITLE -DLOGIN_CAP -DVIRTUAL_HOSTING
+-CFLAGS+=-DUSE_SENDFILE
++#CFLAGS+=-DUSE_SENDFILE
+ #CFLAGS+=-DINET6
+ 
+ YFLAGS=
+--- ftpd/ftpd.c.ORI	Mon Nov 10 11:42:45 2003
++++ ftpd/ftpd.c	Mon Jan 12 00:36:04 2004
+@@ -2810,6 +2810,17 @@
+ 				goto oldway;
+ 			} else
+ #endif /* USE_SSL */
++/* workaround for the problem described in
++ * http://bsdftpd-ssl.sc.ru/news/bfa_20040112.txt */
++#if __FreeBSD__ >= 5
++#	if __FreeBSD_version >= 502000
++#		define USE_SENDFILE = 1
++#	endif
++#else 
++#	if __FreeBSD_version > 490000
++#		define USE_SENDFILE = 1
++#	endif
++#endif /* __FreeBSD__ */
+ #ifdef USE_SENDFILE
+ 			while (err != -1 && filesize > 0) {
+ #ifdef LINUX /* Linux port */
+@@ -2834,7 +2845,7 @@
+ 
+ 				if (err == -1) {
+ #ifndef LINUX /* BSD source */
+-					if (errno == EAGAIN) {
++					if (errno == EAGAIN || errno == EINTR) {
+ 					    err = 0;
+ 					    continue;
+ 					}
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list