From: Yehuda Sadeh Date: Thu, 20 Nov 2014 18:36:05 +0000 (-0800) Subject: rgw-admin: create subuser if needed when creating user X-Git-Tag: v0.80.9~22^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b89a827a063acf78a848a34c1c3298db213950f;p=ceph.git rgw-admin: create subuser if needed when creating user Fixes: #10103 Backport: firefly, giant This turned up after fixing #9973. Earlier we also didn't create the subuser in this case, but we didn't really read the subuser info when it was authenticating. Now we do that as required, so we end up failing the authentication. This only applies to cases where a subuser was created using 'user create', and not the 'subuser create' command. Reviewed-by: Sage Weil Signed-off-by: Yehuda Sadeh (cherry picked from commit 9ba17a321db06d3d76c9295e411c76842194b25c) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index e31a28a67668..730c57df27e4 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1364,7 +1364,13 @@ int main(int argc, char **argv) cerr << "could not create user: " << err_msg << std::endl; return -ret; } - + if (!subuser.empty()) { + ret = user.subusers.add(user_op, &err_msg); + if (ret < 0) { + cerr << "could not create subuser: " << err_msg << std::endl; + return -ret; + } + } break; case OPT_USER_RM: ret = user.remove(user_op, &err_msg);