Tim Rice wrote:
On Wed, 22 Apr 2009, Brad House wrote:
I've attached a trivial patch to correct the build of OpenSSL
on SCO OpenServer 5. SCO 5 doesn't define socklen_t, this
patch works around that.
-------
diff -ruN openssl-1.0.0-beta2.orig/crypto/bio/b_sock.c
openssl-1.0.0-beta2/crypto/bio/b_sock.c
--- openssl-1.0.0-beta2.orig/crypto/bio/b_sock.c 2009-04-03
12:44:40.000000000 -0400
+++ openssl-1.0.0-beta2/crypto/bio/b_sock.c 2009-04-22 14:58:05.000000000
-0400
@@ -808,7 +808,7 @@
if (addr == NULL) goto end;
#ifdef EAI_FAMILY
-# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_BEOS_BONE) ||
defined(OPENSSL_SYS_MSDOS)
+# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_BEOS_BONE) ||
defined(OPENSSL_SYS_MSDOS) || defined(_SCO_ELF)
# define SOCKLEN_T size_t
# elif !defined(SOCKLEN_T)
# define SOCKLEN_T socklen_t
-------
Two problems with that patch.
1) _SCO_ELF is defined in gcc but not the native cc.
2) SOCKLEN_T should be int on OpenServer 5.
You can run "./config -DSOCKLEN_T=int" to get the desired result.
You are correct, socklen_t should be int on SCO5, that said, size_t
is the same size, granted not the same sign, but in the limited scope
of the particular code that is using it, it would be fine.
I'm not sure size_t sounds right for the other OS's listed either,
as I know on MSDOS, WATT-32/WATTCP uses int as well:
http://www.bgnett.no/~giva/watt-doc/a01301.html
Check out the second param in 'getnameinfo()' which is the function
being called in crypto/bio/b_sock.c:831
prototyped in crypto/bio/b_sock.c:820
I'm not sure about the _SCO_ELF thing as I only use gcc on SCO 5 so I
can't vouch for what SCO's native compiler returns. I know our
SCO-specific hacks in our own code rely on _SCO_ELF, but we only
use GCC.
That said, you're right -DSOCKLEN_T=int would work because of the
#elif !defined(SOCKLEN_T), so I propose just patching Configure then
(as attached), so someone doesn't have to know to manually pass that
on the command line.
-Brad
P.S. - I only patched the sco5-gcc line since that is the only thing
I can currently test, but I'm pretty sure the same thing should be
applied to the sco5-cc line.
diff -ruN openssl-1.0.0-beta2.orig/Configure openssl-1.0.0-beta2/Configure
--- openssl-1.0.0-beta2.orig/Configure 2009-04-06 10:31:34.000000000 -0400
+++ openssl-1.0.0-beta2/Configure 2009-04-22 21:46:56.000000000 -0400
@@ -424,7 +424,7 @@
"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer
-march=pentium -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des}
${x86_gcc_opts}:${x86_elf_asm}:dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# SCO 5 - Ben Laurie <[email protected]> says the -O breaks the SCO cc.
"sco5-cc", "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des}
${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG
${x86_gcc_des}
${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"sco5-gcc", "gcc:-O3 -fomit-frame-pointer
-DSOCKLEN_T=int::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des}
${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### IBM's AIX.
"aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG
RC4_CHAR:::",