Attached is a patch for stunnel 4.15 that allows the source to be built under Microsoft Visual Studio 2005. Here's a rundown of what's been changed:
In common.h, I included io.h and fcntl.h so that pty.c would build without error. In env.c, I included the winsock headers (replicating how it was done for common.h), and removed a duplicate include of sys/socket.h. The latter change wasn't necessary for compiliation with MSVC, but I thought I'd remove what looked like an unncessary line.
To get stunnel to build without warning, I defined the following preprocessor definitions: USE_WIN32 _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE HAVE_GETADDRINFO HAVE_GETNAMEINFO _MBCS
Later in the week, I'll post a patch to vs.mak to automate the build process (I'm still building with a solution file at the moment).
To the stunnel developers: If there's anything extra I can do to ensure these changes are incorporated into the next release, please let me know.