[Libreoffice-commits] core.git: comphelper/source include/comphelper sfx2/source

Giuseppe Castagno giuseppe.castagno at acca-esse.eu
Fri Aug 5 18:13:23 UTC 2016


 comphelper/source/misc/stillreadwriteinteraction.cxx |   18 +++++++++++++-----
 include/comphelper/stillreadwriteinteraction.hxx     |    5 +++--
 sfx2/source/dialog/filedlghelper.cxx                 |    1 -
 3 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit ecba128020572966a161899083b7147e2adc5766
Author: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
Date:   Fri Aug 5 17:44:25 2016 +0200

    Fix certificate validation interaction
    
    This enables the certificate validation when
    StillReadWriteInteraction::StillReadWriteInteraction interaction
    handler is used.
    
    Certificate validation is needed for Web/WebDAV files.
    
    Change-Id: I38cba9fc8b586953477d7df02acfcc8347603220
    Reviewed-on: https://gerrit.libreoffice.org/27914
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>

diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx
index 8b80d5c..f4fdf76 100644
--- a/comphelper/source/misc/stillreadwriteinteraction.cxx
+++ b/comphelper/source/misc/stillreadwriteinteraction.cxx
@@ -29,14 +29,16 @@
 
 #include <com/sun/star/ucb/AuthenticationRequest.hpp>
 
+#include <com/sun/star/ucb/CertificateValidationRequest.hpp>
+
 namespace comphelper{
 
 StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
-                                                     const css::uno::Reference< css::task::XInteractionHandler >& xAuthenticationHandler)
+                                                     const css::uno::Reference< css::task::XInteractionHandler >& xAuxiliaryHandler)
              : m_bUsed                    (false)
              , m_bHandledByMySelf         (false)
              , m_bHandledByInternalHandler(false)
-             , m_xAuthenticationHandler(xAuthenticationHandler)
+             , m_xAuxiliaryHandler(xAuxiliaryHandler)
 {
     ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
     ::ucbhelper::InterceptedInteraction::InterceptedRequest                  aInterceptedRequest;
@@ -56,6 +58,11 @@ StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference<
     aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
     lInterceptions.push_back(aInterceptedRequest);
 
+    aInterceptedRequest.Handle = HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION;
+    aInterceptedRequest.Request <<= css::ucb::CertificateValidationRequest();
+    aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
+    lInterceptions.push_back(aInterceptedRequest);
+
     setInterceptedHandler(xHandler);
     setInterceptions(lInterceptions);
 }
@@ -105,12 +112,13 @@ ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction:
             bAbort = true;
         }
         break;
+    case HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION:
     case HANDLE_AUTHENTICATIONREQUESTEXCEPTION:
        {
-//use internal authentication dedicated handler and return
-           if (m_xAuthenticationHandler.is())
+//use internal auxiliary handler and return
+           if (m_xAuxiliaryHandler.is())
            {
-               m_xAuthenticationHandler->handle(xRequest);
+               m_xAuxiliaryHandler->handle(xRequest);
                return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
            }
            else //simply abort
diff --git a/include/comphelper/stillreadwriteinteraction.hxx b/include/comphelper/stillreadwriteinteraction.hxx
index 95d9bb5..dcad760 100644
--- a/include/comphelper/stillreadwriteinteraction.hxx
+++ b/include/comphelper/stillreadwriteinteraction.hxx
@@ -34,6 +34,7 @@ private:
     static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION       = 0;
     static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
     static const sal_Int32 HANDLE_AUTHENTICATIONREQUESTEXCEPTION = 2;
+    static const sal_Int32 HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION = 3;
 
     bool m_bUsed;
     bool m_bHandledByMySelf;
@@ -41,14 +42,14 @@ private:
 
 public:
     StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
-                              const css::uno::Reference< css::task::XInteractionHandler >& xAuthenticationHandler);
+                              const css::uno::Reference< css::task::XInteractionHandler >& xAuxiliaryHandler);
 
     void resetInterceptions();
     void resetErrorStates();
     bool wasWriteError() { return (m_bUsed && m_bHandledByMySelf);}
 
 private:
-    css::uno::Reference< css::task::XInteractionHandler > m_xAuthenticationHandler;
+    css::uno::Reference< css::task::XInteractionHandler > m_xAuxiliaryHandler;
 
     virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest&                         aRequest,
         const css::uno::Reference< css::task::XInteractionRequest >& xRequest) override;
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 79d48f1..cf5866e 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -46,7 +46,6 @@
 #include <comphelper/fileurl.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
-#include <comphelper/stillreadwriteinteraction.hxx>
 #include <comphelper/string.hxx>
 #include <comphelper/types.hxx>
 #include <tools/urlobj.hxx>


More information about the Libreoffice-commits mailing list