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 @@
#include <osl/diagnose.h>
#include <rtl/uri.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace
......@@ -300,27 +301,34 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream(
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" );
aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode );
if ( aHelper.xSignatureStorage.is() )
try
{
OUString aSIGStreamName;
if ( eDocSigMode == SignatureModeDocumentContent )
aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
else if ( eDocSigMode == SignatureModeMacros )
aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName();
else
aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode );
OUString aSIGStoreName( "META-INF" );
aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode );
if ( aHelper.xSignatureStorage.is() )
{
OUString aSIGStreamName;
if ( eDocSigMode == SignatureModeDocumentContent )
aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
else if ( eDocSigMode == SignatureModeMacros )
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;
......
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