From: Matt Benjamin Date: Mon, 18 Jan 2016 20:58:07 +0000 (-0500) Subject: rgw-admin: return error on email address conflict (add user) X-Git-Tag: v0.94.10~60^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F11952%2Fhead;p=ceph.git 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) --- diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index 11073172eaa5..4aa4a5261399 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); }