From bb692dd15d3c32e85f193c3f60c7917f2b1e13d2 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 13 Dec 2022 08:51:59 +0100 Subject: 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 --- xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xmlsecurity') 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(aEnvironment.get()); + comphelper::getFromUnoTunnel(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(aEnvironment.get()); + comphelper::getFromUnoTunnel(aEnvironment); if( pSecEnv == nullptr ) throw RuntimeException() ; -- cgit