summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-05-03 19:11:31 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-05-09 10:47:56 +0200
commitcf1fa4900840b94380ae29c8f296356b995b6482 (patch)
treeed6247558960ee5fd5e8be450665daf9a2c85ddd
parent2dfacdc8041fc52c76e29cc0fe8d6b79e029bf8a (diff)
ucb: webdav-curl: fix handling of non-standard properties
Sharepoint uses properties like these: "http://schemas.microsoft.com/repl/resourcetag" "urn:schemas-microsoft-com:Win32CreationTime" They aren't standard and don't match our own ucbprops namespace, and it looks like they should be handled by an encoding to a name like "<prop:Win32CreationTime xmlns:prop=\"urn:schemas-microsoft-com:\">" Unfortunately WebDAVResponseParser::endElement() didn't do that when handling a PROPFIND reply to get the property names. This causes a crash when all properties are copied in UniversalContentBroker::globalTransfer(), which is called by SfxMedium::DoBackup_Impl() when the setting "/org.openoffice.Office.Common/Save/Document/CreateBackup" is in effect. Change-Id: I2d6480bfd2f828b6e7fc431ba4b333d95ec12718 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133769 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 65362d63b9019e45d1224ed6d78d4e1d443d6b00) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133727 Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 8a8226630e7e2458835f21f57cb73769ef06c668)
-rw-r--r--ucb/source/ucp/webdav-curl/DAVProperties.cxx3
-rw-r--r--ucb/source/ucp/webdav-curl/webdavresponseparser.cxx19
2 files changed, 16 insertions, 6 deletions
diff --git a/ucb/source/ucp/webdav-curl/DAVProperties.cxx b/ucb/source/ucp/webdav-curl/DAVProperties.cxx
index b362d512c52a..78fc5c6fdccc 100644
--- a/ucb/source/ucp/webdav-curl/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVProperties.cxx
@@ -76,6 +76,9 @@ void DAVProperties::createSerfPropName( OUString const& rFullName,
}
else
{
+ // this must not be a URI - WebDAVResponseParser must have converted it
+ // to the "<prop:" form above
+ assert(rFullName.indexOf(':') == -1);
// Add our namespace to our own properties.
rName.nspace = "http://ucb.openoffice.org/dav/props/";
rName.name
diff --git a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
index 6d7902a2f9c3..ae05397d897a 100644
--- a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
@@ -522,6 +522,15 @@ namespace
}
}
+ OUString MakePropertyName(WebDAVContext const& rContext)
+ {
+ OUString ret;
+ OString const name(OUStringToOString(rContext.getName(), RTL_TEXTENCODING_UTF8));
+ OString const nameSpace(OUStringToOString(rContext.getNamespace(), RTL_TEXTENCODING_UTF8));
+ DAVProperties::createUCBPropName(nameSpace.getStr(), name.getStr(), ret);
+ return ret;
+ }
+
void SAL_CALL WebDAVResponseParser::endElement( const OUString& aName )
{
const sal_Int32 nLen(aName.getLength());
@@ -531,9 +540,9 @@ namespace
{
if(collectThisPropertyAsName())
{
- // When collecting property names and parent is prop, just append the prop name
- // to the collection, no need to parse deeper
- maPropStatNames.push_back(mpContext->getNamespace() + mpContext->getName());
+ // name must be encoded as expected by createSerfPropName()
+ OUString const name(MakePropertyName(*mpContext));
+ maPropStatNames.emplace_back(name);
}
else
{
@@ -850,9 +859,7 @@ namespace
&& isCollectingProperties())
{
http_dav_ucp::DAVPropertyValue aDAVPropertyValue;
- OString const name(OUStringToOString(mpContext->getParent()->getName(), RTL_TEXTENCODING_UTF8));
- OString const nameSpace(OUStringToOString(mpContext->getParent()->getNamespace(), RTL_TEXTENCODING_UTF8));
- DAVProperties::createUCBPropName(nameSpace.getStr(), name.getStr(), aDAVPropertyValue.Name);
+ aDAVPropertyValue.Name = MakePropertyName(*mpContext->getParent());
if (UCBDeadPropertyValue::createFromXML(m_UCBType, m_UCBValue, aDAVPropertyValue.Value))
{
maPropStatProperties.push_back(aDAVPropertyValue);