[omniORB] Colliding defines when using VS2010 and OpenSSL

Peter Klotz Peter.Klotz at ith-icoserve.com
Fri Mar 25 12:09:33 GMT 2011


Hello

Using omniORB 4.1.5 with Visual Studio 2010 and OpenSSL 1.0.0d results in non working binaries.

The reason is a duplicate DEFINE and an unfortunate include order. The attached patch fixes the problem by changing the include order, the duplicate DEFINE remains.

When compiling omniORB one encounters this warning:

E:\VS2010\include\errno.h(104) : warning C4005: 'EINPROGRESS' : macro redefinition
        C:\omniORB-4.1.5\include\omniORB4\internal\SocketCollection.h(220) : 
see previous definition of 'EINPROGRESS'


Since VS2010 the DEFINE EINPROGRESS exists in errno.h with value 112. In SocketCollection.h omniORB defines EINPROGRESS to be replaced by WSAEWOULDBLOCK in Windows. WSAEWOULDBLOCK has value 10035 according to WinSock2.h.

After connect() calls, the resulting error value is compared with EINPROGRESS. That case happens very often when using non-blocking sockets.

Due to the duplicate DEFINE the error value is compared with 112 instead of 10035 and the socket is immediately closed.

The problem only occurs when using SSL connections, due to this include order (obtained using compiler flag /showIncludes when compiling sslTransportImpl.cc):

Note: including file: C:\omniORB-4.1.5\src\lib\omniORB\orbcore\ssl/sslConnection.h
Note: including file:  C:\omniORB-4.1.5\include\omniORB4\internal\SocketCollection.h
...
Note: including file: c:\OpenSSL-1.0.0d\include\openssl/err.h
...
Note: including file:  E:\devel\ICOMPILER\win32\cl1600\include\errno.h
E:\devel\ICOMPILER\win32\cl1600\include\errno.h(104) : warning C4005: 'EINPROGRESS' : macro redefinition
        C:\omniORB-4.1.5\include\omniORB4\internal\SocketCollection.h(220) : see previous definition of 'EINPROGRESS'

First SocketCollection.h is included by sslConnection.h and later errno.h is included by openssl/err.h.

The attached patch changes the include order in all 4 source files (sslAddress.cc, sslContext.cc, sslEndpoint.cc, sslTransportImpl.cc) that include openssl/err.h. So it is ensured that EINPROGRESS finally equal 10035, not 112.

Regards, Peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omniORB-4.1.5-EINPROGRESS.patch
Type: application/octet-stream
Size: 3025 bytes
Desc: omniORB-4.1.5-EINPROGRESS.patch
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20110325/dccf133c/omniORB-4.1.5-EINPROGRESS.obj


More information about the omniORB-list mailing list