From ec186f4cf460dd935e177449827222808db17138 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Fri, 26 Feb 2016 16:42:01 +0100 Subject: [PATCH] rgw: fix wrong handling of limit=0 during listing of Swift account. Fixes: #14903 Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_op.cc | 5 +++-- src/rgw/rgw_op.h | 4 ++++ src/rgw/rgw_rest_swift.h | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index b4171217c887e..bd9dfbc59d512 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1310,8 +1310,9 @@ void RGWListBuckets::execute() } op_ret = rgw_read_user_buckets(store, s->user->user_id, buckets, - marker, end_marker, read_count, - should_get_stats(), &is_truncated); + marker, end_marker, read_count, + should_get_stats(), &is_truncated, + get_default_max()); if (op_ret < 0) { /* hmm.. something wrong here.. the user was authenticated, so it should exist */ diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 895c2b3991e4f..482ebe2b801a3 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -286,6 +286,10 @@ class RGWListBuckets : public RGWOp { map attrs; bool is_truncated; + virtual uint64_t get_default_max() const { + return 1000; + } + public: RGWListBuckets() : sent_data(false) { limit = limit_max = RGW_LIST_BUCKETS_LIMIT_MAX; diff --git a/src/rgw/rgw_rest_swift.h b/src/rgw/rgw_rest_swift.h index 170f4fe78ba50..1ed1f597e37f5 100644 --- a/src/rgw/rgw_rest_swift.h +++ b/src/rgw/rgw_rest_swift.h @@ -21,6 +21,10 @@ class RGWGetObj_ObjStore_SWIFT : public RGWGetObj_ObjStore { class RGWListBuckets_ObjStore_SWIFT : public RGWListBuckets_ObjStore { bool need_stats; + + uint64_t get_default_max() const override { + return 0; + } public: RGWListBuckets_ObjStore_SWIFT() : need_stats(true) {} ~RGWListBuckets_ObjStore_SWIFT() {}