Skip to content

Commit 69d44d8

Browse files
authored
Merge pull request ceph#45873 from BenoitKnecht/rgw-opa-segv
rgw: Avoid segfault when OPA authz is enabled Reviewed-by: Daniel Gryniewicz <dang@redhat.com>
2 parents 8310bd5 + ac71916 commit 69d44d8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/rgw/rgw_opa.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,18 @@ int rgw_opa_authorize(RGWOp *& op,
4747
jf.dump_string("decoded_uri", s->decoded_uri.c_str());
4848
jf.dump_string("params", s->info.request_params.c_str());
4949
jf.dump_string("request_uri_aws4", s->info.request_uri_aws4.c_str());
50-
jf.dump_string("object_name", s->object->get_name().c_str());
51-
jf.dump_string("subuser", s->auth.identity->get_subuser().c_str());
52-
jf.dump_object("user_info", s->user->get_info());
53-
jf.dump_object("bucket_info", s->bucket->get_info());
50+
if (s->object) {
51+
jf.dump_string("object_name", s->object->get_name().c_str());
52+
}
53+
if (s->auth.identity) {
54+
jf.dump_string("subuser", s->auth.identity->get_subuser().c_str());
55+
}
56+
if (s->user) {
57+
jf.dump_object("user_info", s->user->get_info());
58+
}
59+
if (s->bucket) {
60+
jf.dump_object("bucket_info", s->bucket->get_info());
61+
}
5462
jf.close_section();
5563
jf.close_section();
5664

0 commit comments

Comments
 (0)