summaryrefslogtreecommitdiff
path: root/ucb
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-04 10:22:06 +0200
commit65362d63b9019e45d1224ed6d78d4e1d443d6b00 (patch)
tree00ba0bccc959d17350b6f6f28b5665f6a514fbef /ucb
parentd47d8f3725ca38d46c6f2f37465f3856945de90e (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>
Diffstat (limited to 'ucb')
-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 746c82ad993d..8b3dce369c5e 100644
--- a/ucb/source/ucp/webdav-curl/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav-curl/DAVProperties.cxx
@@ -76,6 +76,9 @@ void DAVProperties::createSerfPropName( ::std::u16string_view const rFullName,
}
else
{
+ // this must not be a URI - WebDAVResponseParser must have converted it
+ // to the "<prop:" form above
+ assert(rFullName.find(':') == ::std::u16string_view::npos);
// 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 b2ec174688e4..9a0500d01bff 100644
--- a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx
@@ -523,6 +523,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());
@@ -532,9 +541,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
{
@@ -851,9 +860,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);