From owner-freebsd-ports Mon Jan 15 8: 0:22 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 80F9637B401 for ; Mon, 15 Jan 2001 08:00:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0FG02v68338; Mon, 15 Jan 2001 08:00:02 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 488A237B400 for ; Mon, 15 Jan 2001 07:53:07 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0FFr7267513; Mon, 15 Jan 2001 07:53:07 -0800 (PST) (envelope-from nobody) Message-Id: <200101151553.f0FFr7267513@freefall.freebsd.org> Date: Mon, 15 Jan 2001 07:53:07 -0800 (PST) From: kazarov@izmiran.rssi.ru To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: ports/24348: stunnel bugs ports/22121 still exists for stunnel-3.11 Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24348 >Category: ports >Synopsis: stunnel bugs ports/22121 still exists for stunnel-3.11 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 15 08:00:02 PST 2001 >Closed-Date: >Last-Modified: >Originator: Dmitry Kazarov >Release: FreeBSD-4.2-STABLE >Organization: IZMIRAN >Environment: >Description: Originally problem was found in stunnel-3.8p4 ( http://www.freebsd.org/cgi/query-pr.cgi?pr=22121 ) but it still exists in stunnel-3.11 1. if USE_FORK macro is not defined (FreeBSD case) SIGCHLD handler is not compiled in and -l option leaves zombies. 2. PID file is stored in directory wich is removed during system boot process: there is a 'magic' line in /etc/rc: rm -rf /var/run/* wich removes /var/run/stunnel/ on reboot. That prevents stunnel to start on reboot from /usr/local/etc/rc.d >How-To-Repeat: /usr/local/sbin/stunnel -p /usr/local/etc/stunnel.pem -D 4 -d 995 -l /usr/local/libexec/popper3 telnet localhost 995 ^] telnet> close ps -ax | fgrep Z .... Z ... (popper3) >Fix: *** orig/stunnel.c Thu Dec 21 21:45:34 2000 --- stunnel.c Mon Jan 15 18:07:02 2001 *************** static void host2num(u32 **, char *); *** 120,128 **** /* Error/exceptions handling functions */ static void ioerror(char *); void sockerror(char *); ! #ifdef USE_FORK static void sigchld_handler(int); ! #endif #ifndef USE_WIN32 static void signal_handler(int); #endif --- 120,128 ---- /* Error/exceptions handling functions */ static void ioerror(char *); void sockerror(char *); ! /* !!! #ifdef USE_FORK */ static void sigchld_handler(int); ! /* !!! #endif */ #ifndef USE_WIN32 static void signal_handler(int); #endif *************** static void daemon_loop() *** 443,453 **** ls=listen_local(); options.clients=0; #ifndef USE_WIN32 ! #ifdef USE_FORK signal(SIGCHLD, sigchld_handler); ! #else /* defined USE_FORK */ ! signal(SIGCHLD, SIG_IGN); ! #endif /* defined USE_FORK */ #endif /* ndefined USE_WIN32 */ while(1) { addrlen=sizeof(addr); --- 443,453 ---- ls=listen_local(); options.clients=0; #ifndef USE_WIN32 ! /* !!! #ifdef USE_FORK */ signal(SIGCHLD, sigchld_handler); ! /* !!! #else */ /* defined USE_FORK */ ! /* !!! signal(SIGCHLD, SIG_IGN); */ ! /* !!! #endif */ /* defined USE_FORK */ #endif /* ndefined USE_WIN32 */ while(1) { addrlen=sizeof(addr); *************** void sockerror(char *txt) /* Socket erro *** 915,928 **** log(LOG_ERR, "%s: %s (%d)", txt, strerror(error), error); } ! #ifdef USE_FORK static void sigchld_handler(int sig) /* Dead children detected */ { int pid, status; #if defined(HAVE_WAITPID) while((pid=waitpid(-1, &status, WNOHANG))>0) { options.clients--; /* One client less */ if(WIFSIGNALED(status)) { log(LOG_DEBUG, "%s[%d] terminated on signal %d (%d left)", options.servname, pid, WTERMSIG(status), options.clients); --- 915,931 ---- log(LOG_ERR, "%s: %s (%d)", txt, strerror(error), error); } ! /* !!! #ifdef USE_FORK */ ! #ifndef USE_WIN32 static void sigchld_handler(int sig) /* Dead children detected */ { int pid, status; #if defined(HAVE_WAITPID) while((pid=waitpid(-1, &status, WNOHANG))>0) { + # ifdef USE_FORK options.clients--; /* One client less */ + # endif if(WIFSIGNALED(status)) { log(LOG_DEBUG, "%s[%d] terminated on signal %d (%d left)", options.servname, pid, WTERMSIG(status), options.clients); *************** static void sigchld_handler(int sig) /* *** 933,939 **** --- 936,944 ---- } #else pid=wait(&status); + # ifdef USE_FORK options.clients--; /* One client less */ + # endif log(LOG_DEBUG, "%s[%d] finished with code %d (%d left)", options.servname, pid, status, options.clients); #endif *** orig/Makefile.in Mon Jan 15 18:17:03 2001 --- Makefile.in Mon Jan 15 18:17:19 2001 *************** exec_prefix=@exec_prefix@ *** 9,15 **** sbindir=@sbindir@ libdir=@libdir@ man8dir=@mandir@/man8 ! piddir=@localstatedir@/stunnel/ ssldir=@ssldir@ PEM_DIR=@PEM_DIR@ @SET_MAKE@ --- 9,15 ---- sbindir=@sbindir@ libdir=@libdir@ man8dir=@mandir@/man8 ! piddir=@localstatedir@/ ssldir=@ssldir@ PEM_DIR=@PEM_DIR@ @SET_MAKE@ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message