Commit Graph

5866 Commits

Author SHA1 Message Date
Evgeny Khramtsov 7a85e51237 Fix error reporting in configuration related admin commands 2019-10-19 19:58:42 +03:00
Evgeny Khramtsov 9ff6cc25dc Log supervisor reports in debug loglevel 2019-10-18 22:00:37 +03:00
Evgeny Khramtsov e4a8afb15d Replace lager with built-in new logging API
This change requires Erlang/OTP-21.0 or higher.
The commit also deprecates the following options:
  - log_rotate_date
  - log_rate_limit

Furthermore, these options have no effect. The logger now fully
relies on log_rotate_size, that cannot be 0 anymore.

The loglevel option now accepts levels in literal formats.
Those are: none, emergency, alert, critical, error, warning, notice, info, debug.
Old integer values (0-5) are still supported and automatically converted
into literal format.
2019-10-18 19:12:32 +03:00
Badlop b1d458999a Flatten strings in ejabberd_xmlrpc error results 2019-10-18 13:16:37 +02:00
Paweł Chmielowski 9822535e70 Convert oauth_expire option to accept timeout values 2019-10-15 11:28:47 +02:00
Alexey Shchepin e7a20d9fc5 Fix dialyzer warning in #oauth_ctx 2019-10-11 17:39:11 +03:00
Evgeny Khramtsov 211cc80fd4 Implement X-OAUTH2 authentication for mod_mqtt
This will only work for MQTT 5.0 connections.
A client MUST set "Authentication Method" property of CONNECT
packet to "X-OAUTH2" and MUST set the token in "Authentication Data"
property of the same CONNECT packet.

The server responses as usual with CONNACK.
2019-10-11 16:46:16 +03:00
Paweł Chmielowski 8d571adca8 Verify http host in web admin only if authentication is missing host
This should allow access to web admin through ip address or just served
from domain not defined in ejabberd hosts
2019-10-09 10:31:02 +02:00
Badlop 9df26a5740 Update ejabberd_xmlrpc to handle binaries in restuple result (#3048) 2019-10-03 16:48:22 +02:00
Alexey Shchepin 5d549dca96 Check redirect_uri for OAUTH implicit grant 2019-10-03 06:18:48 +03:00
Badlop 949e71efb6 Update Guide links in WebAdmin to website, as local file isn't included 2019-10-02 12:42:59 +02:00
Badlop 20205c66c1 Support custom base path in WebAdmin by using relative URLs (#3043) 2019-10-02 12:42:54 +02:00
Evgeny Khramtsov 7fc272918a Fix startup of supervisors for listening modules 2019-10-01 23:28:00 +03:00
Evgeny Khramtsov c49edaca19 Improve best match 2019-09-28 11:27:20 +03:00
Alexey Shchepin 8f7fa38949 Support OAUTH client authentication 2019-09-27 20:36:58 +03:00
Evgeny Khramtsov 47d0eed3f1 Advertise muc#roominfo_logs in disco#info of the room
The commit adds new `url` option for mod_muc_log.
Fixes #3040
2019-09-26 16:53:36 +03:00
Evgeny Khramtsov 2eaad21863 Don't log warning when an option is consulted for uknown vhost
Such warnings may be unappropriate in some situation, e.g.
when a virtual host is disabled in runtime but some packets
for this host are still in transit.

Fixes #3037
2019-09-25 13:58:05 +03:00
Evgeny Khramtsov aefe2fd640 Rename to p1_acme 2019-09-25 13:10:47 +03:00
Evgeny Khramtsov 5770946f03 Correctly handle unicode in log messages 2019-09-23 15:17:20 +03:00
Evgeny Khramtsov 2e1e128833 Fix unicode formatting in ACME module 2019-09-22 20:11:54 +03:00
Evgeny Khramtsov b7e296857c Don't call to xmpp_idna 2019-09-22 13:28:14 +03:00
Evgeny Khramtsov 75fe6f44d2 Fix IDNA support in ACME requests 2019-09-22 12:44:31 +03:00
Evgeny Khramtsov 30346a56de Don't forget to log an error message on IDNA failure 2019-09-22 11:30:20 +03:00
Evgeny Khramtsov a616cc04cb Support IDN hostnames in ACME requests 2019-09-22 11:04:38 +03:00
Evgeny Khramtsov d5e0ccb04a Don't attempt to create acme directory on ejabberd startup 2019-09-22 01:14:29 +03:00
Evgeny Khramtsov ea09497038 Slightly improve arg example 2019-09-22 01:03:08 +03:00
Evgeny Khramtsov f5156390bb Don't allow requesting certificates for localhost or IP-like domains 2019-09-22 00:53:03 +03:00
Evgeny Khramtsov 12691e738b Improve warning message 2019-09-22 00:21:12 +03:00
Evgeny Khramtsov 81ae691738 Use round/0 instead of ceil/0
Because ceil/0 was introduced in OTP20.0 only
2019-09-20 15:33:08 +03:00
Evgeny Khramtsov 9805b1a73a Fix typo 2019-09-20 14:04:00 +03:00
Evgeny Khramtsov 68ba109889 Remove unused file 2019-09-20 13:08:03 +03:00
Evgeny Khramtsov 4cdb4c2090 Don't auto request certificate for localhost and IP-like domains 2019-09-20 13:03:25 +03:00
Evgeny Khramtsov e227940b85 Improve ACME implementation
Fixes #2487, fixes #2590, fixes #2638
2019-09-20 12:36:31 +03:00
Alexey Shchepin 0fe1e40a9d JWT-only authentication for some users (#3012) 2019-09-18 18:46:24 +03:00
Holger Weiss f48b4124b1 mod_jidprep: Don't call gen_mod functions directly 2019-09-18 17:39:40 +02:00
Badlop fd4c5edc23 Apply default role after revoking admin affiliation (#3023) 2019-09-17 12:31:14 +02:00
Holger Weiss b1c10d2a03 Add support for XEP-0328: JID Prep
The mod_jidprep module implements XEP-0328: JID Prep, version 0.1.
2019-09-12 09:26:45 +02:00
Evgeny Khramtsov 56b4d3902a Log Mnesia table type on creation 2019-09-10 21:57:51 +03:00
Evgeny Khramtsov 533a4eec96 Replicate Mnesia 'bosh' table when nodes are joined 2019-09-10 16:02:51 +03:00
Mickael Remond 7b79921734
Use email field type to avoid jid capitalization on iOS 2019-09-09 12:12:54 +02:00
Alexey Shchepin 6d83cbd1a8 Add missing ejabberd_auth_jwt:user_exists/2 function (#3012) 2019-09-09 00:57:55 +03:00
Alexey Shchepin 21aa344ed5 Fix BEGIN/COMMIT/ROLLBACK syntax for MSSQL (#2978) 2019-09-09 00:16:44 +03:00
Evgeny Khramtsov a8c6eec28c Fix certificate selection for s2s
The bug was introduced in c2cbb4d879
Fixes #3015
2019-09-06 22:20:07 +03:00
Paweł Chmielowski 6d08ecc41f Add ejabberd_oauth:verify_resowner_scope callback back
This fixes issue #2982
2019-09-06 16:47:22 +02:00
Evgeny Khramtsov 9a8245b8e6 Fix the regression introduced in dd57950
Fixes #3010
2019-09-04 10:31:09 +03:00
Badlop e50ecf9e96 Fix some links to Guide in WebAdmin and add new ones (#3003) 2019-08-27 15:41:37 +02:00
Vyache c0f8e5d7c0 Custom exit message is not broadcast 2019-08-23 09:32:58 +03:00
Badlop 1fd75265d6 Use select fields to input host in WebAdmin Backup (#3000) 2019-08-22 18:35:43 +02:00
Badlop 94d50a447d Fix call to deprecated ejabberd_config:get_myhosts() (#3000) 2019-08-22 18:35:41 +02:00
Badlop 12c4dfd955 Provide meaningful error when adding non-local users to shared roster (#3000) 2019-08-22 17:13:18 +02:00
Badlop a51aa2bc44 Check account auth provided in WebAdmin is a local host (#3000) 2019-08-22 17:13:13 +02:00
Paweł Chmielowski 07ef1775cd Add another variant of transformation of offline_msg in mod_offline_mnesia 2019-08-16 18:34:42 +02:00
Evgeny Khramtsov 9ec69b8d62 Don't treat 'Host' header as a virtual XMPP host
Fixes #2989
2019-08-13 18:30:28 +03:00
Badlop 0bb14bdc0b Revert "Affiliations other than admin and owner cannot invite to members_only rooms"
This reverts commit b010a1a0a0.
More details in #2987
2019-08-13 14:55:37 +02:00
Badlop a157e22c2f When join new room with password, set pass and password_protected (#2668) 2019-08-13 11:37:32 +02:00
Badlop a1dfb7fbe6 Improve rooms_* commands to accept 'global' as MUC service argument (#2976) 2019-08-12 17:03:32 +02:00
Evgeny Khramtsov 8f8f53a595 Fix typo in type spec 2019-08-12 12:28:17 +03:00
Evgeny Khramtsov d796dcace5 Spawn SQL connections on demand only 2019-08-12 12:21:31 +03:00
Badlop dd8c468de3 Rename MUC command arguments from Host to Service (#2976) 2019-08-08 12:32:59 +02:00
Evgeny Khramtsov ced62e0df8 Don't use close/2: set stop_reason explicitly
Fixes #2984
2019-08-08 11:21:28 +03:00
Evgeny Khramtsov 950c209310 Report connection error before waiting for resumption
In other words don't hide the reason why c2s connection has failed
2019-08-06 16:18:04 +03:00
Evgeny Khramtsov 934392fd7e Implement reload/3 for mod_http_upload 2019-08-06 12:31:33 +03:00
Evgeny Khramtsov 2168489ddf Don't retain module option on gen_mod supervisor
When module's options were updated (e.g. by reloading ejabberd.yml)
and, later, the module's process crashed, gen_mod supervisor
restarts the process with outdated options. This is now fixed.
2019-08-04 21:46:18 +03:00
Evgeny Khramtsov 4dac9f1e6d Validate BINVAL values of vcard elements as Base64 2019-08-02 14:20:10 +03:00
Evgeny Khramtsov 5a976719fb Introduce 'vcard' option for the modules supporting vCards
The mapping between vCard's XML elements and YAML elements
of 'vcard' option is straightforward. For example, if you
want mod_muc to return the following vCard:
```
<vCard xmlns='vcard-temp'>
  <FN>Conferences</FN>
  <ADR>
    <WORK/>
    <STREET>Elm Street</STREET>
  </ADR>
</vCard>
```
you need to set the configuration as:
```
modules:
  ...
  mod_muc:
    vcard:
      fn: Conferences
      adr:
        -
          work: true
          street: Elm Street
  ...
```
2019-08-02 13:59:42 +03:00
Badlop 66d2e6ca27 Explain requirements of the FROM argument of send_message command (#2959) 2019-08-01 11:29:42 +02:00
Evgeny Khramtsov 059cf8fed1 Don't call ejabberd_cluster from its submodules
Fixes #2971
2019-07-31 19:25:47 +03:00
Evgeny Khramtsov 465e1f5ee1 Fix db_type validation 2019-07-31 18:55:43 +03:00
Paweł Chmielowski 51bf552c3f For pubsub items with max_item = 1 use order by in sql queries 2019-07-31 13:06:44 +02:00
Evgeny Khramtsov 48bed43902 Don't render CAPTCHA whitelist when CAPTCHA is not configured
Fixes #2970
2019-07-31 12:35:06 +03:00
Evgeny Khramtsov bbee13f970 Improve SQL timeouts handling
Also improve some formatting
2019-07-31 10:39:53 +03:00
Evgeny Khramtsov 651d69fb98 Also catch 'shutdown' exit reason 2019-07-30 23:17:10 +03:00
Evgeny Khramtsov 15f50f5331 Improve pattern matching 2019-07-30 20:57:32 +03:00
Evgeny Khramtsov 3e4d7a98af Implement read-repair for session pids 2019-07-30 20:57:09 +03:00
Evgeny Khramtsov 46cc6c66ec Remove dead code 2019-07-30 15:31:44 +03:00
Evgeny Khramtsov b4770815c0 Fix race condition when deleting c2s session record 2019-07-30 15:21:58 +03:00
Evgeny Khramtsov 209f5d32e1 Fix SQL connections leakage 2019-07-30 14:26:11 +03:00
Evgeny Khramtsov 81996b153a Fix previous commit 2019-07-30 13:40:40 +03:00
Evgeny Khramtsov 59adfcb8e0 Correctly report resume timeout 2019-07-30 12:50:31 +03:00
Evgeny Khramtsov 8a2b2668cf Expose access_model and publish_model in pubsub#metadata
Fixes #2931
2019-07-30 10:45:32 +03:00
Evgeny Khramtsov 949e4c1c59 Generate 'remote-server-not-found' stanza error for non-IDN domains
Fixes #2969
2019-07-29 22:45:38 +03:00
Evgeny Khramtsov d64951c2b2 Improve handling of errors in tree_action/3 2019-07-29 22:24:26 +03:00
Evgeny Khramtsov 2cd930b7d5 Appropriately abort pubsub transaction 2019-07-29 21:44:30 +03:00
Badlop 630cfe26b7 mod_multicast service discovery bugfix (thanks to McPo)(#2968) 2019-07-29 19:32:26 +02:00
Evgeny Khramtsov 2da168cf05 Improve handling of errors in pubsub code 2019-07-29 17:13:16 +03:00
Frank Diebolt cd88d342b9 Apply shaping to websocket connections 2019-07-29 14:54:25 +02:00
Evgeny Khramtsov 35576b4608 Improve hooks validator and fix bugs related to hooks registration 2019-07-29 10:46:20 +03:00
Evgeny Khramtsov 0aa004bafc Improve ejabberd halting procedure 2019-07-26 11:40:19 +03:00
Evgeny Khramtsov a54694684d Fix default value of resume_timeout 2019-07-25 13:57:43 +03:00
Evgeny Khramtsov 3b18e7cc00 Don't attempt to restart killed lager
This is not very robust and the call may hang forever
2019-07-24 19:47:14 +03:00
Evgeny Khramtsov ca0e53b3c5 Fix typo in log message 2019-07-24 18:56:44 +03:00
Evgeny Khramtsov ae135e57d9 Improve SQL pool logic
Avoid using ETS table for SQL workers: rely on processes names instead
2019-07-24 14:28:43 +03:00
Holger Weiss c3c8dffeab Revert "mod_privacy: Don't try to look up 'undefined' list"
This reverts commit 4218aecd1c.  The issue
was fixed in a0d3fb3b23 already.
2019-07-24 11:29:57 +02:00
Holger Weiss 4218aecd1c mod_privacy: Don't try to look up 'undefined' list
Don't crash if the <query/> element of an IQ of type 'set' contains
neither a <default/> nor an <active/> child.

This fixes a regression introduced in commit
8410a203ec.
2019-07-24 10:45:30 +02:00
Evgeny Khramtsov 9ef52f2b0f Fix UTF-8 support in translation files 2019-07-24 11:34:40 +03:00
Evgeny Khramtsov 052917961a Add 'certauth' command to extauth port 2019-07-24 10:13:51 +03:00
Holger Weiss 8ac4a5f792 mod_stream_mgmt: Allow flexible timeout format
Adjust mod_stream_mgmt and the related code in mod_push_keepalive to
support the flexible timeout format.
2019-07-23 00:15:40 +02:00
Christophe Romain c0dc95d529 Fix wrong virtual host in mod_pubsub:send_stanza (#2930) 2019-07-22 10:13:27 +02:00
Evgeny Khramtsov 4be98b5aef Log an error when JWT authentication is configured without jwt_key 2019-07-19 12:01:57 +03:00
Evgeny Khramtsov 55d42b9000 Fix typo 2019-07-18 22:35:16 +03:00
Evgeny Khramtsov 6d6e3e348d Improve robustness of reading jwt_key option 2019-07-18 22:31:08 +03:00
Evgeny Khramtsov 50ef982eff Get rid of useless code 2019-07-18 21:53:22 +03:00
Evgeny Khramtsov ad902c2e16 Don't forget to unregister route when the owning process is dead 2019-07-18 21:48:53 +03:00
Evgeny Khramtsov 3f7d9e3ad6 Remove Riak support
Reasons:
- Riak DB development is almost halted after Basho
- riak-erlang-client is abandoned and doesn't work
  correctly with OTP22
- Riak is slow in comparison to other databases
- Missing key ordering makes it impossible to implement range
  queries efficiently (e.g. MAM queries)
2019-07-18 19:31:12 +03:00
Evgeny Khramtsov 478f69317b Report failures of changing net_ticktime 2019-07-18 13:02:13 +03:00
Evgeny Khramtsov 6397dc5d4c Reset net ticktime on config reload 2019-07-18 12:47:29 +03:00
Evgeny Khramtsov dd301306d3 Allow flexible timeout format in session_expiry option of mod_mqtt 2019-07-17 22:58:14 +03:00
Evgeny Khramtsov d718b35d46 Use econf:timeout() instead of econf:pos_int() wherever appropriate 2019-07-17 22:15:56 +03:00
Evgeny Khramtsov c5305c5f9a Improve RPC calls in mod_configure 2019-07-17 20:51:33 +03:00
Evgeny Khramtsov 38b2e099d5 Fix pending nodes retrieval for SQL backend
Thanks to Christophe Romain
2019-07-17 12:34:09 +03:00
Evgeny Khramtsov 554f4fc851 Change time unit of hibernation_timeout option to 'second'
This is done for the sake of consistency with other options
2019-07-16 23:42:38 +03:00
Evgeny Khramtsov 15b4b3fa1b Fix typos using codespell 2019-07-16 22:07:39 +03:00
Evgeny Khramtsov cc2f674805 Avoid record duplication 2019-07-16 18:34:05 +03:00
Evgeny Khramtsov a7a53f601e Add econf:string/2 validator 2019-07-16 18:10:45 +03:00
Evgeny Khramtsov 0e48adb1ed Fix opt_type.sh script and re-generate options 2019-07-16 18:06:51 +03:00
Evgeny Khramtsov 76d4c178a7 Use econf:timeout/2 2019-07-16 18:02:32 +03:00
Evgeny Khramtsov f85488583c Handle CAPTCHA forms using captcha_form codec 2019-07-16 17:51:51 +03:00
Paweł Chmielowski 6b3d0d154e Add code for hibernating inactive muc_room processes 2019-07-16 15:09:58 +02:00
Evgeny Khramtsov 4d877289fb Bump xmpp version and fix revealed bugs 2019-07-16 15:59:33 +03:00
Evgeny Khramtsov f10de6439b Fix 'get-pending' command form generation 2019-07-16 15:09:51 +03:00
Badlop 5ecbed5eae Remove very old useless comments in ejabberd_xmlrpc.erl 2019-07-16 12:56:41 +02:00
Badlop 7079634f18 Documentation of mod_http_api moved from source code to Docs page 2019-07-16 12:53:06 +02:00
Evgeny Khramtsov 5eeb95c74f Remove modules management from mod_configure 2019-07-15 17:08:41 +03:00
Evgeny Khramtsov e1f3526466 Don't hide errors using catch 2019-07-15 17:03:29 +03:00
Evgeny Khramtsov a00496a38f Compile some regexps as unicode 2019-07-15 15:26:47 +03:00
Evgeny Khramtsov 2419e00a26 Bump yconf version 2019-07-15 15:22:51 +03:00
Evgeny Khramtsov 061c754c68 Fix regexp matching 2019-07-15 15:07:56 +03:00
Evgeny Khramtsov 104c4093dc Only respond with occupants list to disco#items with empty node
Fixes #2942
2019-07-15 14:10:45 +03:00
Evgeny Khramtsov 4ec78736b9 Improve handling of unexpected iq in mod_muc_room
Don't crash on an iq-set/get containing unexpected tag within
expected namespace

This further improves PR #2900
2019-07-15 13:59:41 +03:00
Evgeny Khramtsov 04dab48794 ejabberd_s2s should start after its supervisors 2019-07-15 12:59:47 +03:00
Evgeny Khramtsov 295015a8cb Fix startup order of ejabberd_sup children 2019-07-15 12:53:26 +03:00
Evgeny Khramtsov e1eedd587d Remove processing of {wait, _} result in gen_mod
This is no longer needed
2019-07-15 12:43:55 +03:00
Evgeny Khramtsov a4e19b7108 Increase shutdown time to 5 seconds 2019-07-15 12:43:32 +03:00
Evgeny Khramtsov 87b8344ede Attach mod_muc_room processes to a supervisor 2019-07-15 12:43:05 +03:00
Evgeny Khramtsov 1fe1322bc1 Improve some validators 2019-07-15 09:59:07 +03:00
Holger Weiss cd36bb6eda mod_http_fileserver: Unregister 'reopen_log_hook'
Unregister the global 'reopen_log_hook' on termination if the module isn't
loaded for another host.
2019-07-14 15:16:13 +02:00
Evgeny Khramtsov 15dcff92e8 Use correct virtual host when consulting trusted_proxies 2019-07-13 12:20:06 +03:00
Evgeny Khramtsov 6013b4a3a6 Fix broken ejabberd_cluster:call/5 2019-07-13 10:34:59 +03:00
Evgeny Khramtsov f0c0e4a6fc Don't crash when attempt to get an option for unknown virtual host
Log a warning instead and retry with a global scope
2019-07-12 13:59:33 +03:00
Evgeny Khramtsov 696c64064b Add call/5 and multicall/5 to ejabberd_cluster 2019-07-12 13:58:46 +03:00
Evgeny Khramtsov 53dacb3825 Use ejabberd_cluster:call() instead of rpc:call() 2019-07-12 12:30:38 +03:00
Evgeny Khramtsov 6f5d99275b Process unexpected messages uniformly 2019-07-12 11:55:36 +03:00
Evgeny Khramtsov 19cbbf69b2 Improve previous commit 2019-07-11 00:13:39 +03:00
Evgeny Khramtsov 6fd736d496 Gracefully report invalid encoding of a translation file 2019-07-11 00:04:32 +03:00
Evgeny Khramtsov b0379db5a1 Fix formatting 2019-07-10 23:46:42 +03:00
Evgeny Khramtsov d1b5844d64
Merge pull request #2900 from aquarhead/protect-muc-owner
Protect against bad muc#owner requests
2019-07-10 23:46:08 +03:00
Evgeny Khramtsov 9dedbe30ba Make sure configuration file path always represented as binary()
Fixes #2936
2019-07-10 23:35:53 +03:00
Evgeny Khramtsov bfa3125a81 Fix Elixir modules detection in the configuration file
Fixes #2937
2019-07-10 23:17:53 +03:00
Evgeny Khramtsov 5700089187 Gracefully close inbound s2s connections 2019-07-10 12:15:58 +03:00
Evgeny Khramtsov 722864666d Add/improve type specs 2019-07-10 10:31:51 +03:00
Evgeny Khramtsov 691f9e0bf7 Improve error handling/reporting when loading language translations
Also speed up loading on multi-core machines
2019-07-10 10:30:11 +03:00
Evgeny Khramtsov 04ccba0347 Fall back to map/2 and foreach/2 on single-core machines 2019-07-10 10:28:37 +03:00
Evgeny Khramtsov 01f531b3d6 Add type specs for mod_adhoc 2019-07-09 17:02:54 +03:00
Evgeny Khramtsov f19b41fd19 Improve type specs for ejabberd_s2s
Also minor code cleanup
2019-07-09 16:42:24 +03:00
Evgeny Khramtsov 43da45cf67 Improve type specs of mod_muc_room 2019-07-09 15:21:17 +03:00
Evgeny Khramtsov 11fa02cd6c Improve type specs of mod_roster 2019-07-09 14:30:59 +03:00
Evgeny Khramtsov 590849e2c3 Avoid returning 'stopped' from ejabberd_hooks:run_fold() 2019-07-09 14:30:25 +03:00
Evgeny Khramtsov f7ad25108c Get rid of unused API functions in ejabberd_hooks
Also improve code formatting and type specs
2019-07-09 01:26:48 +03:00
Evgeny Khramtsov 3e88a0b0b4 Don't expose internal FSM API of ejabberd_c2s 2019-07-09 01:01:56 +03:00
Evgeny Khramtsov 9cbc0685db Don't expose internal FSM API of mod_muc_room 2019-07-09 00:47:54 +03:00
Evgeny Khramtsov cbe84eb50c Check virtual host before running the command 2019-07-08 23:14:31 +03:00
Evgeny Khramtsov 0545e0a797 Ignore late arrival of an already cancelled timer 2019-07-08 19:32:37 +03:00
Evgeny Khramtsov e8eb6bc2b4 Avoid crashing of ejabberd_iq process on invalid callback 2019-07-08 10:45:13 +03:00
Evgeny Khramtsov d4d352492c Debug hooks 2019-07-08 09:57:33 +03:00
Evgeny Khramtsov 83e6741117 Use maps instead of dict 2019-07-08 09:55:32 +03:00
Evgeny Khramtsov 92ab59a581 Use ets and maps instead of dict 2019-07-08 09:46:50 +03:00
Evgeny Khramtsov 80beb6d6f6 Improve formatting of exceptions 2019-07-07 22:12:14 +03:00
Evgeny Khramtsov 368858a744 Fix return type in try_set_password()
Fixes #2932
2019-07-07 12:16:04 +03:00
Evgeny Khramtsov fd8e5ffce7 Avoid routing packets through a single process 2019-07-06 12:30:57 +03:00
Evgeny Khramtsov 1663e78cf7 Fix validator of option ejabberd_service->hosts
Fixes #2929
2019-07-06 10:38:25 +03:00
Evgeny Khramtsov 61a58f6e67 Do not call the same function twice 2019-07-06 10:21:01 +03:00
Paweł Chmielowski 756adaba55 Restore room when receiving message or generic iq for not started room 2019-07-05 13:46:48 +02:00
Paweł Chmielowski d7e86d1d32 Limit number of rooms that we return for disco_items from muc
We will limit it to max_room_discoitems and return rsm that would allow
fetching more
2019-07-05 11:08:32 +02:00
Evgeny Khramtsov f82de80c66 Add forgotten file 2019-07-05 10:49:27 +03:00
Evgeny Khramtsov b3caade0a0 Distribute routing of MUC messages accross all CPU cores
Also relay as less stanzas as possible through mod_muc workers
2019-07-05 10:35:31 +03:00
Evgeny Khramtsov 05461d1686 Propagate max_fsm_queue to all modules started as gen_server 2019-07-04 10:26:59 +03:00
Evgeny Khramtsov d411e68a2e Make return type of sql_transaction() consistent 2019-07-04 09:27:51 +03:00
Evgeny Khramtsov 4658d478b4 Don't call ejabberd_option from ejabberd_options 2019-07-03 19:23:05 +03:00
Evgeny Khramtsov b7f6620166 Fix jwt_key option processing 2019-07-03 19:16:54 +03:00
Evgeny Khramtsov 0d0ad9d1d9 Use correct virtual host 2019-07-03 19:08:38 +03:00
Evgeny Khramtsov 8180bc22ee Fix formatting 2019-07-03 12:58:59 +03:00
Evgeny Khramtsov 6e2502ea7d Monitor routes
Clean route table from the process that died unexpectedly.
This usually may happen when the corresponding process
gets killed by OOM killer during overload.
2019-07-03 10:39:03 +03:00
Evgeny Khramtsov 0fc190e2ef Fix 'request_handlers' transformation
Fixes #2925
2019-07-03 09:54:56 +03:00
Evgeny Khramtsov 9f9e308241 Avoid using ! in ejabberd_router and mod_offline 2019-07-03 09:42:18 +03:00
Alexey Shchepin ff6884f313 Read jwt_key from file 2019-07-03 05:33:35 +03:00
Evgeny Khramtsov f68da70f3e Avoid last handled stanzas cache to grow indefinitely 2019-07-01 20:43:57 +03:00
Paweł Chmielowski 40c360c607 Invalidate proper cache when using mam for offline in pop_messages 2019-07-01 14:30:39 +02:00
Alexey Shchepin 8956b7d60d Fix a condition in ejabberd_auth_jwt 2019-07-01 14:44:28 +03:00
Paweł Chmielowski 3e8f3573a3 Make count_offline_messages cache work when offline uses mam for storage
This also replace existing cache for checking if spool is empty with this
cache.
2019-07-01 13:36:41 +02:00
Evgeny Khramtsov c5fde9d5af Get rid of useless dialyzer instructions 2019-07-01 10:36:20 +03:00
Evgeny Khramtsov 3d82a5eee6 Fix ejabberd_auth_jwt return types and regenerate ejabberd_option.erl 2019-07-01 09:05:33 +03:00
Alexey Shchepin 3e5c0a1df8 Authentication using JWT tokens 2019-07-01 05:01:55 +03:00
Evgeny Khramtsov 4aebd2fd8e Cache number of offline messages 2019-06-30 21:14:37 +03:00
Evgeny Khramtsov 253ec13971 Use new ets_cache API in ejabberd_auth 2019-06-30 17:15:43 +03:00
Evgeny Khramtsov a2a061c1c8 Avoid using broad p1_queue:queue() type wherever possible 2019-06-28 22:16:29 +03:00
Evgeny Khramtsov 6011135d24 Use yconf validator for custom Mnesia schemas 2019-06-27 15:23:21 +03:00
Evgeny Khramtsov 39cf8d86d6 Avoid using broad map() type wherever possible 2019-06-27 15:22:27 +03:00
Evgeny Khramtsov 6b684c866b Use correct rr_type() 2019-06-27 11:35:56 +03:00
Evgeny Khramtsov 2abca350e0 Fix type specs 2019-06-27 11:32:54 +03:00
Evgeny Khramtsov 4e5daf4d72 Make sure queue bouncing doesn't yield into infinite recursion 2019-06-26 11:56:25 +03:00
Evgeny Khramtsov ffe1c722e0 Deprecate 'route_subdomains' option
This option was introduced to fulfill requirement of RFC3920 10.3,
but in practice it was very inconvenient and many admins were
forced to change its value to 's2s' (i.e. to behaviour that
violates the RFC). Also, it seems like in RFC6120 this requirement
no longer presents.

Those admins who used this option to block s2s with their subdomains
can use 's2s_access' option for the same purpose.
2019-06-26 10:45:58 +03:00
Evgeny Khramtsov b479fe5315 Use correct stacktrace in logging macros
By calling erlang:get_stacktrace() inside a lager function
we obtain actually a stacktrace of the lager function, not
the one we got during exception. This is not a problem for
newest Erlang versions though.
2019-06-26 00:05:41 +03:00
Evgeny Khramtsov 6697a3e3f1 Use proper loglevel to log resumption failures 2019-06-25 20:42:54 +03:00
Paweł Chmielowski 7b35690bc9 Store muc_subscribers in process dict if get_subscribed_rooms not available 2019-06-25 16:41:47 +02:00
Evgeny Khramtsov 8b300d734b Don't propagate downstream already handled message 2019-06-25 14:36:17 +03:00
Evgeny Khramtsov 28b1d88772 Call ejabberd_s2s:allow_host/2 with correct virtual host 2019-06-24 21:18:57 +03:00
Evgeny Khramtsov a3e0cbbdd8 Make logging messages more consistent 2019-06-24 20:32:34 +03:00
Evgeny Khramtsov 370226417a Check if mod_last is loaded before calling its functions 2019-06-24 18:47:51 +03:00
Evgeny Khramtsov db9e8220ec Deprecated access_commands option 2019-06-24 17:20:29 +03:00
Evgeny Khramtsov 1d239ec6fb Make ejabberd_xmlrpc working as a listening module again
Fixes #2915
2019-06-24 17:13:34 +03:00
Evgeny Khramtsov d0b65a3c95 Don't crash on empty avatar data 2019-06-24 17:00:51 +03:00
Evgeny Khramtsov c2cbb4d879 Use correct virtual host for s2s options 2019-06-23 19:37:54 +03:00
Evgeny Khramtsov 4b65fcab62 Avoid code duplication in gen_mod 2019-06-23 17:06:53 +03:00
Evgeny Khramtsov deee194522 Let it crash on unspecified option 2019-06-23 16:54:01 +03:00
Evgeny Khramtsov 83c291c064 Respond with 'Bad Request' to unexpected 'Host' header
Where "unexpected" means the host in 'Host' header is not
a registered route. The rationale is to avoid propagation
of uknown "Host" further in the code, which may lead to
nasty errors related to reading configuration values, calling
functions from ejabberd_router.erl, etc.
2019-06-23 13:12:00 +03:00
Evgeny Khramtsov e477a8c220 Validate and set 'version' option at an earlier stage 2019-06-23 12:23:22 +03:00
Evgeny Khramtsov 00f2a736eb Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro.
The macro itself is defined in include/translate.hrl.
Example:

-module(foo).
-export([bar/1]).
-include("translate.hrl").

bar(Lang) ->
    translate:translate(Lang, ?T("baz")).
2019-06-22 17:08:45 +03:00
Evgeny Khramtsov 4f69325e3c Fix shaper selection in ejabberd_c2s 2019-06-22 10:19:17 +03:00
Evgeny Khramtsov e9a78d0de7 Make option 'validate_stream' global 2019-06-21 21:06:32 +03:00
Evgeny Khramtsov a0d3fb3b23 Don't attempt to query 'undefined' active list
Also code formatting was improved
2019-06-21 19:37:47 +03:00
Evgeny Khramtsov 72572d990a Allow multiple definitions of host_config and append_host_config 2019-06-21 15:37:51 +03:00
Evgeny Khramtsov f3d5916236 Correct mod_mix_pam protocol version
Fixes #2913
2019-06-21 14:47:10 +03:00
Evgeny Khramtsov be35350b9c Fix usage of TLS in mod_mqtt
Fixes #2919
2019-06-21 14:39:46 +03:00
Holger Weiss 026540f7e6 mod_pubsub: Check access_model when publishing PEP
Don't just adhere to the node's access_model when delivering the last
PEP item but also when a new item is published.

Many thanks to Philipp Hrist for spotting this.
2019-06-20 18:18:14 +02:00
Badlop c318b5f8a2 Rename remaining command arguments from Server to Host (#2908) 2019-06-19 09:31:12 +02:00
Badlop fb77e2e8c0 Add support for backwards compatibility in command argument names (#2908) 2019-06-19 09:30:53 +02:00
Badlop ad98d4a515 Fix support for nonexistent or empty access_commands in ejabberd_xmlrpc 2019-06-19 09:19:32 +02:00
Evgeny Khramtsov 5a5f188767 Require opt_type/1 callback 2019-06-17 20:51:04 +03:00
Evgeny Khramtsov ef3753aa86 Generate more readable exception 2019-06-17 20:49:43 +03:00
Evgeny Khramtsov 0c4818daca Reflect recent pubsub changes in configuration transformer 2019-06-17 13:42:58 +03:00
Evgeny Khramtsov 21d9bd8325 Bump supported version of XEP-0355 2019-06-17 12:53:15 +03:00
Evgeny Khramtsov 50af436fad Fix component routes unregistration
Fixes #2910
2019-06-17 12:29:04 +03:00
Christophe Romain c9d3beb9eb Remove deprecated pubsub plugins 2019-06-17 11:19:28 +02:00
Evgeny Khramtsov e84391a6a9 Use list_to_existing_atom/1 wherever possible 2019-06-15 15:14:45 +03:00
Evgeny Khramtsov a205ebad2b Get rid of "well-known" type 2019-06-15 12:53:16 +03:00
Evgeny Khramtsov 67fbbe7a0b Remove default_db/1 and add default_db/3
Same for default_ram_db/1 and default_ram_db/3
2019-06-15 12:10:35 +03:00
Evgeny Khramtsov cfaed70fe3 Warn about 'service_url' option during config transformation 2019-06-14 17:38:55 +03:00
Evgeny Khramtsov 9e2e590061 Fix exception formatting on old Erlang 2019-06-14 16:58:39 +03:00
Evgeny Khramtsov 377748b688 Fix validator of mod_avatar 2019-06-14 16:42:22 +03:00
Evgeny Khramtsov d85cf7780c Introduce option 'captcha_url'
Option 'captcha_host' is now deprecated in favor of 'captcha_url'.
However, it's not replaced automatically at startup, i.e. both options
are supported with 'captcha_url' being the preferred one.
2019-06-14 16:06:04 +03:00
Evgeny Khramtsov a589843abd Remove mod_echo module 2019-06-14 14:47:46 +03:00
Evgeny Khramtsov a02cff0e78 Use new configuration validator 2019-06-14 12:33:26 +03:00
Paweł Chmielowski d48c067681 Return jid_malformed error when sending presence without nick to conference 2019-06-13 18:42:02 +02:00
badlop b48b6dbda5
Merge pull request #2651 from Iperity/fix-privacy-race-condition
Fix mod_privacy race condition
2019-06-13 09:34:58 +02:00
Mickaël Rémond 267ce0dde0
Debug log to help troubleshoot delegation ACLs 2019-06-11 18:52:44 +02:00
Christophe Romain 88a3e1b510 Revert "Fix pubsub compliance XEP-0060 § 7.1.3.6 (#2864)"
This reverts commit 2fff4d1ea6.
This commit broke the XEP compliance. more details here
https://xmpp.org/extensions/xep-0060.html#events
2019-06-11 10:18:36 +02:00
Nathan Bruning 8410a203ec Refactor mod_privacy patch; move logic user_receive_packet to
user_send_packet.
2019-06-10 14:10:37 +02:00
Nathan Bruning aa489c5a8b Fix user_send_packet in mod_privacy; was failing on newly created users 2019-06-10 12:49:39 +02:00
Nathan Bruning 570800a540 Fix mod_privacy race condition
mod_privacy updates the c2s state in user_receive_packet, which
tracks the *result* of the IQ set for active privacy lists.

When a second stanza is sent directly after a privacy list request,
the second stanza will be processed using the old privacy list,
because the IQ result has not yet been routed.
2019-06-10 12:49:39 +02:00
Evgeny Khramtsov 80b7d50628 Use system_time/1 instead of monotonic_time/1
The value of monotonic_time/1 may differ significantly between
nodes in a cluster due to different erlang:time_offset/0 values.

Thanks to Christoph Scholz for spotting this
2019-06-06 21:26:50 +03:00
LOU Xun 8d6455460d
Protect against bad muc#owner requests 2019-06-06 15:40:13 +00:00
Holger Weiss 6c0d6f0774 mod_register_web: Don't crash if user exists
Since commit 633b68db11,
ejabberd_auth:try_register/3 returns {error, exists} rather than
{atomic, exists}.

Thanks to Thomas Leister for reporting the issue.
2019-06-05 18:28:35 +02:00
Badlop ed1cbc2c31 Fix example argument in private_set, don't include Query element 2019-05-29 19:41:36 +02:00
Holger Weiss 274a507590 mod_stream_mgmt: Drop unused code
Revert the changes applied to mod_stream_mgmt in commit
b76f90fe39, as the new implementation of
mod_offline's 'use_mam_for_storage' feature doesn't need them.
2019-05-29 00:30:59 +02:00
Paweł Chmielowski 571a786b9b Change implementation of mod_offline use_mam_for_storage
Previous version was trying to determine range of messages that should
be fetched from mam by storing time when last user resource disconnected.

But that had couple edge cases that could cause problems, for example in
case of node crash we could not store information about user disconnect
and with that we didn't have data to initiate mam query.

New version don't track user disconnects, but simply ensure that we have
timestamp of first message that is gonna be put in storage, after some
measurements cost of that check with caching on top is not that costly,
and as much more robust i decided to introduce that change.
2019-05-28 14:32:17 +02:00
Evgeny Khramtsov 4eaba13189 Don't check mod_register restrictions in 'register' command
The commit reverts behaviour introduced in
1f2b8adc28
2019-05-28 15:14:45 +03:00
Holger Weiss 8b301fc93e mod_http_upload: Avoid catch-all error handling 2019-05-27 21:56:37 +02:00
Mickaël Rémond a06bdb1721
Improve captcha blocking alert wording 2019-05-25 11:30:04 +02:00
Paweł Chmielowski 50f93023f5 Fix last commit 2019-05-24 15:18:15 +02:00
Paweł Chmielowski 226c09f031 Make mod_admin_extra add/delete_rosteritem reuse code from mod_roster 2019-05-24 14:02:17 +02:00
Evgeny Khramtsov 3f7a850ae8 Use different cache tables per auth module
Fixes #2322
2019-05-23 11:32:55 +03:00
Evgeny Khramtsov 17f9ffb7e7 Merge branch 'master' of github.com:processone/ejabberd 2019-05-19 11:23:29 +03:00
Evgeny Khramtsov 2b523030cf Report better errors on SQL terms decode failure 2019-05-19 11:22:41 +03:00
Alexey Shchepin 63e9b82a46 Fix PostgreSQL compatibility in mod_offline_sql:remove_old_messages (#2695) 2019-05-18 21:16:45 +03:00
Badlop 937f07a4cc Fix typo in Change User Password adhoc command (thanks to lovetox)(#2884) 2019-05-17 15:48:03 +02:00
Badlop 2db547b557 Vcard search doesn't support * in mnesia, fix search form (#633) 2019-05-17 15:26:44 +02:00
Evgeny Khramtsov 2aa181658a Fix mod_legacy_auth to reflect recent changes 2019-05-15 20:55:17 +03:00
Evgeny Khramtsov a4c3ea0dfb Don't process failed EXTERNAL authentication by mod_fail2ban
This will only lead to confusion because it's not considered
possible to brute force client certificates.
2019-05-15 18:13:31 +03:00
Evgeny Khramtsov 3c95764d1a Modify arguments of c2s_auth_result hook
The hook now accepts `true | {false, Reason :: binary()}` arguments
instead of just `true | false`
2019-05-15 17:21:09 +03:00
Badlop e996579dd1 Preliminary support for SQL in process_rosteritems, and move code (#2448) 2019-05-15 10:57:55 +02:00
Paweł Chmielowski 122cb4b959 Don't put duplicate polling attribute in bosh payload
This fixes issue #2790
2019-05-14 17:32:19 +02:00
Holger Weiss 1452023c93 mod_http_upload: Case-insensitive host comparison
Perform a case-insensitive lookup of the host name specified by the HTTP
client.

Fixes #2827.
2019-05-12 11:57:17 +02:00
Evgeny Khramtsov 3d8711f708 Avoid late arrival of get_disco_item response 2019-05-11 19:27:56 +03:00
Evgeny Khramtsov 4b6f1195c6 Handle TCP errors in websockets 2019-05-09 22:06:23 +03:00
Christophe Romain 2fff4d1ea6 Fix pubsub compliance XEP-0060 § 7.1.3.6 (#2864) 2019-05-07 16:23:36 +02:00
Christophe Romain a6f7d7ce23 Raise api hook right before performing the call 2019-05-07 11:46:04 +02:00
Paweł Chmielowski 4dc8549738 Make anonymous auth don't {de}register user when there are other resources
This should fix issue reported in #2878
2019-05-07 11:02:53 +02:00
Paweł Chmielowski 7d23cd2899 When applying limit of max msgs in spool check only spool size 2019-05-07 09:58:14 +02:00
Paweł Chmielowski 8207ea18bf Remove compiler warnings 2019-05-06 20:03:10 +02:00
Paweł Chmielowski 83b790c7c9 Do not store mucsub wrapped messages with no-store hint in offline storage
We already don't store those messages in mam and we don't store messages
that aren't wrapped with that hint in offline, so it make sense to extend
it also to mucsub messages.
2019-05-06 19:22:18 +02:00
Paweł Chmielowski 3d434cfcef Handle get_subscribed_rooms call from mod_muc_room pid
Previously sometimes we tried to post message to all online rooms, and
if that was called from muc room pid, we were not able to process that
message for that room and send response, and this did lead to timeout.
2019-05-06 19:15:48 +02:00
Paweł Chmielowski 4e7bf9207e Do not declare mod_muc as dependency of mod_mam to prevent loop in deps 2019-05-06 12:22:19 +02:00
Mickael Remond 7a8de9cfcf
Make some standard admin command to get Mnesia info 2019-05-03 14:59:24 +02:00
Badlop 6b0f7f2a24 Fix bug that appears when importing privacy from Prosody (#2872) 2019-05-02 21:10:21 +02:00
Badlop 7a107c02a5 Store imported room in the correct ServerHost (#2874) 2019-05-02 20:32:10 +02:00
Paweł Chmielowski cd2d62bffd Set from/to in activity marker messages 2019-05-02 13:19:54 +02:00
Christophe Romain f7bc969729 Fix typo and remove forgotten log from 492da2ba 2019-05-02 12:05:20 +02:00
Christophe Romain 492da2baac Remove logging from REST lib 2019-05-02 11:40:53 +02:00
Paweł Chmielowski 25f7ce0cb6 Always store ActivityMarker messages 2019-05-02 11:12:47 +02:00
Paweł Chmielowski 0d2720d7ab Don't issue count/message fetch queries for offline from mam when not needed 2019-05-02 11:12:22 +02:00
Paweł Chmielowski 7eb5a0877b Sqlite doesn't recognize concat() so use || on it instead 2019-04-30 18:33:12 +02:00
Paweł Chmielowski eac7a77b6a Fix room state cleanup from db on change of persistent option change 2019-04-30 17:34:49 +02:00
Paweł Chmielowski b83d30fd07 Make get_subscribed_rooms work even for non-persistant rooms
This will store info about non-persistant rooms in db, but rooms with that
that option enabled will not be restored on server restart.

This will save info about room only on subscribers change.
2019-04-30 13:41:03 +02:00
Paweł Chmielowski b071c4906f Fix escaping for sql part of mamsub from muc mam 2019-04-30 13:36:31 +02:00
Evgeny Khramtsov c7d04a82a2 Deprecate some listening options
Those are: captcha, register, web_admin, http_bind and xmlrpc
The option `request_handlers` should be used instead, e.g.:

listen:
  ...
  -
    module: ejabberd_http
    request_handlers:
      "/admin": ejabberd_web_admin
      "/bosh": mod_bosh
      "/captcha": ejabberd_captcha
      "/register": mod_register_web
      "/": ejabberd_xmlrpc
2019-04-30 11:14:14 +03:00
Evgeny Khramtsov 268750e3b7 Provide a suggestion when unknown request handler is detected 2019-04-30 10:31:03 +03:00
Evgeny Khramtsov 11e963aa78 Provide a suggestion when unknown command is detected 2019-04-30 10:05:06 +03:00
Evgeny Khramtsov 4af99f7b03 Rename ejabberd_config:similar_option/2 -> misc:best_match/2 2019-04-30 09:36:38 +03:00
Evgeny Khramtsov c56209a27d Provide a suggestion when unknown module is detected 2019-04-29 21:15:52 +03:00
Evgeny Khramtsov 39bbc7cad8 Provide a suggestion when unknown option is detected 2019-04-29 20:57:59 +03:00