[Libreoffice-commits] core.git: sfx2/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 22 10:40:57 UTC 2020


 sfx2/source/doc/docfile.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d768757872ad25219fa291acd623ab98924acaaa
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Jan 22 10:59:06 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jan 22 11:40:23 2020 +0100

    tdf#129829 sfx2: fix handling of password to open vs modify
    
    Regression from commit e0f20211a8048a87b078aa4cf0f28c0c847487ad (sw
    reqif-xhtml import: add a new AllowedRTFOLEMimeTypes parameter,
    2019-12-16), the problem was that in case the (input) stream for an
    opened document is kept alive, then we don't try to re-create it, which
    means providing a different password behaves the same as providing the
    same (wrong) password.
    
    It seems CheckPasswd_Impl() in sfx2 only calls
    comphelper::DocPasswordHelper::requestAndVerifyDocPassword() in case we
    don't have a decrypted stream already.
    
    Fix the problem by deleting those streams from the remembered input
    parameters, the interesting ones have custom key names anyway.
    
    [ No testcase, the problem is Windows-only and it's not clear to me why
    the behavior is platform-specific. ]
    
    Change-Id: I2fc1f0567244897caa18548161fe426ac7d0dfd4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87182
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index e7a6d8fbb5bd..06302d39f280 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3220,7 +3220,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
     SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() );
     pImpl->m_pSet.reset( pParams );
     TransformParameters( SID_OPENDOC, aArgs, *pParams );
-    pImpl->m_aArgs = aArgs;
+    SetArgs(aArgs);
 
     OUString aFilterProvider, aFilterName;
     {
@@ -3284,7 +3284,10 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
 
 void SfxMedium::SetArgs(const uno::Sequence<beans::PropertyValue>& rArgs)
 {
-    pImpl->m_aArgs = rArgs;
+    comphelper::SequenceAsHashMap aArgsMap(rArgs);
+    aArgsMap.erase("Stream");
+    aArgsMap.erase("InputStream");
+    pImpl->m_aArgs = aArgsMap.getAsConstPropertyValueList();
 }
 
 uno::Sequence<beans::PropertyValue> SfxMedium::GetArgs() const { return pImpl->m_aArgs; }


More information about the Libreoffice-commits mailing list