Ver código fonte

HPCC-12073 Can't build without openssl

Modify cmake and source files to allow build without openssl
Shamser Ahmed 10 anos atrás
pai
commit
f92236972d

+ 6 - 1
common/remote/CMakeLists.txt

@@ -66,6 +66,11 @@ install ( TARGETS remote RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${L
 target_link_libraries ( remote 
 target_link_libraries ( remote 
     jlib 
     jlib 
     mp
     mp
-    securesocket
     ${URIPARSER_LIBRARIES}
     ${URIPARSER_LIBRARIES}
     )
     )
+
+IF (USE_OPENSSL)
+    target_link_libraries ( remote 
+    	securesocket
+    )
+ENDIF()

+ 10 - 0
common/remote/sockfile.cpp

@@ -190,6 +190,7 @@ public:
 static CriticalSection              secureContextCrit;
 static CriticalSection              secureContextCrit;
 static Owned<ISecureSocketContext>  secureContext;
 static Owned<ISecureSocketContext>  secureContext;
 
 
+#ifdef USE_OPENSSL
 static ISecureSocket *createSecureSocket(ISocket *sock,SecureSocketType type)
 static ISecureSocket *createSecureSocket(ISocket *sock,SecureSocketType type)
 {
 {
     {
     {
@@ -208,6 +209,7 @@ static ISecureSocket *createSecureSocket(ISocket *sock,SecureSocketType type)
     return secureContext->createSecureSocket(sock);
     return secureContext->createSecureSocket(sock);
 #endif
 #endif
 }
 }
+#endif
 
 
 void clientSetRemoteFileTimeouts(unsigned maxconnecttime,unsigned maxreadtime)
 void clientSetRemoteFileTimeouts(unsigned maxconnecttime,unsigned maxreadtime)
 {
 {
@@ -889,11 +891,15 @@ class CRemoteBase: public CInterface
                     socket.setown(ISocket::connect(ep));
                     socket.setown(ISocket::connect(ep));
                 if (useSSL)
                 if (useSSL)
                 {
                 {
+#ifdef USE_OPENSSL
                     Owned<ISecureSocket> ssock = createSecureSocket(socket.getClear(), ClientSocket);
                     Owned<ISecureSocket> ssock = createSecureSocket(socket.getClear(), ClientSocket);
                     int status = ssock->secure_connect();
                     int status = ssock->secure_connect();
                     if (status < 0)
                     if (status < 0)
                         throw createDafsException(DAFSERR_connection_failed,"Failure to establish secure connection");
                         throw createDafsException(DAFSERR_connection_failed,"Failure to establish secure connection");
                     socket.setown(ssock.getLink());
                     socket.setown(ssock.getLink());
+#else
+                    throw createDafsException(DAFSERR_connection_failed,"Failure to establish secure connection: OpenSSL disabled in build");
+#endif
                 }
                 }
             }
             }
             catch (IJSOCK_Exception *e) {
             catch (IJSOCK_Exception *e) {
@@ -5013,11 +5019,15 @@ public:
                     sock.setown(acceptsock->accept(true));
                     sock.setown(acceptsock->accept(true));
                     if (useSSL)
                     if (useSSL)
                     {
                     {
+#ifdef USE_OPENSSL
                         Owned<ISecureSocket> ssock = createSecureSocket(sock.getClear(), ServerSocket);
                         Owned<ISecureSocket> ssock = createSecureSocket(sock.getClear(), ServerSocket);
                         int status = ssock->secure_accept();
                         int status = ssock->secure_accept();
                         if (status < 0)
                         if (status < 0)
                             throw createDafsException(DAFSERR_connection_failed,"Failure to establish secure connection");
                             throw createDafsException(DAFSERR_connection_failed,"Failure to establish secure connection");
                         sock.setown(ssock.getLink());
                         sock.setown(ssock.getLink());
+#else
+                        throw createDafsException(DAFSERR_connection_failed,"Failure to establish secure connection: OpenSSL disabled in build");
+#endif
                     }
                     }
                     if (!sock||stopping)
                     if (!sock||stopping)
                         break;
                         break;

+ 5 - 1
common/thorhelper/CMakeLists.txt

@@ -98,8 +98,12 @@ target_link_libraries ( thorhelper
          eclrtl 
          eclrtl 
          roxiemem
          roxiemem
          deftype 
          deftype 
-         securesocket 
          dalibase 
          dalibase 
     )
     )
 
 
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( thorhelper 
+    	securesocket
+    )
+ENDIF()

+ 10 - 0
common/thorhelper/thorsoapcall.cpp

@@ -937,6 +937,7 @@ public:
         return error.getLink();
         return error.getLink();
     }
     }
     inline IEngineRowAllocator * queryOutputAllocator() const { return outputAllocator; }
     inline IEngineRowAllocator * queryOutputAllocator() const { return outputAllocator; }
+#ifdef USE_OPENSSL
     ISecureSocket *createSecureSocket(ISocket *sock)
     ISecureSocket *createSecureSocket(ISocket *sock)
     {
     {
         {
         {
@@ -951,6 +952,7 @@ public:
         }
         }
         return secureContext->createSecureSocket(sock);
         return secureContext->createSecureSocket(sock);
     }
     }
+#endif
     bool isTimeLimitExceeded(unsigned *_remainingMS)
     bool isTimeLimitExceeded(unsigned *_remainingMS)
     {
     {
         if (timeLimitMS != WAIT_FOREVER)
         if (timeLimitMS != WAIT_FOREVER)
@@ -1772,6 +1774,7 @@ public:
                     socket.setown(blacklist->connect(connUrl.port, connUrl.host, master->logctx, (unsigned)master->maxRetries, master->timeoutMS, master->roxieAbortMonitor));
                     socket.setown(blacklist->connect(connUrl.port, connUrl.host, master->logctx, (unsigned)master->maxRetries, master->timeoutMS, master->roxieAbortMonitor));
                     if (stricmp(url.method, "https") == 0)
                     if (stricmp(url.method, "https") == 0)
                     {
                     {
+#ifdef USE_OPENSSL
                         Owned<ISecureSocket> ssock = master->createSecureSocket(socket.getClear());
                         Owned<ISecureSocket> ssock = master->createSecureSocket(socket.getClear());
                         if (ssock) 
                         if (ssock) 
                         {
                         {
@@ -1787,6 +1790,13 @@ public:
                             }
                             }
                             socket.setown(ssock.getLink());
                             socket.setown(ssock.getLink());
                         }
                         }
+#else
+                        StringBuffer err;
+                        err.append("Failure to establish secure connection to ");
+                        connUrl.getUrlString(err);
+                        err.append(": OpenSSL disabled in build");
+                        throw MakeStringExceptionDirect(0, err.str());
+#endif
                     }
                     }
                     break;
                     break;
                 }
                 }

+ 5 - 2
deployment/configgen/CMakeLists.txt

@@ -45,7 +45,10 @@ target_link_libraries ( configgen
         deploy 
         deploy 
         jlib 
         jlib 
         environment 
         environment 
-        securesocket      
         )
         )
 
 
-
+IF (USE_OPENSSL)
+    target_link_libraries ( configgen
+    	securesocket
+    )
+ENDIF()

+ 6 - 1
deployment/deploy/CMakeLists.txt

@@ -62,10 +62,15 @@ target_link_libraries ( deploy
          jlib 
          jlib 
          environment 
          environment 
          xmllib 
          xmllib 
-         securesocket
          configutils
          configutils
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( deploy 
+    	securesocket
+    )
+ENDIF()
+
 if ( PLATFORM )
 if ( PLATFORM )
     install ( PROGRAMS configesp.install DESTINATION etc/init.d/install COMPONENT Runtime )
     install ( PROGRAMS configesp.install DESTINATION etc/init.d/install COMPONENT Runtime )
     install ( PROGRAMS configesp.uninstall DESTINATION etc/init.d/uninstall COMPONENT Runtime )
     install ( PROGRAMS configesp.uninstall DESTINATION etc/init.d/uninstall COMPONENT Runtime )

+ 11 - 2
deployment/deploy/DeploymentEngine.cpp

@@ -1813,8 +1813,10 @@ void CDeploymentEngine::setXsl(IXslProcessor* processor, IXslTransform* transfor
    m_externalFunction.setown(m_transform->createExternalFunction("addDeploymentFile", addDeploymentFile));
    m_externalFunction.setown(m_transform->createExternalFunction("addDeploymentFile", addDeploymentFile));
    m_transform->setExternalFunction(SEISINT_NAMESPACE, m_externalFunction.get(), true);
    m_transform->setExternalFunction(SEISINT_NAMESPACE, m_externalFunction.get(), true);
 
 
+#ifdef USE_OPENSSL
    m_externalFunction2.setown(m_transform->createExternalFunction("siteCertificate", siteCertificateFunction));
    m_externalFunction2.setown(m_transform->createExternalFunction("siteCertificate", siteCertificateFunction));
    m_transform->setExternalFunction(SEISINT_NAMESPACE, m_externalFunction2.get(), true);
    m_transform->setExternalFunction(SEISINT_NAMESPACE, m_externalFunction2.get(), true);
+#endif
 }
 }
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
@@ -2355,6 +2357,7 @@ void CDeploymentEngine::addDeploymentFile(StringBuffer &ret, const char *in, IXs
 //  siteCertificate
 //  siteCertificate
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 /*static*/
 /*static*/
+#ifdef USE_OPENSSL
 void CDeploymentEngine::siteCertificateFunction(StringBuffer &ret, const char *in, IXslTransform*)
 void CDeploymentEngine::siteCertificateFunction(StringBuffer &ret, const char *in, IXslTransform*)
 {
 {
     //input is of the format <processType>+<process name>+<instance name>+<output path>
     //input is of the format <processType>+<process name>+<instance name>+<output path>
@@ -2382,7 +2385,7 @@ void CDeploymentEngine::siteCertificateFunction(StringBuffer &ret, const char *i
 
 
     s_xsltDepEngine->siteCertificate( *pProcess, instanceName, outputFile );
     s_xsltDepEngine->siteCertificate( *pProcess, instanceName, outputFile );
 }
 }
-
+#endif
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //  processCustomMethod
 //  processCustomMethod
@@ -2399,9 +2402,15 @@ void CDeploymentEngine::processCustomMethod(const char* method, const char *sour
         throw MakeStringException(0, "Process '%s': invalid method '%s' specified for file '%s'",
         throw MakeStringException(0, "Process '%s': invalid method '%s' specified for file '%s'",
         m_name.get(), method, fileName);
         m_name.get(), method, fileName);
 
 
+#ifdef USE_OPENSSL
     siteCertificate(m_process, instanceName, outputFile);
     siteCertificate(m_process, instanceName, outputFile);
+#else
+    throw MakeStringException(0, "Process '%s' file '%s' method '%s': requires OpenSSL (disabled in build)",
+        m_name.get(), fileName, method);
+#endif
 }
 }
 
 
+#ifdef USE_OPENSSL
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //  processCustomMethod
 //  processCustomMethod
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
@@ -2616,7 +2625,7 @@ void CDeploymentEngine::siteCertificate(IPropertyTree& process, const char *inst
         s_dynamicFileList.push_back(LinkedFilePtr(pInstallFile2.get()));
         s_dynamicFileList.push_back(LinkedFilePtr(pInstallFile2.get()));
     }
     }
 }
 }
-
+#endif
 
 
 bool CDeploymentEngine::fireException(IException *e)
 bool CDeploymentEngine::fireException(IException *e)
 {
 {

+ 4 - 0
deployment/deploy/DeploymentEngine.hpp

@@ -244,7 +244,9 @@ protected:
         EnvMachineOS os=MachineOsUnknown, const char* processName=NULL,bool isEspModuleOrPlugin=false);
         EnvMachineOS os=MachineOsUnknown, const char* processName=NULL,bool isEspModuleOrPlugin=false);
    virtual void processCustomMethod(const char *method, const char *source, const char *outputFile, 
    virtual void processCustomMethod(const char *method, const char *source, const char *outputFile, 
                                     const char *instanceName, EnvMachineOS os);
                                     const char *instanceName, EnvMachineOS os);
+#ifdef USE_OPENSSL
    virtual void siteCertificate(IPropertyTree& process, const char *instanceName, const char *outputFile);
    virtual void siteCertificate(IPropertyTree& process, const char *instanceName, const char *outputFile);
+#endif
 
 
    StringBuffer getHostRoot(const char* computer, const char* dir, bool bIgnoreDepToFolder=false) const;
    StringBuffer getHostRoot(const char* computer, const char* dir, bool bIgnoreDepToFolder=false) const;
    StringBuffer getHostDir(IPropertyTree& node, bool bIgnoreDepToFolder=false);
    StringBuffer getHostDir(IPropertyTree& node, bool bIgnoreDepToFolder=false);
@@ -287,7 +289,9 @@ protected:
                                    EnvMachineOS os, bool bCacheable, 
                                    EnvMachineOS os, bool bCacheable, 
                                    const char* params=NULL);
                                    const char* params=NULL);
    static void addDeploymentFile(StringBuffer &ret, const char *in, IXslTransform*);
    static void addDeploymentFile(StringBuffer &ret, const char *in, IXslTransform*);
+#ifdef USE_OPENSSL
    static void siteCertificateFunction(StringBuffer &ret, const char *in, IXslTransform*);
    static void siteCertificateFunction(StringBuffer &ret, const char *in, IXslTransform*);
+#endif
    virtual IEnvDeploymentEngine& getEnvDepEngine() const { return m_envDepEngine; }
    virtual IEnvDeploymentEngine& getEnvDepEngine() const { return m_envDepEngine; }
    virtual IDeploymentCallback& getCallback() const { return *m_pCallback; }
    virtual IDeploymentCallback& getCallback() const { return *m_pCallback; }
      void copyInstallFiles(const char* instanceName, int instanceIndex, const char* destPath, EnvMachineOS os);
      void copyInstallFiles(const char* instanceName, int instanceIndex, const char* destPath, EnvMachineOS os);

+ 5 - 1
deployment/envgen/CMakeLists.txt

@@ -48,7 +48,11 @@ target_link_libraries ( envgen
         deployutils 
         deployutils 
         jlib 
         jlib 
         environment 
         environment 
-        securesocket      
         )
         )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( envgen 
+    	securesocket
+    )
+ENDIF()
 
 

+ 5 - 1
ecl/hthor/CMakeLists.txt

@@ -85,9 +85,13 @@ target_link_libraries ( hthor
          deftype
          deftype
          workunit
          workunit
          jhtree
          jhtree
-         securesocket
          thorhelper
          thorhelper
          roxiemem
          roxiemem
          schedulectrl
          schedulectrl
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( hthor
+    	securesocket
+    )
+ENDIF()

+ 5 - 1
esp/clients/WUManager/CMakeLists.txt

@@ -54,7 +54,11 @@ target_link_libraries ( wumanager
          jlib
          jlib
          xmllib 
          xmllib 
          esphttp
          esphttp
-         securesocket
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( wumanager
+    	securesocket
+    )
+ENDIF()
 
 

+ 5 - 2
esp/services/WsDeploy/CMakeLists.txt

@@ -75,10 +75,13 @@ target_link_libraries ( WsDeploy
          dllserver 
          dllserver 
          eclrtl 
          eclrtl 
          hql 
          hql 
-         securesocket 
          deploy
          deploy
          deployutils
          deployutils
          configutils
          configutils
     )
     )
 
 
-
+IF (USE_OPENSSL)
+    target_link_libraries ( WsDeploy
+    	securesocket
+    )
+ENDIF()

+ 6 - 1
esp/services/ecldirect/CMakeLists.txt

@@ -75,8 +75,13 @@ target_link_libraries ( EclDirect
          jhtree 
          jhtree 
          hql 
          hql 
          fileview2 
          fileview2 
-         securesocket 
     )
     )
+
+IF (USE_OPENSSL)
+    target_link_libraries ( EclDirect
+    	securesocket
+    )
+ENDIF()
 IF (USE_OPENLDAP)
 IF (USE_OPENLDAP)
   target_link_libraries ( EclDirect LdapSecurity )
   target_link_libraries ( EclDirect LdapSecurity )
 ENDIF(USE_OPENLDAP)
 ENDIF(USE_OPENLDAP)

+ 6 - 1
esp/services/esdl_svc_engine/CMakeLists.txt

@@ -72,6 +72,11 @@ target_link_libraries ( esdl_svc_engine
          hql
          hql
          remote
          remote
          dalibase
          dalibase
-         securesocket
          esdllib
          esdllib
     )
     )
+
+IF (USE_OPENSSL)
+    target_link_libraries ( esdl_svc_engine
+    	securesocket
+    )
+ENDIF()

+ 5 - 1
esp/services/ws_access/CMakeLists.txt

@@ -63,6 +63,10 @@ target_link_libraries ( ws_access
          xmllib 
          xmllib 
          esphttp 
          esphttp 
          LdapSecurity 
          LdapSecurity 
-         securesocket 
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_access
+    	securesocket
+    )
+ENDIF()

+ 5 - 1
esp/services/ws_account/CMakeLists.txt

@@ -60,8 +60,12 @@ target_link_libraries ( ws_account
          jlib
          jlib
          xmllib 
          xmllib 
          esphttp 
          esphttp 
-         securesocket 
     )
     )
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_account
+    	securesocket
+    )
+ENDIF()
 IF (USE_OPENLDAP)
 IF (USE_OPENLDAP)
 target_link_libraries ( ws_account LdapSecurity )
 target_link_libraries ( ws_account LdapSecurity )
 ENDIF(USE_OPENLDAP)
 ENDIF(USE_OPENLDAP)

+ 5 - 2
esp/services/ws_dfu/CMakeLists.txt

@@ -96,8 +96,11 @@ target_link_libraries ( ws_dfu
          SMCLib 
          SMCLib 
          dfuXRefLib 
          dfuXRefLib 
          dfuwu 
          dfuwu 
-         securesocket 
          roxiecommlib 
          roxiecommlib 
     )
     )
 
 
-
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_dfu
+    	securesocket
+    )
+ENDIF()

+ 5 - 1
esp/services/ws_ecl/CMakeLists.txt

@@ -77,7 +77,11 @@ target_link_libraries ( ws_ecl
          jhtree 
          jhtree 
          hql 
          hql 
          fileview2 
          fileview2 
-         securesocket 
          xmllib 
          xmllib 
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_ecl
+    	securesocket
+    )
+ENDIF()

+ 6 - 1
esp/services/ws_machine/CMakeLists.txt

@@ -71,10 +71,15 @@ target_link_libraries ( ws_machine
          remote 
          remote 
          dalibase 
          dalibase 
          environment 
          environment 
-         securesocket 
          workunit
          workunit
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_machine
+    	securesocket
+    )
+ENDIF()
+
 FOREACH ( iFILES
 FOREACH ( iFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/DhcpMethods.xslt
     ${CMAKE_CURRENT_SOURCE_DIR}/DhcpMethods.xslt
     ${CMAKE_CURRENT_SOURCE_DIR}/StartStop.xslt
     ${CMAKE_CURRENT_SOURCE_DIR}/StartStop.xslt

+ 5 - 1
esp/services/ws_packageprocess/CMakeLists.txt

@@ -53,8 +53,12 @@ target_link_libraries ( ws_packageprocess
          jlib
          jlib
          xmllib
          xmllib
          esphttp
          esphttp
-         securesocket
          dalibase
          dalibase
          ws_fs
          ws_fs
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_packageprocess
+    	securesocket
+    )
+ENDIF()

+ 5 - 1
esp/services/ws_smc/CMakeLists.txt

@@ -77,7 +77,6 @@ target_link_libraries ( ws_smc
          remote 
          remote 
          dalibase 
          dalibase 
          environment 
          environment 
-         securesocket 
          ws_machine 
          ws_machine 
          dalift 
          dalift 
          dllserver 
          dllserver 
@@ -98,6 +97,11 @@ target_link_libraries ( ws_smc
          schedulectrl 
          schedulectrl 
          ws_workunits 
          ws_workunits 
     )
     )
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_smc
+    	securesocket
+    )
+ENDIF()
 IF (USE_OPENLDAP)
 IF (USE_OPENLDAP)
 target_link_libraries ( ws_smc LdapSecurity )
 target_link_libraries ( ws_smc LdapSecurity )
 ENDIF(USE_OPENLDAP)
 ENDIF(USE_OPENLDAP)

+ 6 - 1
esp/services/ws_topology/CMakeLists.txt

@@ -76,9 +76,14 @@ target_link_libraries ( ws_topology
          deftype 
          deftype 
          workunit 
          workunit 
          SMCLib 
          SMCLib 
-         securesocket 
          swapnodelib
          swapnodelib
          )
          )
+
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_topology
+    	securesocket
+    )
+ENDIF()
          
          
 IF (USE_ZLIB)
 IF (USE_ZLIB)
   target_link_libraries ( ws_topology
   target_link_libraries ( ws_topology

+ 5 - 1
esp/services/ws_workunits/CMakeLists.txt

@@ -106,9 +106,13 @@ target_link_libraries ( ws_workunits
          hql
          hql
          jhtree
          jhtree
          fileview2
          fileview2
-         securesocket
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( ws_workunits
+    	securesocket
+    )
+ENDIF()
 IF (USE_ZLIB)
 IF (USE_ZLIB)
   target_link_libraries ( ws_workunits
   target_link_libraries ( ws_workunits
       ${ZLIB_LIBRARIES}
       ${ZLIB_LIBRARIES}

+ 5 - 1
esp/test/httptest/CMakeLists.txt

@@ -44,7 +44,11 @@ HPCC_ADD_EXECUTABLE ( httptest ${SRCS} )
 
 
 target_link_libraries ( httptest 
 target_link_libraries ( httptest 
          jlib
          jlib
-         securesocket 
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( httptest
+    	securesocket
+    )
+ENDIF()
 
 

+ 20 - 0
esp/test/httptest/httptest.cpp

@@ -152,10 +152,14 @@ HttpClient::HttpClient(int threads, int times, const char* host, int port, FILE*
     m_use_ssl = use_ssl;
     m_use_ssl = use_ssl;
     if(use_ssl)
     if(use_ssl)
     {
     {
+#ifdef USE_OPENSSL
         if(sslconfig != NULL)
         if(sslconfig != NULL)
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
         else
         else
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpClient: failure to create SSL connection to host '%s': OpenSSL not enabled in build", host);
+#endif
     }
     }
 }
 }
 
 
@@ -183,8 +187,12 @@ int HttpClient::getUrl(const char* url)
 
 
     if(m_use_ssl)
     if(m_use_ssl)
     {
     {
+#if USE_OPENSSL
         if(m_ssctx.get() == NULL)
         if(m_ssctx.get() == NULL)
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpClient: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
     }
     }
 
 
     StringBuffer request;
     StringBuffer request;
@@ -276,8 +284,12 @@ int HttpClient::sendSoapRequest(const char* url, const char* soapaction, const c
 
 
     if(m_use_ssl)
     if(m_use_ssl)
     {
     {
+#ifdef USE_OPENSSL
         if(m_ssctx.get() == NULL)
         if(m_ssctx.get() == NULL)
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpClient: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
     }
     }
 
 
     StringBuffer request;
     StringBuffer request;
@@ -602,10 +614,14 @@ HttpServer::HttpServer(int port, const char* in, FILE* ofile, bool use_ssl, IPro
     m_recvDelay = m_sendDelay = m_closeDelay = 0;
     m_recvDelay = m_sendDelay = m_closeDelay = 0;
     if(use_ssl)
     if(use_ssl)
     {
     {
+#ifdef USE_OPENSSL
         if(sslconfig != NULL)
         if(sslconfig != NULL)
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ServerSocket));
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ServerSocket));
         else
         else
             m_ssctx.setown(createSecureSocketContext(ServerSocket));
             m_ssctx.setown(createSecureSocketContext(ServerSocket));
+#else
+        throw MakeStringException(-1, "HttpServer: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
     }
     }
 }
 }
 
 
@@ -1168,10 +1184,14 @@ HttpProxy::HttpProxy(int localport, const char* host, int port, FILE* ofile, boo
     m_use_ssl = use_ssl;
     m_use_ssl = use_ssl;
     if(use_ssl)
     if(use_ssl)
     {
     {
+#if USE_OPENSSL
         if(sslconfig != NULL)
         if(sslconfig != NULL)
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
         else
         else
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpProxy: failure to create SSL connection to host '%s': OpenSSL not enabled in build", host);
+#endif
     }
     }
 }
 }
 
 

+ 4 - 0
esp/tools/soapplus/CMakeLists.txt

@@ -50,8 +50,12 @@ install ( TARGETS soapplus RUNTIME DESTINATION ${EXEC_DIR} COMPONENT Runtime)
 target_link_libraries ( soapplus 
 target_link_libraries ( soapplus 
          jlib
          jlib
          xmllib 
          xmllib 
+    )
+IF (USE_OPENSSL)
+    target_link_libraries ( soapplus 
          securesocket 
          securesocket 
     )
     )
+ENDIF()
 
 
 FOREACH( iFILES
 FOREACH( iFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/EspMethods.txt
     ${CMAKE_CURRENT_SOURCE_DIR}/EspMethods.txt

+ 4 - 0
esp/tools/soapplus/http.cpp

@@ -459,8 +459,12 @@ HttpClient::HttpClient(IProperties* globals, const char* url, const char* inname
 
 
         if(stricmp(m_protocol.str(), "HTTPS") == 0)
         if(stricmp(m_protocol.str(), "HTTPS") == 0)
         {
         {
+#ifdef USE_OPENSSL
             if(m_ssctx.get() == NULL)
             if(m_ssctx.get() == NULL)
                 m_ssctx.setown(createSecureSocketContext(ClientSocket));
                 m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpClient: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
         }
         }
 
 
         if(m_user.length() > 0)
         if(m_user.length() > 0)

+ 12 - 0
esp/tools/soapplus/httpproxy.cpp

@@ -197,12 +197,16 @@ int COneServerHttpProxyThread::start()
         socket2.setown(ISocket::connect(ep));
         socket2.setown(ISocket::connect(ep));
         if(m_use_ssl && m_ssctx != NULL)
         if(m_use_ssl && m_ssctx != NULL)
         {
         {
+#ifdef USE_OPENSSL
             Owned<ISecureSocket> securesocket = m_ssctx->createSecureSocket(socket2.getLink());
             Owned<ISecureSocket> securesocket = m_ssctx->createSecureSocket(socket2.getLink());
             int res = securesocket->secure_connect();
             int res = securesocket->secure_connect();
             if(res >= 0)
             if(res >= 0)
             {
             {
                 socket2.set(securesocket.get());
                 socket2.set(securesocket.get());
             }
             }
+#else
+        throw MakeStringException(-1, "COneServerHttpProxyThread: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
         }
         }
 
 
         if(socket2.get() == NULL)
         if(socket2.get() == NULL)
@@ -558,7 +562,11 @@ HttpProxy::HttpProxy(int localport, const char* url, FILE* ofile, const char* ur
 
 
         if(m_use_ssl)
         if(m_use_ssl)
         {
         {
+#ifdef USE_OPENSSL
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpProxy: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
         }       
         }       
     }
     }
     
     
@@ -574,10 +582,14 @@ HttpProxy::HttpProxy(int localport, const char* host, int port, FILE* ofile, boo
     m_use_ssl = use_ssl;
     m_use_ssl = use_ssl;
     if(use_ssl)
     if(use_ssl)
     {
     {
+#ifdef USE_OPENSSL
         if(sslconfig != NULL)
         if(sslconfig != NULL)
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
             m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
         else
         else
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
             m_ssctx.setown(createSecureSocketContext(ClientSocket));
+#else
+        throw MakeStringException(-1, "HttpProxy: failure to create SSL socket - OpenSSL not enabled in build");
+#endif
     }       
     }       
 }
 }
 
 

+ 5 - 1
roxie/ccd/CMakeLists.txt

@@ -103,7 +103,6 @@ target_link_libraries ( ccd
          eclrtl 
          eclrtl 
          dalibase 
          dalibase 
          deftype 
          deftype 
-         securesocket 
          thorhelper 
          thorhelper 
          jhtree 
          jhtree 
          environment 
          environment 
@@ -112,5 +111,10 @@ target_link_libraries ( ccd
          workunit 
          workunit 
     )
     )
 
 
+IF (USE_OPENSSL)
+    target_link_libraries ( ccd
+    	securesocket
+    )
+ENDIF()
 
 
 
 

+ 3 - 1
system/security/CMakeLists.txt

@@ -16,7 +16,9 @@
 IF (USE_OPENLDAP)
 IF (USE_OPENLDAP)
 HPCC_ADD_SUBDIRECTORY (LdapSecurity)
 HPCC_ADD_SUBDIRECTORY (LdapSecurity)
 ENDIF(USE_OPENLDAP)
 ENDIF(USE_OPENLDAP)
-HPCC_ADD_SUBDIRECTORY (securesocket)
+IF (USE_OPENSSL)
+  HPCC_ADD_SUBDIRECTORY (securesocket)
+ENDIF()
 HPCC_ADD_SUBDIRECTORY (test "PLATFORM")
 HPCC_ADD_SUBDIRECTORY (test "PLATFORM")
 if (USE_ZLIB)
 if (USE_ZLIB)
   HPCC_ADD_SUBDIRECTORY (zcrypt "PLATFORM")
   HPCC_ADD_SUBDIRECTORY (zcrypt "PLATFORM")

+ 2 - 0
system/security/test/CMakeLists.txt

@@ -16,4 +16,6 @@
 IF (USE_OPENLDAP)
 IF (USE_OPENLDAP)
 add_subdirectory (ldapsecuritytest)
 add_subdirectory (ldapsecuritytest)
 ENDIF(USE_OPENLDAP)
 ENDIF(USE_OPENLDAP)
+IF (USE_OPENSSL)
 add_subdirectory (myssl)
 add_subdirectory (myssl)
+ENDIF(USE_OPENSSL)