diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-07 10:16:58 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-07 15:00:14 +0100 |
commit | 64f86c7fec0a0e88d7d91703ea1aab68714608d1 (patch) | |
tree | 783f0d729c06f6f5ceee19a79f67fdeef9aab67c /xmlsecurity/source/helper/xmlsignaturehelper.cxx | |
parent | 170e0e028085745564c2755ba7e02b0a327b9e7d (diff) |
xmlsecurity OOXML export: don't write signature relations when all ...
... signatures are removed.
With this, the _xmlsignatures/ sub-storage inside the document is empty
when all signatures are removed.
Change-Id: I391bd1d3b6fdb724952a7158a043b1e602d532a9
Diffstat (limited to 'xmlsecurity/source/helper/xmlsignaturehelper.cxx')
-rw-r--r-- | xmlsecurity/source/helper/xmlsignaturehelper.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 57474f2cc97d..4b60731cf0e8 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -388,6 +388,13 @@ bool lcl_isSignatureOriginType(const beans::StringPair& rPair) bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embed::XStorage>& xStorage, bool bCacheLastSignature) { sal_Int32 nOpenMode = embed::ElementModes::READ; + uno::Reference<container::XNameAccess> xNameAccess(xStorage, uno::UNO_QUERY); + if (xNameAccess.is() && !xNameAccess->hasByName("_rels")) + { + SAL_WARN("xmlsecurity.helper", "expected stream, in signature storage but not found: _rels"); + return false; + } + uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode); uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement("origin.sigs.rels", nOpenMode), uno::UNO_QUERY); uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo; @@ -402,7 +409,6 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embe std::vector<beans::StringPair>::iterator it = std::find_if(aRelation.begin(), aRelation.end(), [](const beans::StringPair& rPair) { return rPair.First == "Target"; }); if (it != aRelation.end()) { - uno::Reference<container::XNameAccess> xNameAccess(xStorage, uno::UNO_QUERY); if (xNameAccess.is() && !xNameAccess->hasByName(it->Second)) { SAL_WARN("xmlsecurity.helper", "expected stream, but not found: " << it->Second); |