From: Casey Bodley Date: Wed, 3 Apr 2024 20:23:53 +0000 (-0400) Subject: rgw/notify: support cross-tenant and cross-account notifications X-Git-Tag: v20.0.0~2159^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3a5af5fdfe138f1de385f7637d04398606be4eca;p=ceph.git rgw/notify: support cross-tenant and cross-account notifications a bucket's notification configuration may refer to topics from several different tenants or accounts. when publishing to a given topic, look in the correct namespace for each topic instead of defaulting to the requesting user's tenant namespace Signed-off-by: Casey Bodley --- diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 11623dd48f8bb..6000bb8d1177f 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -11,6 +11,7 @@ #include #include #include +#include "include/function2.hpp" #include "rgw_sal_rados.h" #include "rgw_pubsub.h" #include "rgw_pubsub_push.h" @@ -1040,7 +1041,11 @@ int publish_reserve(const DoutPrefixProvider* dpp, << dendl; // reload the topic in case it changed since the notification was added - const RGWPubSub ps(res.store, res.user_tenant, site); + const std::string& topic_tenant = std::visit(fu2::overload( + [] (const rgw_user& u) -> const std::string& { return u.tenant; }, + [] (const rgw_account_id& a) -> const std::string& { return a; } + ), topic_cfg.owner); + const RGWPubSub ps(res.store, topic_tenant, site); int ret = ps.get_topic(res.dpp, topic_cfg.dest.arn_topic, topic_cfg, res.yield, nullptr); if (ret < 0) {