From 1afb69a69e4c406d9fb03f69704e0980e389ee74 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 22 May 2024 16:54:13 -0400 Subject: [PATCH] rgw: RGWDeleteMultiObj adds error messages and consistently returns ERR_MALFORMED_XML for xml errors Signed-off-by: Casey Bodley --- src/rgw/rgw_op.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 95e382435bc46..c2a8d05bb061a 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include "include/scope_guard.h" #include "common/Clock.h" @@ -6788,13 +6789,15 @@ void RGWDeleteMultiObj::execute(optional_yield y) } if (!parser.parse(buf, data.length(), 1)) { - op_ret = -EINVAL; + s->err.message = "Failed to parse xml input"; + op_ret = -ERR_MALFORMED_XML; return; } auto multi_delete = static_cast(parser.find_first("Delete")); if (!multi_delete) { - op_ret = -EINVAL; + s->err.message = "Missing require element Delete"; + op_ret = -ERR_MALFORMED_XML; return; } @@ -6805,6 +6808,7 @@ void RGWDeleteMultiObj::execute(optional_yield y) } const int multi_delete_object_num = multi_delete->objects.size(); if (multi_delete_object_num > max_num) { + s->err.message = fmt::format("Object count limit {} exceeded", max_num); op_ret = -ERR_MALFORMED_XML; return; } -- 2.39.5