Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2018-07-10 22:19:15 +0300
committerHolger Weiss <holger@zedat.fu-berlin.de>2018-07-10 22:19:15 +0300
commitc5dd1bdd9d54d64f23bf81e2da0d9bc0c4c36ed8 (patch)
treef982ac8d91589e84dd281baeb6881097bf1d1897
parentd03432a95608494650ce41bcb0d6e25479ce0cd0 (diff)
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.
-rw-r--r--src/mod_http_upload.erl2
-rw-r--r--src/mod_http_upload_quota.erl9
2 files changed, 5 insertions, 6 deletions
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl
index afba0f09a..f58d4bc78 100644
--- a/src/mod_http_upload.erl
+++ b/src/mod_http_upload.erl
@@ -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),
diff --git a/src/mod_http_upload_quota.erl b/src/mod_http_upload_quota.erl
index 529c79291..f27c0222e 100644
--- a/src/mod_http_upload_quota.erl
+++ b/src/mod_http_upload_quota.erl
@@ -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.