Date: Tue, 29 Jul 2003 17:50:25 -0700 From: "Peter A. Friend" Subject: patch to deal with stdio problems on Solaris when using libwrap Solaris has this wonderful problem where it cannot handle descriptors greater than 255. This becomes a problem when libwrap is compiled in, since the TCP Wrappers package uses stdio to read it's files. When a threaded stunnel has a sufficient number of active connections, fopen gets a descriptor it cannot handle, and the libwrap calls fail, which also causes the connection to fail. Attached is a patch to stunnel version 3.24 to deal with this. The files patched are configure.ac, client.c and stunnel.c. I added a new configure option called --enable-highfds for this, which also shows up in -V: stunnel 3.24 on sparc-sun-solaris2.8 PTHREAD+LIBWRAP+HIGHFDS with OpenSSL 0.9.6j 10 Apr 2003 The patch is quite simple. Just after each socket() or accept() call, fcntl(socket, F_DUPFD, 256) is used to force the low numbered file descriptor out of the Solaris stdio range. The original socket is then closed. If this call fails, the original socket is used. No strings or license attached to this, it's free for anyone to use. Cheers, Peter Friend --- Software Engineer EarthLink, Inc.