Kaydet (Commit) 6861a8ee authored tarafından Miklos Vajna's avatar Miklos Vajna

xmlsecurity: handle no META-INF in DocumentSignatureHelper

Change-Id: I7e0ac2d43e97fe9cb67a58c8dd8d83c1068f501d
üst 1d436cdb
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <rtl/uri.hxx> #include <rtl/uri.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
namespace namespace
...@@ -300,27 +301,34 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( ...@@ -300,27 +301,34 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream(
SignatureStreamHelper aHelper; SignatureStreamHelper aHelper;
try uno::Reference<container::XNameAccess> xNameAccess(rxStore, uno::UNO_QUERY);
if (!xNameAccess.is())
return aHelper;
if (xNameAccess->hasByName("META-INF"))
{ {
OUString aSIGStoreName( "META-INF" ); try
aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode );
if ( aHelper.xSignatureStorage.is() )
{ {
OUString aSIGStreamName; OUString aSIGStoreName( "META-INF" );
if ( eDocSigMode == SignatureModeDocumentContent ) aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode );
aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName(); if ( aHelper.xSignatureStorage.is() )
else if ( eDocSigMode == SignatureModeMacros ) {
aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName(); OUString aSIGStreamName;
else if ( eDocSigMode == SignatureModeDocumentContent )
aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName(); aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
else if ( eDocSigMode == SignatureModeMacros )
aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode ); aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName();
else
aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode );
}
}
catch(css::io::IOException& )
{
// Doesn't have to exist...
DBG_ASSERT( nOpenMode == css::embed::ElementModes::READ, "Error creating signature stream..." );
} }
}
catch(css::io::IOException& )
{
// Doesn't have to exist...
DBG_ASSERT( nOpenMode == css::embed::ElementModes::READ, "Error creating signature stream..." );
} }
return aHelper; return aHelper;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment