]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw-admin: return error on email address conflict (add user) 11952/head
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 18 Jan 2016 20:58:07 +0000 (15:58 -0500)
committerNathan Cutler <ncutler@suse.com>
Sun, 13 Nov 2016 10:23:50 +0000 (11:23 +0100)
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 <mbenjamin@redhat.com>
(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

index 11073172eaa5edb2d322e80fb199d1c32990c3e1..4aa4a52613991621de68bd113b1196cd1acef2da 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <string>
 #include <map>
+#include <boost/algorithm/string.hpp>
 
 #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);
     }