From owner-freebsd-questions  Tue Aug 22 21:54:10 2000
Delivered-To: freebsd-questions@freebsd.org
Received: from mailhost01.reflexnet.net (mailhost01.reflexnet.net [64.6.192.82])
	by hub.freebsd.org (Postfix) with ESMTP id 49EF437B43E
	for <freebsd-questions@freebsd.org>; Tue, 22 Aug 2000 21:54:06 -0700 (PDT)
Received: from 149.211.6.64.reflexcom.com ([64.6.211.149]) by mailhost01.reflexnet.net  with Microsoft SMTPSVC(5.5.1877.197.19);
	 Tue, 22 Aug 2000 21:52:58 -0700
Received: (from cjc@localhost)
	by 149.211.6.64.reflexcom.com (8.9.3/8.9.3) id VAA46644;
	Tue, 22 Aug 2000 21:54:03 -0700 (PDT)
	(envelope-from cjc)
Date: Tue, 22 Aug 2000 21:54:03 -0700
From: "Crist J . Clark" <cjclark@reflexnet.net>
To: John <papalia@udel.edu>
Cc: freebsd-questions@FreeBSD.ORG
Subject: Re: stunnel not working in background
Message-ID: <20000822215403.H28027@149.211.6.64.reflexcom.com>
Reply-To: cjclark@alum.mit.edu
References: <4.3.1.2.20000822200248.00ab9380@mail.udel.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 1.0i
In-Reply-To: <4.3.1.2.20000822200248.00ab9380@mail.udel.edu>; from papalia@udel.edu on Tue, Aug 22, 2000 at 08:12:32PM -0400
Sender: owner-freebsd-questions@FreeBSD.ORG
Precedence: bulk
X-Loop: FreeBSD.ORG

On Tue, Aug 22, 2000 at 08:12:32PM -0400, John wrote:
> Hey all,
> 
> I've been fiddling on and off with using stunnel to pipe through imapd and 
> ipop3d to require SSL.  The problem is, if I execute as:
> 
> /usr/local/sbin/stunnel -d 993 -l /usr/local/libexec/imapd imapd
> 
> If instead I execute as
> 
> /usr/local/sbin/stunnel -f -d 993 -l /usr/local/libexec/imapd imapd
> 
> Everything works just great.  Only problem is that it's running in the 
> foreground - not a good thing really.
> 
> Any ideas or thoughts would be much appreciated!!!

Is this old bug still there? See if this helps.

  From cjc@cc942873-a.ewndsr1.nj.home.com Thu Feb 10 11:16:19 2000
  Date: Thu, 10 Feb 2000 11:16:19 -0500
  From: "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
  Subject: Re: [cjc@cc942873-a.ewndsr1.nj.home.com: stunnel Works in Foreground,Not in BG]
  Message-ID: <20000210111619.A17974@cc942873-a.ewndsr1.nj.home.com>                      
  Reply-To: cjclark@home.com                                                              
  References: <20000117110748.C62078@cc942873-a.ewndsr1.nj.home.com>                      
  Mime-Version: 1.0                                                                       
  Content-Type: text/plain; charset=us-ascii                                              
  X-Mailer: Mutt 1.0i                                              
  Status: RO                                                       
  Content-Length: 1136                                             
  Lines: 34                                                        

  On Thu, Feb 10, 2000 at 05:39:08PM +1030, Greg Lewis wrote:
  > Hi Crist,                                                
  > 
  > Alas, I think I spoke too soon :(.  Now that I've tested it more thoroughly
  > I'm getting the same problems.  My current workaround is to use -f but run 
  > the program in the background.  That seems to do the trick but isn't       
  > entirely satisfying.  I may try sslwrap, etc.                              

  I modified stunnel to use the builtin daemon(3) function rather than
  its own code to drop to the background. This fixed the problem for  
  me. However, I am not really sure why. The source for the daemonize()
  function in stunnel and the daemon(3) source are pretty much identical.

  Anyway, I dropped this patch into,

    /usr/ports/security/stunnel/patches/patch-az

  Before I did a make and it worked fine,

--- stunnel.c.orig      Tue Jul 13 09:34:28 1999
+++ stunnel.c   Mon Jan 17 14:18:43 2000                                  
@@ -189,7 +189,7 @@                                                       
     if(options.option&OPT_DAEMON) {
 #ifndef USE_WIN32                                                   
         if(!(options.option&OPT_FOREGROUND))                        
-            daemonize();                                            
+            daemon(0,0);                                             
         create_pid();
 #endif                                                           
         daemon_loop();                


-- 
Crist J. Clark                           cjclark@alum.mit.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message