diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-25 11:05:15 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-25 11:05:15 -0700 |
commit | 8bd31d42a25ffb162ced98b3c1fa75cc09444036 (patch) | |
tree | 4a66e94b6890e3fbfd9d5f899eece0b780ece071 | |
parent | 422bb6d0acaece313041c5b6613b15d7600c764d (diff) | |
download | ceph-8bd31d42a25ffb162ced98b3c1fa75cc09444036.tar.gz |
rgw: filter read xattrs
We're only interested in object xattrs that have specific rgw.user
prefix.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_rados.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index e8638a8173a..a382f21467b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4419,7 +4419,7 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, io_ctx.locator_set_key(key); - map<string, bufferlist> attrset; + map<string, bufferlist> unfiltered_attrset; uint64_t size = 0; time_t mtime = 0; @@ -4427,7 +4427,7 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, if (objv_tracker) { objv_tracker->prepare_op_for_read(&op); } - op.getxattrs(&attrset, NULL); + op.getxattrs(&unfiltered_attrset, NULL); op.stat(&size, &mtime, NULL); if (first_chunk) { op.read(0, RGW_MAX_CHUNK_SIZE, first_chunk, NULL); @@ -4441,6 +4441,16 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime, if (r < 0) return r; + map<string, bufferlist> attrset; + map<string, bufferlist>::iterator iter; + string check_prefix = RGW_ATTR_PREFIX; + for (iter = unfiltered_attrset.lower_bound(check_prefix); + iter != unfiltered_attrset.end(); ++iter) { + if (!str_startswith(iter->first, check_prefix)) + break; + attrset[iter->first] = iter->second; + } + if (psize) *psize = size; if (pmtime) |