When I run stunnel 4.10 with openssl 0.9.8 beta4 in Solaris 7, it crashes just after a connection is established. Nothing appears in the stunnel log. If I run it in foreground mode, "Bus Error" appears on the console. Running with 'truss -f', I see the output that follows. Gdb reveals nothing (it's not compiled for debug and I"m not sure how to change that).
so_socket(2, 2, 0, "", 1) = 9 fcntl(9, F_GETFL, 0x00000000) = 2 fstat64(9, 0x001686B8) = 0 getsockopt(9, 65535, 8192, 0x001687B8, 0x001687B0, 0) = 0 fstat64(9, 0x001686B8) = 0 getsockopt(9, 65535, 8192, 0x001687B8, 0x001687B4, 0) = 0 setsockopt(9, 65535, 8192, 0x001687B8, 4, 0) = 0 fcntl(9, F_SETFL, 0x00000082) = 0 time() = 1118632479 getpid() = 25472 [25471] write(3, " 2 0 0 5 . 0 6 . 1 3 1".., 61) = 61 time() = 1118632479 getpid() = 25472 [25471] write(3, " 2 0 0 5 . 0 6 . 1 3 1".., 78) = 78 connect(9, 0x00168998, 16, 1) = 0 time() = 1118632479 getpid() = 25472 [25471] write(3, " 2 0 0 5 . 0 6 . 1 3 1".., 59) = 59 Incurred fault #5, FLTACCESS %pc = 0x00031720 siginfo: SIGBUS BUS_ADRALN addr=0x0002CDE9 Received signal #10, SIGBUS [default] siginfo: SIGBUS BUS_ADRALN addr=0x0002CDE9 *** process killed ***
The stunnel options are: stunnel 4.10 on sparc-sun-solaris2.7 UCONTEXT+POLL+IPv4 with OpenSSL 0.9.8-beta4 06 Jun 2005
Global options cert = /u/etc/stunnel/stunnel.pem ciphers = ALL:!ADH:+RC4:@STRENGTH debug = 5 key = /u/etc/stunnel/stunnel.pem pid = /u/var/run/stunnel.pid RNDbytes = 64 RNDoverwrite = yes session = 300 seconds verify = none
Service-level options TIMEOUTbusy = 300 seconds TIMEOUTclose = 60 seconds TIMEOUTconnect = 10 seconds TIMEOUTidle = 43200 seconds
Also, I had some warnings errors during compilation , which should be fixed (compiling with gcc 3.4.1 in pedantic mode). (None of them are the cause of the crash though, as I hacked up some fixes and the crash still happened).
log.c: In function `s_log': log.c:134: warning: implicit declaration of function `localtime_r' log.c:134: warning: assignment makes pointer from integer without a cast
The culprit here is that config.h defines HAVE_LOCALTIME_R, but when the system header with that function is included, the #defines are set up so that localtime_r is NOT defined. (I guess this is an autoconf problem). The code links successfully but I'm not sure how reliable it will be, since localtime_r was not declared properly.
options.c and network: there were many uses of isspace() with a (signed) char value, this is incorrect (isspace requires an unsigned char value -- it could fail if it gets a negative number). However many C libraries (eg. glibc) work with negative values anyway, although I have used compilers that don't.
resolver.c has some cases of potential alignment errors, but I guess they aren't a problem in this case.