package/source/zippackage/ZipPackage.cxx | 4 ++-- sfx2/source/dialog/filedlghelper.cxx | 2 +- sfx2/source/doc/objserv.cxx | 15 +++++++++++++-- sfx2/source/doc/objstor.cxx | 4 ++-- 4 files changed, 18 insertions(+), 7 deletions(-)
New commits: commit a191d98dea79284e25154cb955ec75e7b54ed204 Author: Vasily Melenchuk <[email protected]> AuthorDate: Mon Oct 14 00:01:52 2019 +0300 Commit: Vasily Melenchuk <[email protected]> CommitDate: Mon Oct 14 10:34:48 2019 +0300 temporary: do not clean up EncryptionData during SaveAs This clean up can ruin sensetive encryption details saving document in plain mode which is not expected. Relaization is not final and requires more atention. Change-Id: I46b757af81e68ad4781e83b1a0e0b6da3a5e13e1 diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index f5d8ca351ba9..97c079d088c8 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1756,7 +1756,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const if ( !( aValue >>= aKeys ) ) throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); - if ( aKeys.hasElements() ) +/* if ( aKeys.hasElements() ) { bool bHasSHA256 = false; bool bHasSHA1 = false; @@ -1770,7 +1770,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const if ( !bHasSHA256 && !bHasSHA1 ) throw IllegalArgumentException(THROW_WHERE "Expected keys are not provided!", uno::Reference< uno::XInterface >(), 2 ); - } + }*/ m_aStorageEncryptionKeys = aKeys; m_aEncryptionKey.realloc( 0 ); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 11a4d2b7e9ab..aab06bbe30f7 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1415,7 +1415,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORDINTERACTION ); rpSet->ClearItem( SID_PASSWORD ); - rpSet->ClearItem( SID_ENCRYPTIONDATA ); + //rpSet->ClearItem( SID_ENCRYPTIONDATA ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); rpSet->ClearItem( SID_MODIFYPASSWORDINFO ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 8cc196c015ce..53af3948917e 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -810,10 +810,21 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) bool bPreselectPassword = false; - const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false); const SfxStringItem* pOldPasswordItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_PASSWORD, false); - if ( pOldEncryptionDataItem || pOldPasswordItem ) + if (pOldPasswordItem) + { bPreselectPassword = true; + } + else + { + const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false); + if (pOldEncryptionDataItem) + { + uno::Sequence< beans::NamedValue > aEncryptionData; + pOldEncryptionDataItem->GetValue() >>= aEncryptionData; + + } + } uno::Sequence< beans::PropertyValue > aDispatchArgs; if ( rReq.GetArgs() ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index b703f0ffdfeb..005669ffc28e 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2757,11 +2757,11 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString& std::unique_ptr<SfxAllItemSet> pMergedParams(new SfxAllItemSet( *pMedium->GetItemSet() )); // in "SaveAs" title and password will be cleared ( maybe the new itemset contains new values, otherwise they will be empty ) - pMergedParams->ClearItem( SID_ENCRYPTIONDATA ); + //pMergedParams->ClearItem( SID_ENCRYPTIONDATA ); pMergedParams->ClearItem( SID_PASSWORD ); // #i119366# - As the SID_ENCRYPTIONDATA and SID_PASSWORD are using for setting password together, we need to clear them both. // Also, ( maybe the new itemset contains new values, otherwise they will be empty ) - pMergedParams->ClearItem( SID_ENCRYPTIONDATA ); +// pMergedParams->ClearItem( SID_ENCRYPTIONDATA ); pMergedParams->ClearItem( SID_DOCINFO_TITLE ); pMergedParams->ClearItem( SID_INPUTSTREAM ); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
