From: Weijun Duan Date: Sat, 27 Feb 2016 09:28:14 +0000 (-0500) Subject: rgw:user email can modify to empty X-Git-Tag: v11.0.1~7^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ebfd713d9a40e1cb33dfdf2198c20d621e387e36;p=ceph.git rgw:user email can modify to empty Fixes: http://tracker.ceph.com/issues/13286 Signed-off-by: Weijun Duan --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index a7a732f22f1d..0ba2f2bab197 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2105,6 +2105,7 @@ int main(int argc, char **argv) secret_key = val; } else if (ceph_argparse_witharg(args, i, &val, "-e", "--email", (char*)NULL)) { user_email = val; + user_op.user_email_specified=true; } else if (ceph_argparse_witharg(args, i, &val, "-n", "--display-name", (char*)NULL)) { display_name = val; } else if (ceph_argparse_witharg(args, i, &val, "-b", "--bucket", (char*)NULL)) { diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index d4104c45b246..23f9e73d65cf 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -2150,8 +2150,17 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg) } } user_info.user_email = op_email; - } + } else if (op_email.empty() && op_state.user_email_specified) { + rgw_obj email_obj(store->zone.user_email_pool, user_info.user_email); + ldout(store->ctx(), 10) << "removing email index: " << user_info.user_email << dendl; + ret = store->delete_system_obj(email_obj); + if (ret < 0 && ret != -ENOENT) { + ldout(store->ctx(), 0) << "ERROR: could not remove " << user_info.user_id << ":" << email_obj << ", should be fixed (err=" << ret << ")" << dendl; + return ret; + } + user_info.user_email = ""; + } // update the remaining user info if (!display_name.empty())