As per XEP-0016 and XEP-0191, return a service-unavailable error when an
incoming message was blocked by a privacy list. This lets the user
appear offline to the contact.
When an unacknowledged stanza is resent from the Stream Management
queue, add a timestamp so that the receiving client can display the time
at which the stanza was originally sent.
Provide a simpler interface for adding <delay/> and <x/> timestamps to
stanzas. This also makes sure that only one <delay/> tag and one <x/>
tag is added to a given stanza.
Terminate the ejabberd_c2s process immediately once stanza queue
overflow is detected. This makes sure the FSM won't process additional
stanzas before terminating if the recipient is flooded.
Don't offer the CSI stream feature when mod_client_state isn't actually
configured to filter stanzas. This makes sure clients won't send CSI
tags that end up being ignored.
If "resend_on_timeout" is set to "if_offline", resend unacknowledged
stanzas only if no other resource is online when the session times out.
In other words, allow for sending them to offline storage, but nowhere
else.
When Stream Management is enabled and a gen_tcp:send/2 call fails, go
into the 'wait_for_resume' state immediately. This makes sure that
gen_tcp:send/2 won't be called again, which might avoid an Erlang issue
where gen_tcp:send/2 apparently hangs despite 'send_timeout' (and
'send_timeout_close') being set.
Produce a proper error message instead of crashing when the JID encoded
in the 'previd' value of a <resume/> request is different from the
authenticated JID.
On stanza queue overflow, pass a message to self() using the exclamation
mark operator instead of send_all_state_event/2. This allows for
reusing the existing handler for 'kick' events.
On queue overflow, terminate the c2s session instead of just dropping
items from the queue. This makes sure all stanzas are either delivered
or bounced.
When the FSM goes into the 'wait_for_resume' state, let fsm_next_state/2
take care of updating #state.mgmt_state and of writing the log line.
This doesn't change the behavior, but simplifies the code.
The 'previd' value provided by the client during a session resume
request includes the client's JID and ejabberd's session ID. If there
is a session for the requested JID but with a different session ID,
resumption should fail, but that session shouldn't be closed. This
commit makes sure the latter won't happen.
In practice, this will only make a difference in odd corner cases.
If stream management is enabled, don't exit the c2s process when
ejabberd_socket:send/2 fails, but close the socket instead. This gives
the client a chance to resume the session.
Thanks go to Matthias Rieber for reporting the issue, providing detailed
logs, and testing the fix.
Only the child elements of <iq/> stanzas are qualified by the namespaces
in question, not the <iq/> stanzas themselves.
This change just clarifies the code. It doesn't alter the behaviour, as
those <iq/> stanzas are handed over to jlib:iq_to_xml/1, and that
function ignores the 'xmlns' attribute anyway.
Only stanzas are subject to stream management, so when XEP-0198 support
is enabled, we must distinguish them from non-stanza elements. This
commit adds a send_packet/2 function that can be used in place of
send_stanza/2 or send_element/2 whenever a packet is delivered that
might or might not be a stanza.
If the client says that it handled more stanzas than we sent (due to a
bug in the client's or in our code), increase our outgoing stanza count
accordingly. There's no point in sticking to the old value even if it
was correct, as the client surely won't fix its count during the current
session.
Do not log a warning (but only a debug message) if the client sends an
invalid </a> packet. Some clients do that occasionally, and there's
nothing server admininistrators could do about that.
There are corner cases where certain clients acknowledge more stanzas
than they received. Nothing really bad will happen in those cases, and
server administrators can't do anything about such issues anyway.
Due to timing issues, ejabberd_c2s might receive stream elements from
the client while the session is waiting for stream resumption. Those
elements are now accepted.
Log an informational message when a session goes into the pending state
(waiting for resumption) after the connection was lost. Administrators
may well be interested in this state change when looking into issues.
On connection timeout, drop any messages that were forwarded by some
encapsulating protocol, such as XEP-0280 carbon copies or XEP-0313
archive messages. Bouncing or resending them could easily lead to
unexpected results.
Implement the optional session resumption feature described in XEP-0198.
A client that supports this feature may now resume the previous session
(within a configurable number of seconds) if the connection was lost.
During resumption, ejabberd will retransmit any stanzas that hadn't been
acknowledged by the client.
Implement partial support for XEP-0198: Stream Management. After
successful negotiation of this feature, the server requests an ACK for
each stanza transmitted to the client and responds to ACK requests
issued by the client. On session termination, the server re-routes any
unacknowledged stanzas. The length of the pending queue can be limited
by setting the "max_ack_queue" option to some integer value (default:
500). XEP-0198 support can be disabled entirely by setting the
"stream_management" option to false (default: true).
So far, stream management is implemented only for c2s connections, and
the optional stream resumption feature also described in XEP-0198 is not
(yet) supported.
This addition was originally based on a patch provided by Magnus Henoch
and updated by Grzegorz Grasza. Their code implements an early draft of
XEP-0198 for some previous version of ejabberd. It has since been
rewritten almost entirely.
Use dynamic Rebar configuration
Make iconv dependency optional
Disable transient_supervisors compile option
Add hipe compilation support
Only compile ibrowse and lhttpc when needed
Make it possible to generate an OTP application release
Add --enable-debug compile option
Add --enable-all compiler option
Add --enable-tools configure option
Add --with-erlang configure option.
Add --enable-erlang-version-check configure option.
Add lager support
Improve the test suite
According to XEP-0012, 4. Online User Query, "if the requesting entity
is not authorized to view the user's presence information (normally via
a presence subscription as defined in XMPP IM), the user's server MUST
NOT deliver the IQ-get to an available resource but instead MUST return
a <forbidden/> error in response to the last activity request."
So check for a subscription of from of the jid and bare jid and whether
outgoing presences to From are allowed.
Fixes problem 3 of EJAB-1158.
For EJAB-1045, the special NS_VCARD block for handling incoming vcard
iqs on behalf of clients has already been restricted to cases where the
user or resource part of the recipient is empty. But then the packets
should not have been routed to the c2s process anyway. This patch
completely removes it.
is_privacy_allow is only used in ejabberd_c2s:handle_info/3 to determine
for a few presence types whether the packet is allowed to be forwarded
to the user's client. This only makes sense if To#jid.user and
To#jid.server match StateData#state.user and StateData#state.server.
Also, add the atom in as parameter to a new argument Dir of
is_privacy_allow and extract from that function
privacy_check_packet(StateData, From, To, Packet, Dir) which runs the
privavcy check without converting allow/deny to true/false.
A new callback is introduced on the p1_fsm behaviour:
print_error/1
If the module implements this function, it will be invoked
in case of process crash with the current state data *before*
printing the error in the log. The function must return the
desired State to print.
It is used in ejabberd_c2s to prune the presence sets that
can be large. Instead, the state is changed to include only
the # of elements on each set.
Change inspired in comming changes to gen_server on OTP, and
b01d15abc3 (diff-0)
Introduces two options for mod_roster and mod_roster_odbc:
- {versioning, true | false} Enable or disable roster versioning on ejabberd.
- {store_current_id, true | false} If true, the current roster version is stored on DB (internal or odbc). Otherwise it is calculated on the fly each time.
Performance:
Setting store_current_id to true should help in reducing the load for both ejabberd and the DB.
Details:
If store_current_id is false, the roster version is a hash of the entire roster. If store_current_id is true, the roster version is a hash, but of the current time
(this has to do with transactional semantics; we need to perform both the roster update and the version update on the same transaction, but we don't
have the entire roster when we are changing a single item on DB. Loading it there requires significant changes to be introduced, so I opted for this simpler approach).
In either case, there is no difference for the clients, the roster version ID is opaque.
IMPORTANT:
mod_shared_roster is not compatible with the option 'store_current_id'. Shared roster and roster versioning can be both enabled, but store_current_id MUST be set to false.
SVN Revision: 2428
EJAB-300 (EJAB-890). Check default privacy list when account, not
a specific session, receives a presence subscription
stanza (EJAB-300).
* src/ejabberd_c2s.erl: Likewise
SVN Revision: 1998
remove rosters accidentally (EJAB-549). New functions in
ejabberd_auth to get/check password and know which module accepted
the authentication. New element 'auth_module' in ejabberd_c2s
record 'statedata'. Cyrsasl provides a new property in the
response: {auth_module, AuthModule}.
* src/ejabberd_auth_anonymous.erl: Likewise
* src/ejabberd_c2s.erl: Likewise
* src/cyrsasl_anonymous.erl: Likewise
* src/cyrsasl_digest.erl: Likewise
* src/cyrsasl_plain.erl: Likewise
SVN Revision: 1297
* src/ejabberd_local.erl: Support for IQ responses
* src/jlib.erl: Added iq_query_or_response_info/1 function
* src/jlib.hrl: Added NS_PUBSUB_ERRORS and NS_CAPS
* src/mod_pubsub/Makefile.in: New pubsub+pep implementation
(thanks to Christophe Romain and Magnus Henoch)
* src/ejabberd_sm.erl: Added get_session_pid/3 function
* src/ejabberd_c2s.erl: Added get_subscribed_and_online/1 function
SVN Revision: 1004
a s2s connection to ensure that a muc room always uses the same
connection
Merge branch 'ejabberd_s2s'
Conflicts:
.gitignore
src/configure
src/ejabberd_c2s.erl
src/ejabberd_s2s.erl
SVN Revision: 963
the error code used on unknown namespace.
* src/ejabberd_s2s_out.erl: Improved s2s connection negociation
(dialback namespace usage) when using tls.
* src/ejabberd_sm.erl: Fixed the error code used on unknown
namespace.
* src/mod_register.erl: ejabberd now sends iq result and stream
end on user remove.
SVN Revision: 590
login as long as they have not been answered. mod_roster do no more
depends on mod_offline.
* src/ejabberd_sm.erl: Likewise.
* src/ejabberd_c2s.erl: Likewise.
* src/mod_roster_odbc.erl: Likewise (The ODBC/relational support
has not yet been tested).
* src/mod_roster.hrl: Likewise.
* src/mod_offline.erl: Likewise.
* src/mod_offline_odbc.erl: Likewise.
* odbc/pg.sql: Likewise.
* odbc/mysql.sql: Likewise.
SVN Revision: 569
* src/ejabberd_c2s.erl: Bugfix (thanks to Sergei Golovan)
* doc/guide.tex: Updated (thanks to Sergei Golovan)
* src/msgs/nl.msg: Updated (thanks to Sander Devrieze)
SVN Revision: 531
print-out (make ejabberd_debug=true).
* src/ejabberd_c2s.erl: Added a new debug printout: We can now
print the XML packets send by the server.
SVN Revision: 524
* src/configure.ac: Likewise
* src/mod_muc/mod_muc_room.erl: Weakened presence filtering, added
warning in non-anonymous rooms, room destroying updated to latest
JEP-0045, added a number of occupants and room name in room's
disco#info reply, miscellaneous internal changes (thanks to Sergei
Golovan)
* src/mod_muc/mod_muc.erl: Better support for nick unregistration
(thanks to Sergei Golovan)
* src/ejabberd_zlib/ejabberd_zlib.erl: Zlib support (thanks to
Sergei Golovan)
* src/ejabberd_zlib/ejabberd_zlib_drv.c: Likewise
* src/ejabberd_zlib/Makefile.in: Likewise
* src/ejabberd_c2s.erl: Stream compression support (JEP-0138)
* src/ejabberd_receiver.erl: Likewise
* src/mod_disco.erl: Don't split node name before calling hooks
(thanks to Sergei Golovan)
* src/mod_configure.erl: Support for configuration using ad-hoc
commands (thanks to Sergei Golovan)
* src/mod_announce.erl: Support for sending announce messages
using ad-hoc commands (thanks to Sergei Golovan)
* src/mod_adhoc.erl: Ad-hoc support (JEP-0050) (thanks to Magnus
Henoch)
* src/adhoc.erl: Likewise
* src/adhoc.hrl: Likewise
* src/jlib.hrl: Updated (thanks to Sergei Golovan)
* src/gen_mod.erl: Added function is_loaded/2 (thanks to Sergei
Golovan)
* src/ejabberd_service.erl: Changed error message on handshake
error (thanks to Sergei Golovan)
* src/ejabberd.cfg.example: Updated (thanks to Sergei Golovan)
SVN Revision: 486
moved to mod_register.erl (thanks to Sergei Golovan)
* src/mod_register.erl: Likewise
* src/win32/ejabberd.nsi: Added two pictures in installer (thanks
to Maxim Ryazanov)
* src/win32/ejabberd_header.bmp: Likewise
* src/win32/ejabberd_intro.bmp: Likewise
* src/web/ejabberd_web_admin.erl: Fixed spelling of word
"authentication"
* src/ejabberd_c2s.erl: Likewise
SVN Revision: 375
session (thanks to Maxim Ryazanov)
* src/tls/tls_drv.c: Now reads all certificates from certificate
file instead of reading only first one (thanks to Karl-Johan
Karlsson)
* examples/transport-configs/init-scripts/jabber-gg-transport:
Fixed typo (thanks to Sander Devrieze)
SVN Revision: 304
to "password"
* src/jlib.hrl: More stream error defines (thanks to Sergei
Golovan)
* src/ejabberd_c2s.erl: Support for starttls_required option
(thanks to Sergei Golovan)
* src/mod_muc/mod_muc_room.erl: Fixed mistake in case condition
(thanks to Sergei Golovan)
* src/xml_stream.erl: Added function parse_element/1
* src/expat_erl.c: Added PARSE_FINAL_COMMAND
SVN Revision: 289
(thanks to Leif Johansson)
* src/ejabberd_auth.erl: Added support for ldap_rootdn and
ldap_password options (thanks to Stefan de Konink)
* src/mod_vcard_ldap.erl: Likewise
* src/ejabberd_router.erl: Now possible to route packet via
function call instead of message sending
* src/ejabberd_sm.erl: Added function route/3, use it in route
table
* src/ejabberd_local.erl: Likewise
* src/ejabberd_s2s.erl: Likewise
* (all): Fixed spelling of word "authentication"
* src/*/Makefile.in: Replaced erlc with @ERLC@
SVN Revision: 285
* src/ejabberd_c2s.erl: Send iq-register feature
* src/ejabberd_config.erl: Config file can be configured from the
command line (thanks to Mickael Remond)
* src/web/ejabberd_http.erl: Added SSL support (thanks to Sergei
Golovan)
* src/msgs/*.msg: Updated (thanks to Sergei Golovan)
* src/jlib.hrl: Updated error codes (thanks to Sergei Golovan)
* src/ejabberd_c2s.erl: Likewise
SVN Revision: 266
(thanks to Sergei Golovan)
* src/mod_disco.erl: Added registration of sm features and nodes
(thanks to Sergei Golovan)
* src/mod_vcard.erl: Register vcard-temp feature (thanks to Sergei
Golovan)
* src/jlib.erl: Added functions now_to_utc_string/1,
now_to_local_string/1, and datetime_string_to_timestamp/1 (thanks
to Sergei Golovan)
* src/mod_muc/mod_muc_room.erl: Use time parsing functions from
jlib (thanks to Sergei Golovan)
* ejabberd/src/mod_pubsub/mod_pubsub.erl: Bugfix (thanks to
Mickael Remond)
* src/mod_pubsub/mod_pubsub.erl: Bugfix
SVN Revision: 265
* src/mod_announce.erl: New module to manage announce messages
(thanks to Sergei Golovan)
* src/ejabberd_local.erl: Moved processing of announce messages to
mod_announce (thanks to Sergei Golovan)
* src/ejabberd_c2s.erl: Added several hooks
* src/ejabberd_hooks.erl: Fixed run_fold (thanks to Sergei
Golovan)
* src/ejabberd.cfg.example: Updated (thanks to Sergei Golovan)
* doc/guide.tex: Updated (thanks to Sergei Golovan)
SVN Revision: 256
* src/ejabberd_auth.erl: Now uses two LDAP connections
* src/ejabberd_c2s.erl: Return resource on get_presence request
(thanks to Mickael Remond)
* src/mod_configure2.erl: Bugfix (thanks to Sergei Golovan)
* src/msgs/ua.msg: New Ukrainian translation (thanks to usercard)
* src/msgs/nl.msg: Updated (thanks to Sander Devrieze)
SVN Revision: 247