Resolves: rhbz#1013844 encrypted OOo 1.0 files don't reopen

f41
Caolán McNamara 11 years ago
parent f9604cdcc6
commit 2e5d741a75

@ -0,0 +1,215 @@
From 11ad93f4ba84f190c908e92a2c960f7a9fa800c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Wed, 2 Oct 2013 11:38:22 +0100
Subject: [PATCH] Resolves: rhbz#1013844 fdo#47482 encrypted OOo 1.0 docs
cannot be reopened
Workaround for the encrypted OpenOffice.org 1.0 documents generated by
Libreoffice <= 3.6 with the new encryption format and using SHA256, but missing
a specified startkey of SHA256
Change-Id: Ib1acc4441b5adc6721cb3cde7a1191aa978e9a1b
---
package/source/zippackage/ZipPackageStream.cxx | 34 +++++++++++++++++++++----
sc/qa/unit/data/ods/passwordWrongSHA.ods | Bin 0 -> 6560 bytes
sc/qa/unit/subsequent_filters-test.cxx | 10 ++++++++
3 files changed, 39 insertions(+), 5 deletions(-)
create mode 100644 sc/qa/unit/data/ods/passwordWrongSHA.ods
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 78e647e..bb96203 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -535,13 +535,37 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
{
xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
- catch( packages::WrongPasswordException& )
+ catch( const packages::WrongPasswordException& )
{
- // workaround for the encrypted documents generated with the old OOo1.x bug.
- if ( rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 && !m_bUseWinEncoding )
+ if ( rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 )
{
- xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData( true ), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
- m_bUseWinEncoding = true;
+ try
+ {
+ // rhbz#1013844 / fdo#47482 workaround for the encrypted
+ // OpenOffice.org 1.0 documents generated by Libreoffice <=
+ // 3.6 with the new encryption format and using SHA256, but
+ // missing a specified startkey of SHA256
+
+ // force SHA256 and see if that works
+ m_nImportedStartKeyAlgorithm = xml::crypto::DigestID::SHA256;
+ xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return xResult;
+ }
+ catch (const packages::WrongPasswordException&)
+ {
+ // if that didn't work, restore to SHA1 and trundle through the *other* earlier
+ // bug fix
+ m_nImportedStartKeyAlgorithm = xml::crypto::DigestID::SHA1;
+ }
+
+ // workaround for the encrypted documents generated with the old OOo1.x bug.
+ if ( !m_bUseWinEncoding )
+ {
+ xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData( true ), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ m_bUseWinEncoding = true;
+ }
+ else
+ throw;
}
else
throw;
diff --git a/sc/qa/unit/data/ods/passwordWrongSHA.ods b/sc/qa/unit/data/ods/passwordWrongSHA.ods
new file mode 100644
index 0000000000000000000000000000000000000000..b8a0e80dc675dca66bd895061fb8ec7da2520905
GIT binary patch
literal 6560
zcmb7I1yq#X)*g@?y1S*3MnXavx)})va42bp7&@h-1tg?XkrY8nkPhiihf=yjDW!h!
zUO&9w)%)MOXYIAlnt7jR-V^)m{cH{88z{s800sb{0hR{I))B>10|0<4zx)aSvx1p9
zdpMXGJ2=={nHoD=+1v5B+CAcSa<SufhuLzQ8rzy`{9wTNC&MM^FZ;n@=4^cR=u|2I
zP&yFqlL%$oW*DOD!d^E$wDN3=Avc+Mf9?T-DP;@;(jKPE5RwMchF7Pi4!B~HDOB{%
zE|A9Dgt0`fBX2%|@ElYZTUxxxCMhNtTaOLQUOTaigp8Ix>7oqF9q3p%$ywnd+#O8@
zhy|zAj8#Y#-*k=2|6D#Sqcs9iUE;q(7<;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u#`m)H7sb5_U?gN>z@K}wf5r2U!Ou?ZPt?z<^Vc5XRX_IHq%Vh;-Q6GE*}tQH
z?LS=g53jBBve)=)H}UVtUj@unf8yG5E-$5Dx)ncxf6_PCz*NkC7XtsLcK&s(uE7An
zmEO6w$={Ius($`k9{kJd`tR!GS2gtC@+ka<=T~*~XPzs4bZvgW;rUm!^k=3k<#TPd
zzhSyoPya2;?r&JG)zp8>!g6_p{=UlB>gpdXKTrCvqUcIrU7NvgSpJ~4exAyoq`zj=
v%NhM*&6lLt>gpQzk9_-UAYbL%Yx_v>hwQ7NjEZ*k7~bV)_wo)%`GNaCYB+jj
literal 0
HcmV?d00001
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 7db8c16..34e9cd3 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -125,6 +125,7 @@ public:
//misc tests unrelated to the import filters
void testPasswordNew();
void testPasswordOld();
+ void testPasswordWrongSHA();
//test shape import
void testControlImport();
@@ -198,6 +199,7 @@ public:
//disable testPassword on MacOSX due to problems with libsqlite3
//also crashes on DragonFly due to problems with nss/nspr headers
#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT)
+ CPPUNIT_TEST(testPasswordWrongSHA);
CPPUNIT_TEST(testPasswordOld);
CPPUNIT_TEST(testPasswordNew);
#endif
@@ -1326,6 +1328,14 @@ void ScFiltersTest::testPasswordOld()
testPassword_Impl(aFileNameBase);
}
+void ScFiltersTest::testPasswordWrongSHA()
+{
+ //tests opening a file wrongly using the new password algorithm
+ //in a sxc with the key algorithm missing
+ const OUString aFileNameBase("passwordWrongSHA.");
+ testPassword_Impl(aFileNameBase);
+}
+
void ScFiltersTest::testControlImport()
{
ScDocShellRef xDocSh = loadDoc("singlecontrol.", XLSX);
--
1.8.3.1

@ -260,6 +260,7 @@ Patch19: 0001-select-sheet-menu-as-a-right-click-popup-to-the-prev.patch
Patch20: 0001-Avoid-crash-when-a-comment-contains-data-but-no-text.patch
Patch21: 0001-Resolves-rhbz-1013480-crash-in-EditLineList-operator.patch
Patch22: 0001-rhbz-1014010-Missing-dependencies-in-isBootstrapType.patch
Patch23: 0001-Resolves-rhbz-1013844-fdo-47482-encrypted-OOo-1.0-do.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@ -1014,6 +1015,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch20 -p1 -b .Avoid-crash-when-a-comment-contains-data-but-no-text.patch
%patch21 -p1 -b .rhbz-1013480-crash-in-EditLineList-operator.patch
%patch22 -p1 -b .rhbz-1014010-Missing-dependencies-in-isBootstrapType.patch
%patch23 -p1 -b .rhbz-1013844-fdo-47482-encrypted-OOo-1.0-do.patch
# TODO: check this
# these are horribly incomplete--empty translations and copied english
@ -2104,9 +2106,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
* Tue Oct 01 2013 Caolán McNamara <caolanm@redhat.com> - 1:4.1.2.3-2-UNBUILT
* Wed Oct 02 2013 Caolán McNamara <caolanm@redhat.com> - 1:4.1.2.3-2
- Resolves: rhbz#1013480 crash in EditLineList::operator[]
- Resolves: rhbz#1014010 crash on start up
- Resolves: rhbz#1013844 encrypted OOo 1.0 files don't reopen
* Mon Sep 30 2013 David Tardon <dtardon@redhat.com> - 1:4.1.2.3-1
- 4.1.2 rc3

Loading…
Cancel
Save