Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


changed it and pushed to master:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=8b8f6835e60e179de616117f59af64d6f2c34b0a

2011/8/6 Kohei Yoshida <kohei.yoshida@suse.com>

Hi Markus,

On Fri, 2011-08-05 at 22:01 +0200, Markus Mohrhard wrote:
Hello,

this patch should ensure that we write the password algorithm only to
odf 1.2 and later files.

I'm not quite sure how important it is to be 100% standard compliant
so I don't know if we should include it into 3-4.

Well, I do know that 100% standard compliance *does* matter to some
circle of users, so as long as the fix is a safe fix, I would say we
should put it in.

I would make one change though.  Instead of

if ( IsOdfVersionGreaterEqual_1_2() )

we should do

if (getDefaultVersion() >= SvtSaveOptions::ODFVER_012)

and drop the additional method you added in your patch.
Conditionalizing for the ODF version 1.2 or above is common enough that
it is done in many other places, and this is how it is done there.

Other than that, the patch looks good & safe.

Kohei

--
Kohei Yoshida, LibreOffice hacker, Calc
<kohei.yoshida@suse.com>


From 28b587975b33333b1900ee309ab49c0f3ca052cd Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Sun, 7 Aug 2011 18:16:19 +0200
Subject: [PATCH] fix for fdo#39678: don't write password algorithm in odf 1.0 and 1.1

---
 sc/source/filter/xml/xmlexprt.cxx |   38 +++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 4a5eecb..514e27a 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1525,16 +1525,19 @@ void ScXMLExport::SetBodyAttributes()
         if (aBuffer.getLength())
         {
             AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
-            if (eHashUsed == PASSHASH_XL)
+            if ( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
             {
-                AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
-                             ScPassHashHelper::getHashURI(PASSHASH_XL));
-                AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
-                             ScPassHashHelper::getHashURI(PASSHASH_SHA1));
+                if (eHashUsed == PASSHASH_XL)
+                {
+                    AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+                                 ScPassHashHelper::getHashURI(PASSHASH_XL));
+                    AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
+                                 ScPassHashHelper::getHashURI(PASSHASH_SHA1));
+                }
+                else if (eHashUsed == PASSHASH_SHA1)
+                    AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+                                 ScPassHashHelper::getHashURI(PASSHASH_SHA1));
             }
-            else if (eHashUsed == PASSHASH_SHA1)
-                AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
-                             ScPassHashHelper::getHashURI(PASSHASH_SHA1));
         }
     }
 }
@@ -2695,16 +2698,19 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const 
Reference<sheet::XSpreadshe
                 if (aBuffer.getLength())
                 {
                     AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, 
aBuffer.makeStringAndClear());
-                    if (eHashUsed == PASSHASH_XL)
+                    if ( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
                     {
-                        AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
-                                     ScPassHashHelper::getHashURI(PASSHASH_XL));
-                        AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
-                                     ScPassHashHelper::getHashURI(PASSHASH_SHA1));
+                        if (eHashUsed == PASSHASH_XL)
+                        {
+                            AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+                                         ScPassHashHelper::getHashURI(PASSHASH_XL));
+                            AddAttribute(XML_NAMESPACE_TABLE, 
XML_PROTECTION_KEY_DIGEST_ALGORITHM_2,
+                                         ScPassHashHelper::getHashURI(PASSHASH_SHA1));
+                        }
+                        else if (eHashUsed == PASSHASH_SHA1)
+                            AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+                                         ScPassHashHelper::getHashURI(PASSHASH_SHA1));
                     }
-                    else if (eHashUsed == PASSHASH_SHA1)
-                        AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
-                                     ScPassHashHelper::getHashURI(PASSHASH_SHA1));
                 }
             }
         }
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.