Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Oct 2005 18:43:17 GMT
From:      Pavel Gubin <pg@ie.tusur.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/87174: vsftpd gots caught in an endless loop while parsing erroneous config AND stdin is e.g. /dev/null
Message-ID:  <200510091843.j99IhHdi042709@www.freebsd.org>
Resent-Message-ID: <200510091850.j99IoGFM000279@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         87174
>Category:       ports
>Synopsis:       vsftpd gots caught in an endless loop while parsing erroneous config AND stdin is e.g. /dev/null
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 09 18:50:16 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Pavel Gubin
>Release:        4.10, 4.11, 5.4
>Organization:
TUSUR
>Environment:
>Description:
When vsftpd tries to report config error, and stdin is detached from controlling terminal, it gots  caught in an endless loop because it uses die() (utility.c) to report an error condition, which in turn calls bug() (DIE_DEBUG defined by default), bug() calls vsf_sysutil_activate_noblock() which fails to set nonblocking mode when /dev/null is opened as fd=0, calls again die() etc., until the program eats up ann vertual memory and gots killes by the system.
>How-To-Repeat:
Make a vsftpd.conf with syntax error, then feed it to vsftpd:
/usr/local/libexec/vsftpd vsftpd.conf </dev/null

>Fix:
Put a file named patch-utility into files/ subdir of vsftpd port, rebuild and reinstall:

patch-utility
--- utility.c.orig      Fri Jul  2 18:26:30 2004                               
+++ utility.c   Mon Oct 10 01:19:02 2005                                       
@@ -33,6 +33,10 @@                                                             
 void                                                                          
 bug(const char* p_text)                                                       
 {                                                                             
+  static int inside_bug = 0;                                                  
+  if (inside_bug)                                                             
+    vsf_sysutil_exit(1);                                                      
+  inside_bug++;                                                               
   /* Rats. Try and write the reason to the network for diagnostics */         
   vsf_sysutil_activate_noblock(VSFTP_COMMAND_FD);                             
   (void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "500 OOPS: ", 10);

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510091843.j99IhHdi042709>