changeset 2145:39f4207727db

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 17:09:29 +0100
parents a979ded1dbb1
children 68557554348f
files Core/Pkcs11.cpp Core/Pkcs11.h Core/WebServiceParameters.cpp Core/WebServiceParameters.h
diffstat 4 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Pkcs11.cpp	Wed Nov 09 16:57:19 2016 +0100
+++ b/Core/Pkcs11.cpp	Wed Nov 09 17:09:29 2016 +0100
@@ -33,10 +33,6 @@
 #include "PrecompiledHeaders.h"
 #include "Pkcs11.h"
 
-#if ORTHANC_ENABLE_PKCS11 != 1 || ORTHANC_ENABLE_SSL != 1
-#  error This file cannot be used if OpenSSL or PKCS#11 support is disabled
-#endif
-
 
 #if defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_EC) || defined(OPENSSL_NO_ECDSA) || defined(OPENSSL_NO_ECDH)
 #  error OpenSSL was compiled without support for RSA, EC, ECDSA or ECDH
@@ -45,12 +41,12 @@
 
 #include "Logging.h"
 #include "OrthancException.h"
-#include "Toolbox.h"
+#include "SystemToolbox.h"
 
 extern "C"
 {
-#include <libp11/engine.h>  // This is P11's "engine.h"
-#include <libp11/libp11.h>
+#  include <libp11/engine.h>  // This is P11's "engine.h"
+#  include <libp11/libp11.h>
 }
 
 #include <openssl/engine.h>
@@ -261,7 +257,7 @@
       }
 
       if (module.empty() ||
-          !Toolbox::IsRegularFile(module))
+          !SystemToolbox::IsRegularFile(module))
       {
         LOG(ERROR) << "The PKCS#11 module must be a path to one shared library (DLL or .so)";
         throw OrthancException(ErrorCode_InexistentFile);
--- a/Core/Pkcs11.h	Wed Nov 09 16:57:19 2016 +0100
+++ b/Core/Pkcs11.h	Wed Nov 09 17:09:29 2016 +0100
@@ -32,6 +32,10 @@
 
 #pragma once
 
+#if !defined(ORTHANC_SANDBOXED)
+#  error The macro ORTHANC_SANDBOXED must be defined
+#endif
+
 #if !defined(ORTHANC_ENABLE_PKCS11)
 #  error The macro ORTHANC_ENABLE_PKCS11 must be defined
 #endif
@@ -40,6 +44,10 @@
 #  error The macro ORTHANC_ENABLE_SSL must be defined
 #endif
 
+#if ORTHANC_SANDBOXED == 1
+#  error This file cannot be used in sandboxed environments
+#endif
+
 #if ORTHANC_ENABLE_PKCS11 != 1 || ORTHANC_ENABLE_SSL != 1
 #  error This file cannot be used if OpenSSL or PKCS#11 support is disabled
 #endif
--- a/Core/WebServiceParameters.cpp	Wed Nov 09 16:57:19 2016 +0100
+++ b/Core/WebServiceParameters.cpp	Wed Nov 09 17:09:29 2016 +0100
@@ -34,10 +34,13 @@
 #include "WebServiceParameters.h"
 
 #include "../Core/Logging.h"
-#include "../Core/SystemToolbox.h"
 #include "../Core/Toolbox.h"
 #include "../Core/OrthancException.h"
 
+#if ORTHANC_SANDBOXED == 0
+#  include "../Core/SystemToolbox.h"
+#endif
+
 #include <cassert>
 
 namespace Orthanc
@@ -58,6 +61,7 @@
   }
 
 
+#if ORTHANC_SANDBOXED == 0
   void WebServiceParameters::SetClientCertificate(const std::string& certificateFile,
                                                   const std::string& certificateKeyFile,
                                                   const std::string& certificateKeyPassword)
@@ -85,6 +89,7 @@
     certificateKeyFile_ = certificateKeyFile;
     certificateKeyPassword_ = certificateKeyPassword;
   }
+#endif
 
 
   static void AddTrailingSlash(std::string& url)
--- a/Core/WebServiceParameters.h	Wed Nov 09 16:57:19 2016 +0100
+++ b/Core/WebServiceParameters.h	Wed Nov 09 17:09:29 2016 +0100
@@ -32,6 +32,10 @@
 
 #pragma once
 
+#if !defined(ORTHANC_SANDBOXED)
+#  error The macro ORTHANC_SANDBOXED must be defined
+#endif
+
 #include <string>
 #include <json/json.h>
 
@@ -88,9 +92,11 @@
 
     void ClearClientCertificate();
 
+#if ORTHANC_SANDBOXED == 0
     void SetClientCertificate(const std::string& certificateFile,
                               const std::string& certificateKeyFile,
                               const std::string& certificateKeyPassword);
+#endif
 
     const std::string& GetCertificateFile() const
     {