This is an automated email from the ASF dual-hosted git repository. ardovm pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 9aeb65733b2b54e00652b3cf3aed7e0a672a61a6 Author: Arrigo Marchiori <[email protected]> AuthorDate: Mon Apr 7 23:12:51 2025 +0200 IFrameObject::load() asks the current document for authorization --- main/sfx2/source/doc/iframe.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/main/sfx2/source/doc/iframe.cxx b/main/sfx2/source/doc/iframe.cxx index 1ccd7bf9ca..dfc3a215d1 100644 --- a/main/sfx2/source/doc/iframe.cxx +++ b/main/sfx2/source/doc/iframe.cxx @@ -27,6 +27,8 @@ #include "iframe.hxx" #include <sfx2/sfxdlg.hxx> #include <sfx2/sfxsids.hrc> +#include <com/sun/star/document/XLinkAuthorizer.hpp> +#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> @@ -36,6 +38,7 @@ #include <tools/debug.hxx> #include <rtl/ustring.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <ucbhelper/simpleinteractionrequest.hxx> #include <svtools/miscopt.hxx> #include <vcl/window.hxx> @@ -143,6 +146,21 @@ throw( uno::RuntimeException ) if ( SvtMiscOptions().IsPluginsEnabled() ) { DBG_ASSERT( !mxFrame.is(), "Frame already existing!" ); + ::rtl::OUString sURL( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); + // Obtain authorization from the current document, that is: our mxObj'x "client site" + uno::Reference< com::sun::star::document::XLinkAuthorizer > xLinkAuthorizer; + uno::Reference< com::sun::star::lang::XComponent > xComponent; + uno::Reference< com::sun::star::embed::XComponentSupplier > xCompSupplier( mxObj->getClientSite(), uno::UNO_QUERY ); + if ( xCompSupplier.is() ) { + xComponent.set( xCompSupplier->getComponent(), uno::UNO_QUERY ); + if ( xComponent.is() ) { + xLinkAuthorizer.set( xComponent, uno::UNO_QUERY ); + } + } + if ( xLinkAuthorizer.is() ) { + if ( !xLinkAuthorizer->authorizeLinks( sURL ) ) + return sal_False; + } Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); IFrameWindow_Impl* pWin = new IFrameWindow_Impl( pParent, maFrmDescr.IsFrameBorderOn() ); pWin->SetSizePixel( pParent->GetOutputSizePixel() ); @@ -168,7 +186,7 @@ throw( uno::RuntimeException ) uno::Reference< frame::XDispatchProvider > xProv( mxFrame, uno::UNO_QUERY ); util::URL aTargetURL; - aTargetURL.Complete = ::rtl::OUString( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); + aTargetURL.Complete = sURL; uno::Reference < util::XURLTransformer > xTrans( mxFact->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); xTrans->parseStrict( aTargetURL );
