Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for v12.2.9 #105

Open
wants to merge 6 commits into
base: origin-v12.2.9-1733488852
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
commit patch 22116651
  • Loading branch information
turly221 committed Dec 6, 2024
commit fa915218af3f09f4cd13a690fa8daa044df4ca41
2 changes: 1 addition & 1 deletion src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5675,7 +5675,7 @@ std::vector<Option> get_rgw_options() {
.set_default(1000)
.set_min_max(1, 100000)
.add_service("rgw")
.set_description("Upper bound on results in listing operations, ListBucket max-keys"),
.set_description("Upper bound on results in listing operations, ListBucket max-keys")
.set_long_description("This caps the maximum permitted value for listing-like operations in RGW S3. "
"Affects ListBucket(max-keys), "
"ListBucketVersions(max-keys), "
Expand Down
4 changes: 3 additions & 1 deletion src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,9 @@ int RGWListBucket::parse_max_keys()
// Bound min value of max-keys to '0'
// Some S3 clients explicitly send max-keys=0 to detect if the bucket is
// empty without listing any items.
op_ret = parse_value_and_bound(max_keys, &max, 0, g_conf()->rgw_max_listing_results, default_max);
return parse_value_and_bound(max_keys, max, 0,
s->cct->_conf->get_val<uint64_t>("rgw_max_listing_results"),
default_max);
}

void RGWListBucket::pre_exec()
Expand Down
19 changes: 12 additions & 7 deletions src/rgw/rgw_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -2214,11 +2214,16 @@ class RGWGetClusterStat : public RGWOp {
virtual const string name() { return "get_cluster_stat"; }
};

static inline int parse_value_and_bound(const string &input, long *output, const long lower_bound, const long upper_bound, const long default_val)
static inline int parse_value_and_bound(
const string &input,
int &output,
const long lower_bound,
const long upper_bound,
const long default_val)
{
if (!input.empty()) {
char *endptr;
*output = strtol(input.c_str(), &endptr, 10);
output = strtol(input.c_str(), &endptr, 10);
if (endptr) {
if (endptr == input.c_str()) return -EINVAL;
while (*endptr && isspace(*endptr)) // ignore white space
Expand All @@ -2227,14 +2232,14 @@ static inline int parse_value_and_bound(const string &input, long *output, const
return -EINVAL;
}
}
if(*output > upper_bound) {
*output = upper_bound;
if(output > upper_bound) {
output = upper_bound;
}
if(*output < lower_bound) {
*output = lower_bound;
if(output < lower_bound) {
output = lower_bound;
}
} else {
*output = default_val;
output = default_val;
}

return 0;
Expand Down
8 changes: 6 additions & 2 deletions src/rgw/rgw_rest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,9 @@ int RGWListMultipart_ObjStore::get_params()
}

string str = s->info.args.get("max-parts");
op_ret = parse_value_and_bound(str, &max_parts, 0, g_conf()->rgw_max_listing_results, max_parts);
op_ret = parse_value_and_bound(str, max_parts, 0,
g_conf->get_val<uint64_t>("rgw_max_listing_results"),
max_parts);

return op_ret;
}
Expand All @@ -1669,7 +1671,9 @@ int RGWListBucketMultiparts_ObjStore::get_params()
delimiter = s->info.args.get("delimiter");
prefix = s->info.args.get("prefix");
string str = s->info.args.get("max-uploads");
op_ret = parse_value_and_bound(str, &max_uploads, 0, g_conf()->rgw_max_listing_results, default_max);
op_ret = parse_value_and_bound(str, max_uploads, 0,
g_conf->get_val<uint64_t>("rgw_max_listing_results"),
default_max);
if (op_ret < 0) {
return op_ret;
}
Expand Down