Commit Graph

203 Commits

Author SHA1 Message Date
Paweł Chmielowski 538f35d05a Replace code using p1_time_compat wrapper with native functions
Since we now require R19, we shouldn't need that anymore.

There are still couple places where p1_time_compat:unique_timestamp() is
used as there is no direct equivalent.
2019-02-27 09:56:31 +01:00
Evgeny Khramtsov 8def827f9c Don't crash on malformed 'modules' section 2019-02-19 12:31:18 +03:00
Evgeny Khramtsov 5e9945f060 Improve validation of configured language options 2019-01-19 11:29:45 +03:00
Badlop 55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Paweł Chmielowski 3b1c0dc27f Normalize hostname when processing host_config 2018-12-06 15:12:23 +01:00
Evgeny Khramtsov d60d72d7bf Don't hide 'undef' exceptions during config validation 2018-09-19 01:00:50 +03:00
Evgeny Khramtsov dd888f90ec Improve error formatting 2018-09-17 12:08:04 +03:00
Evgeny Khramtsov 2d246f61dd Fix some dialyzer warnings 2018-09-09 09:59:08 +03:00
Evgeniy Khramtsov 5b055d7eec Use "localhost" as a default host 2018-08-17 18:42:09 +03:00
Evgeniy Khramtsov 8c796ed027 Better format invalid values when logging them 2018-07-08 20:42:53 +03:00
Evgeniy Khramtsov 68d12017cc Better detection of duplicated routes/hosts 2018-07-08 20:28:11 +03:00
Evgeniy Khramtsov 11811e5f48 Only lookup FQDN at configuration (re)loading 2018-07-06 09:18:27 +03:00
Evgeniy Khramtsov 0bb14d16c7 Move XMPP stream and SASL processing to xmpp repo 2018-07-06 01:07:36 +03:00
Evgeniy Khramtsov ed1ee6061e Move move randoms module to p1_utils repo 2018-07-05 11:51:49 +03:00
Evgeniy Khramtsov 50b645aa92 Move shaper to p1_utils repo 2018-07-05 09:31:55 +03:00
Evgeniy Khramtsov 3a5d2dbed8 Move mod_irc to ejabberd-contrib 2018-06-20 12:27:44 +03:00
Evgeniy Khramtsov fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Paweł Chmielowski 40185b6bd3 Add ability to modify version string 2018-06-07 15:38:33 +02:00
Evgeniy Khramtsov 35a076c251 Stop ejabberd initialization on invalid/unknown options
Since now, ejabberd doesn't ignore unknown options and doesn't
allow to have options with malformed values. The rationale for
this is to avoid unexpected behaviour during runtime, i.e. to
conform to "fail early" approach. Note that it's safe to reload
a configuration with potentialy invalid and/or unknown options:
this will not halt ejabberd, but will only prevent the configuration
from loading.

***NOTE FOR PACKAGE BUILDERS***
This new behaviour should be documented in the upgrade notes.
2018-05-09 11:44:24 +03:00
Evgeniy Khramtsov 9373ad20ca Don't produce a crash dump during intentional exit
Also halt faster without relying on timeouts for buffers flushing
2018-03-29 12:14:31 +03:00
Evgeniy Khramtsov 4bf4193d55 Add 'negotiation_timeout' to the known options list 2018-02-20 19:47:50 +03:00
Evgeniy Khramtsov d625e24029 Introduce 'negotiation_timeout'
The option can be used to specify a period (in seconds) for a stream
negotiation to complete. If the timer fires, the stream is considered
as failed and the underlying connection gets closed. This is a global
option (you cannot set it per domain) and the default is 30 seconds.
2018-02-20 11:38:00 +03:00
Christophe Romain 7e1df0752a Export helper function 2018-02-16 09:53:38 +01:00
Evgeniy Khramtsov 672c2f75d3 Introduce option 'validate_stream'
If set to `true`, all incoming XML packets are fully validated
against known schemas. If an error occurs, the packet will be bounced
with the corresponding error reason. The default value is `false`.
The option might be useful to protect client software from sofisticated
bugs related to XML validation as well as for client developers
who want to catch validation errors at early stage of development.

Note that the option might have slight performance impact, so use it
with care on loaded machines.
2018-02-09 18:12:50 +03:00
Paweł Chmielowski ddf6076328 Fix elixir tests 2018-01-29 18:28:02 +01:00
Paweł Chmielowski dc601610b6 Don't return undefined from ejabberd_config:get_myhosts() 2018-01-29 11:05:59 +01:00
Paweł Chmielowski c47366ba97 Restore original return value to ejabberd_config:add_option 2018-01-29 09:46:11 +01:00
Evgeniy Khramtsov ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov fbd6ea8a48 Move 'certfile' based options in a single place 2017-11-23 11:04:47 +03:00
Christophe Romain 00e32ee4b6 Allow writing custom modules in own path (#1327)
in ejabberdctl, just add this to EJABBERD_OPTS
external_beams /path/to/my/beams

then all beams file /path/to/my/beams/*.beam will be known
by ejabberd_config, and allowed to be loaded.
2017-11-16 14:48:47 +01:00
Evgeniy Khramtsov 35b7203e01 Introduce 'certfiles' global option
The option is supposed to replace existing options 'c2s_certfile',
's2s_certfile' and 'domain_certfile'. The option accepts a list
of file paths (optionally with wildcards "*") containing either
PEM certificates or PEM private keys. At startup, ejabberd sorts
the certificates, finds matching private keys and rebuilds full
certificates chains which can be used by fast_tls. Example:

certfiles:
  - "/etc/letsencrypt/live/example.org/*.pem"
  - "/etc/letsencrypt/live/example.com/*.pem"
2017-11-01 00:20:27 +03:00
Evgeniy Khramtsov 9bd099013f Don't attempt to access(2) a certificate file
Fixes #1375
2017-08-17 14:33:41 +03:00
Evgeniy Khramtsov 6691c59a7a Clean up database code related to mod_vcard_xupdate 2017-05-17 19:29:19 +03:00
Evgeniy Khramtsov d3c8fb7705 Check presence of some files during option validation 2017-05-12 09:34:57 +03:00
Evgeniy Khramtsov 5d7a704ca5 Remove forgotten 'export_all' 2017-05-08 17:23:29 +03:00
Evgeniy Khramtsov 6b6d07745d Split some functions in smaller ones 2017-05-08 16:29:01 +03:00
Evgeniy Khramtsov 01a2c9fe12 Add type specs for Module:opt_type/1 2017-05-08 12:59:28 +03:00
Evgeniy Khramtsov 2b63d07329 Merge branch 'new-option-validation' 2017-04-29 11:48:57 +03:00
Evgeniy Khramtsov b82b93f8f0 Don't validate an option in ejabberd_config:get_option() functions
The commit introduces the following changes:
* Now there is no need to pass validating function in
  ejabberd_config:get_option() functions, because the configuration
  keeps already validated values.
* New function ejabberd_config:get_option/1 is introduced
* Function ejabberd_config:get_option/3 is deprecated. If the function
  is still called, the second argument (validating function) is simply
  ignored.
* The second argument for ejabberd_config:get_option/2 is now
  a default value, not a validating function.
2017-04-29 11:39:40 +03:00
Evgeniy Khramtsov 7129aebe76 Don't re-define validation functions in multiple places 2017-04-28 13:23:32 +03:00
Paweł Chmielowski 2bcf822637 Fix elixir tests 2017-04-28 10:08:09 +02:00
Evgeniy Khramtsov 0b93cb7ece Store options using p1_options module 2017-04-27 19:44:58 +03:00
Evgeniy Khramtsov 9a93acc62a Improve Mnesia tables creation and transformation 2017-04-23 16:37:58 +03:00
Evgeniy Khramtsov 02790b105e Speedup Mnesia tables initialization 2017-04-21 12:27:15 +03:00
Evgeniy Khramtsov f496d22074 Improve logging message 2017-04-16 23:56:12 +03:00
Evgeniy Khramtsov 86b680a3ad Move compile_exprs() to misc module 2017-04-16 20:05:46 +03:00
Evgeniy Khramtsov 78dba217bf Speedup configuration options lookup
We now avoid excessive ETS lookups; instead, we use dynamically
compiled module 'ejabberd_options' keeping the configuration options
2017-04-16 15:29:10 +03:00
Evgeniy Khramtsov 878c762cdf Log human readable description when configuration file is not found 2017-04-16 01:22:55 +03:00
Evgeniy Khramtsov 920f2678ac Report configuration file location on startup 2017-04-16 01:02:46 +03:00