From caefe693562837f9c9071d3bb273b47c5821f169 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 23 Jan 2015 17:28:14 -0800 Subject: [PATCH] rgw: version id should not contain underscore The problem is that we use underscore for the raw object name encoding. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_common.cc | 20 ++++++++++++++++++++ src/rgw/rgw_common.h | 1 + src/rgw/rgw_rados.cc | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index fd0a35cac81c4..17e9fc95a58a3 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -505,6 +505,26 @@ int gen_rand_alphanumeric(CephContext *cct, char *dest, int size) /* size should return 0; } +static const char alphanum_no_underscore_table[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-."; + +int gen_rand_alphanumeric_no_underscore(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; iset_instance(buf); } -- 2.39.5