summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-21 16:01:08 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-22 06:56:59 +0000
commit24e14afd1bfcaed6c200ab081973fba7e47267ca (patch)
tree370e634ab773cd8c2b82b73ace94cbe40ad20c91
parent1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 (diff)
loplugin:unocast (SignatureVerifierImpl)
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I3c2f1eae3d9b2b5ecb6a05c9e7149946b63bb11f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144697 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--xmlsecurity/inc/framework/signatureverifierimpl.hxx7
-rw-r--r--xmlsecurity/source/framework/signatureverifierimpl.cxx10
-rw-r--r--xmlsecurity/source/helper/xsecverify.cxx5
3 files changed, 19 insertions, 3 deletions
diff --git a/xmlsecurity/inc/framework/signatureverifierimpl.hxx b/xmlsecurity/inc/framework/signatureverifierimpl.hxx
index 15c79643e0aa..29d286d7ee57 100644
--- a/xmlsecurity/inc/framework/signatureverifierimpl.hxx
+++ b/xmlsecurity/inc/framework/signatureverifierimpl.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultBroadcaster.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/implbase.hxx>
#include <xmlsecuritydllapi.h>
@@ -35,7 +36,8 @@ typedef cppu::ImplInheritanceHelper
SignatureEngine,
css::xml::crypto::sax::XSignatureVerifyResultBroadcaster,
css::lang::XInitialization,
- css::lang::XServiceInfo
+ css::lang::XServiceInfo,
+ css::lang::XUnoTunnel
> SignatureVerifierImpl_Base;
class SignatureVerifierImpl final : public SignatureVerifierImpl_Base
@@ -74,6 +76,9 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+ sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
+ static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
+
void updateSignature( const css::uno::Reference< css::xml::crypto::XXMLSignature >& xSignature,
const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& xContext ) { m_xXMLSignature = xSignature; m_xXMLSecurityContext = xContext; }
};
diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx
index 44e9e4c0a46c..3489dab31bed 100644
--- a/xmlsecurity/source/framework/signatureverifierimpl.cxx
+++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx
@@ -21,6 +21,7 @@
#include <framework/signatureverifierimpl.hxx>
#include <framework/xmlsignaturetemplateimpl.hxx>
#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/diagnose.h>
#include <rtl/ref.hxx>
@@ -127,4 +128,13 @@ css::uno::Sequence< OUString > SAL_CALL SignatureVerifierImpl::getSupportedServi
return SignatureVerifierImpl_getSupportedServiceNames();
}
+sal_Int64 SignatureVerifierImpl::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) {
+ return comphelper::getSomethingImpl(aIdentifier, this);
+}
+
+css::uno::Sequence<sal_Int8> const & SignatureVerifierImpl::getUnoTunnelId() {
+ static comphelper::UnoIdInit const id;
+ return id.getSeq();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index c45bece5fed9..e2d3fc8b5050 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -42,6 +42,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/seqstream.hxx>
+#include <comphelper/servicehelper.hxx>
namespace com::sun::star::graphic { class XGraphic; }
@@ -133,8 +134,8 @@ void XSecController::switchGpgSignature()
return;
SignatureVerifierImpl* pImpl=
- dynamic_cast<SignatureVerifierImpl*>(
- m_vInternalSignatureInformations.back().xReferenceResolvedListener.get());
+ comphelper::getFromUnoTunnel<SignatureVerifierImpl>(
+ m_vInternalSignatureInformations.back().xReferenceResolvedListener);
if (pImpl)
{
css::uno::Reference<css::xml::crypto::XSEInitializer> xGpgSEInitializer(