diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-05-03 19:11:31 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-05-04 22:16:00 +0200 |
commit | 8a8226630e7e2458835f21f57cb73769ef06c668 (patch) | |
tree | 265bac61ed4c4663db40f77c026758bcf2b88ce0 /ucb | |
parent | f1cc1d09934a45b47a3d4be44603d50859ce8e77 (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>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav-curl/DAVProperties.cxx | 3 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-curl/webdavresponseparser.cxx | 19 |
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 8b7d0473585c..83daa33b112d 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); |