Compare commits

...

237 Commits

Author SHA1 Message Date
Holger Weiss e87d332394 mod_carboncopy: Apply small code simplification 2015-02-12 00:14:57 +01:00
Holger Weiss bc7f93ad1e Check availability before carbon copying
Before generating a carbon copy for a resource, make sure it's actually
available.  This handles the case where, for some reason, the
'unset_presence_hook' wasn't called during logout of a resource.  Carbon
copies sent to that resource would otherwise be re-routed to another
resource (which might've received a copy of that message already).
2015-02-11 16:12:08 +01:00
Holger Weiss 9f822dd2b8 Don't crash if 'request_path' has unexpected type 2015-02-11 15:38:55 +01:00
Mickaël Rémond 3cba2cb1ec Fix incorrect Elixir name 2015-02-11 10:19:40 +01:00
Holger Weiss 834c680f97 Remove unused function clause in mod_carboncopy 2015-02-11 00:52:47 +01:00
Holger Weiss f075e92f08 Fix "make install" without Elixir support
Don't bail out during "make install" when ./configure was called without
"--enable-elixir".
2015-02-11 00:23:40 +01:00
Paweł Chmielowski fbb512cb5a Disable elixir support in travis tests 2015-02-10 18:22:54 +01:00
Mickaël Rémond 0f80523736 Merge pull request #429 from mremond/master
Add Elixir support to ejabberd
2015-02-10 18:10:27 +01:00
Mickaël Rémond 01e1f677c7 Add Elixir support to ejabberd 2015-02-10 17:56:44 +01:00
Holger Weiss cf929e730f Document EJABBERD_CONFIG_PATH in ejabberdctl.cfg 2015-02-10 00:15:06 +01:00
Holger Weiss 5c32ba49e2 README: Mention commands in the right order 2015-02-09 14:57:23 +01:00
Holger Weiss 2ccbff3b98 README: Mention how to create "configure" script 2015-02-09 14:31:59 +01:00
Holger Weiss d00f0fb1f4 Don't convert configuration values to strings 2015-02-09 01:08:01 +01:00
Holger Weiss 7fd7e53e4a Fix typo in debug message 2015-02-08 23:49:17 +01:00
Badlop ed502673f4 List all available commands in the guide (EJAB-1735) 2015-01-28 17:54:05 +01:00
Badlop 87d2eb5f9a Support for "> ." in YAML configuration files 2015-01-28 17:16:10 +01:00
Evgeny Khramtsov 0c501b760f Merge pull request #414 from weiss/fix-function-specs
Fix a few jlib function specifications
2015-01-23 16:44:48 +03:00
Holger Weiss 0a047d790f Fix a few function specifications 2015-01-23 00:42:18 +01:00
Christophe Romain c4d17d939d Fix integer parameter which can be set to 0 2015-01-22 12:40:27 +01:00
Evgeny Khramtsov 561025ba32 Merge pull request #413 from weiss/fix-timestamp-overflow
Fix timestamp formatting
2015-01-22 11:00:41 +03:00
Badlop 15e77e9c0f New command to reload config (EJAB-1140) 2015-01-21 15:18:46 +01:00
Christophe Romain 120e581865 Fix missing copyright dates to 2015 (EJAB-1733) 2015-01-21 14:52:37 +01:00
Holger Weiss 528aabf49c Increment number of seconds on timestamp overflow
Increment the number of seconds and set the fractional part to zero if
the latter is too large.
2015-01-21 11:20:26 +01:00
Holger Weiss 18d9f18642 Don't match integer() against float() value 2015-01-21 11:06:06 +01:00
Nathan Bruning a983df4848 Fix overflow in XEP-0203 delay: if microseconds exceeded 999499, *** was put in the formatted timestamp 2015-01-21 01:10:41 +01:00
Christophe Romain 0559edd1cd Merge pull request #410 from weiss/enable-transient-supervisors
Enable transient supervisors by default
2015-01-20 13:16:10 +01:00
Holger Weiss 2683b340ae Cosmetic changes for "./configure --help" output 2015-01-20 12:32:22 +01:00
Holger Weiss cc7b68b7c5 Enable transient supervisors by default
Some features (e.g., "ejabberdctl incoming_s2s_number") don't work with
transient supervisors disabled.
2015-01-20 11:50:11 +01:00
Evgeny Khramtsov 104009b3a9 Merge pull request #409 from hamano/scram-stringprep-checking
Scram stringprep checking(correct fix)
2015-01-19 15:23:47 +03:00
HAMANO Tsukasa e01eb734b4 correct fix for #396 2015-01-19 16:00:18 +09:00
HAMANO Tsukasa cb57cfa1a6 correct fix for #396 2015-01-19 15:25:58 +09:00
Badlop 146adce3d6 Update the Guide about using access_commands in YAML/CFG files 2015-01-15 20:00:35 +01:00
Badlop 2c4647a980 Fix binaries when ejabberd_ctl passes auth details 2015-01-15 20:00:06 +01:00
Badlop 7690320f0f Fix access_commands option in ejabberd_xmlrpc, now it works 2015-01-15 17:39:12 +01:00
Evgeniy Khramtsov 4575649e10 Get rid of asn1rt calls 2015-01-15 14:51:20 +03:00
Evgeniy Khramtsov d53a54d900 Ignore warnings_as_errors everywhere 2015-01-15 13:49:24 +03:00
Evgeny Khramtsov 479da33092 Merge pull request #400 from toopay/patch-clarity-cleanup
Fix spec comment and remove useless case block
2015-01-09 19:14:53 +03:00
Taufan Aditya f650fc83ae Fix spec comment and remove useless case block 2015-01-09 22:19:46 +07:00
Evgeny Khramtsov 17a7844e40 Merge pull request #399 from toopay/patch-cleanup-unused-vars
Fix unused vars warning
2015-01-08 21:47:20 +03:00
Taufan Aditya 864e113256 Fix unused vars warning 2015-01-09 01:00:26 +07:00
Badlop e7e8f2f63a Update some RFC links (EJAB-1728) 2015-01-08 18:18:17 +01:00
Badlop 3063a84fe2 Update compilation from git (github #397) 2015-01-08 17:53:25 +01:00
Badlop 5a35405cd5 Update copyright dates to 2015 (EJAB-1733) 2015-01-08 17:34:43 +01:00
Evgeny Khramtsov 4ef2d08456 Merge pull request #396 from hamano/scram-stringprep-checking
checking stringprep in scram authentication
2015-01-08 11:02:23 +03:00
HAMANO Tsukasa ede5a353e8 checking stringprep in scram authentication 2015-01-08 14:12:05 +09:00
Badlop b88fa6f617 Fix missing presences when adding shared groups (Github PR#99, thanks to Bokner) 2015-01-07 13:11:53 +01:00
Badlop 3882c4d514 Fix binaries in command ejabberdctl stop_kindly 2015-01-07 11:44:04 +01:00
badlop d24dc4e9c8 Merge pull request #383 from weiss/fix-shutdown
Give temporary processes a little time to stop cleanly
2015-01-07 11:42:22 +01:00
badlop afaf68159d Merge pull request #395 from weiss/fix-turn-example
Fix example: turn_ip must be specified as string
2015-01-04 12:06:17 +01:00
Holger Weiss a7f578089a Fix example: turn_ip must be specified as string 2015-01-04 00:55:00 +01:00
Evgeny Khramtsov 173d9761ca Merge pull request #387 from weiss/fix-captcha-without-proto
Fix ejabberd_captcha's listener parsing
2014-12-24 19:16:02 +03:00
Holger Weiss 9dc9d75502 Fix ejabberd_captcha's listener parsing
If the "captcha_host" is specified without "http://" or "https://"
prefix, ejabberd_captcha tries to figure out the protocol automatically.
Fix the code that parses the listener configuration in order to do that.
2014-12-24 00:35:22 +01:00
Holger Weiss 06db65e108 Give temporary processes time to stop cleanly
Allow temporary processes to perform some final actions when shutting
down.  For example, moc_muc_room:terminate/3 fails to send 'unavailable'
presence to the room participants when killed immediately.
2014-12-21 21:03:22 +01:00
Jerome Sautret cc958f7787 Fix upgrade of PubSub mnesia tables from older ejabberd version. 2014-12-18 11:51:28 +01:00
Evgeny Khramtsov 8781c8346b Merge pull request #379 from weiss/polish-readme
Polish the README file a bit
2014-12-17 18:36:05 +03:00
Holger Weiss ad4b41730e Apply various cosmetic changes to README file 2014-12-16 22:14:36 +01:00
Christophe Romain 5935b4e104 improve readability of links on github page 2014-12-15 10:52:47 +01:00
Christophe Romain d1f09a29b9 improve README adding feature list 2014-12-15 10:26:57 +01:00
Evgeny Khramtsov df88d9f2e5 Merge pull request #377 from weiss/new-timestamps
Add timestamps to stanzas resent from stream management queue
2014-12-13 09:42:30 +03:00
Holger Weiss 466278fde1 Let jlib use "B" instead of "w" to format integers
As a small optimization, use io:format's "B" control sequence to format
integers.  We don't need to let Erlang figure out the data type if we
already know it.
2014-12-12 23:50:03 +01:00
Holger Weiss 0a19dac4fd Add fractions of seconds to <delay/> timestamps
Include fractions of a second with XEP-0203 <delay/> timestamps, as
specified in XEP-0082.

	Old timestamp: 2014-05-19T11:55:00Z
	New timestamp: 2014-05-19T11:55:00.123Z
2014-12-11 23:11:35 +01:00
Christophe Romain 7e6d310fe4 include static versions of deps in rebar.config/script (thanks to Holger Weiß)(EJAB-1730) 2014-12-11 15:21:58 +01:00
Evgeny Khramtsov ffe3ea8917 Merge pull request #374 from weiss/fix-muc-log-config
mod_muc_log: Fix configuration parsing
2014-12-08 22:56:20 +03:00
Holger Weiss 455039ae69 mod_muc_log: Fix configuration parsing
Fix mod_muc_log's parsing of the "file_permissions" option.

Resolves #373.
2014-12-08 15:51:06 +01:00
Holger Weiss a78a0a65fe Let CSI code add timestamp at later point in time
As a small optimization, make sure we won't add timestamps to presence
stanzas which end up being thrown away by the CSI code.
2014-12-07 16:27:51 +01:00
Holger Weiss ba8f38e2eb XEP-0198: Add timestamp to resent stanzas
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.
2014-12-07 16:12:06 +01:00
Holger Weiss 9899935e42 Improve interface for adding timestamps
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.
2014-12-07 15:55:18 +01:00
Evgeny Khramtsov 865509757c Merge pull request #366 from weiss/remove-unused-field
Remove unused field from ejabberd_c2s #state
2014-11-26 02:42:00 +03:00
Holger Weiss 2cb16bc509 Remove unused field from c2s #state 2014-11-26 00:15:19 +01:00
Evgeny Khramtsov 00dfcc1e10 Merge pull request #350 from flygoast/master
Used current working home as base directory to config relative path.
2014-11-25 14:24:37 +03:00
Evgeny Khramtsov 4163626844 Merge pull request #365 from weiss/csi-config
Fix mod_client_state's configuration parsing
2014-11-25 14:21:18 +03:00
Evgeny Khramtsov f60c721f84 Merge pull request #364 from weiss/copy-normal-messages
Also carbon-copy messages of type "normal"
2014-11-25 14:21:06 +03:00
Evgeny Khramtsov e97e56d776 Merge pull request #363 from weiss/drop-pep-errors
Don't route PEP error messages to clients
2014-11-25 14:20:11 +03:00
Evgeny Khramtsov 6b916e7a04 Merge pull request #354 from weiss/pep-privacy
Respect privacy lists for incoming PEP messages
2014-11-25 14:20:01 +03:00
Evgeny Khramtsov 6279c3fd8d Merge pull request #352 from weiss/no-last-pep-duplicates
Don't duplicate last published PEP items
2014-11-25 14:19:53 +03:00
Holger Weiss 6900a41e7d Fix mod_client_state's configuration parsing
Don't log an "invalid value" message when "queue_presence" or
"drop_chat_states" is set to "false".
2014-11-25 12:05:09 +01:00
Holger Weiss a456482e2f Also carbon-copy messages of type "normal"
It makes no sense to restrict carbon-copying to "chat" messages.
XEP-0280 is expected to be updated accordingly.
2014-11-24 22:37:14 +01:00
Holger Weiss 30687c40ef Don't route PEP error messages to clients 2014-11-24 21:19:32 +01:00
Holger Weiss 16311b73c8 Add new hook: c2s_filter_packet_in
The c2s_filter_packet_in hook can be used to modify or drop incoming
packets before they are transmitted to the client.
2014-11-24 20:55:18 +01:00
badlop b85357d280 Merge pull request #223 from kaLaJengkinG/patch-1
Update id.msg
2014-11-24 11:49:26 +01:00
Evgeny Khramtsov 946b64e166 Merge pull request #361 from weiss/parse-ldap-dn-filter
Fix parsing of "ldap_dn_filter" option
2014-11-22 10:36:21 +03:00
Holger Weiss 46d035c142 Fix parsing of "ldap_dn_filter" option 2014-11-22 01:33:23 +01:00
Evgeny Khramtsov 982215d644 Merge pull request #360 from lbanders/master
Fix for ejabbed bug #359 - now strings are formatted correctly.
2014-11-20 13:45:27 +03:00
Leif Bredgaard Honore 5afa1f6ade Fix for ejabbed bug #359 - now strings are formatted correctly. 2014-11-20 14:21:51 +04:00
Holger Weiss c566b1d01e Respect privacy lists for incoming PEP messages 2014-11-18 01:25:12 +01:00
Holger Weiss 84c227e6ae Don't duplicate last published PEP items
When a contact becomes available, usually both the 'caps_update' hook
and the 'presence_probe_hook' are called.  For remote contacts, both
hooks triggered PEP notifications, so each item was sent twice.  Fix
this by ignoring the 'presence_probe_hook' for remote contacts.
2014-11-18 01:13:22 +01:00
Evgeny Khramtsov ab12270837 Merge pull request #351 from weiss/floating-muc-intervals
Support floating point message/presence intervals
2014-11-16 12:35:21 +03:00
Holger Weiss 3b96525550 Support floating point message/presence intervals
Let mod_muc support floating point values for "min_message_interval" and
"min_presence_interval", as documented in the guide.
2014-11-15 22:35:56 +01:00
Gu Feng 62ccf1cf0e Used current working home as base directory to config relative path.
When a config relative path specified, get_absolute_path would not
return an absolute path. The patch fixed it using current working
home as base directory.

Signed-off-by: Gu Feng <flygoast@126.com>
2014-11-16 00:09:52 +08:00
Evgeny Khramtsov d5ecd32cec Merge pull request #345 from weiss/last-pep-items
Fix sending of last published PEP items to newly-available resources
2014-11-14 21:27:24 +03:00
Evgeny Khramtsov e770d3174d Merge pull request #346 from weiss/fix-type
Cosmetic fix: Use correct type for initial c2s #state.user value
2014-11-14 21:22:46 +03:00
Holger Weiss 2446b66016 Use correct type for initial c2s #state.user value 2014-11-14 15:32:48 +01:00
Holger Weiss f69d1ca282 Send last PEP items to remote subscribers
When a remote subscriber becomes available, send him the last published
PEP items, as we do for local subscribers.

However, the current implementation depends on a running ejabberd_c2s
process of the publisher to send items to remote subscribers.  So, for
those, the behavior is always like it is for local subscribers when
"ignore_pep_from_offline" is set to "true".
2014-11-14 01:33:11 +01:00
Holger Weiss 830fdccd21 Don't broadcast last published PEP items
When a client becomes available, don't send the last published PEP items
of all his peers to all his other peers, but only to that client.
2014-11-14 01:03:26 +01:00
Holger Weiss 5cc30c3977 Move routing of last PEP items into new function
This doesn't change the behavior, but avoids some code duplication.
2014-11-14 00:16:13 +01:00
Holger Weiss 8efae1f05b ODBC: Sync last item notifications with mod_pubsub
A while back, mod_pubsub was modified to address EJAB-1456.  However,
the change was only partially applied to mod_pubsub_odbc.  This commit
adds the remaining part.
2014-11-14 00:02:59 +01:00
Evgeny Khramtsov de3e1c3508 Merge pull request #341 from sezuan/fix-kick-user-command
Fix kick_user command
2014-11-10 23:14:34 +03:00
Matthias Rieber 8184326eb9 Fix kick_user command 2014-11-10 20:53:00 +01:00
Evgeny Khramtsov f47a59de2f Merge pull request #340 from weiss/disable-mechanisms
New option: disable_sasl_mechanisms
2014-11-10 11:47:10 +03:00
Holger Weiss ee0ecd2419 New option: disable_sasl_mechanisms
The new "disable_sasl_mechanisms" option allows for restricting the list
of SASL mechanisms offered to the client.

Closes #339.
2014-11-10 01:10:04 +01:00
Evgeny Khramtsov 7138cc5633 Merge pull request #337 from weiss/fix-install-without-json
Fix "make install" without JSON support
2014-11-06 21:11:17 +03:00
Holger Weiss f95f22aea0 Fix "make install" without JSON support
Don't bail out during "make install" when ./configure was called without
"--enable-json".
2014-11-06 17:11:15 +01:00
Evgeny Khramtsov 25e5253f33 Merge pull request #335 from weiss/avoid-carbon-dups
Avoid duplicates of carbon copies
2014-11-05 23:17:45 +03:00
Holger Weiss 41dc1efde4 Avoid duplicates of carbon copies
When multiple resources have the same (highest) priority, the session
manager routes messages sent to their bare JID to each of these
resources.  When another resource has a lower priority but receives
carbon copies, make sure it won't receive multiple copies of such
messages.
2014-11-05 19:04:02 +01:00
Jerome Sautret 1d2efcc168 Add xref test to travis.
Conflicts:
	.travis.yml
2014-10-31 11:24:56 +01:00
Evgeniy Khramtsov dfb21e802e Fix race in CSI test case 2014-10-31 00:26:22 +03:00
Evgeniy Khramtsov 9a0b951855 Add tests for mod_vcard_xupdate 2014-10-30 23:57:15 +03:00
Christophe Romain 7819986ec0 Merge branch 'master' of github.com:processone/ejabberd 2014-10-30 17:44:04 +01:00
Christophe Romain 295681283a don't stop on error if jiffy.so symlink exists #309 2014-10-30 17:43:57 +01:00
Jerome Sautret 5b0d8b7776 Merge branch 'master' of github.com:processone/ejabberd 2014-10-30 17:19:37 +01:00
Jerome Sautret 1d2ef85b33 Clean up rebar script. 2014-10-30 16:51:01 +01:00
Christophe Romain b550f247e7 fix invalid path of jiffy.so on install #309 2014-10-30 15:47:33 +01:00
Jerome Sautret 565f064b15 Fix xref check when odbc driver is not used. 2014-10-30 15:21:42 +01:00
Jerome Sautret 7db4587eeb Ignore riak_object module call for xref check.
It's used in map-reduce function called from riak vm.
2014-10-30 15:21:35 +01:00
Jerome Sautret fad0d867fc Add xref Makefile target.
Conflicts:
	rebar.config.script
2014-10-30 15:21:25 +01:00
Evgeny Khramtsov 56dab7ddbe Merge pull request #328 from flygoast/master
Return an empty <vCard/> element in an IQ-result when no vCard exists.
2014-10-29 16:43:49 +03:00
Evgeniy Khramtsov 74b67fa0dc Add new option: store_empty_body 2014-10-27 14:18:09 +03:00
Evgeniy Khramtsov 067958d705 Merge branch 'master' of github.com:processone/ejabberd 2014-10-27 13:44:59 +03:00
Evgeniy Khramtsov dec1e1f67f Revert "fix mod_offline to store only chat messages with body xml element"
This reverts commit 436f0832c1.
2014-10-27 13:44:46 +03:00
Evgeny Khramtsov 76b9098a25 Merge pull request #330 from weiss/accept-newline
Accept trailing newline characters in Base64 strings
2014-10-25 21:17:56 +04:00
Holger Weiss 2399aba67d Accept trailing whitespace in Base64 strings 2014-10-25 02:05:02 +02:00
Gu Feng 94cdcd7b34 Return an empty <vCard/> element in an IQ-result when no vCard exists.
According to XEP-0054, if no vCard exists, the server MUST return a stanza
error (which SHOULD be <item-not-found/>) or an IQ-result containing an
empty <vCard/> element.

Signed-off-by: Gu Feng <flygoast@126.com>
2014-10-25 00:55:49 +08:00
Evgeniy Khramtsov bf33f74ef8 Get rid of a hyphen in VSN 2014-10-24 18:01:42 +04:00
Evgeny Khramtsov 8cf43cf750 Merge pull request #325 from weiss/auth-after-tls
Don't advertise authentication mechanisms too early
2014-10-23 14:56:15 +04:00
Holger Weiss 2d748115ee Don't advertise auth mechanisms too early
If "starttls_required: true" is specified for c2s connections,
authentication mechanisms shouldn't be offered before negotiating the
TLS connection.
2014-10-23 10:04:14 +02:00
Evgeny Khramtsov 0b22277b11 Merge pull request #321 from weiss/fix-http-request-record
Use 'request' record definition from header file
2014-10-21 12:12:55 +04:00
Evgeny Khramtsov c7d9b46b6f Merge pull request #324 from liudanking/master
fix odbc_keepalive_interval configuration bug
2014-10-21 11:03:16 +04:00
liudan d2edcf1288 fix odbc keepalive interval bug 2014-10-21 10:05:44 +08:00
Evgeniy Khramtsov 160c9d7698 Remove append_host_config from ejabberd.yml.example 2014-10-20 12:59:30 +04:00
Evgeny Khramtsov ecd35f7ba8 Merge pull request #322 from weiss/xep-0198
XEP-0198: Abort immediately on stanza queue overflow
2014-10-17 11:56:25 +04:00
Holger Weiss 0c24e18b5e XEP-0198: Abort immediately on queue overflow
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.
2014-10-17 01:35:30 +02:00
Holger Weiss 96d6aacede Use 'request' record definition from header file
This fixes a 'badrecord' crash in mod_http_fileserver.
2014-10-16 13:51:13 +02:00
Evgeny Khramtsov adaa067333 Merge pull request #317 from weiss/xep-0198
XEP-0198: Set #state.conn field on session resume
2014-10-13 20:38:15 +04:00
Evgeny Khramtsov 724a31fa13 Merge pull request #318 from weiss/remove-xmlrpc-dep
Remove "xmlrpc" dependency for "make rel"
2014-10-13 20:37:28 +04:00
Holger Weiss 1ccc0d8bcb XEP-0198: Set #state.conn field on session resume 2014-10-12 19:44:35 +02:00
Holger Weiss 3f3f64c217 Remove "xmlrpc" dependency for "make rel"
The "xmlrpc" library isn't used anymore.
2014-10-12 17:23:25 +02:00
Evgeny Khramtsov 97fa57c360 Merge pull request #316 from weiss/really-require-tls
Make sure "starttls_required" can't be bypassed
2014-10-12 11:05:49 +04:00
Holger Weiss 7bdc1151b1 Make sure "starttls_required" can't be bypassed
Don't allow clients to circumvent the "starttls_required" option by
enabling XMPP stream compression.
2014-10-12 02:08:08 +02:00
Evgeniy Khramtsov 4bbf16b21a Fix list unblocking when Riak is used as a backend 2014-10-10 11:38:13 +04:00
Evgeniy Khramtsov d87ca9fb7b Fix format of an XML-RPC response 2014-10-04 12:55:59 +04:00
Evgeniy Khramtsov 7b3209cc7f Switch to P1 implementation of XML-RPC 2014-10-04 12:49:33 +04:00
Evgeniy Khramtsov 1d782db84f Process XML-RPC requests via p1_xml and ejabberd_http 2014-10-04 12:49:12 +04:00
Evgeniy Khramtsov e109f352e3 Make directory creation more robust 2014-10-02 14:21:27 +04:00
Evgeny Khramtsov 6e63ee480e Merge pull request #310 from weiss/ignore-rel-dir
Let Git ignore the "rel/ejabberd" directory
2014-09-30 13:50:32 +04:00
Holger Weiss 90fb19797d Let Git ignore the "rel/ejabberd" directory 2014-09-30 11:35:58 +02:00
Evgeny Khramtsov 415936146b Merge pull request #303 from weiss/no-csi-if-unconfigured
Offer CSI stream feature only if mod_client_state is enabled
2014-09-26 13:16:28 +04:00
Holger Weiss 277e1dc3ff Offer CSI stream feature only if configured
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.
2014-09-25 18:28:20 +02:00
Holger Weiss 56175fef1b Add new hook: c2s_post_auth_features
The c2s_post_auth_features hook can be used to extend the list of stream
features offered after authentication.
2014-09-25 18:15:33 +02:00
Evgeny Khramtsov ef89497d3f Merge pull request #307 from weiss/remove-invisible-presence
Remove invisible presence fields from c2s #state
2014-09-25 17:20:45 +04:00
Holger Weiss 7aec0337e1 Remove invisible presence fields from c2s #state
Invisible presence isn't supported anymore, so the corresponding
ejabberd_c2s #state fields were unused.
2014-09-25 00:08:56 +02:00
Evgeny Khramtsov e49cf604e9 Merge pull request #302 from weiss/ldap-deref-aliases
Rename deref_aliases back to ldap_deref_aliases
2014-09-23 13:54:22 +04:00
Holger Weiss 61c8836740 Rename deref_aliases back to ldap_deref_aliases
The "ldap_deref_aliases" option has accidentally been renamed to
"deref_aliases".  Revert that change (but accept both names for a
while), so that the option name now matches the documentation again.
2014-09-23 11:31:44 +02:00
Evgeny Khramtsov 57dec40007 Merge pull request #301 from Iperity/master
Fix init script
2014-09-18 01:17:04 +04:00
Nathan Bruning 29a841d8c7 Fix init script: use getent to allow ejabberd user from external authentication sources (LDAP) 2014-09-17 21:28:50 +02:00
Evgeny Khramtsov c18413c52b Merge pull request #300 from weiss/resend-if-offline
XEP-0198: Support "resend_on_timeout: if_offline"
2014-09-17 09:31:09 +04:00
Holger Weiss 0a9212583d XEP-0198: Support "resend_on_timeout: if_offline"
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.
2014-09-16 22:42:34 +02:00
Evgeny Khramtsov 19446967fa Merge pull request #299 from sjmackenzie/processone
added p1_utils to reltool.config resolving treap:empty() undefined error
2014-09-15 09:31:27 +04:00
stewart 8d9a9228d9 added p1_utils to reltool.config resolving treap:empty() undefined error 2014-09-15 04:06:07 +00:00
Evgeniy Khramtsov 72fd353988 Avoid generation of excessive records 2014-09-13 22:54:07 +04:00
Evgeny Khramtsov c90786527e Merge pull request #298 from weiss/csi
Add support for XEP-0352: Client State Indication (CSI)
2014-09-12 21:55:10 +04:00
Holger Weiss 1a320baad8 Add tests for Client State Indication support 2014-09-11 18:18:20 +02:00
Holger Weiss b8c98232b8 Support XEP-0352: Client State Indication 2014-09-11 17:44:29 +02:00
Evgeny Khramtsov f723c00762 Merge pull request #297 from weiss/remove-configure-flag
Travis CI: Remove unused configure flag
2014-09-11 19:35:50 +04:00
Holger Weiss 4d59f677a9 Travis CI: Remove unused configure flag
The --disable-http flag no longer exists.
2014-09-10 21:04:43 +02:00
Evgeny Khramtsov 7a48e30523 Merge pull request #296 from weiss/remove-unused-clause
XEP-0198: Remove unused function clause
2014-09-07 07:27:17 +04:00
Evgeny Khramtsov f0887e45b8 Merge pull request #295 from weiss/xep-0198
XEP-0198: Change state immediately when gen_tcp:send/2 returns failure
2014-09-07 07:27:07 +04:00
Holger Weiss 2ca563e328 XEP-0198: Remove unused function clause
In the 'wait_for_resume' state, #state.mgmt_pending_since is always
initialized.  fsm_next_state/2 takes care of that.
2014-09-06 20:39:38 +02:00
Holger Weiss 2e169167d4 XEP-0198: Change state on gen_tcp:send/2 failure
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.
2014-09-06 20:34:32 +02:00
Holger Weiss 11b2921971 XEP-0198: Let fsm_next_state/2 check timeout value
Don't force the fsm_next_state/2 caller to check for 'mgmt_timeout = 0'.
2014-09-06 20:29:02 +02:00
Christophe Romain 646b445515 allow guide not to be compiled for install 2014-09-05 19:16:13 +04:00
Evgeniy Khramtsov 50d7046517 Test MUC nick registration 2014-09-03 21:30:44 +04:00
Evgeniy Khramtsov c3eaa29f70 Parse x:data in jabber:register 2014-09-03 21:30:27 +04:00
Evgeniy Khramtsov ac2ba399a9 Make sure x:data form possesses 'type' attribute 2014-09-03 21:28:55 +04:00
Evgeniy Khramtsov fda73c3d16 Fix privacy checks of presence probes 2014-09-01 16:39:02 +04:00
Evgeniy Khramtsov a1ce33ebf8 Automatically remove IPs from ban, add the documentation 2014-08-27 13:25:49 +04:00
Evgeniy Khramtsov 9be9949dab Remove useless -include() 2014-08-27 13:18:29 +04:00
Evgeniy Khramtsov 0f1d95a074 Ban the IP if there are too many failed authentications 2014-08-27 13:18:22 +04:00
Evgeniy Khramtsov 2430e6691b Add mod_fail2ban 2014-08-27 13:17:56 +04:00
Evgeniy Khramtsov bfd028beea Recompile the xmpp_codec using updated XML generator 2014-08-27 12:55:31 +04:00
Evgeny Khramtsov 2cb0f92fe6 Merge pull request #293 from weiss/fix-comment
Fix a comment in ejabberd_hooks
2014-08-27 12:48:58 +04:00
Evgeny Khramtsov 2ae7d0a122 Merge pull request #292 from weiss/fix-xep-reference
Fix an XEP reference in the guide
2014-08-27 12:48:34 +04:00
Holger Weiss f1ad6f017b Fix a comment in ejabberd_hooks 2014-08-26 01:04:15 +02:00
Holger Weiss c658984531 Fix an XEP reference in the guide 2014-08-26 01:01:11 +02:00
Evgeny Khramtsov 191eeed7c9 Merge pull request #287 from vesvalo/master
Fix return value of mod_shared_roster:delete_group.
2014-08-21 16:32:31 +04:00
vesvalo 01a3c1c2e1 Fix return value of mod_shared_roster:delete_group. Current one is not compatible with mod_admin_extra. 2014-08-21 15:13:43 +04:00
Evgeny Khramtsov 8e3a49d369 Merge pull request #286 from vesvalo/fix_pep_odbc_publishing
fix 404 on pep first publishing with odbc
2014-08-21 13:29:55 +04:00
vesvalo c48b7f272b fix 404 on pep first publishing with odbc 2014-08-21 11:23:58 +04:00
Evgeny Khramtsov 4a9417c501 Merge pull request #284 from weiss/infinity-vs-unlimited
Guide: For consistency, use 'infinity' everywhere
2014-08-21 01:26:22 +04:00
Holger Weiss 72049e5323 Guide: For consistency, use 'infinity' everywhere 2014-08-20 20:43:38 +02:00
Evgeny Khramtsov 33e0bf1c19 Merge pull request #283 from weiss/allow-unlimited-ack-queue
Support "max_ack_queue: infinity"
2014-08-20 17:47:04 +04:00
Evgeny Khramtsov 5ed7f10153 Merge pull request #282 from weiss/fix-muc-option-docs
Fix MUC option docs: "infinity", not "infinite"
2014-08-20 17:44:06 +04:00
Holger Weiss 2802b6cee2 Allow for "max_ack_queue: infinity", as documented 2014-08-20 12:53:26 +02:00
Holger Weiss 44828c54fe Fix MUC option docs: "infinity", not "infinite" 2014-08-20 12:26:03 +02:00
Evgeny Khramtsov ae0d31a8c9 Merge pull request #280 from weiss/store-persistent-muc-on-init
Store peristent MUC room during creation
2014-08-19 13:28:15 +04:00
Holger Weiss 7274dafe10 Store persistent MUC room during creation
Make sure persistent rooms are stored to the database.  Without this
change, a room got lost if the 'persistent' flag was handed over to
mod_muc:create_room/5 and the server was then restartet before any
activity took place in that room.
2014-08-19 11:12:51 +02:00
Evgeny Khramtsov bc2e26fecd Merge pull request #277 from weiss/xep-0198
XEP-0198: Create shorter session resume IDs
2014-08-15 19:15:32 +04:00
Holger Weiss 2d4c39cd54 XEP-0198: Create shorter resume IDs
Omit the user and server name from the 'previd' value.
2014-08-15 10:56:59 +02:00
Evgeny Khramtsov 9484b11383 Merge pull request #276 from weiss/xep-0198
XEP-0198: Don't crash if the resume ID is incorrect
2014-08-15 10:49:59 +04:00
Holger Weiss 848e1497d1 XEP-0198: Gracefully handle broken 'previd'
Produce a proper error message instead of crashing when the 'previd'
value of a <resume/> request has an unexpected format.
2014-08-15 01:54:41 +02:00
Holger Weiss 2daf95e93f XEP-0198: Gracefully handle wrong credentials
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.
2014-08-15 01:53:47 +02:00
Evgeny Khramtsov 1b1d9b5a73 Merge pull request #269 from Iperity/master
Fix migration of pubsub nodes. Was deleting and re-creating all nodes on...
2014-08-15 03:20:36 +04:00
Evgeny Khramtsov 5836eb5bc2 Merge pull request #268 from benlangfeld/fix/ldap_filter_dnattributes_new_ejabberd
Set dnAttributes on when it's requested by a filter
2014-08-15 03:19:18 +04:00
Evgeniy Khramtsov 5c88f6423a Fix the deprecation warning to reflect YAML format 2014-08-12 14:26:15 +04:00
Evgeniy Khramtsov 56d61c2784 Do not call functions from ejabberd_riak directly 2014-08-12 14:25:54 +04:00
Evgeny Khramtsov 0917209711 Merge pull request #273 from gamenet/master
odb_queries patch return value of functions update and update_t in case of sql insert
2014-08-08 16:03:03 +04:00
vesvalo 8c22b154c9 Merge pull request #2 from vesvalo/master
fix mod_offline to store only chat messages with body xml element
2014-08-08 14:05:35 +04:00
vesvalo 436f0832c1 fix mod_offline to store only chat messages with body xml element 2014-08-08 13:57:27 +04:00
Nikolay Bondarenko 5d0de39127 Merge pull request #1 from vesvalo/master
Fix odbc update_t and update insert case return value
2014-08-08 13:39:44 +04:00
vesvalo 92f89e3d45 Fix odbc update_t and update insert case return value 2014-08-08 13:26:16 +04:00
Evgeny Khramtsov f91caf7108 Merge pull request #270 from weiss/log-s2s-in-auth
Log authentication method for incoming s2s connections
2014-08-05 16:51:51 +04:00
Holger Weiss 38c016a041 Log auth method for incoming s2s connections
Generate an [info] message that logs whether an incoming s2s connection
is authenticated using the SASL EXTERNAL mechanism or via Server
Dialback.  While at it, also mention whether TLS is enabled.
2014-08-05 14:10:32 +02:00
Nathan Bruning 4f63cb21c2 Fix migration of pubsub nodes. Was deleting and re-creating all nodes on each startup. 2014-08-03 21:03:16 +02:00
Evgeny Khramtsov 2e70c59471 Merge pull request #267 from weiss/replace-echo-calls
doc/Makefile: Replace non-portable echo(1) calls
2014-08-01 19:25:01 +04:00
Alexey Shchepin f00725dffb mod_offline now uses gen_server 2014-07-31 14:26:09 +04:00
Christophe Romain 4205108f30 typo fix on roster subscription (EJAB-1711) 2014-07-31 11:50:22 +02:00
Ben Langfeld 651de2ca8e Set dnAttributes on when it's requested by a filter 2014-07-29 15:22:54 -03:00
Holger Weiss e79290fb56 doc/Makefile: Replace non-portable echo(1) calls
The echo(1) behavior is system-dependent, the printf(1) behavior is not.
2014-07-28 22:54:09 +02:00
Evgeniy Khramtsov db3c469d4d Reorganize mod_announce test in order to avoid race 2014-07-28 13:42:50 +04:00
Evgeny Khramtsov 7d93463d31 Merge pull request #266 from weiss/remove-http
Remove "--enable-http" flag
2014-07-28 11:08:13 +04:00
Evgeny Khramtsov 5d79dff4f3 Merge pull request #265 from weiss/mention-starttls-required
Mention "starttls_required" option in sample configuration file
2014-07-28 11:06:59 +04:00
Evgeny Khramtsov 58fd56e6a2 Merge pull request #264 from weiss/su-without-p
ejabberdctl: Omit su(1)'s "-p" flag
2014-07-28 11:06:27 +04:00
Holger Weiss f1e6365ee1 Remove "--enable-http" flag
Specifying the "--enable-http" flag on the ./configure command line had
no effect.
2014-07-27 12:51:25 +02:00
Holger Weiss 4a02df8b6d Mention "starttls_required" option in ejabberd.yml
Closes #258.
2014-07-27 12:44:34 +02:00
Holger Weiss bee9ffd91e Apply minor improvement to ejabberd.yml comment 2014-07-27 11:54:30 +02:00
Holger Weiss 3e232952ea ejabberdctl: Omit su(1)'s "-p" flag
On Linux, su(1)'s "-p" flag makes sure the following environment
variables are preserved: $HOME, $SHELL, $USER, and $LOGNAME.  The flag
isn't portable, and since we don't set HOME=$SPOOLDIR anymore, there's
no reason to preserve these variables anyway.

Without "-p", we also don't need to set HOME=$INSTALLUSER_HOME, as su(1)
now does that for us.
2014-07-27 11:21:55 +02:00
Evgeniy Khramtsov c0001184fd Merge branch 'master' of github.com:processone/ejabberd 2014-07-27 13:06:46 +04:00
Evgeniy Khramtsov abeaac1c11 Add tests for mod_announce 2014-07-27 13:06:20 +04:00
Evgeny Khramtsov 6427d9398a Merge pull request #263 from weiss/fix-ejabberdctl-issues
Fix ejabberdctl issues
2014-07-24 20:56:32 +04:00
Evgeny Khramtsov 677b358a9a Merge pull request #262 from weiss/update-gitignore
Let Git ignore the "configure" script
2014-07-24 20:55:50 +04:00
Holger Weiss b997c4325a Let Git ignore the "configure" script 2014-07-24 17:50:43 +02:00
Holger Weiss 9c279f2e06 ejabberdctl: Remove outdated comment
The home directory is no longer set to $SPOOL_DIR.
2014-07-24 17:20:09 +02:00
Holger Weiss 46f01b962a ejabberdctl: Create home directory as root
If the $INSTALLUSER is not root, he will usually not have the necessary
permissions to create his home directory.
2014-07-24 17:16:47 +02:00
Evgeny Khramtsov 9db39a5e4c Merge pull request #261 from weiss/no-bash
doc/Makefile: Don't insist on using /bin/bash
2014-07-24 17:44:06 +04:00
Holger Weiss 43000d9ce4 ejabberdctl: Use $INSTALLUSER's home directory
Make sure ejabberdctl uses the $INSTALLUSER's .erlang.cookie file even
if the script was executed by root.
2014-07-24 15:25:28 +02:00
Holger Weiss 33368b7e5c doc/Makefile: Don't insist on using /bin/bash
Fix "make doc" for systems that don't have /bin/bash.  There's no
bash-specific code in doc/Makefile anymore.
2014-07-24 15:15:00 +02:00
Evgeniy Khramtsov a087af7060 Re-generate the XMPP codec using updated xml_gen 2014-07-24 10:35:17 +04:00
bLaDe 48600ae71d Update id.msg 2014-05-24 17:53:39 +07:00
194 changed files with 13250 additions and 8796 deletions
+5
View File
@@ -7,6 +7,7 @@
/Makefile
/config.log
/config.status
/configure
/aclocal.m4
/contrib/extract_translations/extract_translations.beam
/*.cache
@@ -28,8 +29,12 @@
/ejabberd.init
/ejabberdctl.example
/include/XmppAddr.hrl
/rel/ejabberd/
/src/XmppAddr.asn1db
/src/XmppAddr.erl
/src/ejabberd.app.src
/src/eldap_filter_yecc.erl
/vars.config
/dialyzer/
/test/*.beam
/logs/
+2 -2
View File
@@ -23,8 +23,8 @@ before_script:
script:
- ./autogen.sh
- ./configure --enable-all --disable-http --disable-odbc
- make
- ./configure --enable-all --disable-odbc --disable-elixir
- make xref
- ERL_LIBS=$PWD make test
- grep -q 'TEST COMPLETE, \([[:digit:]]*\) ok, .* of \1 ' logs/raw.log
+27 -3
View File
@@ -11,6 +11,9 @@ DESTDIR =
# /etc/ejabberd/
ETCDIR = $(DESTDIR)@sysconfdir@/ejabberd
# /bin/
BINDIR = $(DESTDIR)@bindir@
# /sbin/
SBINDIR = $(DESTDIR)@sbindir@
@@ -88,6 +91,10 @@ update:
rm -rf deps/.built
$(REBAR) update-deps && :> deps/.got
xref: all
$(REBAR) skip_deps=true xref
translations:
contrib/extract_translations/prepare-translation.sh -updateall
@@ -114,6 +121,7 @@ install: all
|| $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml
$(SED) -e "s*{{rootdir}}*@prefix@*" \
-e "s*{{installuser}}*@INSTALLUSER@*" \
-e "s*{{bindir}}*@bindir@*" \
-e "s*{{libdir}}*@libdir@*" \
-e "s*{{sysconfdir}}*@sysconfdir@*" \
-e "s*{{localstatedir}}*@localstatedir@*" \
@@ -128,6 +136,11 @@ install: all
# Administration script
[ -d $(SBINDIR) ] || $(INSTALL) -d -m 755 $(SBINDIR)
$(INSTALL) -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl
# Elixir binaries
[ -d $(BINDIR) ] || $(INSTALL) -d -m 755 $(BINDIR)
-[ -f deps/elixir/bin/iex ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/iex $(BINDIR)/iex
-[ -f deps/elixir/bin/elixir ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/elixir $(BINDIR)/elixir
-[ -f deps/elixir/bin/mix ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/mix $(BINDIR)/mix
#
# Init script
$(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*" \
@@ -141,6 +154,9 @@ install: all
$(INSTALL) -m 644 ebin/*.beam $(BEAMDIR)
$(INSTALL) -m 644 deps/*/ebin/*.app $(BEAMDIR)
$(INSTALL) -m 644 deps/*/ebin/*.beam $(BEAMDIR)
# Install Elixir and Elixir dependancies
-$(INSTALL) -m 644 deps/*/lib/*/ebin/*.app $(BEAMDIR)
-$(INSTALL) -m 644 deps/*/lib/*/ebin/*.beam $(BEAMDIR)
rm -f $(BEAMDIR)/configure.beam
#
# ejabberd header files
@@ -157,6 +173,7 @@ install: all
# Binary system libraries
$(INSTALL) -d $(SODIR)
$(INSTALL) -m 644 $(DLLs) $(SODIR)
-[ -f $(SODIR)/jiffy.so ] && (cd $(PRIVDIR); ln -s lib/jiffy.so; true)
#
# Translated strings
$(INSTALL) -d $(MSGSDIR)
@@ -180,18 +197,25 @@ install: all
#
# Documentation
$(INSTALL) -d $(DOCDIR)
$(INSTALL) -m 644 doc/dev.html $(DOCDIR)
$(INSTALL) -m 644 doc/guide.html $(DOCDIR)
$(INSTALL) -m 644 doc/*.png $(DOCDIR)
[ -f doc/dev.html ] \
&& $(INSTALL) -m 644 doc/dev.html $(DOCDIR) \
|| echo "No doc/dev.html was built"
[ -f doc/guide.html ] \
&& $(INSTALL) -m 644 doc/guide.html $(DOCDIR) \
|| echo "No doc/guide.html was built"
[ -f doc/guide.pdf ] \
&& $(INSTALL) -m 644 doc/guide.pdf $(DOCDIR) \
|| echo "No doc/guide.pdf was built"
$(INSTALL) -m 644 doc/*.png $(DOCDIR)
$(INSTALL) -m 644 COPYING $(DOCDIR)
uninstall: uninstall-binary
uninstall-binary:
rm -f $(SBINDIR)/ejabberdctl
rm -f $(BINDIR)/iex
rm -f $(BINDIR)/elixir
rm -f $(BINDIR)/mix
rm -fr $(DOCDIR)
rm -f $(BEAMDIR)/*.beam
rm -f $(BEAMDIR)/*.app
+129 -30
View File
@@ -1,54 +1,145 @@
ejabberd - High-Performance Enterprise Instant Messaging Server
---------------------------------------------------------------
ejabberd Community Edition, by ProcessOne
=========================================
ejabberd is a distributed, fault-tolerant technology that allows the creation
of large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to
provide exceptional standards of fault tolerance. As an open source
technology, based on industry-standards, ejabberd can be used to build bespoke
solutions very cost effectively.
Key Features
------------
- **Cross-platform**
ejabberd runs under Microsoft Windows and Unix-derived systems such as
Linux, FreeBSD and NetBSD.
- **Distributed**
You can run ejabberd on a cluster of machines and all of them will serve the
same XMPP domain(s). When you need more capacity you can simply add a new
cheap node to your cluster. Accordingly, you do not need to buy an expensive
high-end machine to support tens of thousands concurrent users.
- **Fault-tolerant**
You can deploy an ejabberd cluster so that all the information required for
a properly working service will be replicated permanently on all nodes. This
means that if one of the nodes crashes, the others will continue working
without disruption. In addition, nodes also can be added or replaced on
the fly.
- **Administrator-friendly**
ejabberd is built on top of the Open Source Erlang. As a result you do not
need to install an external database, an external web server, amongst others
because everything is already included, and ready to run out of the box.
Other administrator benefits include:
- Comprehensive documentation.
- Straightforward installers for Linux and Mac OS X.
- Web administration.
- Shared roster groups.
- Command line administration tool.
- Can integrate with existing authentication mechanisms.
- Capability to send announce messages.
- **Internationalized**
ejabberd leads in internationalization. Hence it is very well suited in a
globalized world. Related features are:
- Translated to 25 languages.
- Support for IDNA.
- **Open Standards**
ejabberd is the first Open Source Jabber server claiming to fully comply to
the XMPP standard.
- Fully XMPP-compliant.
- XML-based protocol.
- Many protocols supported.
Additional Features
-------------------
Moreover, ejabberd comes with a wide range of other state-of-the-art features:
- **Modularity**
- Load only the modules you want.
- Extend ejabberd with your own custom modules.
- **Security**
- SASL and STARTTLS for c2s and s2s connections.
- STARTTLS and Dialback s2s connections.
- Web Admin accessible via HTTPS secure access.
- **Databases**
- Internal database for fast deployment (Mnesia).
- Native MySQL support.
- Native PostgreSQL support.
- ODBC data storage support.
- Microsoft SQL Server support.
- **Authentication**
- Internal authentication.
- PAM, LDAP and ODBC.
- External authentication script.
- **Others**
- Support for virtual hosting.
- Compressing XML streams with Stream Compression (XEP-0138).
- Statistics via Statistics Gathering (XEP-0039).
- IPv6 support both for c2s and s2s connections.
- Multi-User Chat module with support for clustering and HTML logging.
- Users Directory based on users vCards.
- Publish-Subscribe component with support for Personal Eventing.
- Support for web clients: HTTP Polling and HTTP Binding (BOSH).
- IRC transport.
- Component support: interface with networks such as AIM, ICQ and MSN.
Quickstart guide
================
----------------
0. Requirements
---------------
### 0. Requirements
To compile ejabberd you need:
- GNU Make
- GCC
- Libexpat 1.95 or higher
- Libyaml 0.1.4 or higher
- GNU Make.
- GCC.
- Libexpat 1.95 or higher.
- Libyaml 0.1.4 or higher.
- Erlang/OTP R15B or higher.
- OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption.
- Zlib 1.2.3 or higher, for Stream Compression support
(XEP-0138). Optional.
- Zlib 1.2.3 or higher, for Stream Compression support (XEP-0138). Optional.
- PAM library. Optional. For Pluggable Authentication Modules (PAM).
- GNU Iconv 1.8 or higher, for the IRC Transport
(mod_irc). Optional. Not needed on systems with GNU Libc.
- GNU Iconv 1.8 or higher, for the IRC Transport (mod_irc). Optional. Not
needed on systems with GNU Libc.
- ImageMagick's Convert program. Optional. For CAPTCHA challenges.
1. Compile and install on *nix systems
--------------------------------------
### 1. Compile and install on *nix systems
To compile ejabberd execute the commands:
To compile ejabberd, execute the following commands. The first one is only
necessary if your source tree didn't come with a `configure` script.
./autogen.sh
./configure
make
To install ejabberd, run this command with system administrator rights
(root user):
To install ejabberd, run this command with system administrator rights (root
user):
sudo make install
These commands will:
- Install the configuration files in `/etc/ejabberd/`
- Install ejabberd binary, header and runtime files in `/lib/ejabberd/`
- Install the administration script: `/sbin/ejabberdctl`
- Install ejabberd documentation in `/share/doc/ejabberd/`
- Create a spool directory: `/var/lib/ejabberd/`
- Create a directory for log files: `/var/log/ejabberd/`
- Install the configuration files in `/etc/ejabberd/`
- Install ejabberd binary, header and runtime files in `/lib/ejabberd/`
- Install the administration script: `/sbin/ejabberdctl`
- Install ejabberd documentation in `/share/doc/ejabberd/`
- Create a spool directory: `/var/lib/ejabberd/`
- Create a directory for log files: `/var/log/ejabberd/`
2. Start ejabberd
-----------------
### 2. Start ejabberd
You can use the `ejabberdctl` command line administration script to
start and stop ejabberd. For example:
@@ -56,7 +147,15 @@ start and stop ejabberd. For example:
ejabberdctl start
For detailed information please refer to the [ejabberd Installation and
Operation Guide][1].
For detailed information please refer to the ejabberd Installation and
Operation Guide available online and in the `doc` directory of the source
tarball.
[1]: http://www.process-one.net/docs/ejabberd/guide_en.html
Links
-----
- Guide: https://www.process-one.net/docs/ejabberd/guide_en.html
- Official site: https://www.process-one.net/en/ejabberd
- Community site: https://www.ejabberd.im
- Forum: https://www.process-one.net/en/forum
+15 -15
View File
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.53)
AC_INIT(ejabberd, m4_esyscmd([echo `git describe --tags 2>/dev/null || echo community` | sed 's/-g.*//' | tr -d '\012']), [ejabberd@process-one.net], [ejabberd])
AC_INIT(ejabberd, m4_esyscmd([echo `git describe --tags 2>/dev/null || echo 0.0` | sed 's/-g.*//;s/-/./' | tr -d '\012']), [ejabberd@process-one.net], [ejabberd])
REQUIRE_ERLANG_MIN="5.9.1 (Erlang/OTP R15B01)"
REQUIRE_ERLANG_MAX="9.0.0 (No Max)"
@@ -82,12 +82,12 @@ AC_ARG_ENABLE(roster_gateway_workaround,
esac],[roster_gateway_workaround=false])
AC_ARG_ENABLE(transient_supervisors,
[AC_HELP_STRING([--enable-transient_supervisors], [use Erlang supervision for transient process (default: no)])],
[AC_HELP_STRING([--disable-transient-supervisors], [disable Erlang supervision for transient processes (default: no)])],
[case "${enableval}" in
yes) transient_supervisors=true ;;
no) transient_supervisors=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-transient_supervisors) ;;
esac],[transient_supervisors=false])
esac],[transient_supervisors=true])
AC_ARG_ENABLE(full_xml,
[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])],
@@ -106,10 +106,10 @@ AC_ARG_ENABLE(mssql,
esac],[db_type=generic])
AC_ARG_ENABLE(all,
[AC_HELP_STRING([--enable-all], [same as --enable-nif --enable-odbc --enable-mysql --enable-pgsql --enable-pam --enable-zlib --enable-riak --enable-json --enable-iconv --enable-debug --enable-http --enable-lager --enable-tools (useful for Dialyzer checks, default: no)])],
[AC_HELP_STRING([--enable-all], [same as --enable-nif --enable-odbc --enable-mysql --enable-pgsql --enable-pam --enable-zlib --enable-riak --enable-json --enable-elixir --enable-iconv --enable-debug --enable-lager --enable-tools (useful for Dialyzer checks, default: no)])],
[case "${enableval}" in
yes) nif=true odbc=true mysql=true pgsql=true pam=true zlib=true riak=true json=true iconv=true debug=true http=true lager=true tools=true ;;
no) nif=false odbc=false mysql=false pgsql=false pam=false zlib=false riak=false json=false iconv=false debug=false http=false lager=false tools=false ;;
yes) nif=true odbc=true mysql=true pgsql=true pam=true zlib=true riak=true json=true elixir=true iconv=true debug=true lager=true tools=true ;;
no) nif=false odbc=false mysql=false pgsql=false pam=false zlib=false riak=false json=false elixir=false iconv=false debug=false lager=false tools=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;;
esac],[])
@@ -185,6 +185,14 @@ AC_ARG_ENABLE(json,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-json) ;;
esac],[if test "x$json" = "x"; then json=false; fi])
AC_ARG_ENABLE(elixir,
[AC_HELP_STRING([--enable-elixir], [enable Elixir support (default: no)])],
[case "${enableval}" in
yes) elixir=true ;;
no) elixir=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-elixir) ;;
esac],[if test "x$elixir" = "x"; then elixir=false; fi])
AC_ARG_ENABLE(iconv,
[AC_HELP_STRING([--enable-iconv], [enable iconv support (default: yes)])],
[case "${enableval}" in
@@ -201,14 +209,6 @@ AC_ARG_ENABLE(debug,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[if test "x$debug" = "x"; then debug=true; fi])
AC_ARG_ENABLE(http,
[AC_HELP_STRING([--enable-http], [build external HTTP libraries ('ibrowse' and 'lhttpc', default: no)])],
[case "${enableval}" in
yes) http=true ;;
no) http=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-http) ;;
esac],[if test "x$http" = "x"; then http=false; fi])
AC_ARG_ENABLE(lager,
[AC_HELP_STRING([--enable-lager], [enable lager support (default: yes)])],
[case "${enableval}" in
@@ -248,9 +248,9 @@ AC_SUBST(pam)
AC_SUBST(zlib)
AC_SUBST(riak)
AC_SUBST(json)
AC_SUBST(elixir)
AC_SUBST(iconv)
AC_SUBST(debug)
AC_SUBST(http)
AC_SUBST(lager)
AC_SUBST(tools)
+10 -10
View File
@@ -1,6 +1,6 @@
# $Id$
SHELL = /bin/bash
SHELL = /bin/sh
CONTRIBUTED_MODULES = ""
#ifeq ($(shell ls mod_http_bind.tex),mod_http_bind.tex)
@@ -11,16 +11,16 @@ CONTRIBUTED_MODULES = ""
all: release pdf html
release:
@echo "Notes for the releaser:"
@echo "* Do not forget to add a link to the release notes in guide.tex"
@echo "* Do not forget to update the version number in ebin/ejabberd.app!"
@echo "* Do not forget to update the features in introduction.tex (including \new{} and \improved{} tags)."
@echo "Press any key to continue"
@printf '%s\n' "Notes for the releaser:"
@printf '%s\n' "* Do not forget to add a link to the release notes in guide.tex"
@printf '%s\n' "* Do not forget to update the version number in ebin/ejabberd.app!"
@printf '%s\n' "* Do not forget to update the features in introduction.tex (including \new{} and \improved{} tags)."
@printf '%s\n' "Press any key to continue"
##@read foo
@echo "% ejabberd version (automatically generated)." > version.tex
@echo "\newcommand{\version}{"`sed '/vsn/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ../ebin/ejabberd.app`"}" >> version.tex
@echo -n "% Contributed modules (automatically generated)." > contributed_modules.tex
@echo -e "$(CONTRIBUTED_MODULES)" >> contributed_modules.tex
@printf '%s\n' "% ejabberd version (automatically generated)." > version.tex
@printf '%s\n' "\newcommand{\version}{"`sed '/vsn/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ../ebin/ejabberd.app`"}" >> version.tex
@printf '%s' "% Contributed modules (automatically generated)." > contributed_modules.tex
@printf '%b\n' "$(CONTRIBUTED_MODULES)" >> contributed_modules.tex
html: guide.html dev.html features.html
+171 -28
View File
@@ -66,12 +66,14 @@
\newcommand{\module}[1]{\texttt{#1}}
\newcommand{\modadhoc}{\module{mod\_adhoc}}
\newcommand{\modannounce}{\module{mod\_announce}}
\newcommand{\modclientstate}{\module{mod\_client\_state}}
\newcommand{\modblocking}{\module{mod\_blocking}}
\newcommand{\modcaps}{\module{mod\_caps}}
\newcommand{\modcarboncopy}{\module{mod\_carboncopy}}
\newcommand{\modconfigure}{\module{mod\_configure}}
\newcommand{\moddisco}{\module{mod\_disco}}
\newcommand{\modecho}{\module{mod\_echo}}
\newcommand{\modfailban}{\module{mod\_fail2ban}}
\newcommand{\modhttpbind}{\module{mod\_http\_bind}}
\newcommand{\modhttpfileserver}{\module{mod\_http\_fileserver}}
\newcommand{\modirc}{\module{mod\_irc}}
@@ -341,7 +343,7 @@ Alternatively, the latest development source code can be retrieved from the Git
\begin{verbatim}
git clone git://github.com/processone/ejabberd.git ejabberd
cd ejabberd
git checkout -b 2.1.x origin/2.1.x
./autogen.sh
\end{verbatim}
@@ -691,6 +693,29 @@ in Erlang terms. The format is still supported, but it is highly recommended
to convert it to the new YAML format using \term{convert\_to\_yaml} command
from \term{ejabberdctl} (see~\ref{ejabberdctl} and \ref{list-eja-commands} for details).
If you want to specify some options using the old Erlang format,
you can set them in an additional cfg file, and include it using
the \option{include\_config\_file} option, see \ref{includeconfigfile}
for the option description and a related example in \ref{accesscommands}.
If you just want to provide an erlang term inside an option,
you can use the \term{"> erlangterm."} syntax for embedding erlang terms in a YAML file, for example:
\begin{verbatim}
modules:
mod_cron:
tasks:
- time: 10
units: seconds
module: mnesia
function: info
arguments: "> []."
- time: 3
units: seconds
module: ejabberd_auth
function: try_register
arguments: "> [\"user1\", \"localhost\", \"pass\"]."
\end{verbatim}
\makesubsection{hostnames}{Host Names}
\ind{options!hosts}\ind{host names}
@@ -1020,7 +1045,7 @@ request_handlers:
/"a"/"b": mod_foo
/"http-bind": mod_http_bind
\end{verbatim}
\titem{resend\_on\_timeout: true|false}
\titem{resend\_on\_timeout: true|false|if\_offline}
If \term{stream\_management} is enabled and this option is set to
\term{true}, any stanzas that weren't acknowledged by the client
will be resent on session timeout. This behavior might often be
@@ -1028,8 +1053,12 @@ request_handlers:
circumstances. For example, a message that was sent to two resources
might get resent to one of them if the other one timed out.
Therefore, the default value for this option is \term{false}, which
tells ejabberd to generate an error message instead. The option can
be specified for \term{ejabberd\_c2s} listeners.
tells ejabberd to generate an error message instead. As an
alternative, the option may be set to \term{if\_offline}. In this
case, unacknowledged stanzas are resent only if no other resource is
online when the session times out. Otherwise, error messages are
generated. The option can be specified for \term{ejabberd\_c2s}
listeners.
\titem{resume\_timeout: Seconds}
This option configures the number of seconds until a session times
out if the connection is lost. During this period of time, a client
@@ -1062,7 +1091,7 @@ request_handlers:
You can define a certificate file for a specific domain using the global option \option{domain\_certfile}.
\titem{stream\_management: true|false}
Setting this option to \term{false} disables ejabberd's support for
\ind{protocols!XEP-0198: Stream Management}. It can be specified for
Stream Management (\xepref{0198}). It can be specified for
\term{ejabberd\_c2s} listeners. The default value is \term{true}.
\titem{timeout: Integer} \ind{options!timeout}
Timeout of the connections, expressed in milliseconds.
@@ -1447,6 +1476,11 @@ The FQDN is used to authenticate some clients that use the DIGEST-MD5 SASL mecha
The option syntax is:
\esyntax{fqdn: undefined|FqdnString|[FqdnString]}
The option \option{disable\_sasl\_mechanisms} specifies a list of SASL
mechanisms that should \emph{not} be offered to the client. The mechanisms can
be listed as lowercase or uppercase strings. The option syntax is:
\esyntax{disable\_sasl\_mechanisms: [Mechanism, ...]}
\makesubsubsection{internalauth}{Internal}
\ind{internal authentication}\ind{Mnesia}
@@ -2023,10 +2057,10 @@ The specific configurable options are:
\titem{turn\_max\_port: Integer}
Together with \option{turn\_min\_port} forms port range to allocate from.
The default is 65535. Implies \term{use\_turn}.
\titem{turn\_max\_allocations: Integer|unlimited}
\titem{turn\_max\_allocations: Integer|infinity}
Maximum number of TURN allocations available from the particular IP address.
The default value is 10. Implies \term{use\_turn}.
\titem{turn\_max\_permissions: Integer|unlimited}
\titem{turn\_max\_permissions: Integer|infinity}
Maximum number of TURN permissions available from the particular IP address.
The default value is 10. Implies \term{use\_turn}.
\titem{auth\_type: user|anonymous}
@@ -2072,7 +2106,7 @@ listen:
port: 3478
transport: udp
use_turn: true
turn_ip: 10.20.30.1
turn_ip: "10.20.30.1"
module: ejabberd_stun
...
\end{verbatim}
@@ -2780,9 +2814,11 @@ The following table lists all modules included in \ejabberd{}.
\hline \modblocking{} & Simple Communications Blocking (\xepref{0191}) & \modprivacy{} \\
\hline \modcaps{} & Entity Capabilities (\xepref{0115}) & \\
\hline \modcarboncopy{} & Message Carbons (\xepref{0280}) & \\
\hline \ahrefloc{modclientstate}{\modclientstate{}} & Filter stanzas for inactive clients & \\
\hline \modconfigure{} & Server configuration using Ad-Hoc & \modadhoc{} \\
\hline \ahrefloc{moddisco}{\moddisco{}} & Service Discovery (\xepref{0030}) & \\
\hline \ahrefloc{modecho}{\modecho{}} & Echoes XMPP stanzas & \\
\hline \ahrefloc{modfail2ban}{\modfailban{}} & Bans IPs that show the malicious signs & \\
\hline \ahrefloc{modhttpbind}{\modhttpbind{}} & XMPP over Bosh service (HTTP Binding) & \\
\hline \ahrefloc{modhttpfileserver}{\modhttpfileserver{}} & Small HTTP file server & \\
\hline \ahrefloc{modirc}{\modirc{}} & IRC transport & \\
@@ -2999,6 +3035,38 @@ Note that \modannounce{} can be resource intensive on large
deployments as it can broadcast lot of messages. This module should be
disabled for instances of \ejabberd{} with hundreds of thousands users.
\makesubsection{modclientstate}{\modclientstate{}}
\ind{modules!\modclientstate{}}\ind{Client State Indication}
\ind{protocols!XEP-0352: Client State Indication}
This module allows for queueing or dropping certain types of stanzas
when a client indicates that the user is not actively using the client
at the moment (see \xepref{0352}). This can save bandwidth and
resources.
Options:
\begin{description}
\titem{drop\_chat\_states: true|false} \ind{options!drop\_chat\_states}
Drop most "standalone" Chat State Notifications (as defined in
\xepref{0085}) while a client indicates inactivity. The default value
is \term{false}.
\titem{queue\_presence: true|false} \ind{options!queue\_presence}
While a client is inactive, queue presence stanzas that indicate
(un)availability. The latest queued stanza of each contact is
delivered as soon as the client becomes active again. The default
value is \term{false}.
\end{description}
Example:
\begin{verbatim}
modules:
...
mod_client_state:
drop_chat_states: true
queue_presence: true
...
\end{verbatim}
\makesubsection{moddisco}{\moddisco{}}
\ind{modules!\moddisco{}}
\ind{protocols!XEP-0030: Service Discovery}
@@ -3117,6 +3185,30 @@ modules:
...
\end{verbatim}
\makesubsection{modfail2ban}{\modfailban{}}
\ind{modules!\modfailban{}}\ind{modfail2ban}
The module bans IPs that show the malicious signs. Currently only C2S authentication
failures are detected.
Available options:
\begin{description}
\titem{c2s\_auth\_ban\_lifetime: Seconds} The lifetime of the IP ban caused by too
many C2S authentication failures. The default is 3600, i.e. one hour.
\titem{c2s\_max\_auth\_failures: Integer} The number of C2S authentication failures to
trigger the IP ban. The default is 20.
\end{description}
Example:
\begin{verbatim}
modules:
...
mod_fail2ban:
c2s_auth_block_lifetime: 7200
c2s_max_auth_failures: 50
...
\end{verbatim}
\makesubsection{modhttpbind}{\modhttpbind{}}
\ind{modules!\modhttpbind{}}\ind{modhttpbind}
@@ -3415,15 +3507,15 @@ Module options:
\titem{max\_room\_id: Number} \ind{options!max\_room\_id}
This option defines the maximum number of characters that Room ID
can have when creating a new room.
The default value is to not limit: infinite.
The default value is to not limit: \term{infinity}.
\titem{max\_room\_name: Number} \ind{options!max\_room\_name}
This option defines the maximum number of characters that Room Name
can have when configuring the room.
The default value is to not limit: infinite.
The default value is to not limit: \term{infinity}.
\titem{max\_room\_desc: Number} \ind{options!max\_room\_desc}
This option defines the maximum number of characters that Room Description
can have when configuring the room.
The default value is to not limit: infinite.
The default value is to not limit: \term{infinity}.
\titem{min\_message\_interval: Number} \ind{options!min\_message\_interval}
This option defines the minimum interval between two messages send
by an occupant in seconds. This option is global and valid for all
@@ -3755,6 +3847,8 @@ online again. Thus it is very similar to how email works. Note that
The default value is \term{max\_user\_offline\_messages}.
Then you can define an access rule with a syntax similar to
\term{max\_user\_sessions} (see \ref{configmaxsessions}).
\titem{store\_empty\_body: true|false}\ind{options!store\_empty\_body} Whether or not
to store messages with empty \term{<body/>} element. The default value is \term{true}.
\end{description}
This example allows power users to have as much as 5000 offline messages,
@@ -3859,9 +3953,9 @@ modules:
\makesubsection{modprivacy}{\modprivacy{}}
\ind{modules!\modprivacy{}}\ind{Blocking Communication}\ind{Privacy Rules}\ind{protocols!RFC 3921: XMPP IM}
This module implements Blocking Communication (also known as Privacy Rules)
as defined in section 10 from XMPP IM. If end users have support for it in
their \XMPP{} client, they will be able to:
This module implements \footahref{http://xmpp.org/rfcs/rfc3921.html\#privacy}{Blocking Communication}
(also known as Privacy Rules).
If end users have support for it in their \XMPP{} client, they will be able to:
\begin{quote}
\begin{itemize}
\item Retrieving one's privacy lists.
@@ -4259,10 +4353,10 @@ It is important to include the last / character in the URL,
otherwise the subpages URL will be incorrect.
\makesubsection{modroster}{\modroster{}}
\ind{modules!\modroster{}}\ind{roster management}\ind{protocols!RFC 3921: XMPP IM}
\ind{modules!\modroster{}}\ind{roster management}\ind{protocols!RFC 6121: XMPP IM}
This module implements roster management as defined in
\footahref{http://xmpp.org/rfcs/rfc3921.html\#roster}{RFC 3921: XMPP IM}.
\footahref{http://tools.ietf.org/html/rfc6121\#section-2}{RFC 6121: XMPP IM}.
It also supports Roster Versioning (\xepref{0237}).
Options:
@@ -5332,15 +5426,10 @@ The \term{ejabberdctl commands} are:
The \term{ejabberdctl} script can be restricted to require authentication
and execute some \term{ejabberd commands}; see \ref{accesscommands}.
Add the option to the file \term{ejabberd.yml}.
In this example there is no restriction:
\begin{verbatim}
ejabberdctl_access_commands: []
\end{verbatim}
If account \term{robot1@example.org} is registered in \ejabberd{} with password \term{abcdef}
(which MD5 is E8B501798950FC58AAD83C8C14978E),
and \term{ejabberd.yml} contains this setting:
and your old-format configuration file contains this setting:
\begin{verbatim}
{hosts, ["example.org"]}.
{acl, bots, {user, "robot1", "example.org"}}.
@@ -5462,7 +5551,7 @@ Other known frontends that can be installed to execute ejabberd commands in diff
\makesubsection{list-eja-commands}{List of ejabberd Commands}
\ejabberd{} includes a few ejabberd Commands by default.
\ejabberd{} includes a few ejabberd Commands by default as listed below.
When more modules are installed, new commands may be available in the frontends.
The easiest way to get a list of the available commands, and get help for them is to use
@@ -5478,8 +5567,11 @@ Available commands in this ejabberd node:
...
\end{verbatim}
The most interesting ones are:
The commands included in ejabberd by default are:
\begin{description}
\titem{stop\_kindly delay announcement} Inform users and rooms, wait, and stop the server.
Provide the delay in seconds, and the announcement quoted.
\titem{registered\_vhosts} List all registered vhosts in SERVER
\titem{reopen\_log} Reopen the log files after they were renamed.
If the old files were not renamed before calling this command,
they are automatically renamed to \term{"*-old.log"}. See section \ref{logfiles}.
@@ -5502,8 +5594,6 @@ The most interesting ones are:
Restore immediately from a text file dump.
This is not recommended for big databases, as it will consume much time,
memory and processor. In that case it's preferable to use \term{backup} and \term{install\_fallback}.
%%More information about backuping can
%% be found in section~\ref{backup}.
\titem{import\_piefxis, export\_piefxis, export\_piefxis\_host} \ind{migrate between servers}
These options can be used to migrate accounts
using \xepref{0227} formatted XML files
@@ -5516,20 +5606,45 @@ The most interesting ones are:
from other Jabber/XMPP servers
There exist tutorials to
\footahref{http://www.ejabberd.im/migrate-to-ejabberd}{migrate from other software to ejabberd}.
\titem{set\_master nodename}
Set master node of the clustered Mnesia tables.
If you provide as nodename "self", this node will be set as its own master.
\titem{mnesia\_change\_nodename oldnodename newnodename oldbackup newbackup}
Change the erlang node name in a backup file
\titem{export2odbc virtualhost directory} \ind{export mnesia data to SQL files}
Export virtual host information from Mnesia tables to SQL files.
\titem{update\_list} List modified modules that can be updated
\titem{update module} Update the given module, or use the keyword: all
\titem{reload\_config} Reload ejabberd configuration file into memory
\titem{delete\_expired\_messages} This option can be used to delete old messages
in offline storage. This might be useful when the number of offline messages
is very high.
\titem{delete\_old\_messages days} Delete offline messages older than the given days.
\titem{incoming\_s2s\_number} Number of incoming s2s connections on the node
\titem{outgoing\_s2s\_number} Number of outgoing s2s connections on the node
\titem{register user host password} Register an account in that domain with the given password.
\titem{unregister user host} Unregister the given account.
\titem{registered\_users host} List all registered users in HOST
\titem{connected\_users} List all established sessions
\titem{connected\_users\_number} Get the number of established sessions
\titem{user\_resources user host} List user's connected resources
\titem{kick\_user user host} Disconnect user's active sessions
\end{description}
\makesubsection{accesscommands}{Restrict Execution with AccessCommands}
The frontends can be configured to restrict access to certain commands.
The frontends can be configured to restrict access to certain commands
using the \term{AccessCommands}.
In that case, authentication information must be provided.
This option allows quite complex settings, so it does not use the YAML format,
instead it uses the Erlang format.
If you want to set that option,
then you must move the frontend definition to another config file
and include it using the \term{include\_config\_file} option
(see section~\ref{includeconfigfile} and the example below).
In each frontend the \term{AccessCommands} option is defined
in a different place. But in all cases the option syntax is the same:
\begin{verbatim}
@@ -5587,6 +5702,34 @@ See another list of restrictions (the corresponding ACL and ACCESS are not shown
]
\end{verbatim}
In summary, you put the frontends configurations in a CFG file using Erlang format, for example a file called \term{additional.cfg}:
\begin{verbatim}
{ejabberdctl_access_commands, [ {ctlaccess, [registered_users, register], []} ]}.
{listen, [
{4560, ejabberd_xmlrpc, [{maxsessions, 10}, {timeout, 5000},
{access_commands, [
{ctlaccess, [registered_users], [{host, "localhost"}]}
]}
]}
]}.
{modules, [
{mod_rest, [
{allowed_ips, [ {127,0,0,1}, {192,168,1,12} ]},
{allowed_destinations, [ "nolan@localhost", "admin@example.com" ]},
{allowed_stanza_types, [ "message", "presence", "iq" ]},
{access_commands, [
{ctlaccess, [registered_users], [{host, "localhost"}]}
]}
]}
]}.
\end{verbatim}
and then add this line at the end of your main ejabberd configuration file, usually called \term{ejabberd.yml}:
\begin{verbatim}
include_config_file: "/etc/ejabberd/additional.cfg"
\end{verbatim}
\makesection{webadmin}{Web Admin}
\ind{web admin}
@@ -6305,7 +6448,7 @@ Thanks to all people who contributed to this guide:
\makechapter{copyright}{Copyright Information}
Ejabberd Installation and Operation Guide.\\
Copyright \copyright{} 2003 --- 2014 ProcessOne
Copyright \copyright{} 2003 --- 2015 ProcessOne
This document is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
+1 -1
View File
@@ -69,7 +69,7 @@ Peter Saint-Andr\'e, Executive Director of the Jabber Software Foundation}
\item \marking{Internationalized:} \ejabberd{} leads in internationalization. Hence it is very well suited in a globalized world. Related features are:
\begin{itemize}
\item Translated to 25 languages. %%\improved{}
\item Support for \footahref{http://www.ietf.org/rfc/rfc3490.txt}{IDNA}.
\item Support for \footahref{http://tools.ietf.org/html/rfc3490}{IDNA}.
\end{itemize}
\item \marking{Open Standards:} \ejabberd{} is the first Open Source Jabber server claiming to fully comply to the XMPP standard.
+1 -1
View File
@@ -24,7 +24,7 @@ test -x "$CTL" || {
echo "ERROR: ejabberd not found: $DIR"
exit 1
}
grep ^"$USER": /etc/passwd >/dev/null || {
getent passwd "$USER" >/dev/null || {
echo "ERROR: System user not found: $USER"
exit 2
}
+10 -2
View File
@@ -108,11 +108,16 @@ listen:
##
## If TLS is compiled in and you installed a SSL
## certificate, specify the full path to the
## file and uncomment this line:
## file and uncomment these lines:
##
## certfile: "/path/to/ssl.pem"
## starttls: true
##
## To enforce TLS encryption for client connections,
## use this instead of the "starttls" option:
##
## starttls_required: true
##
## Custom OpenSSL options
##
## protocol_options:
@@ -553,6 +558,9 @@ modules:
mod_blocking: {} # requires mod_privacy
mod_caps: {}
mod_carboncopy: {}
mod_client_state:
drop_chat_states: true
queue_presence: false
mod_configure: {} # requires mod_adhoc
mod_disco: {}
## mod_echo: {}
@@ -638,7 +646,7 @@ modules:
##
## Enable modules with custom options in a specific virtual host
##
## append_host_config:
## host_config:
## "localhost":
## modules:
## mod_echo:
+11
View File
@@ -148,6 +148,17 @@
#
#EJABBERD_PID_PATH=/var/run/ejabberd/ejabberd.pid
#.
#' EJABBERD_CONFIG_PATH: ejabberd configuration file
#
# Specify the full path to the ejabberd configuration file. If the file name has
# a ".yml" extension, it is parsed as a YAML file; otherwise, Erlang syntax is
# expected.
#
# Default: $ETC_DIR/ejabberd.yml
#
#EJABBERD_CONFIG_PATH=/etc/ejabberd/ejabberd.yml
#.
#'
# vim: foldmarker=#',#. foldmethod=marker:
+81 -38
View File
@@ -12,6 +12,7 @@ ERLANG_NODE=ejabberd@localhost
# define default environment variables
SCRIPT_DIR=`cd ${0%/*} && pwd`
ERL={{erl}}
IEX={{bindir}}/iex
INSTALLUSER={{installuser}}
# Compatibility in ZSH
@@ -22,7 +23,12 @@ if [ "$INSTALLUSER" != "" ] ; then
EXEC_CMD="false"
for GID in `id -G`; do
if [ $GID -eq 0 ] ; then
EXEC_CMD="su $INSTALLUSER -p -c"
INSTALLUSER_HOME=$(getent passwd "$INSTALLUSER" | cut -d: -f6)
if [ -n "$INSTALLUSER_HOME" ] && [ ! -d "$INSTALLUSER_HOME" ] ; then
mkdir -p "$INSTALLUSER_HOME"
chown "$INSTALLUSER" "$INSTALLUSER_HOME"
fi
EXEC_CMD="su $INSTALLUSER -c"
fi
done
if [ `id -g` -eq `id -g $INSTALLUSER` ] ; then
@@ -123,6 +129,7 @@ if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
else
NAME="-name"
fi
IEXNAME="-$NAME"
# define ejabberd environment parameters
if [ "$EJABBERD_CONFIG_PATH" != "${EJABBERD_CONFIG_PATH%.yml}" ] ; then
@@ -142,14 +149,7 @@ fi
[ -z "$date" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_date '$date'"
[ -z "$EJABBERD_OPTS" ] || EJABBERD_OPTS="-ejabberd ${EJABBERD_OPTS}"
# create the ejabberd home dir with the proper user if doesn't exist
# then change to that directory readable by INSTALLUSER to
# prevent "File operation error: eacces." messages
[ -d $HOME ] || $EXEC_CMD "mkdir -p $HOME"
[ -d $SPOOL_DIR ] || $EXEC_CMD "mkdir -p $SPOOL_DIR"
# then set SPOOL_DIR as ejabberd home directory by changing
# to that directory readable by INSTALLUSER to prevent
# "File operation error: eacces." messages
cd $SPOOL_DIR
# export global variables
@@ -184,6 +184,67 @@ start()
# attach to server
debug()
{
debugwarning
TTY=`tty | sed -e 's/.*\///g'`
$EXEC_CMD "$ERL \
$NAME debug-${TTY}-${ERLANG_NODE} \
-remsh $ERLANG_NODE \
-hidden \
$KERNEL_OPTS \
$ERLANG_OPTS $ARGS \"$@\""
}
# attach to server using Elixir
iexdebug()
{
debugwarning
TTY=`tty | sed -e 's/.*\///g'`
# Elixir shell is hidden as default
$EXEC_CMD "$IEX \
$IEXNAME debug-${TTY}-${ERLANG_NODE} \
--remsh $ERLANG_NODE \
--erl \"$KERNEL_OPTS\" \
--erl \"$ERLANG_OPTS\" --erl \"$ARGS\" --erl \"$@\""
}
# start interactive server
live()
{
livewarning
$EXEC_CMD "$ERL \
$NAME $ERLANG_NODE \
-pa $EJABBERD_EBIN_PATH \
-mnesia dir \"\\\"$SPOOL_DIR\\\"\" \
$KERNEL_OPTS \
$EJABBERD_OPTS \
-s ejabberd \
$ERLANG_OPTS $ARGS \"$@\""
}
# start interactive server with Elixir
iexlive()
{
livewarning
$EXEC_CMD "$IEX \
$IEXNAME $ERLANG_NODE \
-pa $EJABBERD_EBIN_PATH \
--erl \"-mnesia dir \\\"$SPOOL_DIR\\\"\" \
--erl \"$KERNEL_OPTS\" \
--erl \"$EJABBERD_OPTS\" \
--app ejabberd \
--erl \"$ERLANG_OPTS\" --erl $ARGS --erl \"$@\""
}
etop()
{
$EXEC_CMD "$ERL \
$NAME debug-${TTY}-${ERLANG_NODE} \
-hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
}
# TODO: refactor debug warning and livewarning
debugwarning()
{
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
echo "--------------------------------------------------------------------"
@@ -201,21 +262,13 @@ debug()
echo "--------------------------------------------------------------------"
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
echo " EJABBERD_BYPASS_WARNINGS=true"
echo "Press any key to continue"
echo "Press return to continue"
read foo
echo ""
fi
TTY=`tty | sed -e 's/.*\///g'`
$EXEC_CMD "$ERL \
$NAME debug-${TTY}-${ERLANG_NODE} \
-remsh $ERLANG_NODE \
-hidden \
$KERNEL_OPTS \
$ERLANG_OPTS $ARGS \"$@\""
fi
}
# start interactive server
live()
livewarning()
{
check_start
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
@@ -233,34 +286,22 @@ live()
echo "--------------------------------------------------------------------"
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
echo " EJABBERD_BYPASS_WARNINGS=true"
echo "Press any key to continue"
echo "Press return to continue"
read foo
echo ""
fi
$EXEC_CMD "$ERL \
$NAME $ERLANG_NODE \
-pa $EJABBERD_EBIN_PATH \
-mnesia dir \"\\\"$SPOOL_DIR\\\"\" \
$KERNEL_OPTS \
$EJABBERD_OPTS \
-s ejabberd \
$ERLANG_OPTS $ARGS \"$@\""
}
etop()
{
$EXEC_CMD "$ERL \
$NAME debug-${TTY}-${ERLANG_NODE} \
-hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
}
# TODO: Make iex command display only if ejabberd Elixir support has been enabled
help()
{
echo ""
echo "Commands to start an ejabberd node:"
echo " start Start an ejabberd node in server mode"
echo " debug Attach an interactive Erlang shell to a running ejabberd node"
echo " live Start an ejabberd node in live (interactive) mode"
echo " start Start an ejabberd node in server mode"
echo " debug Attach an interactive Erlang shell to a running ejabberd node"
echo " iexdebug Attach an interactive Elixir shell to a running ejabberd node"
echo " live Start an ejabberd node in live (interactive) mode"
echo " iexlive Start an ejabberd node in live (interactive) mode, within an Elixir shell"
echo ""
echo "Optional parameters when starting an ejabberd node:"
echo " --config-dir dir Config ejabberd: $ETC_DIR"
@@ -411,7 +452,9 @@ wait_for_status()
case $ARGS in
' start') start;;
' debug') debug;;
' iexdebug') iexdebug;;
' live') live;;
' iexlive') iexlive;;
' etop') etop;;
' started') wait_for_status 0 30 2;; # wait 30x2s before timeout
' stopped') wait_for_status 3 15 2 && stop_epmd;; # wait 15x2s before timeout
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -31,5 +31,6 @@
host = <<"">> :: binary(),
port = 5280 :: inet:port_number(),
tp = http, % :: protocol(),
opts = [] :: list(),
headers = [] :: [{atom() | binary(), binary()}]}).
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -2,7 +2,7 @@
%%% RFC 1928 constants.
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -1
View File
@@ -1,6 +1,6 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -147,5 +147,6 @@
-define(NS_CARBONS_2, <<"urn:xmpp:carbons:2">>).
-define(NS_CARBONS_1, <<"urn:xmpp:carbons:1">>).
-define(NS_FORWARD, <<"urn:xmpp:forward:0">>).
-define(NS_CLIENT_STATE, <<"urn:xmpp:csi:0">>).
-define(NS_STREAM_MGMT_2, <<"urn:xmpp:sm:2">>).
-define(NS_STREAM_MGMT_3, <<"urn:xmpp:sm:3">>).
+3 -3
View File
@@ -13,12 +13,12 @@
%%%
%%%
%%% The Initial Developer of the Original Code is ProcessOne.
%%% Portions created by ProcessOne are Copyright 2006-2014, ProcessOne
%%% Portions created by ProcessOne are Copyright 2006-2015, ProcessOne
%%% All Rights Reserved.''
%%% This software is copyright 2006-2014, ProcessOne.
%%% This software is copyright 2006-2015, ProcessOne.
%%%
%%%
%%% copyright 2006-2014 ProcessOne
%%% copyright 2006-2015 ProcessOne
%%%
%%% This file contains pubsub types definition.
%%% ====================================================================
+13
View File
@@ -0,0 +1,13 @@
defmodule Ejabberd.Hooks do
# Generic hook setting features
def add(hook_name, host, module, function, priority) do
:ejabberd_hooks.add(hook_name, host, module, function, priority)
end
# Should be named 'removed'
def delete(hook_name, host, module, function, priority) do
:ejabberd_hooks.delete(hook_name, host, module, function, priority)
end
end
+9
View File
@@ -0,0 +1,9 @@
defmodule Ejabberd.Logger do
def critical(message, args \\ []), do: :lager.log(:critical, [], message, args)
def error(message, args \\ []), do: :lager.log(:error, [], message, args)
def warning(message, args \\ []), do: :lager.log(:warning, [], message, args)
def info(message, args \\ []), do: :lager.log(:info, [], message, args)
def debug(message, args \\ []), do: :lager.log(:debug, [], message, args)
end
+2
View File
@@ -0,0 +1,2 @@
defmodule Ejabberd do
end
+21
View File
@@ -0,0 +1,21 @@
defmodule ModPresenceDemo do
import Ejabberd.Logger # this allow using info, error, etc for logging
@behaviour :gen_mod
def start(host, _opts) do
info('Starting ejabberd module Presence Demo')
Ejabberd.Hooks.add(:set_presence_hook, host, __ENV__.module, :on_presence, 50)
:ok
end
def stop(host) do
info('Stopping ejabberd module Presence Demo')
Ejabberd.Hooks.delete(:set_presence_hook, host, __ENV__.module, :on_presence, 50)
:ok
end
def on_presence(user, _server, _resource, _packet) do
info('Receive presence for #{user}')
:none
end
end
+1 -1
View File
@@ -120,7 +120,7 @@
{"has been kicked because of a system shutdown","telah dikick karena sistem shutdown"}.
{"has been kicked because the room has been changed to members-only","telah dikick karena ruangan telah diubah menjadi hanya untuk member"}.
{"has been kicked","telah dikick"}.
{" has set the subject to: ","telah menetapkan topik yaitu:"}.
{" has set the subject to: "," telah menetapkan topik yaitu: "}.
{"Host","Host"}.
{"If you don't see the CAPTCHA image here, visit the web page.","Jika Anda tidak melihat gambar CAPTCHA disini, silahkan kunjungi halaman web."}.
{"If you want to specify different ports, passwords, encodings for IRC servers, fill this list with values in format '{\"irc server\", \"encoding\", port, \"password\"}'. By default this service use \"~s\" encoding, port ~p, empty password.","Jika Anda ingin menentukan port yang berbeda, sandi, pengkodean untuk layanan IRC, isi daftar ini dengan nilai-nilai dalam format '{\"server irc \", \"encoding \", port, \"sandi \"}'. Secara default ini menggunakan layanan \"~s \" pengkodean, port ~p, kata sandi kosong."}.
Vendored
BIN
View File
Binary file not shown.
+44 -5
View File
@@ -56,7 +56,7 @@ Deps = [{p1_cache_tab, ".*", {git, "git://github.com/processone/cache_tab"}},
{esip, ".*", {git, "git://github.com/processone/p1_sip"}},
{p1_stun, ".*", {git, "git://github.com/processone/stun"}},
{p1_yaml, ".*", {git, "git://github.com/processone/p1_yaml"}},
{xmlrpc, ".*", {git, "git://github.com/rds13/xmlrpc"}},
{ehyperloglog, ".*", {git, "https://github.com/vaxelfel/eHyperLogLog.git"}},
{p1_utils, ".*", {git, "git://github.com/processone/p1_utils"}}],
ConfigureCmd = fun(Pkg, Flags) ->
@@ -95,11 +95,11 @@ CfgDeps = lists:flatmap(
{tag, "1.4.2"}}}];
({json, true}) ->
[{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}];
({elixir, true}) ->
[{rebar_elixir_plugin, ".*", {git, "git://github.com/yrashk/rebar_elixir_plugin"}},
{elixir, "1.1.*", {git, "git://github.com/elixir-lang/elixir"}}];
({iconv, true}) ->
[{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}];
({http, true}) ->
[{ibrowse, ".*", {git, "git://github.com/cmullaparthi/ibrowse"}},
{lhttpc, ".*", {git, "git://github.com/esl/lhttpc"}}];
({lager, true}) ->
[{lager, ".*", {git, "git://github.com/basho/lager"}}];
({lager, false}) ->
@@ -119,6 +119,40 @@ CfgPostHooks = lists:flatmap(
[]
end, Cfg),
CfgXrefs = lists:flatmap(
fun({mysql, false}) ->
["(\".*mysql.*\":_/_)"];
({pgsql, false}) ->
["(\".*pgsql.*\":_/_)"];
({pam, false}) ->
["(\"epam\":_/_)"];
({riak, false}) ->
["(\"riak.*\":_/_)"];
({riak, true}) ->
% used in map-reduce function called from riak vm
["(\"riak_object\":_/_)"];
({json, false}) ->
["(\"jiffy\":_/_)"];
({zlib, false}) ->
["(\"ezlib\":_/_)"];
({http, false}) ->
["(\"lhttpc\":_/_)"];
({iconv, false}) ->
["(\"iconv\":_/_)"];
({odbc, false}) ->
["(\"odbc\":_/_)"];
(_) ->
[]
end, Cfg),
ElixirConfig = case lists:keysearch(elixir, 1, Cfg) of
{value, {elixir, true}} ->
[{plugins, [rebar_elixir_compiler, rebar_exunit] },
{lib_dirs, ["deps/elixir/lib"]}];
_ ->
[]
end,
{ok, Cwd} = file:get_cwd(),
Config = [{erl_opts, Macros ++ HiPE ++ DebugInfo ++
@@ -127,8 +161,13 @@ Config = [{erl_opts, Macros ++ HiPE ++ DebugInfo ++
{keep_build_info, true},
{ct_extra_params, "-include "
++ filename:join([Cwd, "tools"])},
{xref_warnings, false},
{xref_checks, []},
{xref_queries,
[{"(XC - UC) || (XU - X - B - "
++ string:join(CfgXrefs, " - ") ++ ")", []}]},
{post_hooks, PostHooks ++ CfgPostHooks},
{deps, Deps ++ CfgDeps}],
{deps, Deps ++ CfgDeps}] ++ ElixirConfig,
%%io:format("ejabberd configuration:~n ~p~n", [Config]),
Config.
+1 -2
View File
@@ -28,7 +28,7 @@ ConfiguredOTPApps = lists:flatmap(
OTPApps = RequiredOTPApps ++ ConfiguredOTPApps,
DepRequiredApps = [p1_cache_tab, p1_tls, p1_stringprep, p1_xml, p1_yaml, xmlrpc],
DepRequiredApps = [p1_cache_tab, p1_tls, p1_stringprep, p1_xml, p1_yaml, p1_utils],
DepConfiguredApps = lists:flatmap(
fun({mysql, true}) -> [p1_mysql];
@@ -38,7 +38,6 @@ DepConfiguredApps = lists:flatmap(
({stun, true}) -> [p1_stun];
({json, true}) -> [jiffy];
({iconv, true}) -> [p1_iconv];
({http, true}) -> [ibrowse, lhttpc];
({lager, true}) -> [lager, goldrush];
({lager, false}) -> [p1_logger];
(_) -> []
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* ejabberd, Copyright (C) 2002-2014 ProcessOne
* ejabberd, Copyright (C) 2002-2015 ProcessOne
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* ejabberd, Copyright (C) 2002-2014 ProcessOne
* ejabberd, Copyright (C) 2002-2015 ProcessOne
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* ejabberd, Copyright (C) 2002-2014 ProcessOne
* ejabberd, Copyright (C) 2002-2015 ProcessOne
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,5 +1,5 @@
--
-- ejabberd, Copyright (C) 2002-2014 ProcessOne
-- ejabberd, Copyright (C) 2002-2015 ProcessOne
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -1,5 +1,5 @@
--
-- ejabberd, Copyright (C) 2002-2014 ProcessOne
-- ejabberd, Copyright (C) 2002-2015 ProcessOne
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 31 Oct 2005 by Magnus Henoch <henoch@dtek.chalmers.se>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+26 -4
View File
@@ -5,7 +5,7 @@
%%% Created : 8 Mar 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -93,9 +93,15 @@ start() ->
).
register_mechanism(Mechanism, Module, PasswordType) ->
ets:insert(sasl_mechanism,
#sasl_mechanism{mechanism = Mechanism, module = Module,
password_type = PasswordType}).
case is_disabled(Mechanism) of
false ->
ets:insert(sasl_mechanism,
#sasl_mechanism{mechanism = Mechanism, module = Module,
password_type = PasswordType});
true ->
?DEBUG("SASL mechanism ~p is disabled", [Mechanism]),
true
end.
%%% TODO: use callbacks
%%-include("ejabberd.hrl").
@@ -215,3 +221,19 @@ filter_anonymous(Host, Mechs) ->
true -> Mechs;
false -> Mechs -- [<<"ANONYMOUS">>]
end.
-spec(is_disabled/1 ::
(
Mechanism :: mechanism())
-> boolean()
).
is_disabled(Mechanism) ->
Disabled = ejabberd_config:get_option(
disable_sasl_mechanisms,
fun(V) when is_list(V) ->
lists:map(fun(M) -> str:to_upper(M) end, V);
(V) ->
[str:to_upper(V)]
end, []),
lists:member(Mechanism, Disabled).
+1 -1
View File
@@ -6,7 +6,7 @@
%%% Created : 23 Aug 2005 by Magnus Henoch <henoch@dtek.chalmers.se>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 11 Mar 2003 by Alexey Shchepin <alexey@sevcom.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 8 Mar 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+5 -3
View File
@@ -5,7 +5,7 @@
%%% Created : 7 Aug 2011 by Stephen Röttger <stephen.roettger@googlemail.com>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -76,9 +76,11 @@ mech_step(#state{step = 2} = State, ClientIn) ->
UserName ->
case parse_attribute(ClientNonceAttribute) of
{$r, ClientNonce} ->
case (State#state.get_password)(UserName) of
{Ret, _AuthModule} = (State#state.get_password)(UserName),
case {Ret, jlib:resourceprep(Ret)} of
{false, _} -> {error, <<"not-authorized">>, UserName};
{Ret, _AuthModule} ->
{_, error} when is_binary(Ret) -> ?WARNING_MSG("invalid plain password", []), {error, <<"not-authorized">>, UserName};
{Ret, _} ->
{StoredKey, ServerKey, Salt, IterationCount} =
if is_tuple(Ret) -> Ret;
true ->
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+16 -4
View File
@@ -5,7 +5,7 @@
%%% Created : 7 May 2006 by Mickael Remond <mremond@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -31,6 +31,7 @@
status/0, reopen_log/0,
stop_kindly/2, send_service_message_all_mucs/2,
registered_vhosts/0,
reload_config/0,
%% Erlang
update_list/0, update/1,
%% Accounts
@@ -134,6 +135,11 @@ commands() ->
module = ?MODULE, function = registered_vhosts,
args = [],
result = {vhosts, {list, {vhost, string}}}},
#ejabberd_commands{name = reload_config, tags = [server],
desc = "Reload ejabberd configuration file into memory",
module = ?MODULE, function = reload_config,
args = [],
result = {res, rescode}},
#ejabberd_commands{name = import_file, tags = [mnesia],
desc = "Import user data from jabberd14 spool file",
@@ -252,9 +258,10 @@ reopen_log() ->
%%% Stop Kindly
%%%
stop_kindly(DelaySeconds, AnnouncementText) ->
Subject = io_lib:format("Server stop in ~p seconds!", [DelaySeconds]),
WaitingDesc = io_lib:format("Waiting ~p seconds", [DelaySeconds]),
stop_kindly(DelaySeconds, AnnouncementTextString) ->
Subject = list_to_binary(io_lib:format("Server stop in ~p seconds!", [DelaySeconds])),
WaitingDesc = list_to_binary(io_lib:format("Waiting ~p seconds", [DelaySeconds])),
AnnouncementText = list_to_binary(AnnouncementTextString),
Steps = [
{"Stopping ejabberd port listeners",
ejabberd_listener, stop_listeners, []},
@@ -351,6 +358,11 @@ registered_users(Host) ->
registered_vhosts() ->
?MYHOSTS.
reload_config() ->
ejabberd_config:reload_file(),
acl:start(),
shaper:start().
%%%
%%% Migration management
%%%
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 23 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -300,7 +300,7 @@ get_password_with_authmodule(User, Server) ->
-spec is_user_exists(binary(), binary()) -> boolean().
is_user_exists(User, <<"">>) ->
is_user_exists(_User, <<"">>) ->
false;
is_user_exists(User, Server) ->
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 17 Feb 2006 by Mickael Remond <mremond@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+3 -6
View File
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -77,10 +77,7 @@ update_reg_users_counter_table(Server) ->
mnesia:sync_dirty(F).
plain_password_required() ->
case is_scrammed() of
false -> false;
true -> true
end.
is_scrammed().
store_type() ->
case is_scrammed() of
@@ -150,7 +147,7 @@ set_password(User, Server, Password) ->
ok
end.
%% @spec (User, Server, Password) -> {atomic, ok} | {atomic, exists} | {error, invalid_jid} | {aborted, Reason}
%% @spec (User, Server, Password) -> {atomic, ok} | {atomic, exists} | {error, invalid_jid} | {error, not_allowed} | {error, Reason}
try_register(User, Server, PasswordList) ->
LUser = jlib:nodeprep(User),
LServer = jlib:nameprep(Server),
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -387,7 +387,7 @@ parse_options(Host) ->
[{<<"%u">>, <<"*">>}]),
{DNFilter, DNFilterAttrs} =
eldap_utils:get_opt({ldap_dn_filter, Host}, [],
fun({DNF, DNFA}) ->
fun([{DNF, DNFA}]) ->
NewDNFA = case DNFA of
undefined ->
[];
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 5 Jul 2007 by Evgeniy Khramtsov <xram@jabber.ru>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 12 Nov 2012 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2012 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+336 -187
View File
@@ -5,7 +5,7 @@
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -45,6 +45,7 @@
set_aux_field/3,
del_aux_field/2,
get_subscription/2,
send_filtered/5,
broadcast/4,
get_subscribed/1,
transform_listen_option/2]).
@@ -94,20 +95,20 @@
tls_options = [],
authenticated = false,
jid,
user = "", server = <<"">>, resource = <<"">>,
user = <<"">>, server = <<"">>, resource = <<"">>,
sid,
pres_t = ?SETS:new(),
pres_f = ?SETS:new(),
pres_a = ?SETS:new(),
pres_i = ?SETS:new(),
pres_last, pres_pri,
pres_last,
pres_timestamp,
pres_invis = false,
privacy_list = #userlist{},
conn = unknown,
auth_module = unknown,
ip,
aux_fields = [],
csi_state = active,
csi_queue = [],
mgmt_state,
mgmt_xmlns,
mgmt_queue,
@@ -247,6 +248,9 @@ get_subscription(LFrom, StateData) ->
true -> none
end.
send_filtered(FsmRef, Feature, From, To, Packet) ->
FsmRef ! {send_filtered, Feature, From, To, Packet}.
broadcast(FsmRef, Type, From, Packet) ->
FsmRef ! {broadcast, Type, From, Packet}.
@@ -307,41 +311,37 @@ init([{SockMod, Socket}, Opts]) ->
end,
MaxAckQueue = case proplists:get_value(max_ack_queue, Opts) of
Limit when is_integer(Limit), Limit > 0 -> Limit;
infinity -> infinity;
_ -> 500
end,
ResumeTimeout = case proplists:get_value(resume_timeout, Opts) of
Timeout when is_integer(Timeout), Timeout >= 0 -> Timeout;
_ -> 300
end,
ResendOnTimeout = proplists:get_bool(resend_on_timeout, Opts),
ResendOnTimeout = case proplists:get_value(resend_on_timeout, Opts) of
Resend when is_boolean(Resend) -> Resend;
if_offline -> if_offline;
_ -> false
end,
IP = peerip(SockMod, Socket),
%% Check if IP is blacklisted:
case is_ip_blacklisted(IP) of
true ->
?INFO_MSG("Connection attempt from blacklisted "
"IP: ~s (~w)",
[jlib:ip_to_list(IP), IP]),
{stop, normal};
false ->
Socket1 = if TLSEnabled andalso
SockMod /= ejabberd_frontend_socket ->
SockMod:starttls(Socket, TLSOpts);
true -> Socket
end,
SocketMonitor = SockMod:monitor(Socket1),
StateData = #state{socket = Socket1, sockmod = SockMod,
socket_monitor = SocketMonitor,
xml_socket = XMLSocket, zlib = Zlib, tls = TLS,
tls_required = StartTLSRequired,
tls_enabled = TLSEnabled, tls_options = TLSOpts,
sid = {now(), self()}, streamid = new_id(),
access = Access, shaper = Shaper, ip = IP,
mgmt_state = StreamMgmtState,
mgmt_max_queue = MaxAckQueue,
mgmt_timeout = ResumeTimeout,
mgmt_resend = ResendOnTimeout},
{ok, wait_for_stream, StateData, ?C2S_OPEN_TIMEOUT}
end.
Socket1 = if TLSEnabled andalso
SockMod /= ejabberd_frontend_socket ->
SockMod:starttls(Socket, TLSOpts);
true -> Socket
end,
SocketMonitor = SockMod:monitor(Socket1),
StateData = #state{socket = Socket1, sockmod = SockMod,
socket_monitor = SocketMonitor,
xml_socket = XMLSocket, zlib = Zlib, tls = TLS,
tls_required = StartTLSRequired,
tls_enabled = TLSEnabled, tls_options = TLSOpts,
sid = {now(), self()}, streamid = new_id(),
access = Access, shaper = Shaper, ip = IP,
mgmt_state = StreamMgmtState,
mgmt_max_queue = MaxAckQueue,
mgmt_timeout = ResumeTimeout,
mgmt_resend = ResendOnTimeout},
{ok, wait_for_stream, StateData, ?C2S_OPEN_TIMEOUT}.
%% Return list of all available resources of contacts,
get_subscribed(FsmRef) ->
@@ -365,27 +365,31 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs));
S -> S
end,
Lang = case xml:get_attr_s(<<"xml:lang">>, Attrs) of
Lang1 when byte_size(Lang1) =< 35 ->
%% As stated in BCP47, 4.4.1:
%% Protocols or specifications that
%% specify limited buffer sizes for
%% language tags MUST allow for
%% language tags of at least 35 characters.
Lang1;
_ ->
%% Do not store long language tag to
%% avoid possible DoS/flood attacks
<<"">>
end,
IsBlacklistedIP = is_ip_blacklisted(StateData#state.ip, Lang),
case lists:member(Server, ?MYHOSTS) of
true ->
Lang = case xml:get_attr_s(<<"xml:lang">>, Attrs) of
Lang1 when size(Lang1) =< 35 ->
%% As stated in BCP47, 4.4.1:
%% Protocols or specifications that
%% specify limited buffer sizes for
%% language tags MUST allow for
%% language tags of at least 35 characters.
Lang1;
_ ->
%% Do not store long language tag to
%% avoid possible DoS/flood attacks
<<"">>
end,
true when IsBlacklistedIP == false ->
change_shaper(StateData, jlib:make_jid(<<"">>, Server, <<"">>)),
case xml:get_attr_s(<<"version">>, Attrs) of
<<"1.0">> ->
send_header(StateData, Server, <<"1.0">>, DefaultLang),
case StateData#state.authenticated of
false ->
TLS = StateData#state.tls,
TLSEnabled = StateData#state.tls_enabled,
TLSRequired = StateData#state.tls_required,
SASLState =
cyrsasl:server_new(
<<"jabber">>, Server, <<"">>, [],
@@ -401,12 +405,21 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
ejabberd_auth:check_password_with_authmodule(
U, Server, P, D, DG)
end),
Mechs = lists:map(fun (S) ->
#xmlel{name = <<"mechanism">>,
attrs = [],
children = [{xmlcdata, S}]}
end,
cyrsasl:listmech(Server)),
Mechs =
case TLSEnabled or not TLSRequired of
true ->
Ms = lists:map(fun (S) ->
#xmlel{name = <<"mechanism">>,
attrs = [],
children = [{xmlcdata, S}]}
end,
cyrsasl:listmech(Server)),
[#xmlel{name = <<"mechanisms">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
children = Ms}];
false ->
[]
end,
SockMod =
(StateData#state.sockmod):get_sockmod(
StateData#state.socket),
@@ -424,9 +437,6 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
_ ->
[]
end,
TLS = StateData#state.tls,
TLSEnabled = StateData#state.tls_enabled,
TLSRequired = StateData#state.tls_required,
TLSFeature =
case (TLS == true) andalso
(TLSEnabled == false) andalso
@@ -451,10 +461,7 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
#xmlel{name = <<"stream:features">>,
attrs = [],
children =
TLSFeature ++ CompressFeature ++
[#xmlel{name = <<"mechanisms">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
children = Mechs}]
TLSFeature ++ CompressFeature ++ Mechs
++
ejabberd_hooks:run_fold(c2s_stream_features,
Server, [], [Server])}),
@@ -491,6 +498,8 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
++
RosterVersioningFeature ++
StreamManagementFeature ++
ejabberd_hooks:run_fold(c2s_post_auth_features,
Server, [], [Server]) ++
ejabberd_hooks:run_fold(c2s_stream_features,
Server, [], [Server]),
send_element(StateData,
@@ -523,6 +532,15 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
lang = Lang})
end
end;
true ->
IP = StateData#state.ip,
{true, LogReason, ReasonT} = IsBlacklistedIP,
?INFO_MSG("Connection attempt from blacklisted IP ~s: ~s",
[jlib:ip_to_list(IP), LogReason]),
send_header(StateData, Server, <<"">>, DefaultLang),
send_element(StateData, ?POLICY_VIOLATION_ERR(Lang, ReasonT)),
send_trailer(StateData),
{stop, normal, StateData};
_ ->
send_header(StateData, ?MYNAME, <<"">>, DefaultLang),
send_element(StateData, ?HOST_UNKNOWN_ERR),
@@ -622,9 +640,13 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
P, D, DGen)
of
{true, AuthModule} ->
?INFO_MSG("(~w) Accepted legacy authentication for ~s by ~p",
[StateData#state.socket,
jlib:jid_to_string(JID), AuthModule]),
?INFO_MSG("(~w) Accepted legacy authentication for ~s by ~p from ~s",
[StateData#state.socket,
jlib:jid_to_string(JID), AuthModule,
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[true, U, StateData#state.server,
StateData#state.ip]),
Conn = get_conn_type(StateData),
Info = [{ip, StateData#state.ip}, {conn, Conn},
{auth_module, AuthModule}],
@@ -659,12 +681,13 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
privacy_list = PrivList},
fsm_next_state(session_established, NewStateData);
_ ->
IP = peerip(StateData#state.sockmod,
StateData#state.socket),
?INFO_MSG("(~w) Failed legacy authentication for "
"~s from IP ~s",
[StateData#state.socket,
jlib:jid_to_string(JID), jlib:ip_to_list(IP)]),
?INFO_MSG("(~w) Failed legacy authentication for ~s from ~s",
[StateData#state.socket,
jlib:jid_to_string(JID),
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[false, U, StateData#state.server,
StateData#state.ip]),
Err = jlib:make_error_reply(El, ?ERR_NOT_AUTHORIZED),
send_element(StateData, Err),
fsm_next_state(wait_for_auth, StateData)
@@ -679,9 +702,13 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
fsm_next_state(wait_for_auth, StateData);
true ->
?INFO_MSG("(~w) Forbidden legacy authentication "
"for ~s",
"for ~s from ~s",
[StateData#state.socket,
jlib:jid_to_string(JID)]),
jlib:jid_to_string(JID),
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[false, U, StateData#state.server,
StateData#state.ip]),
Err = jlib:make_error_reply(El, ?ERR_NOT_ALLOWED),
send_element(StateData, Err),
fsm_next_state(wait_for_auth, StateData)
@@ -718,7 +745,7 @@ wait_for_feature_request({xmlstreamelement, El},
(StateData#state.sockmod):get_sockmod(StateData#state.socket),
case {xml:get_attr_s(<<"xmlns">>, Attrs), Name} of
{?NS_SASL, <<"auth">>}
when not ((SockMod == gen_tcp) and TLSRequired) ->
when TLSEnabled or not TLSRequired ->
Mech = xml:get_attr_s(<<"mechanism">>, Attrs),
ClientIn = jlib:decode_base64(xml:get_cdata(Els)),
case cyrsasl:server_start(StateData#state.sasl_state,
@@ -731,8 +758,12 @@ wait_for_feature_request({xmlstreamelement, El},
%AuthModule = xml:get_attr_s(auth_module, Props),
AuthModule = proplists:get_value(auth_module, Props, undefined),
?INFO_MSG("(~w) Accepted authentication for ~s "
"by ~p",
[StateData#state.socket, U, AuthModule]),
"by ~p from ~s",
[StateData#state.socket, U, AuthModule,
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[true, U, StateData#state.server,
StateData#state.ip]),
send_element(StateData,
#xmlel{name = <<"success">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
@@ -753,10 +784,13 @@ wait_for_feature_request({xmlstreamelement, El},
fsm_next_state(wait_for_sasl_response,
StateData#state{sasl_state = NewSASLState});
{error, Error, Username} ->
IP = peerip(StateData#state.sockmod, StateData#state.socket),
?INFO_MSG("(~w) Failed authentication for ~s@~s from IP ~s",
[StateData#state.socket,
Username, StateData#state.server, jlib:ip_to_list(IP)]),
?INFO_MSG("(~w) Failed authentication for ~s@~s from ~s",
[StateData#state.socket,
Username, StateData#state.server,
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[false, Username, StateData#state.server,
StateData#state.ip]),
send_element(StateData,
#xmlel{name = <<"failure">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
@@ -832,7 +866,7 @@ wait_for_feature_request({xmlstreamelement, El},
end
end;
_ ->
if (SockMod == gen_tcp) and TLSRequired ->
if TLSRequired and not TLSEnabled ->
Lang = StateData#state.lang,
send_element(StateData,
?POLICY_VIOLATION_ERR(Lang,
@@ -877,8 +911,12 @@ wait_for_sasl_response({xmlstreamelement, El},
% AuthModule = xml:get_attr_s(auth_module, Props),
AuthModule = proplists:get_value(auth_module, Props, <<>>),
?INFO_MSG("(~w) Accepted authentication for ~s "
"by ~p",
[StateData#state.socket, U, AuthModule]),
"by ~p from ~s",
[StateData#state.socket, U, AuthModule,
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[true, U, StateData#state.server,
StateData#state.ip]),
send_element(StateData,
#xmlel{name = <<"success">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
@@ -896,8 +934,12 @@ wait_for_sasl_response({xmlstreamelement, El},
% AuthModule = xml:get_attr_s(auth_module, Props),
AuthModule = proplists:get_value(auth_module, Props, undefined),
?INFO_MSG("(~w) Accepted authentication for ~s "
"by ~p",
[StateData#state.socket, U, AuthModule]),
"by ~p from ~s",
[StateData#state.socket, U, AuthModule,
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[true, U, StateData#state.server,
StateData#state.ip]),
send_element(StateData,
#xmlel{name = <<"success">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
@@ -920,10 +962,13 @@ wait_for_sasl_response({xmlstreamelement, El},
fsm_next_state(wait_for_sasl_response,
StateData#state{sasl_state = NewSASLState});
{error, Error, Username} ->
IP = peerip(StateData#state.sockmod, StateData#state.socket),
?INFO_MSG("(~w) Failed authentication for ~s@~s from IP ~s",
[StateData#state.socket,
Username, StateData#state.server, jlib:ip_to_list(IP)]),
?INFO_MSG("(~w) Failed authentication for ~s@~s from ~s",
[StateData#state.socket,
Username, StateData#state.server,
jlib:ip_to_list(StateData#state.ip)]),
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
[false, Username, StateData#state.server,
StateData#state.ip]),
send_element(StateData,
#xmlel{name = <<"failure">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
@@ -1136,6 +1181,17 @@ wait_for_session(closed, StateData) ->
session_established({xmlstreamelement, #xmlel{name = Name} = El}, StateData)
when ?IS_STREAM_MGMT_TAG(Name) ->
fsm_next_state(session_established, dispatch_stream_mgmt(El, StateData));
session_established({xmlstreamelement,
#xmlel{name = <<"active">>,
attrs = [{<<"xmlns">>, ?NS_CLIENT_STATE}]}},
StateData) ->
NewStateData = csi_queue_flush(StateData),
fsm_next_state(session_established, NewStateData#state{csi_state = active});
session_established({xmlstreamelement,
#xmlel{name = <<"inactive">>,
attrs = [{<<"xmlns">>, ?NS_CLIENT_STATE}]}},
StateData) ->
fsm_next_state(session_established, StateData#state{csi_state = inactive});
session_established({xmlstreamelement, El},
StateData) ->
FromJID = StateData#state.jid,
@@ -1167,9 +1223,7 @@ session_established({xmlstreamerror, _}, StateData) ->
send_element(StateData, ?INVALID_XML_ERR),
send_trailer(StateData),
{stop, normal, StateData};
session_established(closed, StateData)
when StateData#state.mgmt_timeout > 0,
StateData#state.mgmt_state == active ->
session_established(closed, #state{mgmt_state = active} = StateData) ->
fsm_next_state(wait_for_resume, StateData);
session_established(closed, StateData) ->
{stop, normal, StateData}.
@@ -1640,12 +1694,23 @@ handle_info({route, From, To,
jlib:replace_from_to_attrs(jlib:jid_to_string(From),
jlib:jid_to_string(To), NewAttrs),
FixedPacket = #xmlel{name = Name, attrs = Attrs2, children = Els},
SentStateData = send_packet(NewState, FixedPacket),
ejabberd_hooks:run(user_receive_packet,
SentStateData#state.server,
[SentStateData#state.jid, From, To, FixedPacket]),
FinalState =
case ejabberd_hooks:run_fold(c2s_filter_packet_in,
NewState#state.server, FixedPacket,
[NewState#state.jid, From, To])
of
drop ->
NewState;
FinalPacket = #xmlel{} ->
SentState = send_packet(NewState, FinalPacket),
ejabberd_hooks:run(user_receive_packet,
SentState#state.server,
[SentState#state.jid, From, To,
FinalPacket]),
SentState
end,
ejabberd_hooks:run(c2s_loop_debug, [{route, From, To, Packet}]),
fsm_next_state(StateName, SentStateData);
fsm_next_state(StateName, FinalState);
true ->
ejabberd_hooks:run(c2s_loop_debug, [{route, From, To, Packet}]),
fsm_next_state(StateName, NewState)
@@ -1653,8 +1718,7 @@ handle_info({route, From, To,
handle_info({'DOWN', Monitor, _Type, _Object, _Info},
_StateName, StateData)
when Monitor == StateData#state.socket_monitor ->
if StateData#state.mgmt_timeout > 0,
StateData#state.mgmt_state == active orelse
if StateData#state.mgmt_state == active;
StateData#state.mgmt_state == pending ->
fsm_next_state(wait_for_resume, StateData);
true ->
@@ -1689,6 +1753,32 @@ handle_info({force_update_presence, LUser}, StateName,
_ -> StateData
end,
fsm_next_state(StateName, NewStateData);
handle_info({send_filtered, Feature, From, To, Packet}, StateName, StateData) ->
Drop = ejabberd_hooks:run_fold(c2s_filter_packet, StateData#state.server,
true, [StateData#state.server, StateData,
Feature, To, Packet]),
NewStateData = if Drop ->
?DEBUG("Dropping packet from ~p to ~p",
[jlib:jid_to_string(From),
jlib:jid_to_string(To)]),
StateData;
true ->
FinalPacket = jlib:replace_from_to(From, To, Packet),
case StateData#state.jid of
To ->
case privacy_check_packet(StateData, From, To,
FinalPacket, in) of
deny ->
StateData;
allow ->
send_stanza(StateData, FinalPacket)
end;
_ ->
ejabberd_router:route(From, To, FinalPacket),
StateData
end
end,
fsm_next_state(StateName, NewStateData);
handle_info({broadcast, Type, From, Packet}, StateName, StateData) ->
Recipients = ejabberd_hooks:run_fold(
c2s_broadcast_recipients, StateData#state.server,
@@ -1710,11 +1800,10 @@ handle_info(Info, StateName, StateData) ->
%% Purpose: Prepare the state to be printed on error log
%% Returns: State to print
%%----------------------------------------------------------------------
print_state(State = #state{pres_t = T, pres_f = F, pres_a = A, pres_i = I}) ->
print_state(State = #state{pres_t = T, pres_f = F, pres_a = A}) ->
State#state{pres_t = {pres_t, ?SETS:size(T)},
pres_f = {pres_f, ?SETS:size(F)},
pres_a = {pres_a, ?SETS:size(A)},
pres_i = {pres_i, ?SETS:size(I)}
pres_a = {pres_a, ?SETS:size(A)}
}.
%%----------------------------------------------------------------------
@@ -1750,8 +1839,6 @@ terminate(_Reason, StateName, StateData) ->
<<"Replaced by new connection">>),
presence_broadcast(StateData, From,
StateData#state.pres_a, Packet),
presence_broadcast(StateData, From,
StateData#state.pres_i, Packet),
handle_unacked_stanzas(StateData);
_ ->
?INFO_MSG("(~w) Close session for ~s",
@@ -1759,10 +1846,7 @@ terminate(_Reason, StateName, StateData) ->
jlib:jid_to_string(StateData#state.jid)]),
EmptySet = (?SETS):new(),
case StateData of
#state{pres_last = undefined,
pres_a = EmptySet,
pres_i = EmptySet,
pres_invis = false} ->
#state{pres_last = undefined, pres_a = EmptySet} ->
ejabberd_sm:close_session(StateData#state.sid,
StateData#state.user,
StateData#state.server,
@@ -1778,9 +1862,7 @@ terminate(_Reason, StateName, StateData) ->
StateData#state.resource,
<<"">>),
presence_broadcast(StateData, From,
StateData#state.pres_a, Packet),
presence_broadcast(StateData, From,
StateData#state.pres_i, Packet)
StateData#state.pres_a, Packet)
end,
handle_unacked_stanzas(StateData)
end,
@@ -1812,7 +1894,8 @@ send_text(StateData, Text) when StateData#state.mgmt_state == active ->
?DEBUG("Send XML on stream = ~p", [Text]),
case catch (StateData#state.sockmod):send(StateData#state.socket, Text) of
{'EXIT', _} ->
(StateData#state.sockmod):close(StateData#state.socket);
(StateData#state.sockmod):close(StateData#state.socket),
error;
_ ->
ok
end;
@@ -1828,27 +1911,30 @@ send_element(StateData, El) when StateData#state.xml_socket ->
send_element(StateData, El) ->
send_text(StateData, xml:element_to_binary(El)).
send_stanza(StateData, Stanza) when StateData#state.csi_state == inactive ->
csi_filter_stanza(StateData, Stanza);
send_stanza(StateData, Stanza) when StateData#state.mgmt_state == pending ->
mgmt_queue_add(StateData, Stanza);
send_stanza(StateData, Stanza) when StateData#state.mgmt_state == active ->
send_stanza_and_ack_req(StateData, Stanza),
mgmt_queue_add(StateData, Stanza);
NewStateData = case send_stanza_and_ack_req(StateData, Stanza) of
ok ->
StateData;
error ->
StateData#state{mgmt_state = pending}
end,
mgmt_queue_add(NewStateData, Stanza);
send_stanza(StateData, Stanza) ->
send_element(StateData, Stanza),
StateData.
send_packet(StateData, Packet) when StateData#state.mgmt_state == active;
StateData#state.mgmt_state == pending ->
send_packet(StateData, Packet) ->
case is_stanza(Packet) of
true ->
send_stanza(StateData, Packet);
false ->
send_element(StateData, Packet),
StateData
end;
send_packet(StateData, Stanza) ->
send_element(StateData, Stanza),
StateData.
end.
send_header(StateData, Server, Version, Lang)
when StateData#state.xml_socket ->
@@ -1957,28 +2043,15 @@ process_presence_probe(From, To, StateData) ->
undefined ->
ok;
_ ->
Cond1 = (not StateData#state.pres_invis)
andalso (?SETS:is_element(LFrom, StateData#state.pres_f)
orelse
((LFrom /= LBFrom) andalso
?SETS:is_element(LBFrom, StateData#state.pres_f)))
andalso (not
(?SETS:is_element(LFrom, StateData#state.pres_i)
orelse
((LFrom /= LBFrom) andalso
?SETS:is_element(LBFrom, StateData#state.pres_i)))),
Cond2 = StateData#state.pres_invis
andalso ?SETS:is_element(LFrom, StateData#state.pres_f)
andalso ?SETS:is_element(LFrom, StateData#state.pres_a),
Cond = ?SETS:is_element(LFrom, StateData#state.pres_f)
orelse
((LFrom /= LBFrom) andalso
?SETS:is_element(LBFrom, StateData#state.pres_f)),
if
Cond1 ->
Timestamp = StateData#state.pres_timestamp,
Packet = xml:append_subtags(
StateData#state.pres_last,
%% To is the one sending the presence (the target of the probe)
[jlib:timestamp_to_xml(Timestamp, utc, To, <<"">>),
%% TODO: Delete the next line once XEP-0091 is Obsolete
jlib:timestamp_to_xml(Timestamp)]),
Cond ->
%% To is the one sending the presence (the probe target)
Packet = jlib:add_delay_info(StateData#state.pres_last, To,
StateData#state.pres_timestamp),
case privacy_check_packet(StateData, To, From, Packet, out) of
deny ->
ok;
@@ -1993,11 +2066,6 @@ process_presence_probe(From, To, StateData) ->
ok
end
end;
Cond2 ->
ejabberd_router:route(To, From,
#xmlel{name = <<"presence">>,
attrs = [],
children = []});
true ->
ok
end
@@ -2035,12 +2103,11 @@ presence_update(From, Packet, StateData) ->
OldPresence -> get_priority_from_presence(OldPresence)
end,
NewPriority = get_priority_from_presence(Packet),
Timestamp = calendar:now_to_universal_time(now()),
update_priority(NewPriority, Packet, StateData),
FromUnavail = (StateData#state.pres_last == undefined),
?DEBUG("from unavail = ~p~n", [FromUnavail]),
NewStateData = StateData#state{pres_last = Packet,
pres_timestamp = Timestamp},
pres_timestamp = now()},
NewState = if FromUnavail ->
ejabberd_hooks:run(user_available_hook,
NewStateData#state.server,
@@ -2173,7 +2240,7 @@ presence_broadcast_first(From, StateData, Packet) ->
[],
StateData#state.pres_t),
PacketProbe = #xmlel{name = <<"presence">>, attrs = [{<<"type">>,<<"probe">>}], children = []},
JIDs2Probe = format_and_check_privacy(From, StateData, Packet, JIDsProbe, out),
JIDs2Probe = format_and_check_privacy(From, StateData, PacketProbe, JIDsProbe, out),
Server = StateData#state.server,
send_multiple(StateData, From, JIDs2Probe, PacketProbe),
{As, JIDs} =
@@ -2429,11 +2496,24 @@ fsm_next_state_gc(StateName, PackedStateData) ->
%% fsm_next_state: Generate the next_state FSM tuple with different
%% timeout, depending on the future state
fsm_next_state(session_established, #state{mgmt_max_queue = exceeded} =
StateData) ->
?WARNING_MSG("ACK queue too long, terminating session for ~s",
[jlib:jid_to_string(StateData#state.jid)]),
Err = ?SERRT_POLICY_VIOLATION(StateData#state.lang,
<<"Too many unacked stanzas">>),
send_element(StateData, Err),
send_trailer(StateData),
{stop, normal, StateData#state{mgmt_resend = false}};
fsm_next_state(session_established, #state{mgmt_state = pending} = StateData) ->
fsm_next_state(wait_for_resume, StateData);
fsm_next_state(session_established, StateData) ->
{next_state, session_established, StateData,
?C2S_HIBERNATE_TIMEOUT};
fsm_next_state(wait_for_resume, StateData)
when StateData#state.mgmt_state /= pending ->
fsm_next_state(wait_for_resume, #state{mgmt_timeout = 0} = StateData) ->
{stop, normal, StateData};
fsm_next_state(wait_for_resume, #state{mgmt_pending_since = undefined} =
StateData) ->
?INFO_MSG("Waiting for resumption of stream for ~s",
[jlib:jid_to_string(StateData#state.jid)]),
{next_state, wait_for_resume,
@@ -2451,11 +2531,6 @@ fsm_next_state(StateName, StateData) ->
fsm_reply(Reply, session_established, StateData) ->
{reply, Reply, session_established, StateData,
?C2S_HIBERNATE_TIMEOUT};
fsm_reply(Reply, wait_for_resume, #state{mgmt_pending_since = undefined} =
StateData) ->
{reply, Reply, wait_for_resume,
StateData#state{mgmt_pending_since = os:timestamp()},
StateData#state.mgmt_timeout};
fsm_reply(Reply, wait_for_resume, StateData) ->
Diff = timer:now_diff(os:timestamp(), StateData#state.mgmt_pending_since),
Timeout = max(StateData#state.mgmt_timeout - Diff div 1000, 1),
@@ -2464,9 +2539,9 @@ fsm_reply(Reply, StateName, StateData) ->
{reply, Reply, StateName, StateData, ?C2S_OPEN_TIMEOUT}.
%% Used by c2s blacklist plugins
is_ip_blacklisted(undefined) -> false;
is_ip_blacklisted({IP, _Port}) ->
ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]).
is_ip_blacklisted(undefined, _Lang) -> false;
is_ip_blacklisted({IP, _Port}, Lang) ->
ejabberd_hooks:run_fold(check_bl_c2s, false, [IP, Lang]).
%% Check from attributes
%% returns invalid-from|NewElement
@@ -2725,15 +2800,20 @@ handle_resume(StateData, Attrs) ->
{<<"h">>, AttrH},
{<<"previd">>, AttrId}],
children = []}),
SendFun = fun(_F, _T, El) -> send_element(NewState, El) end,
SendFun = fun(_F, _T, El, Time) ->
NewEl = add_resent_delay_info(NewState, El, Time),
send_element(NewState, NewEl)
end,
handle_unacked_stanzas(NewState, SendFun),
send_element(NewState,
#xmlel{name = <<"r">>,
attrs = [{<<"xmlns">>, AttrXmlns}],
children = []}),
FlushedState = csi_queue_flush(NewState),
NewStateData = FlushedState#state{csi_state = active},
?INFO_MSG("Resumed session for ~s",
[jlib:jid_to_string(NewState#state.jid)]),
{ok, NewState};
[jlib:jid_to_string(NewStateData#state.jid)]),
{ok, NewStateData};
{error, El, Msg} ->
send_element(StateData, El),
?INFO_MSG("Cannot resume session for ~s@~s: ~s",
@@ -2779,30 +2859,25 @@ mgmt_queue_add(StateData, El) ->
Num ->
Num + 1
end,
NewQueue = queue:in({NewNum, El}, StateData#state.mgmt_queue),
NewQueue = queue:in({NewNum, now(), El}, StateData#state.mgmt_queue),
NewState = StateData#state{mgmt_queue = NewQueue,
mgmt_stanzas_out = NewNum},
check_queue_length(NewState).
mgmt_queue_drop(StateData, NumHandled) ->
NewQueue = jlib:queue_drop_while(fun({N, _Stanza}) -> N =< NumHandled end,
NewQueue = jlib:queue_drop_while(fun({N, _T, _E}) -> N =< NumHandled end,
StateData#state.mgmt_queue),
StateData#state{mgmt_queue = NewQueue}.
check_queue_length(#state{mgmt_max_queue = Limit} = StateData)
when Limit == infinity;
Limit == unlimited ->
Limit == exceeded ->
StateData;
check_queue_length(#state{mgmt_queue = Queue,
mgmt_max_queue = Limit} = StateData) ->
case queue:len(Queue) > Limit of
true ->
?WARNING_MSG("ACK queue too long, terminating session for ~s",
[jlib:jid_to_string(StateData#state.jid)]),
Lang = StateData#state.lang,
Err = ?SERRT_POLICY_VIOLATION(Lang, <<"Too many unacked stanzas">>),
self() ! {kick, queue_overflow, Err},
StateData#state{mgmt_resend = false}; % Don't resend the flood!
StateData#state{mgmt_max_queue = exceeded};
false ->
StateData
end.
@@ -2818,12 +2893,12 @@ handle_unacked_stanzas(StateData, F)
?INFO_MSG("~B stanzas were not acknowledged by ~s",
[N, jlib:jid_to_string(StateData#state.jid)]),
lists:foreach(
fun({_, #xmlel{attrs = Attrs} = El}) ->
fun({_, Time, #xmlel{attrs = Attrs} = El}) ->
From_s = xml:get_attr_s(<<"from">>, Attrs),
From = jlib:string_to_jid(From_s),
To_s = xml:get_attr_s(<<"to">>, Attrs),
To = jlib:string_to_jid(To_s),
F(From, To, El)
F(From, To, El, Time)
end, queue:to_list(Queue))
end;
handle_unacked_stanzas(_StateData, _F) ->
@@ -2832,18 +2907,29 @@ handle_unacked_stanzas(_StateData, _F) ->
handle_unacked_stanzas(StateData)
when StateData#state.mgmt_state == active;
StateData#state.mgmt_state == pending ->
ReRoute = case StateData#state.mgmt_resend of
ResendOnTimeout =
case StateData#state.mgmt_resend of
Resend when is_boolean(Resend) ->
Resend;
if_offline ->
ejabberd_sm:get_user_resources(StateData#state.user,
StateData#state.server) == []
end,
ReRoute = case ResendOnTimeout of
true ->
fun ejabberd_router:route/3;
fun(From, To, El, Time) ->
NewEl = add_resent_delay_info(StateData, El, Time),
ejabberd_router:route(From, To, NewEl)
end;
false ->
fun(From, To, El) ->
fun(From, To, El, _Time) ->
Err =
jlib:make_error_reply(El,
?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err)
end
end,
F = fun(From, To, El) ->
F = fun(From, To, El, Time) ->
%% We'll drop the stanza if it was <forwarded/> by some
%% encapsulating protocol as per XEP-0297. One such protocol is
%% XEP-0280, which says: "When a receiving server attempts to
@@ -2856,7 +2942,7 @@ handle_unacked_stanzas(StateData)
?DEBUG("Dropping forwarded stanza from ~s",
[xml:get_attr_s(<<"from">>, El#xmlel.attrs)]);
false ->
ReRoute(From, To, El)
ReRoute(From, To, El, Time)
end
end,
handle_unacked_stanzas(StateData, F);
@@ -2891,7 +2977,7 @@ is_encapsulated_forward(_El) ->
inherit_session_state(#state{user = U, server = S} = StateData, ResumeID) ->
case jlib:base64_to_term(ResumeID) of
{term, {U, S, R, Time}} ->
{term, {R, Time}} ->
case ejabberd_sm:get_session_pid(U, S, R) of
none ->
{error, <<"Previous session PID not found">>};
@@ -2911,19 +2997,19 @@ inherit_session_state(#state{user = U, server = S} = StateData, ResumeID) ->
{auth_module, StateData#state.auth_module}],
ejabberd_sm:open_session(NewSID, U, S, R,
Priority, Info),
{ok, StateData#state{sid = NewSID,
{ok, StateData#state{conn = Conn,
sid = NewSID,
jid = OldStateData#state.jid,
resource = OldStateData#state.resource,
pres_t = OldStateData#state.pres_t,
pres_f = OldStateData#state.pres_f,
pres_a = OldStateData#state.pres_a,
pres_i = OldStateData#state.pres_i,
pres_last = OldStateData#state.pres_last,
pres_pri = OldStateData#state.pres_pri,
pres_timestamp = OldStateData#state.pres_timestamp,
pres_invis = OldStateData#state.pres_invis,
privacy_list = OldStateData#state.privacy_list,
aux_fields = OldStateData#state.aux_fields,
csi_state = OldStateData#state.csi_state,
csi_queue = OldStateData#state.csi_queue,
mgmt_xmlns = OldStateData#state.mgmt_xmlns,
mgmt_queue = OldStateData#state.mgmt_queue,
mgmt_timeout = OldStateData#state.mgmt_timeout,
@@ -2936,7 +3022,7 @@ inherit_session_state(#state{user = U, server = S} = StateData, ResumeID) ->
{error, <<"Cannot grab session state">>}
end
end;
error ->
_ ->
{error, <<"Invalid 'previd' value">>}
end.
@@ -2945,11 +3031,74 @@ resume_session({Time, PID}) ->
make_resume_id(StateData) ->
{Time, _} = StateData#state.sid,
ID = {StateData#state.user,
StateData#state.server,
StateData#state.resource,
Time},
jlib:term_to_base64(ID).
jlib:term_to_base64({StateData#state.resource, Time}).
add_resent_delay_info(#state{server = From}, El, Time) ->
jlib:add_delay_info(El, From, Time, <<"Resent">>).
%%%----------------------------------------------------------------------
%%% XEP-0352
%%%----------------------------------------------------------------------
csi_filter_stanza(#state{csi_state = CsiState, jid = JID} = StateData,
Stanza) ->
Action = ejabberd_hooks:run_fold(csi_filter_stanza,
StateData#state.server,
send, [Stanza]),
?DEBUG("Going to ~p stanza for inactive client ~p",
[Action, jlib:jid_to_string(JID)]),
case Action of
queue -> csi_queue_add(StateData, Stanza);
drop -> StateData;
send ->
From = xml:get_tag_attr_s(<<"from">>, Stanza),
StateData1 = csi_queue_send(StateData, From),
StateData2 = send_stanza(StateData1#state{csi_state = active},
Stanza),
StateData2#state{csi_state = CsiState}
end.
csi_queue_add(#state{csi_queue = Queue} = StateData, Stanza) ->
case length(StateData#state.csi_queue) >= csi_max_queue(StateData) of
true -> csi_queue_add(csi_queue_flush(StateData), Stanza);
false ->
From = xml:get_tag_attr_s(<<"from">>, Stanza),
NewQueue = lists:keystore(From, 1, Queue, {From, now(), Stanza}),
StateData#state{csi_queue = NewQueue}
end.
csi_queue_send(#state{csi_queue = Queue, csi_state = CsiState, server = Host} =
StateData, From) ->
case lists:keytake(From, 1, Queue) of
{value, {From, Time, Stanza}, NewQueue} ->
NewStanza = jlib:add_delay_info(Stanza, Host, Time,
<<"Client Inactive">>),
NewStateData = send_stanza(StateData#state{csi_state = active},
NewStanza),
NewStateData#state{csi_queue = NewQueue, csi_state = CsiState};
false -> StateData
end.
csi_queue_flush(#state{csi_queue = Queue, csi_state = CsiState, jid = JID,
server = Host} = StateData) ->
?DEBUG("Flushing CSI queue for ~s", [jlib:jid_to_string(JID)]),
NewStateData =
lists:foldl(fun({_From, Time, Stanza}, AccState) ->
NewStanza =
jlib:add_delay_info(Stanza, Host, Time,
<<"Client Inactive">>),
send_stanza(AccState, NewStanza)
end, StateData#state{csi_state = active}, Queue),
NewStateData#state{csi_queue = [], csi_state = CsiState}.
%% Make sure we won't push too many messages to the XEP-0198 queue when the
%% client becomes 'active' again. Otherwise, the client might not manage to
%% acknowledge the message flood in time. Also, don't let the queue grow to
%% more than 100 stanzas.
csi_max_queue(#state{mgmt_max_queue = infinity}) -> 100;
csi_max_queue(#state{mgmt_max_queue = Max}) when Max > 200 -> 100;
csi_max_queue(#state{mgmt_max_queue = Max}) when Max < 2 -> 1;
csi_max_queue(#state{mgmt_max_queue = Max}) -> Max div 2.
%%%----------------------------------------------------------------------
%%% JID Set memory footprint reduction code
+1 -1
View File
@@ -6,7 +6,7 @@
%%% Created : 2 Nov 2007 by Mickael Remond <mremond@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+10 -10
View File
@@ -5,7 +5,7 @@
%%% Created : 26 Apr 2008 by Evgeniy Khramtsov <xramtsov@gmail.com>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -549,10 +549,11 @@ get_transfer_protocol(PortString) ->
get_port_listeners(PortNumber) ->
AllListeners = ejabberd_config:get_option(listen, fun(V) -> V end),
lists:filter(fun ({{Port, _Ip, _Netp}, _Module1,
_Opts1})
when Port == PortNumber ->
true;
lists:filter(fun (Listener) when is_list(Listener) ->
case proplists:get_value(port, Listener) of
PortNumber -> true;
_ -> false
end;
(_) -> false
end,
AllListeners).
@@ -562,12 +563,11 @@ get_captcha_transfer_protocol([]) ->
"is not a ejabberd_http listener with "
"'captcha' option. Change the port number "
"or specify http:// in that option.">>);
get_captcha_transfer_protocol([{{_Port, _Ip, tcp},
ejabberd_http, Opts}
| Listeners]) ->
case lists:member(captcha, Opts) of
get_captcha_transfer_protocol([Listener | Listeners]) when is_list(Listener) ->
case proplists:get_value(module, Listener) == ejabberd_http andalso
proplists:get_bool(captcha, Listener) of
true ->
case lists:member(tls, Opts) of
case proplists:get_bool(tls, Listener) of
true -> https;
false -> http
end;
+9 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 20 May 2008 by Badlop <badlop@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -399,7 +399,14 @@ check_auth({User, Server, Password}) ->
check_access(all, _) ->
true;
check_access(Access, Auth) ->
{ok, User, Server} = check_auth(Auth),
case check_auth(Auth) of
{ok, User, Server} ->
check_access(Access, User, Server);
_ ->
false
end.
check_access(Access, User, Server) ->
%% Check this user has access permission
case acl:match_rule(Server, Access, jlib:make_jid(User, Server, <<"">>)) of
allow -> true;
+63 -28
View File
@@ -5,7 +5,7 @@
%%% Created : 14 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -26,7 +26,7 @@
-module(ejabberd_config).
-author('alexey@process-one.net').
-export([start/0, load_file/1, read_file/1,
-export([start/0, load_file/1, reload_file/0, read_file/1,
add_global_option/2, add_local_option/2,
get_global_option/2, get_local_option/2,
get_global_option/3, get_local_option/3,
@@ -125,6 +125,12 @@ load_file(File) ->
State = read_file(File),
set_opts(State).
-spec reload_file() -> ok.
reload_file() ->
Config = get_ejabberd_config_path(),
load_file(Config).
-spec convert_to_yaml(file:filename()) -> ok | {error, any()}.
convert_to_yaml(File) ->
@@ -184,7 +190,7 @@ consult(File) ->
{ok, []} ->
{ok, []};
{ok, [Document|_]} ->
{ok, Document};
{ok, parserl(Document)};
{error, Err} ->
Msg1 = "Cannot load " ++ File ++ ": ",
Msg2 = p1_yaml:format_error(Err),
@@ -201,6 +207,17 @@ consult(File) ->
end
end.
parserl(<<"> ", Term/binary>>) ->
{ok, A2, _} = erl_scan:string(binary_to_list(Term)),
{ok, A3} = erl_parse:parse_term(A2),
A3;
parserl({A, B}) ->
{parserl(A), parserl(B)};
parserl([El|Tail]) ->
[parserl(El) | parserl(Tail)];
parserl(Other) ->
Other.
%% @doc Convert configuration filename to absolute path.
%% Input is an absolute or relative path to an ejabberd configuration file.
%% And returns an absolute path to the configuration file.
@@ -210,9 +227,8 @@ get_absolute_path(File) ->
absolute ->
File;
relative ->
Config_path = get_ejabberd_config_path(),
Config_dir = filename:dirname(Config_path),
filename:absname_join(Config_dir, File)
{ok, Dir} = file:get_cwd(),
filename:absname_join(Dir, File)
end.
@@ -691,26 +707,40 @@ replace_module(mod_roster_odbc) -> {mod_roster, odbc};
replace_module(mod_shared_roster_odbc) -> {mod_shared_roster, odbc};
replace_module(mod_vcard_odbc) -> {mod_vcard, odbc};
replace_module(mod_vcard_xupdate_odbc) -> {mod_vcard_xupdate, odbc};
replace_module(Module) -> Module.
replace_module(Module) ->
case is_elixir_module(Module) of
true -> expand_elixir_module(Module);
false -> Module
end.
replace_modules(Modules) ->
lists:map(
fun({Module, Opts}) ->
case replace_module(Module) of
{NewModule, DBType} ->
emit_deprecation_warning(Module, NewModule, DBType),
NewOpts = [{db_type, DBType} |
lists:keydelete(db_type, 1, Opts)],
{NewModule, transform_module_options(Module, NewOpts)};
NewModule ->
if Module /= NewModule ->
emit_deprecation_warning(Module, NewModule);
true ->
ok
end,
{NewModule, transform_module_options(Module, Opts)}
end
end, Modules).
replace_modules(Modules) -> lists:map( fun({Module, Opts}) -> case
replace_module(Module) of {NewModule, DBType} ->
emit_deprecation_warning(Module, NewModule, DBType), NewOpts =
[{db_type, DBType} | lists:keydelete(db_type, 1, Opts)],
{NewModule, transform_module_options(Module, NewOpts)}; NewModule
-> if Module /= NewModule -> emit_deprecation_warning(Module,
NewModule); true -> ok end, {NewModule,
transform_module_options(Module, Opts)} end end, Modules).
%% Elixir module naming
%% ====================
%% If module name start with uppercase letter, this is an Elixir module:
is_elixir_module(Module) ->
case atom_to_list(Module) of
[H|_] when H >= 65, H =< 90 -> true;
_ ->false
end.
%% We assume we know this is an elixir module
expand_elixir_module(Module) ->
case atom_to_list(Module) of
%% Module name already specified as an Elixir from Erlang module name
"Elixir." ++ _ -> Module;
%% if start with uppercase letter, this is an Elixir module: Append 'Elixir.' to module name.
ModuleString ->
list_to_atom("Elixir." ++ ModuleString)
end.
strings_to_binary([]) ->
[];
@@ -989,9 +1019,14 @@ report_and_stop(Tab, Err) ->
halt(string:substr(ErrTxt, 1, 199)).
emit_deprecation_warning(Module, NewModule, DBType) ->
?WARNING_MSG("Module ~s is deprecated, use {~s, [{db_type, ~s}, ...]}"
?WARNING_MSG("Module ~s is deprecated, use ~s with 'db_type: ~s'"
" instead", [Module, NewModule, DBType]).
emit_deprecation_warning(Module, NewModule) ->
?WARNING_MSG("Module ~s is deprecated, use ~s instead",
[Module, NewModule]).
case is_elixir_module(NewModule) of
%% Do not emit deprecation warning for Elixir
true -> ok;
false ->
?WARNING_MSG("Module ~s is deprecated, use ~s instead",
[Module, NewModule])
end.
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 11 Jan 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -210,7 +210,7 @@ process(Args) ->
%% @spec (Args::[string()], AccessCommands) -> {String::string(), Code::integer()}
process2(["--auth", User, Server, Pass | Args], AccessCommands) ->
process2(Args, {User, Server, Pass}, AccessCommands);
process2(Args, {list_to_binary(User), list_to_binary(Server), list_to_binary(Pass)}, AccessCommands);
process2(Args, AccessCommands) ->
process2(Args, noauth, AccessCommands).
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 23 Aug 2006 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 8 Aug 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -151,7 +151,7 @@ run(Hook, Host, Args) ->
%% The arguments passed to the function are: [Val | Args].
%% The result of a call is used as Val for the next call.
%% If a call returns 'stop', no more calls are performed and 'stopped' is returned.
%% If a call returns {stopped, NewVal}, no more calls are performed and NewVal is returned.
%% If a call returns {stop, NewVal}, no more calls are performed and NewVal is returned.
run_fold(Hook, Val, Args) ->
run_fold(Hook, global, Val, Args).
+16 -5
View File
@@ -5,7 +5,7 @@
%%% Created : 27 Feb 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -65,6 +65,7 @@
request_tp,
request_headers = [],
end_of_request = false,
options = [],
default_host,
trail = <<>>
}).
@@ -133,6 +134,10 @@ init({SockMod, Socket}, Opts) ->
true -> [{[<<"http-poll">>], ejabberd_http_poll}];
false -> []
end,
XMLRPC = case proplists:get_bool(xmlrpc, Opts) of
true -> [{[], ejabberd_xmlrpc}];
false -> []
end,
DefinedHandlers = gen_mod:get_opt(
request_handlers, Opts,
fun(Hs) ->
@@ -141,7 +146,7 @@ init({SockMod, Socket}, Opts) ->
Mod} || {Path, Mod} <- Hs]
end, []),
RequestHandlers = DefinedHandlers ++ Captcha ++ Register ++
Admin ++ Bind ++ Poll,
Admin ++ Bind ++ Poll ++ XMLRPC,
?DEBUG("S: ~p~n", [RequestHandlers]),
DefaultHost = gen_mod:get_opt(default_host, Opts, fun(A) -> A end, undefined),
@@ -150,6 +155,7 @@ init({SockMod, Socket}, Opts) ->
State = #state{sockmod = SockMod1,
socket = Socket1,
default_host = DefaultHost,
options = Opts,
request_handlers = RequestHandlers},
receive_headers(State).
@@ -274,7 +280,7 @@ process_header(State, Data) ->
[]),
throw(http_request_no_host_header);
{ok, http_eoh} ->
?DEBUG("(~w) http query: ~w ~s~n",
?DEBUG("(~w) http query: ~w ~p~n",
[State#state.socket, State#state.request_method,
element(2, State#state.request_path)]),
{HostProvided, Port, TP} =
@@ -293,13 +299,16 @@ process_header(State, Data) ->
_ -> ok
end,
#state{sockmod = SockMod, socket = Socket,
options = State#state.options,
request_handlers = State#state.request_handlers};
_ ->
#state{end_of_request = true,
options = State#state.options,
request_handlers = State#state.request_handlers}
end;
_ ->
#state{end_of_request = true,
options = State#state.options,
request_handlers = State#state.request_handlers}
end.
@@ -359,7 +368,7 @@ process(Handlers, Request) ->
false -> process(HandlersLeft, Request)
end.
process_request(#state{request_method = Method,
process_request(#state{request_method = Method, options = Options,
request_path = {abs_path, Path}, request_auth = Auth,
request_lang = Lang, request_handlers = RequestHandlers,
request_host = Host, request_port = Port,
@@ -389,6 +398,7 @@ process_request(#state{request_method = Method,
IP = analyze_ip_xff(IPHere, XFF, Host),
Request = #request{method = Method,
path = LPath,
opts = Options,
q = LQuery,
auth = Auth,
lang = Lang,
@@ -413,7 +423,7 @@ process_request(#state{request_method = Method,
make_text_output(State, Status, Headers, Output)
end
end;
process_request(#state{request_method = Method,
process_request(#state{request_method = Method, options = Options,
request_path = {abs_path, Path}, request_auth = Auth,
request_content_length = Len, request_lang = Lang,
sockmod = SockMod, socket = Socket, request_host = Host,
@@ -450,6 +460,7 @@ process_request(#state{request_method = Method,
Request = #request{method = Method,
path = LPath,
q = LQuery,
opts = Options,
auth = Auth,
data = Data,
lang = Lang,
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 4 Mar 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -6
View File
@@ -5,7 +5,7 @@
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -201,11 +201,7 @@ listen_tcp(PortIP, Module, SockOpts, Port, IPS) ->
catch
_:_ -> []
end,
DeliverAs = case Module of
ejabberd_xmlrpc -> list;
_ -> binary
end,
Res = gen_tcp:listen(Port, [DeliverAs,
Res = gen_tcp:listen(Port, [binary,
{packet, 0},
{active, false},
{reuseaddr, true},
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 30 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+8 -8
View File
@@ -6,7 +6,7 @@
%%% @end
%%% Created : 12 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
%%%
%%% ejabberd, Copyright (C) 2013 ProcessOne
%%% ejabberd, Copyright (C) 2013-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -61,9 +61,9 @@ get_log_path() ->
-ifdef(LAGER).
get_pos_integer_env(Name, Default) ->
get_integer_env(Name, Default) ->
case application:get_env(ejabberd, Name) of
{ok, I} when is_integer(I), I>0 ->
{ok, I} when is_integer(I), I>=0 ->
I;
undefined ->
Default;
@@ -73,7 +73,7 @@ get_pos_integer_env(Name, Default) ->
[Name, Junk, Default]),
Default
end.
get_pos_string_env(Name, Default) ->
get_string_env(Name, Default) ->
case application:get_env(ejabberd, Name) of
{ok, L} when is_list(L) ->
L;
@@ -94,10 +94,10 @@ start() ->
Dir = filename:dirname(ConsoleLog),
ErrorLog = filename:join([Dir, "error.log"]),
CrashLog = filename:join([Dir, "crash.log"]),
LogRotateDate = get_pos_string_env(log_rotate_date, ""),
LogRotateSize = get_pos_integer_env(log_rotate_size, 10*1024*1024),
LogRotateCount = get_pos_integer_env(log_rotate_count, 1),
LogRateLimit = get_pos_integer_env(log_rate_limit, 100),
LogRotateDate = get_string_env(log_rotate_date, ""),
LogRotateSize = get_integer_env(log_rotate_size, 10*1024*1024),
LogRotateCount = get_integer_env(log_rotate_count, 1),
LogRateLimit = get_integer_env(log_rate_limit, 100),
application:set_env(lager, error_logger_hwm, LogRateLimit),
application:set_env(
lager, handlers,
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 1 Nov 2006 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 8 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -204,7 +204,7 @@ decode_term(Bin) ->
%%%----------------------------------------------------------------------
init([Host, StartInterval]) ->
case ejabberd_config:get_option(
{keepalive_interval, Host},
{odbc_keepalive_interval, Host},
fun(I) when is_integer(I), I>0 -> I end) of
undefined ->
ok;
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 22 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -9,7 +9,7 @@
%%% @doc
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 10 Nov 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 8 Dec 2011 by Badlop
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -4,7 +4,7 @@
%%% Interface for Riak database
%%% @end
%%% Created : 29 Dec 2011 by Alexey Shchepin <alexey@process-one.net>
%%% @copyright (C) 2002-2014 ProcessOne
%%% @copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 29 Dec 2011 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 27 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 7 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+5 -3
View File
@@ -5,7 +5,7 @@
%%% Created : 6 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -374,8 +374,8 @@ wait_for_feature_request({xmlstreamelement, El},
#xmlel{name = <<"success">>,
attrs = [{<<"xmlns">>, ?NS_SASL}],
children = []}),
?DEBUG("(~w) Accepted s2s authentication for ~s",
[StateData#state.socket, AuthDomain]),
?INFO_MSG("Accepted s2s EXTERNAL authentication for ~s (TLS=~p)",
[AuthDomain, StateData#state.tls_enabled]),
change_shaper(StateData, <<"">>,
jlib:make_jid(<<"">>, AuthDomain, <<"">>)),
{next_state, wait_for_stream,
@@ -515,6 +515,8 @@ stream_established({valid, From, To}, StateData) ->
[{<<"from">>, To}, {<<"to">>, From},
{<<"type">>, <<"valid">>}],
children = []}),
?INFO_MSG("Accepted s2s dialback authentication for ~s (TLS=~p)",
[From, StateData#state.tls_enabled]),
LFrom = jlib:nameprep(From),
LTo = jlib:nameprep(To),
NSD = StateData#state{connections =
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 6 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 6 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+3 -3
View File
@@ -5,7 +5,7 @@
%%% Created : 24 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -604,7 +604,7 @@ do_route(From, To, #xmlel{} = Packet) ->
?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err)
end;
_ -> ?DEBUG("packet droped~n", [])
_ -> ?DEBUG("packet dropped~n", [])
end;
Ss ->
Session = lists:max(Ss),
@@ -849,7 +849,7 @@ kick_user(User, Server) ->
lists:foreach(
fun(Resource) ->
PID = get_session_pid(User, Server, Resource),
PID ! disconnect
PID ! kick
end, Resources),
length(Resources).
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 23 Aug 2006 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+17
View File
@@ -5,6 +5,23 @@
%%%
%%% @end
%%% Created : 8 May 2014 by Evgeny Khramtsov <ekhramtsov@process-one.net>
%%%
%%% ejabberd, Copyright (C) 2013-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
%%% published by the Free Software Foundation; either version 2 of the
%%% License, or (at your option) any later version.
%%%
%%% This program is distributed in the hope that it will be useful,
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details.
%%%
%%% You should have received a copy of the GNU General Public License along
%%% with this program; if not, write to the Free Software Foundation, Inc.,
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
%%%-------------------------------------------------------------------
-module(ejabberd_stun).
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 21 Mar 2007 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 18 Jul 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -36,4 +36,4 @@ init(Module) ->
{ok,
{{simple_one_for_one, 10, 1},
[{undefined, {Module, start_link, []}, temporary,
brutal_kill, worker, [Module]}]}}.
1000, worker, [Module]}]}}.
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 27 Jan 2006 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+1 -1
View File
@@ -6,7 +6,7 @@
%%% Created : 28 Feb 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+2 -2
View File
@@ -5,7 +5,7 @@
%%% Created : 9 Apr 2004 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
@@ -340,7 +340,7 @@ make_xhtml(Els, Host, Node, Lang, JID) ->
?XAE(<<"div">>, [{<<"id">>, <<"copyrightouter">>}],
[?XAE(<<"div">>, [{<<"id">>, <<"copyright">>}],
[?XC(<<"p">>,
<<"ejabberd (c) 2002-2014 ProcessOne">>)])])])]}}.
<<"ejabberd (c) 2002-2015 ProcessOne">>)])])])]}}.
get_base_path(global, cluster) -> <<"/admin/">>;
get_base_path(Host, cluster) ->
+44 -30
View File
@@ -17,11 +17,12 @@
-author('badlop@process-one.net').
-export([start/2, handler/2, socket_type/0, transform_listen_option/2]).
-export([start/2, handler/2, process/2, socket_type/0,
transform_listen_option/2]).
-include("ejabberd.hrl").
-include("logger.hrl").
-include("ejabberd_http.hrl").
-include("mod_roster.hrl").
-include("jlib.hrl").
@@ -170,12 +171,14 @@
%% -----------------------------
start({gen_tcp = _SockMod, Socket}, Opts) ->
%MaxSessions = gen_mod:get_opt(maxsessions, Opts,
% fun(I) when is_integer(I), I>0 -> I end,
% 10),
Timeout = gen_mod:get_opt(timeout, Opts,
fun(I) when is_integer(I), I>0 -> I end,
5000),
ejabberd_http:start({gen_tcp, Socket}, [{xmlrpc, true}|Opts]).
socket_type() -> raw.
%% -----------------------------
%% HTTP interface
%% -----------------------------
process(_, #request{method = 'POST', data = Data, opts = Opts}) ->
AccessCommandsOpts = gen_mod:get_opt(access_commands, Opts,
fun(L) when is_list(L) -> L end,
[]),
@@ -201,19 +204,36 @@ start({gen_tcp = _SockMod, Socket}, Opts) ->
[?MODULE, Wrong]),
[]
end, AccessCommandsOpts),
GetAuth = case [ACom
|| {Ac, _, _} = ACom <- AccessCommands, Ac /= all]
of
[] -> false;
_ -> true
GetAuth = case [ACom || {Ac, _, _} = ACom <- AccessCommands, Ac /= all] of
[] -> false;
_ -> true
end,
Handler = {?MODULE, handler},
State = #state{access_commands = AccessCommands,
get_auth = GetAuth},
Pid = proc_lib:spawn(xmlrpc_http, handler, [Socket, Timeout, Handler, State]),
{ok, Pid}.
socket_type() -> raw.
State = #state{access_commands = AccessCommands, get_auth = GetAuth},
case xml_stream:parse_element(Data) of
{error, _} ->
{400, [],
#xmlel{name = <<"h1">>, attrs = [],
children = [{xmlcdata, <<"Malformed XML">>}]}};
El ->
case p1_xmlrpc:decode(El) of
{error, _} = Err ->
?ERROR_MSG("XML-RPC request ~s failed with reason: ~p",
[Data, Err]),
{400, [],
#xmlel{name = <<"h1">>, attrs = [],
children = [{xmlcdata, <<"Malformed Request">>}]}};
{ok, RPC} ->
?DEBUG("got XML-RPC request: ~p", [RPC]),
{false, Result} = handler(State, RPC),
XML = xml:element_to_binary(p1_xmlrpc:encode(Result)),
{200, [{<<"Content-Type">>, <<"text/xml">>}],
<<"<?xml version=\"1.0\"?>", XML/binary>>}
end
end;
process(_, _) ->
{400, [],
#xmlel{name = <<"h1">>, attrs = [],
children = [{xmlcdata, <<"400 Bad Request">>}]}}.
%% -----------------------------
%% Access verification
@@ -340,23 +360,17 @@ build_fault_response(Code, ParseString, ParseArgs) ->
FaultString = "Error " ++ integer_to_list(Code) ++ "\n"
++ lists:flatten(io_lib:format(ParseString, ParseArgs)),
?WARNING_MSG(FaultString, []),
{false, {response, {fault, Code, FaultString}}}.
{false, {response, {fault, Code, list_to_binary(FaultString)}}}.
do_command(AccessCommands, Auth, Command, AttrL, ArgsF,
ResultF) ->
ArgsFormatted = format_args(AttrL, ArgsF),
AuthBin = convert_auth(Auth),
Result =
ejabberd_commands:execute_command(AccessCommands, AuthBin,
ejabberd_commands:execute_command(AccessCommands, Auth,
Command, ArgsFormatted),
ResultFormatted = format_result(Result, ResultF),
{command_result, ResultFormatted}.
convert_auth(noauth) ->
noauth;
convert_auth({UserT, ServerT, PasswordT}) ->
{list_to_binary(UserT), list_to_binary(ServerT), list_to_binary(PasswordT)}.
%%-----------------------------
%% Format arguments
%%-----------------------------
@@ -428,8 +442,8 @@ format_arg({array, Elements}, {list, ElementsDef})
format_arg(Arg, integer) when is_integer(Arg) -> Arg;
format_arg(Arg, binary) when is_list(Arg) -> list_to_binary(Arg);
format_arg(Arg, binary) when is_binary(Arg) -> Arg;
format_arg(Arg, string) when is_list(Arg) -> list_to_binary(Arg);
format_arg(Arg, string) when is_binary(Arg) -> Arg;
format_arg(Arg, string) when is_list(Arg) -> Arg;
format_arg(Arg, string) when is_binary(Arg) -> binary_to_list(Arg);
format_arg(Arg, Format) ->
?ERROR_MSG("don't know how to format Arg ~p for format ~p", [Arg, Format]),
throw({error_formatting_argument, Arg, Format}).
+1 -1
View File
@@ -5,7 +5,7 @@
%%% Created : 22 Aug 2005 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
+8 -9
View File
@@ -828,7 +828,7 @@ send_command(Command, From, S) ->
Message = #'LDAPMessage'{messageID = Id,
protocolOp = {Name, Request}},
?DEBUG("~p~n", [{Name, Request}]),
{ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage',
{ok, Bytes} = 'ELDAPv3':encode('LDAPMessage',
Message),
case (S#eldap.sockmod):send(S#eldap.fd, Bytes) of
ok ->
@@ -863,11 +863,10 @@ gen_req({modify_dn, Entry, NewRDN, DelOldRDN,
#'ModifyDNRequest'{entry = Entry, newrdn = NewRDN,
deleteoldrdn = DelOldRDN, newSuperior = NewSup}};
gen_req({modify_passwd, DN, Passwd}) ->
{ok, ReqVal} = asn1rt:encode('ELDAPv3',
'PasswdModifyRequestValue',
#'PasswdModifyRequestValue'{userIdentity = DN,
newPasswd =
Passwd}),
{ok, ReqVal} = 'ELDAPv3':encode('PasswdModifyRequestValue',
#'PasswdModifyRequestValue'{userIdentity = DN,
newPasswd =
Passwd}),
{extendedReq,
#'ExtendedRequest'{requestName = ?passwdModifyOID,
requestValue = iolist_to_binary(ReqVal)}};
@@ -887,7 +886,7 @@ gen_req({bind, RootDN, Passwd}) ->
%% {'EXIT', Reason} - Broke
%%-----------------------------------------------------------------------
recvd_packet(Pkt, S) ->
case asn1rt:decode('ELDAPv3', 'LDAPMessage', Pkt) of
case 'ELDAPv3':decode('LDAPMessage', Pkt) of
{ok, Msg} ->
Op = Msg#'LDAPMessage'.protocolOp,
?DEBUG("~p", [Op]),
@@ -1005,7 +1004,7 @@ get_op_rec(Id, Dict) ->
%% {'EXIT', Reason} - Broken packet
%%-----------------------------------------------------------------------
recvd_wait_bind_response(Pkt, S) ->
case asn1rt:decode('ELDAPv3', 'LDAPMessage', Pkt) of
case 'ELDAPv3':decode('LDAPMessage', Pkt) of
{ok, Msg} ->
?DEBUG("~p", [Msg]),
check_id(S#eldap.id, Msg#'LDAPMessage'.messageID),
@@ -1152,7 +1151,7 @@ bind_request(Socket, S) ->
Message = #'LDAPMessage'{messageID = Id,
protocolOp = {bindRequest, Req}},
?DEBUG("Bind Request Message:~p~n", [Message]),
{ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage',
{ok, Bytes} = 'ELDAPv3':encode('LDAPMessage',
Message),
case (S#eldap.sockmod):send(Socket, Bytes) of
ok -> {ok, S#eldap{id = Id}};
+1 -1
View File
@@ -6,7 +6,7 @@
%%% Author: Evgeniy Khramtsov <ekhramtsov@process-one.net>
%%%
%%%
%%% ejabberd, Copyright (C) 2002-2014 ProcessOne
%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as

Some files were not shown because too many files have changed in this diff Show More