25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

mod_http_upload_quota: Fix process name lookup

Fix mod_http_upload_quota's process name lookup for the case where a
slot is requested by a JID whose domain part is not the virtual host the
mod_http_upload_quota process is running on.
This commit is contained in:
Holger Weiss 2018-07-10 21:19:15 +02:00
parent d03432a956
commit c5dd1bdd9d
2 changed files with 5 additions and 6 deletions

View File

@ -584,7 +584,7 @@ create_slot(#state{service_url = undefined,
UserStr = make_user_string(JID, JIDinURL),
UserDir = <<DocRoot/binary, $/, UserStr/binary>>,
case ejabberd_hooks:run_fold(http_upload_slot_request, ServerHost, allow,
[JID, UserDir, Size, Lang]) of
[ServerHost, JID, UserDir, Size, Lang]) of
allow ->
RandStr = p1_rand:get_alphanum_string(SecretLength),
FileStr = make_file_string(File),

View File

@ -49,7 +49,7 @@
code_change/3]).
%% ejabberd_hooks callback.
-export([handle_slot_request/5]).
-export([handle_slot_request/6]).
-include("jid.hrl").
-include("logger.hrl").
@ -229,14 +229,13 @@ code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) ->
%%--------------------------------------------------------------------
%% ejabberd_hooks callback.
%%--------------------------------------------------------------------
-spec handle_slot_request(allow | deny, jid(), binary(),
-spec handle_slot_request(allow | deny, binary(), jid(), binary(),
non_neg_integer(), binary()) -> allow | deny.
handle_slot_request(allow, #jid{lserver = ServerHost} = JID, Path, Size,
_Lang) ->
handle_slot_request(allow, ServerHost, JID, Path, Size, _Lang) ->
Proc = mod_http_upload:get_proc_name(ServerHost, ?MODULE),
gen_server:cast(Proc, {handle_slot_request, JID, Path, Size}),
allow;
handle_slot_request(Acc, _JID, _Path, _Size, _Lang) -> Acc.
handle_slot_request(Acc, _ServerHost, _JID, _Path, _Size, _Lang) -> Acc.
%%--------------------------------------------------------------------
%% Internal functions.