diff --git a/README b/README index 1a8dcdd1e..da7742256 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ To compile ejabberd you need: - GCC - Libexpat 1.95 or higher - Erlang/OTP R10B-9 or higher. Recommended versions: R12B-5 and R13B04 - - OpenSSL 0.9.6 or higher, for STARTTLS, SASL and SSL encryption. + - 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. - Erlang mysql library. Optional. MySQL authentication/storage. diff --git a/doc/guide.html b/doc/guide.html index 44d0fd316..3b78cba9e 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -346,7 +346,7 @@ GNU Make
  • GCC
  • Libexpat 1.95 or higher
  • Erlang/OTP R10B-9 or higher. The recommended versions are R12B-5 and R13B04. -
  • OpenSSL 0.9.6 or higher, for STARTTLS, SASL and SSL encryption. +
  • 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.
  • Erlang mysql library. Optional. For MySQL authentication or storage. See section 3.2.1.
  • Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section 3.2.3. @@ -390,7 +390,9 @@ To get the full list run the command: Enable the use of XML based optimisations. It will for example use CDATA to escape characters in the XMPP stream. Use this option only if you are sure your XMPP clients include a fully compliant XML parser.

    --disable-transient-supervisors
    - Disable the use of Erlang/OTP supervision for transient processes. + Disable the use of Erlang/OTP supervision for transient processes.

    --enable-nif
    +Replaces some critical Erlang functions with equivalents written in C to improve performance. +This feature requires Erlang/OTP R13B04 or higher.

    2.4.4  Install

    To install ejabberd in the destination directories, run the command: @@ -1896,6 +1898,8 @@ all entries end with a comma: mod_configureServer configuration using Ad-Hocmod_adhoc mod_discoService Discovery (XEP-0030mod_echoEchoes XMPP stanzas  +mod_http_bindXMPP over Bosh service (HTTP Binding)  +mod_http_fileserverSmall HTTP file server  mod_ircIRC transport  mod_lastLast Activity (XEP-0012mod_last_odbcLast Activity (XEP-0012)supported DB (*) @@ -2475,6 +2479,10 @@ the room occupants.

    {anonymous, true|false}
    The room is anonymous: occupants don’t see the real JIDs of other occupants. Note that the room moderators can always see the real JIDs of the occupants. +
    {captcha_protected, false}
    +When a user tries to join a room where he has no affiliation (not owner, admin or member), +the room requires him to fill a CAPTCHA challenge (see section 3.1.8) +in order to accept her join in the room.
    {logging, false|true}
    The public messages are logged using mod_muc_log.
    {max_users, 200}
    Maximum number of occupants in the room.
    {members_by_default, true|false}
    The occupants that enter the room are participants by default, so they have ’voice’. @@ -2967,9 +2975,11 @@ the processing discipline for In-Band Registration (jabber:iq:register)

    This module reads also another option defined globally for the server: {registration_timeout, Timeout}. This option limits the frequency of registration from a given IP or username. -So, a user can’t register a new account from the same IP address or JID during -this number of seconds after previous registration. -Timeout is expressed in seconds, and must be an integer. +So, a user that tries to register a new account from the same IP address or JID during +this number of seconds after his previous registration +will receive an error resource-constraint with the explanation: +“Users are not allowed to register accounts so quickly”. +The timeout is expressed in seconds, and it must be an integer. To disable this limitation, instead of an integer put a word like: infinity. Default value: 600 seconds.

    Examples: diff --git a/doc/guide.tex b/doc/guide.tex index 1cc41e6c3..ecd4815c6 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -311,7 +311,7 @@ To compile \ejabberd{} on a `Unix-like' operating system, you need: \item GCC \item Libexpat 1.95 or higher \item Erlang/OTP R10B-9 or higher. The recommended versions are R12B-5 and R13B04. -\item OpenSSL 0.9.6 or higher, for STARTTLS, SASL and SSL encryption. +\item OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption. \item Zlib 1.2.3 or higher, for Stream Compression support (\xepref{0138}). Optional. \item Erlang mysql library. Optional. For MySQL authentication or storage. See section \ref{compilemysql}. \item Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section \ref{compilepgsql}. @@ -382,6 +382,10 @@ Some options that you may be interested in modifying: \titem{--disable-transient-supervisors} Disable the use of Erlang/OTP supervision for transient processes. + + \titem{--enable-nif} + Replaces some critical Erlang functions with equivalents written in C to improve performance. + This feature requires Erlang/OTP R13B04 or higher. \end{description} \makesubsection{install}{Install} @@ -2501,6 +2505,8 @@ The following table lists all modules included in \ejabberd{}. \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{modhttpbind}{\modhttpbind{}} & XMPP over Bosh service (HTTP Binding) & \\ + \hline \ahrefloc{modhttpfileserver}{\modhttpfileserver{}} & Small HTTP file server & \\ \hline \ahrefloc{modirc}{\modirc{}} & IRC transport & \\ \hline \ahrefloc{modlast}{\modlast{}} & Last Activity (\xepref{0012}) & \\ \hline \ahrefloc{modlast}{\modlastodbc{}} & Last Activity (\xepref{0012}) & supported DB (*) \\ @@ -3197,6 +3203,10 @@ Module options: \titem{\{anonymous, true|false\}} The room is anonymous: occupants don't see the real JIDs of other occupants. Note that the room moderators can always see the real JIDs of the occupants. + \titem{\{captcha\_protected, false\}} + When a user tries to join a room where he has no affiliation (not owner, admin or member), + the room requires him to fill a CAPTCHA challenge (see section \ref{captcha}) + in order to accept her join in the room. \titem{\{logging, false|true\}} The public messages are logged using \term{mod\_muc\_log}. \titem{\{max\_users, 200\}} Maximum number of occupants in the room. \titem{\{members\_by\_default, true|false\}} The occupants that enter the room are participants by default, so they have 'voice'. @@ -3769,9 +3779,11 @@ from s2s leads to uncontrolled massive accounts creation by rogue users. This module reads also another option defined globally for the server: \term{\{registration\_timeout, Timeout\}}. \ind{options!registratimeout} This option limits the frequency of registration from a given IP or username. -So, a user can't register a new account from the same IP address or JID during -this number of seconds after previous registration. -Timeout is expressed in seconds, and must be an integer. +So, a user that tries to register a new account from the same IP address or JID during +this number of seconds after his previous registration +will receive an error \term{resource-constraint} with the explanation: +``Users are not allowed to register accounts so quickly''. +The timeout is expressed in seconds, and it must be an integer. To disable this limitation, instead of an integer put a word like: \term{infinity}. Default value: 600 seconds. diff --git a/src/ejabberd_zlib/ejabberd_zlib_drv.c b/src/ejabberd_zlib/ejabberd_zlib_drv.c index 363eb5b01..5b420e4eb 100644 --- a/src/ejabberd_zlib/ejabberd_zlib_drv.c +++ b/src/ejabberd_zlib/ejabberd_zlib_drv.c @@ -32,6 +32,15 @@ typedef struct { z_stream *i_stream; } ejabberd_zlib_data; +static void* zlib_alloc(void* data, unsigned int items, unsigned int size) +{ + return (void*) driver_alloc(items*size); +} + +static void zlib_free(void* data, void* addr) +{ + driver_free(addr); +} static ErlDrvData ejabberd_zlib_drv_start(ErlDrvPort port, char *buff) { @@ -39,18 +48,18 @@ static ErlDrvData ejabberd_zlib_drv_start(ErlDrvPort port, char *buff) (ejabberd_zlib_data *)driver_alloc(sizeof(ejabberd_zlib_data)); d->port = port; - d->d_stream = (z_stream *)malloc(sizeof(z_stream)); + d->d_stream = (z_stream *)driver_alloc(sizeof(z_stream)); - d->d_stream->zalloc = (alloc_func)0; - d->d_stream->zfree = (free_func)0; + d->d_stream->zalloc = zlib_alloc; + d->d_stream->zfree = zlib_free; d->d_stream->opaque = (voidpf)0; deflateInit(d->d_stream, Z_DEFAULT_COMPRESSION); - d->i_stream = (z_stream *)malloc(sizeof(z_stream)); + d->i_stream = (z_stream *)driver_alloc(sizeof(z_stream)); - d->i_stream->zalloc = (alloc_func)0; - d->i_stream->zfree = (free_func)0; + d->i_stream->zalloc = zlib_alloc; + d->i_stream->zfree = zlib_free; d->i_stream->opaque = (voidpf)0; inflateInit(d->i_stream); @@ -65,10 +74,10 @@ static void ejabberd_zlib_drv_stop(ErlDrvData handle) ejabberd_zlib_data *d = (ejabberd_zlib_data *)handle; deflateEnd(d->d_stream); - free(d->d_stream); + driver_free(d->d_stream); inflateEnd(d->i_stream); - free(d->i_stream); + driver_free(d->i_stream); driver_free((char *)handle); } diff --git a/src/expat_erl.c b/src/expat_erl.c index 8727e5172..f6b552c59 100644 --- a/src/expat_erl.c +++ b/src/expat_erl.c @@ -41,6 +41,8 @@ typedef struct { XML_Parser parser; } expat_data; +static XML_Memory_Handling_Suite ms = {driver_alloc, driver_realloc, driver_free}; + void *erlXML_StartElementHandler(expat_data *d, const XML_Char *name, const XML_Char **atts) @@ -98,7 +100,7 @@ static ErlDrvData expat_erl_start(ErlDrvPort port, char *buff) { expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data)); d->port = port; - d->parser = XML_ParserCreate("UTF-8"); + d->parser = XML_ParserCreate_MM("UTF-8", &ms, NULL); XML_SetUserData(d->parser, d); set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); diff --git a/src/mod_irc/iconv_erl.c b/src/mod_irc/iconv_erl.c index 9e560610d..3212568d9 100644 --- a/src/mod_irc/iconv_erl.c +++ b/src/mod_irc/iconv_erl.c @@ -64,15 +64,15 @@ static int iconv_erl_control(ErlDrvData drv_data, ei_decode_version(buf, &index, &i); ei_decode_tuple_header(buf, &index, &i); ei_get_type(buf, &index, &i, &size); - from = malloc(size + 1); + from = driver_alloc(size + 1); ei_decode_string(buf, &index, from); ei_get_type(buf, &index, &i, &size); - to = malloc(size + 1); + to = driver_alloc(size + 1); ei_decode_string(buf, &index, to); ei_get_type(buf, &index, &i, &size); - stmp = string = malloc(size + 1); + stmp = string = driver_alloc(size + 1); ei_decode_string(buf, &index, string); /* Special mode: parse as UTF-8 if possible; otherwise assume it's @@ -92,9 +92,9 @@ static int iconv_erl_control(ErlDrvData drv_data, *rbuf = (char*)(b = driver_alloc_binary(size)); memcpy(b->orig_bytes, string, size); - free(from); - free(to); - free(string); + driver_free(from); + driver_free(to); + driver_free(string); return size; } @@ -102,7 +102,7 @@ static int iconv_erl_control(ErlDrvData drv_data, outleft = avail = 4*size; inleft = size; - rtmp = rstring = malloc(avail); + rtmp = rstring = driver_alloc(avail); while (inleft > 0) { if (iconv(cd, &stmp, &inleft, &rtmp, &outleft) == (size_t) -1) { if (invalid_utf8_as_latin1 && (*stmp & 0x80) && outleft >= 2) { @@ -121,10 +121,10 @@ static int iconv_erl_control(ErlDrvData drv_data, *rbuf = (char*)(b = driver_alloc_binary(size)); memcpy(b->orig_bytes, rstring, size); - free(from); - free(to); - free(string); - free(rstring); + driver_free(from); + driver_free(to); + driver_free(string); + driver_free(rstring); iconv_close(cd); return size; diff --git a/src/mod_privacy_odbc.erl b/src/mod_privacy_odbc.erl index ae572ae64..5ad2fb958 100644 --- a/src/mod_privacy_odbc.erl +++ b/src/mod_privacy_odbc.erl @@ -726,11 +726,11 @@ raw_to_item({SType, SValue, SAction, SOrder, SMatchAll, SMatchIQ, "d" -> deny end, Order = list_to_integer(SOrder), - MatchAll = SMatchAll == "1" orelse SMatchAll == "t", - MatchIQ = SMatchIQ == "1" orelse SMatchIQ == "t" , - MatchMessage = SMatchMessage == "1" orelse SMatchMessage == "t", - MatchPresenceIn = SMatchPresenceIn == "1" orelse SMatchPresenceIn == "t", - MatchPresenceOut = SMatchPresenceOut == "1" orelse SMatchPresenceOut == "t", + MatchAll = ejabberd_odbc:to_bool(SMatchAll), + MatchIQ = ejabberd_odbc:to_bool(SMatchIQ), + MatchMessage = ejabberd_odbc:to_bool(SMatchMessage), + MatchPresenceIn = ejabberd_odbc:to_bool(SMatchPresenceIn), + MatchPresenceOut = ejabberd_odbc:to_bool(SMatchPresenceOut), #listitem{type = Type, value = Value, action = Action, diff --git a/src/odbc/ejabberd_odbc.erl b/src/odbc/ejabberd_odbc.erl index 7a5a25955..84619eccd 100644 --- a/src/odbc/ejabberd_odbc.erl +++ b/src/odbc/ejabberd_odbc.erl @@ -39,8 +39,13 @@ sql_bloc/2, escape/1, escape_like/1, +<<<<<<< HEAD keep_alive/1, sql_query_on_all_connections/2]). +======= + to_bool/1, + keep_alive/1]). +>>>>>>> mainline/2.1.x %% gen_fsm callbacks -export([init/1, @@ -169,6 +174,12 @@ escape_like($%) -> "\\%"; escape_like($_) -> "\\_"; escape_like(C) -> odbc_queries:escape(C). +to_bool("t") -> true; +to_bool("true") -> true; +to_bool("1") -> true; +to_bool(true) -> true; +to_bool(1) -> true; +to_bool(_) -> false. %%%---------------------------------------------------------------------- %%% Callback functions from gen_fsm