Commit Graph

37 Commits

Author SHA1 Message Date
Evgeniy Khramtsov fc77051b68 Don't call Mod:function() in xmpp_stream callbacks
If a callback function is not defined by the `Mod` then
a call to code_server process is performed. Under heavy load
this may cause code_server to get overloaded. We now avoid this.
2018-05-26 09:06:24 +03:00
Holger Weiss c2235860ab xmpp_stream_in: Run auth result callbacks earlier
Call Mod:handle_auth_success/4 and Mod:handle_auth_failure/4 before
sending the SASL response rather than afterwards.  This way, callbacks
can send a custom response and disconnect.
2018-02-26 00:06:35 +01:00
Evgeniy Khramtsov 672c2f75d3 Introduce option 'validate_stream'
If set to `true`, all incoming XML packets are fully validated
against known schemas. If an error occurs, the packet will be bounced
with the corresponding error reason. The default value is `false`.
The option might be useful to protect client software from sofisticated
bugs related to XML validation as well as for client developers
who want to catch validation errors at early stage of development.

Note that the option might have slight performance impact, so use it
with care on loaded machines.
2018-02-09 18:12:50 +03:00
Evgeniy Khramtsov 795efb2ee1 Improve logging of idle s2s connections 2018-01-28 11:10:22 +03:00
Holger Weiss 666da60cba Reduce log level for unexpected XML input
Log a warning rather than an error when, for example, a client sends a
stanza before opening the stream.
2018-01-24 12:04:52 +01:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov 2d43c07c62 Get rid of ejabberd receiver
ejabberd receivers were meant to serve connections from frontends
to backends. However, this approach was not popular and frontend
related code was removed in previous releases. Now, ejabberd receiver's
code was also removed, making the code shorter and cleaner. Also, in
stress tests ejabberd now handles load more robustly, without
c2s processes overload (even with disabled shapers).

ejabberd_socket.erl is renamed to xmpp_socket.erl: it's supposed to
be finally moved into stand-alone xmpp library.
2017-12-26 18:55:57 +03:00
Evgeniy Khramtsov bd1ff0e897 Fix processing order 2017-12-17 20:19:44 +03:00
Evgeniy Khramtsov 08e642b988 Only allow compression after SASL
See XEP-0170 for details
Thanks to Vitaly Takmazov for spotting this
2017-12-13 16:52:44 +03:00
Evgeniy Khramtsov 614bd9dd72 Better process subtag decoding errors 2017-12-09 22:39:43 +03:00
Evgeniy Khramtsov 242b3d3968 Don't crash on unexpected XML events
In fact, seems like this is a problem in the receiver code
(or fast_xml?) and should be fixed there
2017-11-24 19:38:20 +03:00
Evgeniy Khramtsov 1bb2bae62b Reflect changes in the xmpp lib 2017-10-13 20:48:21 +03:00
Evgeniy Khramtsov f7e8d287d5 Fix a typo 2017-08-25 12:47:33 +03:00
Evgeniy Khramtsov c290b4284f Fix closing of outbound S2S connections 2017-04-15 11:15:50 +03:00
Evgeniy Khramtsov 5774edfe79 Improve ejabberd_c2s:close() 2017-04-15 08:30:41 +03:00
Evgeniy Khramtsov 5c23187d2c Make sure stream trailer is sent in the very end 2017-04-14 20:56:01 +03:00
Evgeniy Khramtsov 408f9b515e Fix c2s connection close on demand
Fixes #1652
2017-04-04 09:52:42 +03:00
Alexey Shchepin 069d28b1ed Get rid of p1_sha calls 2017-03-14 02:31:51 +03:00
Evgeniy Khramtsov 071c1dcb64 Return 'closed' instead of 'einval' on closed sockets 2017-03-12 08:55:54 +03:00
Evgeniy Khramtsov f6e2840947 External components must always provide 'to' attribute 2017-03-01 00:17:27 +03:00
Evgeniy Khramtsov c3ef56702a Add s2s work-around for gmail.com 2017-02-28 20:15:05 +03:00
Evgeniy Khramtsov 719b4d1183 Don't perform useless resourceprep 2017-02-27 13:58:57 +03:00
Holger Weiss 7c159e3881 Let ejabberd_c2s handle <session/> IQ
This fixes the counting of incoming stanzas for stream management.
2017-02-19 22:43:10 +01:00
Evgeniy Khramtsov 940ca9311d Fix some dialyzer warnings 2017-02-18 09:36:27 +03:00
Evgeniy Khramtsov 67c9de6461 Use p1_server behaviour in xmpp_stream layer 2017-02-08 17:16:18 +03:00
Evgeniy Khramtsov 435e5e6263 Make test suite working again 2017-01-23 13:51:05 +03:00
Evgeniy Khramtsov 94b23482a9 Send <compressed/> in correct order 2017-01-21 10:47:55 +03:00
Evgeniy Khramtsov 17fe272dc5 Update copyright headers in new files 2017-01-20 19:56:19 +03:00
Evgeniy Khramtsov 044e55b98e Fix reporting dialback failures 2017-01-18 18:26:31 +03:00
Evgeniy Khramtsov b8db0a8ed6 Reset XML stream before sending SASL <success/> 2017-01-17 22:06:26 +03:00
Evgeniy Khramtsov 31491ebe16 Fix some corner cases while re-reading RFC6120 2017-01-13 11:35:47 +03:00
Evgeniy Khramtsov 1e55e018e5 Adopt remaining code to support new hooks 2017-01-09 17:02:17 +03:00
Evgeniy Khramtsov cf87c5664f Reflect cyrsasl API changes in remaining code 2016-12-31 13:48:55 +03:00
Evgeniy Khramtsov e7fe4dc474 More refactoring on session management 2016-12-30 00:00:36 +03:00
Evgeniy Khramtsov 309bdfbe28 Add xmpp_stream_out behaviour and rewrite s2s/SM code 2016-12-28 09:47:11 +03:00
Evgeniy Khramtsov 7f653cfe76 Rewrite ejabberd_service to use new XMPP stream API 2016-12-11 18:24:51 +03:00
Evgeniy Khramtsov 5cc8e807df Initial version of new XMPP stream behaviour (for review) 2016-12-11 15:03:37 +03:00