Commit Graph

5866 Commits

Author SHA1 Message Date
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
Evgeny Khramtsov 1db22c9656 Improve code for directory deletion 2019-04-29 18:50:54 +03:00
Paweł Chmielowski a0f48cf52f Fix offline from mam on mnesia 2019-04-29 17:25:06 +02:00
Paweł Chmielowski eff70951c5 Add tests for offline with mam storage 2019-04-29 16:40:47 +02:00
Paweł Chmielowski c550d36581 Properly handle infinity as max number of message in mam offline storage 2019-04-29 16:37:21 +02:00
Paweł Chmielowski aaf674160b Sort messages by stanza_id when using mam storage in mod_offline 2019-04-29 16:32:19 +02:00
Paweł Chmielowski faf9b20ac0 Return correct value from count_offline_messages with mam storage option 2019-04-29 16:31:37 +02:00
Paweł Chmielowski 17ff62d4af Make mod_offline put msg ignored by mam in spool when mam storage is on 2019-04-29 16:30:45 +02:00
Paweł Chmielowski b716b835c4 Add tests for offline use_mam_for_storage 2019-04-29 11:35:18 +02:00
Paweł Chmielowski b76f90fe39 Add mod_offline option for fetching data from mam instead of from spool table
This commit introduces `use_mam_for_storage` option that take boolean
argument. Enabling it will make mod_offline not use spool table for storing
offline message, but instead will use mam archive to retrieve messages
stored when offline.

Enabling this option have couple drawback currently, only messages that
were stored in mam will be available, most of flexible message retrieval
queries don't work (those that allow retrieval/deletion of messages by id).
2019-04-26 19:59:06 +02:00
Paweł Chmielowski bcfe50f817 Return "Bad request" error when origin in websocket connection doesn't match
This also allow websocket_origin option to accept multiple values instead
of just single one.
2019-04-26 15:29:43 +02:00
Paweł Chmielowski 17444ba84e Allow non-moderator subscribers to get list of room subscribers 2019-04-25 14:52:47 +02:00
Evgeny Khramtsov a0c8c70c9c Use binary framing in MQTT WebSockets 2019-04-25 14:30:42 +03:00
Paweł Dorofiejczyk cc5829bc33 Fix RFC6454 violation on websocket connection when validating Origin header 2019-04-24 16:59:54 +02:00
Paweł Chmielowski 8b501f5fe6 Catch potential exceptions in gen_mod:wait_for_process
Seems that at ejabberd shutdown, process may terminate before that function
is called, and in that case erlang:monitor throws exception.
2019-04-24 13:46:16 +02:00
Evgeny Khramtsov fc043dd8cf Reformat try_set_password/4 function 2019-04-23 21:25:10 +03:00
Evgeny Khramtsov cbf3fec2c8 Don't call to mod_register when it's not loaded
Fixes #2828
2019-04-23 21:05:21 +03:00
Evgeny Khramtsov edba1aebb5 Add WebSockets support to mod_mqtt
Example configuration:

listen:
  ...
  -
    port: 5280
    module: ejabberd_http
    request_handlers:
      "/mqtt": mod_mqtt

modules:
  ...
  mod_mqtt: {}
2019-04-23 19:18:22 +03:00
Paweł Chmielowski d2ea905926 Fix handling of list arguments on pgsql 2019-04-23 17:46:42 +02:00
Evgeny Khramtsov feb4c7f5e9 Support other socket modules for MQTT 2019-04-23 16:22:27 +03:00
Evgeny Khramtsov 5faae61bef Move websocket options 2019-04-23 16:21:06 +03:00
Evgeny Khramtsov cc892ddc01 Improve request_handlers validator 2019-04-23 16:19:26 +03:00
Evgeny Khramtsov 7c45b52c86 Correctly support cache tags in ejabberd_auth 2019-04-19 15:42:24 +03:00
Evgeny Khramtsov 0789a145fc Allow returning HTTP headers in REST responses 2019-04-19 15:16:47 +03:00
Evgeny Khramtsov 7f14826564 Use new ets_cache api in ejabberd_auth 2019-04-19 15:08:41 +03:00
Paweł Chmielowski 875b2daff1 Add hook room_destroyed called when room gets destroyed 2019-04-17 18:56:25 +02:00
Paweł Chmielowski 4e2c95fe58 Change implementation of misc:unique_timestamp() 2019-04-16 11:20:55 +02:00
Paweł Chmielowski 83653c0338 Handle cdata in initial data probe of ws module 2019-04-16 10:56:11 +02:00
Paweł Chmielowski 3706e35b86 Make misc:unique_timestamp not overflow microsecond part.
This should fix issue #2860
2019-04-16 10:24:28 +02:00
Paweł Chmielowski c96a925fde Add hooks for tracking mucsub subscriptions changes 2019-04-15 12:03:30 +02:00
Evgeny Khramtsov 009b9a1fd0 Feed whole image to eimp:identify/1
Fixes #2859
2019-04-14 17:05:16 +03:00
Paweł Chmielowski 8761e6e0e0 Handle correctly case where ExtraUsername is empty 2019-04-11 12:00:13 +02:00
Paweł Chmielowski c5a06e9d06 When making mucsub message from mam archive check for subject 2019-04-09 11:17:14 +02:00
Evgeny Khramtsov 2e007f1607 Use xml:lang from stanza when it's missing in <command/> element
Thanks to Philipp Hörist for spotting this
2019-04-06 18:27:28 +03:00
Evgeny Khramtsov 9f3ccd604e Add 'sessionid' attribute when required
Fixes #2852
2019-04-06 16:52:22 +03:00
Evgeny Khramtsov 909a505d65 Update mod_muc_riak 2019-04-03 16:04:58 +03:00
Evgeny Khramtsov 3013f1b9bc Update mod_mam dependencies 2019-04-03 15:01:20 +03:00
Evgeny Khramtsov 17b9dc6035 Decrease ugliness of the ugly code 2019-04-03 14:50:56 +03:00
Evgeny Khramtsov e66f594901 Change mucsub API for database backends 2019-04-03 14:20:37 +03:00
Badlop 4e591a73c5 Add ext_mod paths before checking config (processone/ejabberd-contrib#263) 2019-04-03 13:10:11 +02:00
Paweł Chmielowski 623a9ec3ba Return proper error message for duplicate or missing args in http_api call 2019-04-03 12:05:39 +02:00
Paweł Chmielowski 65a6532cd9 Log message when trying to execute http_api command with extra arguments 2019-04-03 11:50:15 +02:00
Paweł Chmielowski 33c10867e3 Formating fix 2019-04-03 11:48:59 +02:00
Paweł Chmielowski d085fff14b Make http_api command execution exception catcher log also command and args 2019-04-03 11:33:07 +02:00
Badlop cbac8a604a cache_size not applied to mod_roster on reload_config (#2769) 2019-04-02 19:52:07 +02:00
Evgeny Khramtsov d96ab48c6b Fix previous commit
Fixes #2847
2019-04-02 09:58:12 +03:00
Evgeny Khramtsov ed2abe471a Rename listening callback from start/2 to start/3
This will prevent conflicts in callback names in mod_mqtt
Old callback function is still supported.
2019-04-01 16:53:28 +03:00
Paweł Chmielowski 7eef966a04 Fix issue with creating HostMatch in mod_mam_sql
This fixes issue #2844
2019-04-01 10:56:03 +02:00
Evgeny Khramtsov 5c69122bbe Use xmpp:get_subtags/2 2019-04-01 10:47:29 +03:00
Paweł Chmielowski 9b040f65a3 Don't use deprecated gen_mod:db_type 2019-03-29 18:41:51 +01:00
Paweł Chmielowski 24b9b69783 Fix issue with mam tests
Too much copy/paste...
2019-03-29 17:18:30 +01:00
Paweł Chmielowski 0c78e01088 Implement mod_muc_sql:select_with_mucsub
This allows us to limit number of issued queries required by
user_mucsub_from_muc_archive option
2019-03-29 16:11:50 +01:00
Paweł Chmielowski a7310ffea1 Make misc:add_delay_info properly handle multiple delay tags in element 2019-03-29 11:25:35 +01:00
Paweł Chmielowski 8e05fd1d24 Add option user_mucsub_from_muc_archive to mod_muc
This option disable storing separate mucsub message for each individual
subscriber but instead when user fetches archive virtual mucsub messages
are generated from muc archives.
2019-03-28 17:42:25 +01:00
Paweł Chmielowski 063869603a Include id in mucsub notification message 2019-03-28 14:43:28 +01:00
Badlop ee2b441b0f Add 'config' tag to the reload_config command 2019-03-27 11:51:43 +01:00
Badlop 1f2b8adc28 Fix Register command to respect mod_register's Access option (#2837) 2019-03-22 15:02:51 +01:00
Badlop 6545d55473 Fix crash in mod_muc_admin:web_page_main/2 caused by just_created (#2830) 2019-03-18 17:11:00 +01:00
Paweł Dorofiejczyk 6129720838 Origin header validation on websocket connection (#2821) 2019-03-15 12:19:14 +01:00
Christophe Romain 4a920dca5a Add newline to error_logger log format 2019-03-15 11:51:48 +01:00
Paweł Chmielowski 5077d39600 Add check for ljid when setting up subscribers 2019-03-14 15:54:51 +01:00
Paweł Chmielowski 3b16afeda7 Flip default bounce_groupchat flag value, muc will drop bounces anyway 2019-03-14 15:40:34 +01:00
Paweł Chmielowski 89db022da4 Add option to mod_offline to make it not bounce mucsub/groupchat messages 2019-03-14 15:17:25 +01:00
Evgeny Khramtsov 0715e62a41 Use jid() instead of ljid() 2019-03-14 14:34:15 +03:00
Evgeny Khramtsov 7a622c3392 Improve formatting of hook crashes 2019-03-14 12:28:37 +03:00
Badlop 629e568294 Delete the ping timer only when timeout_action=kill (#2820) 2019-03-13 11:28:31 +01:00
Holger Weiss 333b010d54 mod_muc: Simplify room creation checks 2019-03-12 00:05:59 +01:00
Holger Weiss 1af2b2cfc7 Merge remote-tracking branch 'processone/pr/2811'
* processone/pr/2811:
  allow room recreate for admins even if nonempty
2019-03-11 23:30:22 +01:00
Holger Weiss 328553ea3f mod_push: Check for payload in encrypted messages
While distinguishing actual chat messages from other message types,
don't classify all <encrypted/> messages as chat messages, but only
those that have a <payload/> element.
2019-03-11 22:58:53 +01:00
Alexey Shchepin e921b43754 Fix transaction aborting and restarting in ejabberd_sql 2019-03-07 22:14:13 +03:00
Christoph Scholz b5fa3b0e2b allow room recreate for admins even if nonempty 2019-03-05 16:51:57 +01:00
Badlop a4222fe9b3 Handle info log level when using MySQL (#2541) 2019-03-04 18:02:02 +01:00
Holger Weiss 2f46aebca2 mod_http_upload: Log nicer warning on unknown host
If an HTTP client issues a request against an unknown host, log a
readable warning (rather than an unreadable error) and respond with a
404 (rather than a 500) status.
2019-02-28 00:28:46 +01:00
Paweł Chmielowski 456e87e8b2 Copy p1_time_compat:unique_timestamp() to misc and make use of it 2019-02-27 11:00:02 +01:00
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
Paweł Chmielowski 77ac0584ed Remove now() calls that sneaked in in pull requests 2019-02-27 09:56:31 +01:00
Evgeny Khramtsov 0250826cf9 Update mod_mqtt_mnesia.erl 2019-02-26 13:45:53 +03:00
Christoph Scholz e257bc3d32 acl for mam_preferences 2019-02-25 22:21:30 +01:00
Paweł Chmielowski d04a2454cc Add Accept header to requests issued by rest.erl 2019-02-25 16:18:13 +01:00
Evgeny Khramtsov a3df791373 Add MQTT support 2019-02-25 11:42:09 +03:00
Holger Weiss 3491fa3fea mod_muc_admin: Fix indentation 2019-02-23 23:50:14 +01:00
Christoph Scholz dd7754bc59 only destroy rooms if mam is enabled
when using ejabberdctl rooms_empty_list or rooms_empty_destroy only
select rooms that are have mam enabled. Otherwise you may accidently
destroy rooms which seem to be unsused due to archive being empty
2019-02-23 22:48:15 +01:00
Holger Weiss f63dcdb790 mod_mam_sql: Improve check for empty archive
Avoid counting the messages of an archive to check whether it's empty.
2019-02-21 23:50:16 +01:00
Holger Weiss 9a3a7369cb mod_mam_mnesia: Fix check for empty archive
Don't return 'true' if the key exists but points to an empty archive.
Also, avoid looking up all keys.
2019-02-21 22:19:29 +01:00
Evgeny Khramtsov 1684436bfe Merge branch 'mix' 2019-02-21 12:36:33 +03:00
Holger Weiss 9c66cc5885 Merge remote-tracking branch 'processone/pr/2763'
* processone/pr/2763:
  disallow room creation if archive not empty and clear_archive_on_room_destroy is false
  check if mod_mam is loaded before calling mod_mam:is_empty_for_room
  added cmds to list and destroy empty rooms by ejabberdctl
  allow check if archive is empty for or user or room
  option to prevent archive removal on room destroy
2019-02-20 17:01:34 +01:00
Evgeny Khramtsov 8def827f9c Don't crash on malformed 'modules' section 2019-02-19 12:31:18 +03:00
Christoph Scholz 5e7f234ac8 disallow room creation if archive not empty and
clear_archive_on_room_destroy is false
2019-02-18 13:42:45 +01:00
Christoph Scholz f987db5a39 check if mod_mam is loaded before calling mod_mam:is_empty_for_room 2019-02-18 13:42:45 +01:00
Christoph Scholz a47c566b39 added cmds to list and destroy empty rooms by ejabberdctl 2019-02-18 13:42:45 +01:00
Christoph Scholz 2e586000d7 allow check if archive is empty for or user or room 2019-02-18 13:42:45 +01:00
Christoph Scholz 89b9e25588 option to prevent archive removal on room destroy 2019-02-18 13:42:45 +01:00
Paweł Chmielowski b30775a357 Don't perform roster push for non-local contacts in mod_shared_roster
If group have member with jid from external server we tried to make
mod_roster sent roster push to it, and it sometimes didn't like to get
bogus data like that, so let's check if it's local user before doing this.
2019-02-18 12:37:42 +01:00
Holger Weiss abdbc5df13 mod_push: Improve notification error handling
Don't disable push notifications if the app server returned a temporary
error, and log the app server's notification response.
2019-02-11 22:29:49 +01:00
Badlop e18522f74c Once just_created isn't true, use it to keep room process creation (#2787) 2019-02-11 16:56:33 +01:00
Paweł Chmielowski ea32d3f02c Send mucsub subscriber notification events with from set to room jid 2019-02-11 13:04:06 +01:00
Badlop 2819e26c8f Add notice about rooms_unused_destroy using the room history (#2787) 2019-02-06 16:34:02 +01:00
Badlop 6cd458d205 Don't consider room's lack of history when history_size is zero (#2787) 2019-02-06 16:33:59 +01:00
Badlop c41c5b2185 Fix support to restart module with live options in WebAdmin 2019-02-06 13:30:30 +01:00
Badlop 7074a39ff3 Handle versioning result when shared roster group has remote account (#2692) 2019-02-06 12:36:01 +01:00
Badlop 8baced0d8b Merge branch 'mod_ping_no_kill' of https://github.com/fdie/ejabberd into 3 2019-02-01 16:21:58 +01:00
Frank Diebolt 4ff4711d4f catch badarg exceptions on invalid callback procs 2019-01-31 18:14:36 +01:00
Christophe Romain 9577fe3ba8 Fix argument name consistency 2019-01-31 18:05:39 +01:00
Frank Diebolt 9b66894dda ! may raise exceptions on invalid proc 2019-01-31 17:44:11 +01:00
Christophe Romain ae7b391657 Do not overwrite odbc config file (#2295) 2019-01-31 13:25:56 +01:00
Paweł Chmielowski bbffd396f6 Produce better error for http_api request with extra parameters 2019-01-30 16:35:06 +01:00
Paweł Chmielowski 56baa07d48 Reject request http_api request that have malformed Authentication header 2019-01-30 16:34:29 +01:00
Paweł Chmielowski 096b4a50e5 Require that both tag and module matched in from of api_permission 2019-01-30 13:09:06 +01:00
Paweł Chmielowski 62ad1e5e4f Allow specifying tag for listener for api_permission purposes
This commit will allow adding tag to http listeners:

listener:
  - port: 4000
  - module: ejabberd_http
  - tag: "magic_listener"

that later can be used to have special api_permission just for it:

api_permissions:
  "magic_access":
    from:
      - tag: "magic_listener"
    who: all
    what: "*"
2019-01-30 12:57:03 +01:00
Frank Diebolt 7df03ef56f Revert "Apply shaping to websocket connections"
This reverts commit dda89aeda0.
2019-01-30 10:37:26 +01:00
Frank Diebolt dda89aeda0 Apply shaping to websocket connections 2019-01-30 09:57:17 +01:00
Frank Diebolt dd57950103 Fix ping IQ reply/timeout processing ("mod_ping" regression since 17.x that may cause resources leakage) 2019-01-29 18:13:28 +01:00
AquarHEAD Lou 3f3e04812b
Rename two presence functions
send_self_presence is actually implementing XEP-0115, while
send_initial_presence is implementing the "self-presence" step as
described in XEP-0045
2019-01-27 16:48:05 +00:00
Paweł Chmielowski 9e0baef233 Make last commit compile on R19 2019-01-22 14:40:01 +01:00
Paweł Chmielowski 74731a5816 Make sure that room_destroyed is called even when some code throws in terminate
We observed that some code was throwing exception in muc_room:terminate()
and that make this room not properly unregister itself from muc_online
table.
2019-01-22 14:22:23 +01:00
Badlop 0c794c105f Fix crash when running reload_config and sql_pool_size option is used
Fixes #2541
2019-01-21 13:35:21 +01:00
Evgeny Khramtsov 5e9945f060 Improve validation of configured language options 2019-01-19 11:29:45 +03:00
Paweł Chmielowski a8b1a58cc8 Add os_mon to included_application, but start it in ej_system_monitor 2019-01-16 15:40:10 +01:00
Paweł Chmielowski a30bfefb98 Move some apps back to included_applications 2019-01-16 15:01:32 +01:00
Paweł Chmielowski 0d952abe7d Start ejabberd_mnesia before starting mnesia 2019-01-15 18:34:19 +01:00
Paweł Chmielowski 7183fe6b80 Guard agains sm:get_user_info returning offline
This fixes issue #2765
2019-01-15 10:04:15 +01:00
Evgeny Khramtsov 1b0d481f41 Don't produce a crash on config reload when SQL is not configured 2019-01-12 23:40:33 +03:00
Christophe Romain e4067df85e
Merge pull request #2748 from area-42/add_acl_for_mam_in_mod_muc
add acl for mam in mod_muc
2019-01-10 14:29:02 +01:00
Paweł Chmielowski 5bbb4da397 Start ejabberd_logger also when ejabberd:start() is not called 2019-01-09 19:03:36 +01:00
Paweł Chmielowski d47bc1efdb Use OTP application startup infrastructure for starting dependencies 2019-01-09 18:14:50 +01:00
badlop 325877446a
Merge pull request #2680 from Iperity/fix-privacy-check-on-presence-probe
Privacy lists: set from/to on packet *before* calling privacy_check_p…
2019-01-09 16:31:14 +01:00
Christophe Romain 3fa68b17d9 Remove slash producing url /admin//additions.js 2019-01-09 11:55:42 +01:00
Badlop 55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Holger Weiss c3a807832d mod_private: Hardcode item ID for PEP bookmarks
Set the item ID to "current" when publishing bookmarks via PEP.
XEP-0060 says: For singleton nodes, "it is RECOMMENDED for the publisher
to specify an ItemID of 'current' to ensure that the publication of a
new item will overwrite the existing item."
2019-01-08 21:23:21 +01:00
Evgeny Khramtsov edf03b0f3d mod_offline: make some database callbacks optional 2019-01-08 13:41:16 +03:00
Paweł Chmielowski 06d69c5277 Fix decompressing of custom elements with custom namespace 2019-01-07 16:08:58 +01:00
Christoph Scholz 7e4287ff83 add acl for mam in mod_muc 2019-01-04 15:56:41 +01:00
badlop 9631baaa63
Merge pull request #2599 from gardenia/master
Eliminate some repeated SQL queries [Issue #1656]
2019-01-04 12:20:50 +01:00
Evgeny Khramtsov 9af70913b5 mod_mam: more checks for database failure 2019-01-02 21:11:22 +03:00
Badlop 1246a7a50f Add no-store hint to CAPTCHA challenge stanzas (#2730) 2018-12-26 14:04:36 +01:00
Evgeny Khramtsov d5fab856f4 mod_mam: Additional checks for database failures 2018-12-21 22:29:20 +03:00
Badlop 740ea3a047 Handle Prosody storage attributes key, when, with (#2724) 2018-12-21 15:15:02 +01:00
Badlop 011cf55eb5 Handle persist=false in roster items (#2722) 2018-12-21 15:15:00 +01:00
Paweł Chmielowski e9d537527c We are handling groupchat in other branch now 2018-12-20 13:51:05 +01:00
Paweł Chmielowski 69a986a09e Add option to mod_offline that would allow storing group chat messages 2018-12-20 13:28:18 +01:00
Badlop 788d829823 Fix PIEFXIS export of user when password is scrammed (#2721) 2018-12-19 13:17:28 +01:00
Badlop 590bb0e64a Search also for _jid when importing room from prosody (#2723) 2018-12-19 12:11:59 +01:00
Badlop 0b151f5902 Parse persistent and archiving room options importing from prosody (#2720) 2018-12-19 12:11:56 +01:00
Paweł Chmielowski c88a2d0569 Add code for handling deprecations of get_stacktrace() 2018-12-13 11:46:53 +01:00
Christophe Romain f6a557ec86 Add hook on api call 2018-12-11 11:07:07 +01:00
Holger Weiss 1c1694c6bf mod_roster: Don't set version to "not_found"
Don't include a "ver" attribute with roster pushes if no roster version
is available.
2018-12-10 21:38:14 +01:00
Badlop 446ff9257c Don't require a full JID as argument, instead set a dummy resource (#2710) 2018-12-10 21:06:26 +01:00
Badlop f2bd2f6e37 When unknown roster version, return an acceptable version ID binary (#2709) 2018-12-10 20:30:42 +01:00
Evgeny Khramtsov 33202d59c0 Merge branch 'master' into mix 2018-12-10 17:07:28 +03:00
Evgeny Khramtsov 8295bcebec Fix (un)setting of priority 2018-12-10 17:06:21 +03:00
Evgeny Khramtsov e568dc3866 Get rid of outdated mod_mix module 2018-12-10 16:50:13 +03:00
Evgeny Khramtsov 74e8c0376f Merge branch 'master' into mix 2018-12-10 11:57:04 +03:00
Evgeny Khramtsov 6cd8d1025c Don't lose carbons on presence change or session resumption 2018-12-10 11:53:27 +03:00
Evgeny Khramtsov a5ac1d15e7 Avoid badfun in multicast/6 2018-12-07 21:34:49 +03:00
Evgeny Khramtsov 0e954da3fa Fix wording 2018-12-07 20:48:13 +03:00
Evgeny Khramtsov 4f5552128b Fix mod_mix_mnesia get_participants/3 callback 2018-12-07 20:41:37 +03:00
Evgeny Khramtsov 6afefd7bbf Fix submission-id and channel resource 2018-12-07 11:06:26 +03:00
Paweł Chmielowski 3b1c0dc27f Normalize hostname when processing host_config 2018-12-06 15:12:23 +01:00
Paweł Chmielowski 755f34d3ef Start fast_tls before pkix 2018-12-06 13:42:08 +01:00
Holger Weiss 160ffce090 mod_private: Add "bookmarks_to_pep" command
The "bookmarks_to_pep" command exports the bookmarks of the specified
user from private XML storage to PEP.
2018-12-05 22:04:40 +01:00
Holger Weiss 074ebd80f6 mod_pubsub: Improve PEP behavior for 'whitelist'
If a PEP node's access_model is set to 'whitelist' (or 'authorize'),
send last PEP notifications to the node owner.
2018-12-05 18:25:40 +01:00
Paweł Chmielowski 45eb08d05c Add auth:which_user_exist to bulk checking existence of list of users 2018-12-05 14:22:09 +01:00
Paweł Chmielowski a6c06964e1 Add list types to sql_pt 2018-12-05 13:11:52 +01:00
Badlop 0ae3f624ca Revert "Let deliver unsubscribe stanza when no roster push is required (#2598)"
This reverts commit 86048f8a25.
2018-12-05 12:17:16 +01:00
Badlop 86048f8a25 Let deliver unsubscribe stanza when no roster push is required (#2598) 2018-12-05 11:45:54 +01:00
Evgeny Khramtsov d5e4da54cf Update MIX code to reflect newest specification
Note that support for older specification is completely dropped,
i.e. no backward compatibility is provided since the XEPs are
still very experimental and being changed drastically
2018-12-05 13:14:29 +03:00
Alexey Shchepin 8ebcba4d08 Fix PostgreSQL compatibility in mod_offline_sql:remove_old_messages (#2695) 2018-12-05 01:56:39 +03:00
Paweł Chmielowski e85fa96cf7 Proxy protocol may send additional data after addresses 2018-12-04 15:23:28 +01:00
Paweł Chmielowski 6845896d12 Add support for proxy protocol
This add support for version 1 and 2 of protocol specified in
http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

To enable it you need add option use_proxy_protocol: true to listener.
2018-12-04 14:22:45 +01:00
Paweł Chmielowski 9139ea86fb Format list of {{name,string}, {value, _}} as json struct name/val 2018-12-03 13:53:07 +01:00
Paweł Chmielowski 59a148d80b Make mod_http_api assume that missing args of type list are empty list 2018-12-03 13:53:07 +01:00
Evgeny Khramtsov 109ed8f2f6 Keep info about carbons inside session table
Accordingly, Mnesia/SQL/Riak table 'carboncopy' is not used anymore
and can be safely removed.

As a consequence, the commit deprecates the following options of
mod_carboncopy:
- ram_db_type
- use_cache
- cache_size
- cache_missed
- cache_life_time

Fixes #2663
2018-12-01 13:33:44 +03:00
Holger Weiss a9539fef22 ejabberd_s2s_in: Check for subdomain configuration
If an incoming s2s connection to a subdomain such as
conference.example.com is accepted, check for host-specific
configuration settings for that subdomain rather than for example.com.
This is for consistency with ejabberd_s2s_out, and with my previous
commit.
2018-12-01 10:14:04 +01:00
Holger Weiss 122dfec03d ejabberd_s2s_in: Check for subdomain certificate
If an incoming s2s connection to a subdomain such as
conference.example.com is accepted and a separate certificate is
available for that subdomain, offer that certificate instead of the one
for example.com.

Thanks to Mike Kuketz for reporting the bug.
2018-12-01 10:08:28 +01:00
Holger Weiss 2eb907dc7f mod_register: Don't advertise IBR unconditionally
Don't advertise the IBR stream feature if registration is disabled in
the configuration.
2018-12-01 07:21:41 +01:00
Evgeny Khramtsov 59ce0ba6c8 Apply new cache options on mod_stream_mgmt reload 2018-11-30 18:12:27 +03:00
Evgeny Khramtsov 5d27c975dc Keep last handled stanzas number in cache rather than session table 2018-11-30 16:19:00 +03:00
Badlop b8883b5a61 New command unban_ip (#2620) 2018-11-30 13:36:10 +01:00
Evgeny Khramtsov b07b10bdaa Drop some macros related to OTP<19 2018-11-29 13:01:00 +03:00
Evgeny Khramtsov 624485fe26 Implement XEP-0410: MUC Self-Ping optimization
Fixes #2630
2018-11-29 12:16:12 +03:00
Evgeny Khramtsov 3f901b3793 Advertise disco#info and disco#items by MUC room
Fixes #2661
2018-11-29 10:35:03 +03:00
Paweł Chmielowski 0b31aa490b Add xml compression to sql backend of mam 2018-11-28 11:25:16 +01:00
Badlop e37a1a73f1 Add specific Var names to CAPTCHA fallback form fields (#2672) 2018-11-27 19:10:42 +01:00
Badlop 133bc764cd Fix typo in recent PR commit (#2697) 2018-11-23 13:23:00 +01:00
badlop cc9a1a0917
Merge pull request #2697 from Snowmanko/master
Update - fixed ejabberdctl push_roster description
2018-11-23 12:55:44 +01:00
Evgeny Khramtsov fcff3c60b1 Only advertise conversion feature when mod_pubsub is loaded 2018-11-23 14:01:06 +03:00
Evgeny Khramtsov 1cdca1ab99 Support for XEP-0411: Bookmarks Conversion 2018-11-23 13:33:29 +03:00
Evgeny Khramtsov 87f8355908
Merge pull request #2690 from nosnilmot/stopping-hook
Add ejabberd_stopping hook
2018-11-22 23:21:45 +03:00
Snowman 9ed5ba01b2
Update - fixed ejabberdctl push_roster description 2018-11-22 16:32:05 +01:00
Christophe Romain 4b3db3a9cb Relax result matching to fix pgsql keepalive (#2632) 2018-11-21 18:06:32 +01:00
Stu Tomlinson d4cd3ddc32 Add ejabberd_stopping hook
This hook allows modules to detect when ejabberd is stopping and adjust
behaviour if desired
2018-11-19 15:11:33 +00:00
Badlop 06e9d34018 Handle some malformed URL requests in ejabberd_http (#2687) 2018-11-16 12:13:17 +01:00
Evgeny Khramtsov 1d80addb7d Get rid of 'catch-all' statements 2018-11-15 15:07:58 +03:00
Evgeny Khramtsov 43498b39c1 Replace dict with maps
This will improve performance and memory consumptions of large MUCs
2018-11-15 14:13:45 +03:00
Holger Weiss 133c45ce2b Don't suppress notifications on PEP node removal
Send node deletion notifications (as per XEP-0060, #8.4.2) also for PEP
nodes.
2018-11-12 12:54:53 +01:00
Nathan Bruning e965119c0e Privacy lists: set from/to on packet *before* calling privacy_check_packet 2018-11-10 16:56:34 +01:00
Badlop da9bcc3370 Recover logging of user joining room, lost in 32de9a56 (thanks to elexis1) 2018-11-09 13:21:35 +01:00
Alexey Shchepin 48594544ed Fix for the previous commit 2018-11-09 14:18:48 +03:00
Alexey Shchepin d16b99d830 Track presences sent via a multicast service 2018-11-09 03:27:24 +03:00
Badlop 9f7d3520aa Fix unused variable warning 2018-11-06 00:08:45 +01:00
Badlop 602bfa3c3c Local stanzas are routed one by one, not by multicast 2018-11-06 00:07:34 +01:00
Holger Weiss dd93c0b457 ejabberd_logger: Disable debug logging properly
Don't forget to disable xmpp's debug logging when reducing the log level
from 5 to a lower value.
2018-10-31 02:42:54 +01:00
Badlop a73aac691e Don't preprocess arguments, format_args verifies and prepares them (#2629) 2018-10-31 01:34:04 +01:00
Badlop 36891175ec Don't hide result of mod_*:set_* calls 2018-10-30 23:07:30 +01:00
Paweł Chmielowski cb2b927085 Add send_ws_ping to c2s 2018-10-29 12:30:59 +01:00
Holger Weiss 30393bb690 Move unwrap_mucsub_message/1 into misc 2018-10-25 01:22:57 +02:00
Holger Weiss a8b11b6474 Move some functions from xmpp back into ejabberd 2018-10-25 01:05:45 +02:00
Paweł Chmielowski 432ca80db6 Do no add 127.0.0.1 address to trusted_proxies list by default 2018-10-24 15:16:32 +02:00
Paweł Chmielowski 5181983d97 Recognize not_exists error in http_api 2018-10-19 10:30:05 +02:00
Badlop b010a1a0a0 Affiliations other than admin and owner cannot invite to members_only rooms
This is explained in the paragraph:
 If the room is members-only, the service MAY also add the invitee to the
 member list. (Note: Invitation privileges in members-only rooms SHOULD be
 restricted to room admins; if a member without privileges to edit the
 member list attempts to invite another user, the service SHOULD return
 a <forbidden/> error to the occupant; for details, see the Modifying the
 Member List section of this document.)
https://xmpp.org/extensions/xep-0045.html#invite-mediated
2018-10-17 12:57:18 +02:00
Holger Weiss 3d4f65812e ejabberd_s2s_in: Fix indentation 2018-10-15 23:03:53 +02:00
Paweł Chmielowski 914fae3d3e Change logic for archiving mucsub messages
This change should apply usual logic for message wrapped in mucsub except
check for groupchat message, so messages without bodies for example
should be rejected
2018-10-10 18:12:35 +02:00
Paweł Chmielowski a16acd77ed Archive messages with type=normal and pubsub payload (like mucsub messages) 2018-10-08 15:56:44 +02:00
Evgeny Khramtsov ebd50f8a69 Report available options in lexical order 2018-10-04 14:31:41 +03:00
Evgeny Khramtsov d8f831de09 Run ejabberd_started hook earlier 2018-09-29 23:06:34 +03:00
Evgeny Khramtsov 73af98a8dc Add forgotten TURN options to validator
Fixes #2621
2018-09-29 23:05:41 +03:00
Evgeny Khramtsov 984a00195a Fix bugs introduced by previous commit 2018-09-28 00:28:34 +03:00
Evgeny Khramtsov 39fa1a810d Move certificates processing code to pkix application
==== WARNING: MUST BE ADDED TO RELEASE NOTES =====
The commit introduces the following incompatibility:
- Option 'ca_path' is deprecated and has no effect anymore:
  option 'ca_file' should be used instead if needed.
==================================================
2018-09-27 20:37:27 +03:00
Holger Weiss e3a03394c7 mod_avatar: Reduce log level for too large avatars
Log a warning rather than an error when publishing an avatar fails due
to its size exceeding the ?MAX_PAYLOAD_SIZE for PubSub items.
2018-09-26 21:00:52 +02:00
Holger Weiss aa162f30df ejabberd_regexp: Support Unicode 2018-09-26 19:10:32 +02:00
Christophe Romain c109d3eff0 Add odbc connection robustness (#2428) 2018-09-25 16:59:49 +02:00
Badlop e054c2800b Allow a subscribed owner/admin to kick lower-affiliation moderator 2018-09-25 10:55:57 +02:00
Badlop 49f1b4a691 Allow an occupant owner/admin to kick lower-affiliation moderator 2018-09-25 10:55:56 +02:00
Badlop 8b61c7fe4b Allow a subscribed owner/admin to kick participants and visitors 2018-09-25 10:55:54 +02:00
Badlop 9bac2fa185 Allow a subscribed owner/admin to change participant<->visitor 2018-09-25 10:55:51 +02:00
Paweł Chmielowski 0394baaa7a Allow changing invitation message from muc_invite hook 2018-09-21 16:37:52 +02:00
Paweł Chmielowski 1b3a6dd54a Recognize more fields that aren't atom in format_room_option 2018-09-20 18:02:47 +02:00
Evgeny Khramtsov 6d1ea222c0 Remove forgotten debug line 2018-09-19 23:17:04 +03:00
Evgeny Khramtsov 08f3d066b1 Switch more log message to warning level
The commit is supposed to improve logging at loglevel 3, which
is the recommended level for high loaded ejabberd servers
2018-09-19 23:12:14 +03:00
Evgeny Khramtsov ddca2e8b4a Switch mod_fail2ban log messages to warning level 2018-09-19 19:33:33 +03:00
Evgeny Khramtsov a2b2a27bb6 Resize SQL pool on configuration reload
Fixes #2541
2018-09-19 11:55:40 +03:00
Evgeny Khramtsov d60d72d7bf Don't hide 'undef' exceptions during config validation 2018-09-19 01:00:50 +03:00
Evgeny Khramtsov 7ff5f2d3fa Fail early when loading unavailable SIP or STUN modules 2018-09-18 18:19:42 +03:00
Evgeny Khramtsov 1866b56e3b Report real address of a listener 2018-09-18 14:51:42 +03:00
Evgeny Khramtsov e96bfbdbfa Remove useless type specs 2018-09-18 13:24:06 +03:00
Evgeny Khramtsov 3cc964fbcc Fix listeners child specs creation 2018-09-18 13:22:34 +03:00
Evgeny Khramtsov 29f6c43ae3 Remove forgotten debug line 2018-09-18 12:58:29 +03:00
Evgeny Khramtsov 03de853e4f Refactor ejabberd_listener 2018-09-18 12:53:36 +03:00
Holger Weiss d2cdfa66f9 mod_http_upload: Log error if 'put_url' is reused
Log a proper [error] message if a single 'put_url' is used for multiple
virtual hosts.
2018-09-17 21:46:37 +02:00
Badlop d5c1174385 Revert "New option tombstone_expiry locks recent room creation after destroy (#2546)"
This reverts commit efb4fd0d10.
2018-09-17 12:28:39 +02:00
Evgeny Khramtsov dd888f90ec Improve error formatting 2018-09-17 12:08:04 +03:00
Badlop bb9593dd12 Remove unused variables 2018-09-17 10:42:29 +02:00
Evgeny Khramtsov de385591d0 Refactor ejabberd listener API 2018-09-17 11:21:02 +03:00
Holger Weiss adf0d7de91 mod_muc_room: Fix the room's CAPS hash
Don't forget the room's xdata when calculating the CAPS hash.
2018-09-14 00:18:17 +02:00
Marc Schink c156eabb24 mod_register: Remove unused error 'too_many_users' 2018-09-13 21:34:12 +02:00
Badlop 1d6cbd2561 Trigger hook for user_send_packet in send_message command (#2604) 2018-09-13 18:21:30 +02:00
AquarHEAD Lou 8673d2926d
Expect mnesia_up event when joining cluster 2018-09-12 11:01:05 +00:00
colm b0b188aa68 remove some chatty SQL queries by pulling back all groups with opts and filtering in memory. move a call to get_group_name outside of a loop to eliminate redundant repeated queries 2018-09-10 00:08:00 +01:00
Evgeny Khramtsov 2d246f61dd Fix some dialyzer warnings 2018-09-09 09:59:08 +03:00
root b545301f63 fix for freetds UTF-8 corruption 2018-09-07 19:56:39 +03:00
Evgeny Khramtsov 145c0116bf Bump lager version
This is needed for OTP-21 compatibility
2018-09-07 18:03:36 +03:00
Paweł Chmielowski 79c511a441 Add information about real sender to mucsub message meta 2018-09-06 13:36:59 +02:00
Paweł Chmielowski 57936bfa4e Don't stop sending pings when receiving timeout for timeout_action=none 2018-09-04 09:52:41 +02:00
Evgeniy Khramtsov 5c931d7004 Correctly handle empty result with RSM
Fixes #2588
2018-09-02 00:37:07 +03:00
Evgeniy Khramtsov 88d0b71d58 Get stacktrace out of lager context
Calling erlang:get_stacktrace() inside lager functions produces
stacktraces of the logging function itself, not the function which has failed.
2018-09-01 19:37:26 +03:00
Evgeniy Khramtsov b416527e4f Don't set termination reason into presence-unavailable status
Fixes https://github.com/processone/xmpp/issues/35
2018-09-01 17:39:39 +03:00
Holger Weiss 8c8c480477 ejabberd_s2s_in: Log message on connection close
Log a message when an incoming s2s connection is closed, analogous to
the message on outgoing s2s connection close.
2018-08-29 16:23:56 +02:00
Evgeniy Khramtsov b30a9f2f75 Better formatting of unexpected return from Module:start/2 2018-08-28 10:41:57 +03:00
Badlop 0cbd41fbdc Fix max_user_conferences in Mnesia to consider only one MUC service (#2556) 2018-08-20 15:47:53 +02:00
Evgeniy Khramtsov 5b055d7eec Use "localhost" as a default host 2018-08-17 18:42:09 +03:00
Evgeniy Khramtsov f0f3ec211e Disable cache for anonymous auth backend
Fixes #2566
2018-08-17 17:56:23 +03:00
Badlop c3361bab95 Handle get_presence(Pid) when session doesn't exist (#2547) 2018-08-15 12:16:01 +02:00
Badlop f3f3b1586e Fix typo in command description 2018-08-13 16:42:16 +02:00
Badlop 10e01b7bfc Return human error messages when calling export2sql with wrong path (#2480) 2018-08-13 13:56:29 +02:00
Badlop 8f0e066135 In response with list of room subscriptions include also events (#2272) 2018-08-13 12:52:33 +02:00
Badlop dfd96b6037 Remove num_active_users as it uses calls to last_activity mnesia table (#2448) 2018-08-08 14:18:49 +02:00
Badlop 5b373470ac Remove direct calls to muc_room mnesia table in mod_muc_admin (#2448) 2018-08-08 14:18:34 +02:00
Badlop 0146189b65 Add markdown options as specified in the docs git repo 2018-08-07 16:59:26 +02:00
Badlop 4c4c82897c Add import_prosody explanation from docs git repo 2018-08-07 16:58:53 +02:00
Badlop 5509e648ad Allow acme and oauth commands to be read by gen_markdown_doc_for_commands 2018-08-07 16:58:48 +02:00
Badlop c9ba0e83d2 Handle ejabberd_captcha error reports in mod_register_web (#2553) 2018-08-02 18:36:41 +02:00
Marcel Waldvogel 9b48dc9cc3 Make it possible to join extauth pools 2018-07-30 22:49:18 +02:00
Badlop efb4fd0d10 New option tombstone_expiry locks recent room creation after destroy (#2546)
Setting the new mod_muc option tombstone_expiry to a positive integer
will make that any room destroyed gets replaced with a room tombstone.
That tombstone cannot be joined, so it blocks accessing the old room JID
until the expiry seconds have passed.
The default value is 0 seconds, so tombstones are not created.
2018-07-30 19:24:35 +02:00
Holger Weiss 83e2462853 mod_mam: Don't strip offline message stanza IDs
As mod_offline currently doesn't preserve metadata, add an explicit
check for messages retrieved from offline storage to avoid stripping
their stanza IDs.

Thanks to Zuglufttier for spotting this.
2018-07-27 00:27:10 +02:00
Holger Weiss cdfd0cce7b mod_mam: Make sure stanza IDs aren't reused
Strip the stanza ID from the metadata of outgoing messages to make sure
it's not reused for the (local) recipient's MAM archive.
2018-07-27 00:14:48 +02:00
Holger Weiss 2d45832a39 ejabberd_auth: Restore lost case clause
Let check_password_with_authmodule/6 handle the case where
validate_credentials/2 returns an error.  This got lost in commit
4f8af723c6.
2018-07-26 22:37:25 +02:00
Paweł Chmielowski 1af2cf37ea Wait for more data than just <stream:stream> before sending in bosh
This fixes issue #2545
2018-07-26 18:56:05 +02:00
Paweł Chmielowski ca022b6d1f Make sure that we always start inactivity timer from drop_holding_receiver 2018-07-26 17:29:35 +02:00
Paweł Chmielowski e54f1a8485 Set wait_timer to undefined when timer was triggered 2018-07-26 17:29:35 +02:00
Badlop 1be2112634 Fix search for User in vjud
See https://stackoverflow.com/questions/51478247/ejabberd-search-module-failed-to-handle-the-query
2018-07-24 20:01:22 +02:00
Holger Weiss 57a3512dcc mod_http_upload: Adjust default value of 'put_url'
Let the default 'put_url' point to the HTTPS listener specified in the
new default configuration.
2018-07-18 19:44:56 +02:00
Holger Weiss 8ad6afd652 mod_http_upload: Deprecate 'service_url' option
Users should migrate to the 'external_secret' interface.
2018-07-18 18:16:42 +02:00
Holger Weiss e433a63105 mod_http_upload: Avoid function-like macros 2018-07-17 22:28:31 +02:00
Holger Weiss 68c9328a9c Move cancel_timer/1 function into 'misc' module 2018-07-17 20:50:58 +02:00
Holger Weiss 6601f182c4 mod_http_upload: Add "Allow" to OPTIONS response
RFC 2616 says: "A 200 response SHOULD include any header fields that
indicate optional features implemented by the server and applicable to
that resource (e.g., Allow) [...]."
2018-07-17 19:42:57 +02:00
Holger Weiss 326db5535c mod_muc: Don't set default for muc#roomconfig_lang
For the muc#roomconfig_lang setting, no default is preferable over a
possibly incorrect default value.
2018-07-16 15:15:36 +02:00
Holger Weiss 2539be1a04 mod_http_upload: Avoid timers from timer module
Use erlang:start_timer/3 instead of timer:send_after/2, as the former is
more efficient.
2018-07-16 00:17:11 +02:00
Holger Weiss 4e9930597d mod_http_upload: Don't store "external" slots
Don't store requested upload slots if an 'external_secret' is
configured.
2018-07-15 21:53:50 +02:00
Evgeniy Khramtsov 8faa6afa67 Require Redis version >= 3.2.0
Since we now use Lua scripting for cleaning up c2s sessions
the minimum supported Redis version is 3.2.0 or above because
we need to work correctly with Redis replication mechanism.

****** BACKWARD INCOMPATIBILITY WARNING *******
** THIS SHOULD BE ADDED TO THE RELEASE NOTES **
*** PACKAGE MAINTAINERS SHOULD BE INFORMED  ***
***********************************************
2018-07-15 09:52:03 +03:00
Holger Weiss 12e537c43f Avoid "ejabberdctl status" crash 2018-07-14 20:27:30 +02:00
Evgeniy Khramtsov 420e05fa0d Clean up contributed code for Redis SM 2018-07-14 17:53:00 +03:00
Evgeny Khramtsov e2fb154fe9
Merge pull request #2525 from satish-olx/master
Use lua scripting to clear redis sessions.
2018-07-14 16:53:45 +03:00
Evgeniy Khramtsov e9f219a0ac Improve wording 2018-07-14 16:52:09 +03:00
Evgeny Khramtsov 711c5c0d54
Merge pull request #2526 from nosnilmot/enforce-pubsub-option-attributes
Enforce pubsub option required/rejected attributes
2018-07-14 16:42:15 +03:00
Stu Tomlinson f9ed34db4d Enforce pubsub option required/rejected attributes
XEP-0060 states that 'node' and 'jid' attributes to <options> element MUST NOT
be included when <options> are specified at same time as <subscribe> :

https://xmpp.org/extensions/xep-0060.html#subscriber-configure-subandconfig

mod_pubsub will require 'node' and 'jid' attributes on standalone pubsub
options requests, and reject subscribe requests that have options that include
either 'node' or 'jid'
2018-07-14 11:55:38 +01:00
Evgeny Khramtsov 9a895058e7
Merge pull request #2522 from weiss/bump-max-user-conferences
mod_muc: Increase default 'max_user_conferences' value
2018-07-14 08:51:11 +03:00
Paweł Chmielowski e76a57e144 Ensure that returned priority in a number in mod_admin_extra 2018-07-13 09:51:19 +02:00
satish-olx 6fc6bdefc2
Update ejabberd_sm_redis.erl 2018-07-12 16:14:26 +05:30
satish-olx 96e35a3248
Lua script for cleaning redis sessions
Changes:
1. Added extra keys for tracking node -> session mapping
2. Lua script for clearing the sessions in redis itself.
2018-07-12 16:10:24 +05:30
Paweł Chmielowski 48be8e7b1e Adopt code that uses parse_listener_portip after result change 2018-07-11 14:07:24 +02:00
Badlop f40f3a9da7 Fix piefxis import of privacy lists (thanks to crosser)(#2412) 2018-07-11 12:56:57 +02:00