From 3404da8f1e491df86c8a1f12606546cd5a7d952c Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Mon, 18 Jan 2016 15:58:07 -0500 Subject: [PATCH] rgw-admin: return error on email address conflict (add user) Fixes the error return inconsistency documented in upstream Ceph issue #13598 Revised after upstream review, permits changing email address as originally (but use case-insensitive comp). Signed-off-by: Matt Benjamin (cherry picked from commit 90c143efa2156e55dc017ebe81005315cacaf2c5) Conflicts: src/rgw/rgw_user.cc (there is no op_state.found_by_email conditional in hammer) --- src/rgw/rgw_user.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index 11073172eaa5e..4aa4a52613991 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -5,6 +5,7 @@ #include #include +#include #include "common/errno.h" #include "common/Formatter.h" @@ -1789,7 +1790,8 @@ int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg) // fail if the user exists already if (op_state.has_existing_user()) { if (!op_state.exclusive && - (user_email.empty() || old_info.user_email == user_email) && + (user_email.empty() || + boost::iequals(user_email, old_info.user_email)) && old_info.display_name == display_name) { return execute_modify(op_state, err_msg); } -- 2.39.5