summaryrefslogtreecommitdiff
path: root/xmlsecurity/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-13 08:51:59 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-20 08:16:37 +0000
commitbb692dd15d3c32e85f193c3f60c7917f2b1e13d2 (patch)
tree1b1310147dc73d8daa897674818355accf7f6067 /xmlsecurity/source
parent8fe55893af1f62219f9ebb1da9527ce8aa0fbd81 (diff)
Use SecurityEnvironmentGpg's XUnoTunnel instead of dynamic_cast
...where 88ac77c0bc21accfd6f5c404217c3c2aaef2d674 "gpg4libre: List and view GPG keys" had introduced SecurityEnvironmentGpg complete with (apparently unused) XUnoTunnel, but then cae5f2a543b31552ccd9765aca5eb514fa694e07 "gpg4libre: initial GPG signature generation" and 0e226d4c193824d79f71d6918038de48afffaf26 "gpg4libre: initial GPG signature validation" had failed to make use of it. (See the upcoming commit introducing loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I29cc5c1cec9c2e98528c7257993f300d131bf41c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144509 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r--xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index ebe113c73175..1afcd3c88a57 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -95,7 +95,7 @@ SAL_CALL XMLSignature_GpgImpl::generate(
//Get Keys Manager
SecurityEnvironmentGpg* pSecEnv =
- dynamic_cast<SecurityEnvironmentGpg*>(aEnvironment.get());
+ comphelper::getFromUnoTunnel<SecurityEnvironmentGpg>(aEnvironment);
if( pSecEnv == nullptr )
throw RuntimeException() ;
@@ -306,7 +306,7 @@ SAL_CALL XMLSignature_GpgImpl::validate(
Reference< XSecurityEnvironment > aEnvironment = aSecurityCtx->getSecurityEnvironmentByIndex(i);
SecurityEnvironmentGpg* pSecEnv =
- dynamic_cast<SecurityEnvironmentGpg*>(aEnvironment.get());
+ comphelper::getFromUnoTunnel<SecurityEnvironmentGpg>(aEnvironment);
if( pSecEnv == nullptr )
throw RuntimeException() ;