Skip to content

Commit c3b77fd

Browse files
committed
rabbit_runtime_parameters: Pass ActingUser to clear_component()
In rabbit_exchange_parameters, use ?INTERNAL_USER when calling clear_component(). This fixes the call to clear() which expects this `ActingUser`. This went unnoticed because the function was called as M:F() instead of F() even though the function is local. Reported by xref. [#140125673]
1 parent a18fc50 commit c3b77fd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/rabbit_exchange_parameters.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ register() ->
3434
?EXCHANGE_DELETE_IN_PROGRESS_COMPONENT, ?MODULE),
3535
%% ensure there are no leftovers from before node restart/crash
3636
rabbit_runtime_parameters:clear_component(
37-
?EXCHANGE_DELETE_IN_PROGRESS_COMPONENT),
37+
?EXCHANGE_DELETE_IN_PROGRESS_COMPONENT,
38+
?INTERNAL_USER),
3839
ok.
3940

4041
validate(_VHost, ?EXCHANGE_DELETE_IN_PROGRESS_COMPONENT, _Name, _Term, _User) ->

src/rabbit_runtime_parameters.erl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
-export([parse_set/5, set/5, set_any/5, clear/4, clear_any/4, list/0, list/1,
5555
list_component/1, list/2, list_formatted/1, list_formatted/3,
56-
lookup/3, value/3, value/4, info_keys/0, clear_component/1]).
56+
lookup/3, value/3, value/4, info_keys/0, clear_component/2]).
5757

5858
-export([parse_set_global/3, set_global/3, value_global/1, value_global/2,
5959
list_global/0, list_global_formatted/0, list_global_formatted/2,
@@ -228,14 +228,15 @@ clear_global(Key, ActingUser) ->
228228
end
229229
end.
230230

231-
clear_component(Component) ->
231+
clear_component(Component, ActingUser) ->
232232
case list_component(Component) of
233233
[] ->
234234
ok;
235235
Xs ->
236236
[clear(pget(vhost, X),
237237
pget(component, X),
238-
pget(name, X)) || X <- Xs],
238+
pget(name, X),
239+
ActingUser) || X <- Xs],
239240
ok
240241
end.
241242

0 commit comments

Comments
 (0)