Skip to content

Commit

Permalink
Merge pull request #11952: hammer: rgw: fix inconsistent uid/email ha…
Browse files Browse the repository at this point in the history
…ndling in radosgw-admin

Reviewed-by: Nathan Cutler <ncutler@suse.com>
  • Loading branch information
smithfarm committed Nov 21, 2016
2 parents 67d9465 + 3404da8 commit dad5c3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rgw/rgw_user.cc
Expand Up @@ -5,6 +5,7 @@

#include <string>
#include <map>
#include <boost/algorithm/string.hpp>

#include "common/errno.h"
#include "common/Formatter.h"
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/rgw/rgw_user.h
Expand Up @@ -5,6 +5,8 @@
#define CEPH_RGW_USER_H

#include <string>
#include <boost/algorithm/string.hpp>
#include "include/assert.h"

#include "include/types.h"
#include "rgw_common.h"
Expand Down Expand Up @@ -215,6 +217,8 @@ struct RGWUserAdminOpState {
if (email.empty())
return;

/* always lowercase email address */
boost::algorithm::to_lower(email);
user_email = email;
user_email_specified = true;
}
Expand Down

0 comments on commit dad5c3d

Please sign in to comment.