From: Yehuda Sadeh Date: Tue, 21 Jul 2015 03:27:33 +0000 (-0700) Subject: rgw: avoid using slashes for generated secret keys X-Git-Tag: v9.1.0~520^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3f04a6126fdbfb93304f798da3775c0eec9b7d44;p=ceph.git rgw: avoid using slashes for generated secret keys Just use plain alphanumeric characterset. Fixes: #7647 Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index bfe97c28ed2f..57bedc3ef52f 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -553,6 +553,26 @@ int gen_rand_alphanumeric_no_underscore(CephContext *cct, char *dest, int size) return 0; } +static const char alphanum_plain_table[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + +int gen_rand_alphanumeric_plain(CephContext *cct, char *dest, int size) /* size should be the required string size + 1 */ +{ + int ret = get_random_bytes(dest, size); + if (ret < 0) { + lderr(cct) << "cannot get random bytes: " << cpp_strerror(-ret) << dendl; + return ret; + } + + int i; + for (i=0; i