Return empty result for unsupported report methods

This commit is contained in:
Unrud 2017-03-10 22:19:10 +01:00
parent 2f67da5750
commit 53a7e15833

View File

@ -820,6 +820,16 @@ def report(base_prefix, path, xml_request, collection):
"""
root = ET.fromstring(xml_request.encode("utf8"))
if root.tag in (
_tag("D", "principal-search-property-set"),
_tag("D", "principal-property-search"),
_tag("D", "expand-property")):
# We don't support searching for principals or indirect retrieving of
# properties, just return an empty result.
# InfCloud asks for expand-property reports (even if we don't announce
# support for them) and stops working if an error code is returned.
collection.logger.warning("Unsupported report method: %s", root.tag)
return _pretty_xml(ET.Element(_tag("D", "multistatus")))
prop_element = root.find(_tag("D", "prop"))
props = (
[prop.tag for prop in prop_element]