[stunnel-users] One bug solved/fixed -- bug in log.c or perhaps options.c

Eric S. Eberhard flash at vicsmba.com
Mon Oct 2 22:19:32 CEST 2006


Because I am using inetd mode, any unintended output by stunnel to 
stdout is BAD as this is accepted as input through inetd to my 
calling program.  The problem with stunnel is that in main it does 
main_initialize which has the final function "log_open"

However, somewhere in "parse_config" a call is made to "s_log" (with 
the text "Snagged 64 bytes from ..." and since this is before the 
log_open, the output ends up on stdout rather than being 
logged.  Rather than try and hunt down the function
that outputs the premature error message, I modified s_log to open 
the log files itself if not already open.

I fixed it as follows (suggest you put in to the release?):

void s_log(int level, const char *format, ...) {
     va_list 
arglist;
     char text[STRLEN], 
timestamped[STRLEN];
     time_t 
gmt;
     struct tm 
*timeptr;
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
     struct tm 
timestruct;
#endif
     if(level>options.debug_level) 

         return; 

     va_start(arglist, 
format);
#ifdef HAVE_VSNPRINTF
     vsnprintf(text, STRLEN, format, 
arglist);
#else
     vsprintf(text, format, 
arglist);
#endif
     va_end(arglist); 

#if !defined (USE_WIN32) && !defined (__vms)
                         /******************** NEW CODE, NEXT 2 LINES *******/
     if(!outfile && options.output_file)   /* 'output' option 
specified, not open */
         log_open(); 

     if(!outfile && options.option.syslog) 
{
         syslog(level, "LOG%d[%lu:%lu]: 
%s",

So now I don't get the "Snagged" message back on stdout ... but it 
still does not work for me (yet :-) )

Eric




This email sent by:

Eric S. Eberhard
(928) 567-3727          Voice
(928) 567-6122          Fax

928-301-7537 -- you may call any time day or night, I turn it off 
when I sleep :-)  Please try to use a land line first (reception often poor).

Note the change in the domain from vicspdi.com to vicsmba.com !!!!

For Metropolis support and VICS MBA Support!!!!

http://www.vicsmba.com

Completely updated web site of personal pictures with many new 
pictures!  Includes horses, dogs, Corvairs, and more.

http://www.vicsmba.com/ourpics/index.html

Corvair pictures including the Judson setup on our 62 Sedan and lots 
of pictures of Cheryl's 62 Monza Wagon and our 62 Spyder convertible.

http://www.vicsmba.com/ourpics/corvairs.html

My younger brother Martin has started a very serious car company.  A 
hot rod (very fast) electric roadster is the first offering.  The 
chassis is built by Lotus to their specs.  Check it 
out:  http://www.teslamotors.com





More information about the stunnel-users mailing list