aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_c2s.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ejabberd_c2s.erl')
-rw-r--r--src/ejabberd_c2s.erl77
1 files changed, 39 insertions, 38 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index a6434c974..a0255af90 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -27,7 +27,7 @@
-protocol({rfc, 6121}).
%% ejabberd_listener callbacks
--export([start/2, start_link/2, accept/1, listen_opt_type/1]).
+-export([start/2, start_link/2, accept/1, listen_opt_type/1, listen_options/0]).
%% ejabberd_config callbacks
-export([opt_type/1, transform_listen_option/2]).
%% xmpp_stream_in callbacks
@@ -979,53 +979,54 @@ opt_type(_) ->
disable_sasl_mechanisms].
-spec listen_opt_type(atom()) -> fun((any()) -> any()) | [atom()].
-listen_opt_type(access) -> fun acl:access_rules_validator/1;
-listen_opt_type(shaper) -> fun acl:shaper_rules_validator/1;
listen_opt_type(certfile = Opt) ->
fun(S) ->
?WARNING_MSG("Listening option '~s' for ~s is deprecated, use "
"'certfiles' global option instead", [Opt, ?MODULE]),
- ejabberd_pkix:add_certfile(S),
+ ok = ejabberd_pkix:add_certfile(S),
iolist_to_binary(S)
end;
-listen_opt_type(ciphers) -> opt_type(c2s_ciphers);
-listen_opt_type(dhfile) -> opt_type(c2s_dhfile);
-listen_opt_type(cafile) -> opt_type(c2s_cafile);
-listen_opt_type(protocol_options) -> opt_type(c2s_protocol_options);
-listen_opt_type(tls_compression) -> opt_type(c2s_tls_compression);
-listen_opt_type(tls) -> fun(B) when is_boolean(B) -> B end;
listen_opt_type(starttls) -> fun(B) when is_boolean(B) -> B end;
listen_opt_type(starttls_required) -> fun(B) when is_boolean(B) -> B end;
listen_opt_type(tls_verify) -> fun(B) when is_boolean(B) -> B end;
-listen_opt_type(zlib) -> fun(B) when is_boolean(B) -> B end;
-listen_opt_type(supervisor) -> fun(B) when is_boolean(B) -> B end;
-listen_opt_type(max_stanza_size) ->
- fun(I) when is_integer(I), I>0 -> I;
- (unlimited) -> infinity;
- (infinity) -> infinity
+listen_opt_type(zlib) ->
+ fun(true) ->
+ ejabberd:start_app(ezlib),
+ true;
+ (false) ->
+ false
end;
-listen_opt_type(max_fsm_queue) ->
- fun(I) when is_integer(I), I>0 -> I end;
listen_opt_type(stream_management) ->
- ?ERROR_MSG("listening option 'stream_management' is ignored: "
- "use mod_stream_mgmt module", []),
- fun(B) when is_boolean(B) -> B end;
-listen_opt_type(inet) -> fun(B) when is_boolean(B) -> B end;
-listen_opt_type(inet6) -> fun(B) when is_boolean(B) -> B end;
-listen_opt_type(backlog) ->
- fun(I) when is_integer(I), I>0 -> I end;
-listen_opt_type(accept_interval) ->
- fun(I) when is_integer(I), I>=0 -> I end;
+ fun(B) when is_boolean(B) ->
+ ?ERROR_MSG("Listening option 'stream_management' is ignored: "
+ "use mod_stream_mgmt module", []),
+ B
+ end;
listen_opt_type(O) ->
- StreamOpts = mod_stream_mgmt:mod_options(ejabberd_config:get_myname()),
- case lists:keyfind(O, 1, StreamOpts) of
- false ->
- [access, shaper, certfile, ciphers, dhfile, cafile,
- protocol_options, tls, tls_compression, starttls,
- starttls_required, tls_verify, zlib, max_fsm_queue,
- backlog, inet, inet6, accept_interval];
- _ ->
- ?ERROR_MSG("Listening option '~s' is ignored: use '~s' "
- "option from mod_stream_mgmt module", [O, O]),
- mod_stream_mgmt:mod_opt_type(O)
+ MgmtOpts = mod_stream_mgmt:mod_options(ejabberd_config:get_myname()),
+ case lists:keymember(O, 1, MgmtOpts) of
+ true ->
+ fun(V) ->
+ ?ERROR_MSG("Listening option '~s' is ignored: use '~s' "
+ "option from mod_stream_mgmt module", [O, O]),
+ (mod_stream_mgmt:mod_opt_type(O))(V)
+ end
end.
+
+listen_options() ->
+ [{access, all},
+ {shaper, none},
+ {certfile, undefined},
+ {ciphers, undefined},
+ {dhfile, undefined},
+ {cafile, undefined},
+ {protocol_options, undefined},
+ {tls, false},
+ {tls_compression, false},
+ {starttls, false},
+ {starttls_required, false},
+ {tls_verify, false},
+ {zlib, false},
+ {max_stanza_size, infinity},
+ {max_fsm_queue, 5000}|
+ mod_stream_mgmt:mod_options(ejabberd_config:get_myname())].