xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   13 ----------
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |    9 ------
 xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx       |    3 --
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx        |    6 +---
 4 files changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 97db783599148e7829a898f7e46764e777500ecc
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jan 13 09:16:52 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jan 14 09:30:58 2023 +0000

    XUnoTunnel->dynamic_cast in SecurityEnvironment_NssImpl
    
    Change-Id: I65b109f8f45c57633ca3983bacf496a65ea02ea2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145497
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 2add74631001..b12a3356d18c 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -151,19 +151,6 @@ Sequence< OUString > SAL_CALL 
SecurityEnvironment_NssImpl::getSupportedServiceNa
     return seqServiceNames;
 }
 
-/* XUnoTunnel */
-sal_Int64 SAL_CALL SecurityEnvironment_NssImpl::getSomething( const Sequence< 
sal_Int8 >& aIdentifier )
-{
-    return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
-/* XUnoTunnel extension */
-
-const Sequence< sal_Int8>& SecurityEnvironment_NssImpl::getUnoTunnelId() {
-    static const comphelper::UnoIdInit 
theSecurityEnvironment_NssImplUnoTunnelId;
-    return theSecurityEnvironment_NssImplUnoTunnelId.getSeq();
-}
-
 OUString SecurityEnvironment_NssImpl::getSecurityEnvironmentInformation()
 {
     OUStringBuffer buff;
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index 12310372096d..253d3ea1f4e3 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -29,7 +29,6 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
 #include <com/sun/star/xml/crypto/XCertificateCreator.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 
 #include <mutex>
 
@@ -47,8 +46,7 @@ class X509Certificate_NssImpl;
 class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper<
     css::xml::crypto::XSecurityEnvironment,
     css::xml::crypto::XCertificateCreator,
-    css::lang::XServiceInfo,
-    css::lang::XUnoTunnel >
+    css::lang::XServiceInfo >
 {
 private:
 
@@ -87,11 +85,6 @@ private:
 
         virtual OUString SAL_CALL getSecurityEnvironmentInformation(  ) 
override;
 
-        //Methods from XUnoTunnel
-        virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
-        static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
-
         /// @throws css::uno::Exception
         /// @throws css::uno::RuntimeException
         void setCertDb( CERTCertDBHandle* aCertDb ) ;
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 6ada0522bcd9..74c80afe1a82 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -58,8 +58,7 @@ uno::Reference< css::xml::crypto::XXMLSecurityContext > 
SAL_CALL
         uno::Reference< css::xml::crypto::XXMLSecurityContext > xSecCtx = 
css::xml::crypto::XMLSecurityContext::create( m_xContext );
 
         uno::Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv = 
css::xml::crypto::SecurityEnvironment::create( m_xContext );
-        uno::Reference< lang::XUnoTunnel > xSecEnvTunnel(xSecEnv, 
uno::UNO_QUERY_THROW);
-        SecurityEnvironment_NssImpl* pSecEnv = 
comphelper::getFromUnoTunnel<SecurityEnvironment_NssImpl>(xSecEnvTunnel);
+        SecurityEnvironment_NssImpl* pSecEnv = 
dynamic_cast<SecurityEnvironment_NssImpl*>(xSecEnv.get());
         pSecEnv->setCertDb(pCertHandle);
 
         sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv);
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 94e84a71b5d8..9b79b79b245b 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -128,11 +128,10 @@ SAL_CALL XMLSignature_NssImpl::generate(
     }
 
     //Get Keys Manager
-    Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ;
 
     // the key manager should be retrieved from SecurityEnvironment, instead 
of SecurityContext
     SecurityEnvironment_NssImpl* pSecEnv
-        = 
comphelper::getFromUnoTunnel<SecurityEnvironment_NssImpl>(xSecTunnel);
+        = dynamic_cast<SecurityEnvironment_NssImpl*>(aEnvironment.get());
     if( pSecEnv == nullptr )
         throw RuntimeException() ;
 
@@ -219,9 +218,8 @@ SAL_CALL XMLSignature_NssImpl::validate(
         Reference< XSecurityEnvironment > aEnvironment = 
aSecurityCtx->getSecurityEnvironmentByIndex(i);
 
         //Get Keys Manager
-        Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ;
         SecurityEnvironment_NssImpl* pSecEnv
-            = 
comphelper::getFromUnoTunnel<SecurityEnvironment_NssImpl>(xSecTunnel);
+            = dynamic_cast<SecurityEnvironment_NssImpl*>(aEnvironment.get());
         if( pSecEnv == nullptr )
             throw RuntimeException() ;
 

Reply via email to