Stunnel.org  
   
Home
About
News
Faq
Examples
Download
Patches
Support
Related
<Patch List> <Patch Directory>
Patch info for highfds

Patch info for highfds

CreatorPeter Friend
Patch to Version3.24
TypeNew Feature
Patchhighfds.patch
Description

(Full Text)

Work around a bug in some systems (Solaris?) that have trouble with descriptors greater than 255.

Author Comments


Date: Tue, 29 Jul 2003 17:50:25 -0700
From: "Peter A. Friend" <octavian@corp.earthlink.net>
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.
 



This website makes patches available for use by the Internet community. However it does not endorse any of the patches contained herein. They could be work perfectly, or totally foul up everything. We don't know. Contact the authors if you have any questions. Use at your own risk.

The Stunnel software package does not contain any cryptography itself, however please remember that import and/or export of cryptographic software, code providing hooks to cryptographic algorithms, and discussion about cryptography is illegal in some countries. It is imperative for you to know your local laws governing cryptography. We're not liable for anything you do that violates your local laws.