summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_client_io.h
diff options
context:
space:
mode:
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>2016-10-11 17:34:05 +0200
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>2016-10-21 22:57:22 +0200
commita33462f806b729968dc6fdf8acfc169da3af5523 (patch)
tree114cc7deb330e41bd59f1853e57e4e15b6af85bc /src/rgw/rgw_client_io.h
parentrgw: add support for dispatching requests with respect to frontend prefix. (diff)
downloadceph-a33462f806b729968dc6fdf8acfc169da3af5523.tar.xz
ceph-a33462f806b729968dc6fdf8acfc169da3af5523.zip
rgw: protect the {ACCOUNTING,AWS_AUTHv4,RESTFUL}_IO casts with assert.
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
Diffstat (limited to 'src/rgw/rgw_client_io.h')
-rw-r--r--src/rgw/rgw_client_io.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rgw/rgw_client_io.h b/src/rgw/rgw_client_io.h
index 5db0a9f45bf..82460d0d102 100644
--- a/src/rgw/rgw_client_io.h
+++ b/src/rgw/rgw_client_io.h
@@ -213,14 +213,21 @@ public:
/* Type conversions to work around lack of req_state type hierarchy matching
* (e.g.) REST backends (may be replaced w/dynamic typed req_state). */
static inline rgw::io::RestfulClient* RESTFUL_IO(struct req_state* s) {
+ assert(dynamic_cast<rgw::io::RestfulClient*>(s->cio) != nullptr);
+
return static_cast<rgw::io::RestfulClient*>(s->cio);
}
static inline rgw::io::Accounter* ACCOUNTING_IO(struct req_state* s) {
- return dynamic_cast<rgw::io::Accounter*>(s->cio);
+ auto ptr = dynamic_cast<rgw::io::Accounter*>(s->cio);
+ assert(ptr != nullptr);
+
+ return ptr;
}
static inline RGWRestfulIO* AWS_AUTHv4_IO(struct req_state* s) {
+ assert(dynamic_cast<RGWRestfulIO*>(s->cio) != nullptr);
+
return static_cast<RGWRestfulIO*>(s->cio);
}