24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-04 23:15:31 +02:00

merge from latest 2.1.x

This commit is contained in:
Christophe Romain 2010-07-22 12:01:44 +02:00
commit 200815dcdb
8 changed files with 79 additions and 35 deletions

2
README
View File

@ -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.

View File

@ -346,7 +346,7 @@ GNU Make
</LI><LI CLASS="li-itemize">GCC
</LI><LI CLASS="li-itemize">Libexpat 1.95 or higher
</LI><LI CLASS="li-itemize">Erlang/OTP R10B-9 or higher. The recommended versions are R12B-5 and R13B04.
</LI><LI CLASS="li-itemize">OpenSSL 0.9.6 or higher, for STARTTLS, SASL and SSL encryption.
</LI><LI CLASS="li-itemize">OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption.
</LI><LI CLASS="li-itemize">Zlib 1.2.3 or higher, for Stream Compression support (<A HREF="http://xmpp.org/extensions/xep-0138.html">XEP-0138</A>). Optional.
</LI><LI CLASS="li-itemize">Erlang mysql library. Optional. For MySQL authentication or storage. See section <A HREF="#compilemysql">3.2.1</A>.
</LI><LI CLASS="li-itemize">Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section <A HREF="#compilepgsql">3.2.3</A>.
@ -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.<P> </P></DD><DT CLASS="dt-description"><B><TT>--disable-transient-supervisors</TT></B></DT><DD CLASS="dd-description">
Disable the use of Erlang/OTP supervision for transient processes.
Disable the use of Erlang/OTP supervision for transient processes.<P> </P></DD><DT CLASS="dt-description"><B><TT>--enable-nif</TT></B></DT><DD CLASS="dd-description">
Replaces some critical Erlang functions with equivalents written in C to improve performance.
This feature requires Erlang/OTP R13B04 or higher.
</DD></DL><P> <A NAME="install"></A> </P><!--TOC subsection Install-->
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc12">2.4.4</A>&#XA0;&#XA0;<A HREF="#install">Install</A></H3><!--SEC END --><P> <A NAME="install"></A>
</P><P>To install <TT>ejabberd</TT> in the destination directories, run the command:
@ -1896,6 +1898,8 @@ all entries end with a comma:
<TR><TD ALIGN=left NOWRAP><TT>mod_configure</TT></TD><TD ALIGN=left NOWRAP>Server configuration using Ad-Hoc</TD><TD ALIGN=left NOWRAP><TT>mod_adhoc</TT></TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#moddisco"><TT>mod_disco</TT></A></TD><TD ALIGN=left NOWRAP>Service Discovery (<A HREF="http://xmpp.org/extensions/xep-0030.html">XEP-0030</A>)</TD><TD ALIGN=left NOWRAP>&nbsp;</TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#modecho"><TT>mod_echo</TT></A></TD><TD ALIGN=left NOWRAP>Echoes XMPP stanzas</TD><TD ALIGN=left NOWRAP>&nbsp;</TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#modhttpbind"><TT>mod_http_bind</TT></A></TD><TD ALIGN=left NOWRAP>XMPP over Bosh service (HTTP Binding)</TD><TD ALIGN=left NOWRAP>&nbsp;</TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#modhttpfileserver"><TT>mod_http_fileserver</TT></A></TD><TD ALIGN=left NOWRAP>Small HTTP file server</TD><TD ALIGN=left NOWRAP>&nbsp;</TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#modirc"><TT>mod_irc</TT></A></TD><TD ALIGN=left NOWRAP>IRC transport</TD><TD ALIGN=left NOWRAP>&nbsp;</TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#modlast"><TT>mod_last</TT></A></TD><TD ALIGN=left NOWRAP>Last Activity (<A HREF="http://xmpp.org/extensions/xep-0012.html">XEP-0012</A>)</TD><TD ALIGN=left NOWRAP>&nbsp;</TD></TR>
<TR><TD ALIGN=left NOWRAP><A HREF="#modlast"><TT>mod_last_odbc</TT></A></TD><TD ALIGN=left NOWRAP>Last Activity (<A HREF="http://xmpp.org/extensions/xep-0012.html">XEP-0012</A>)</TD><TD ALIGN=left NOWRAP>supported DB (*)</TD></TR>
@ -2475,6 +2479,10 @@ the room occupants.
</DD><DT CLASS="dt-description"><B><TT>{anonymous, true|false}</TT></B></DT><DD CLASS="dd-description"> The room is anonymous:
occupants don&#X2019;t see the real JIDs of other occupants.
Note that the room moderators can always see the real JIDs of the occupants.
</DD><DT CLASS="dt-description"><B><TT>{captcha_protected, false}</TT></B></DT><DD CLASS="dd-description">
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 <A HREF="#captcha">3.1.8</A>)
in order to accept her join in the room.
</DD><DT CLASS="dt-description"><B><TT>{logging, false|true}</TT></B></DT><DD CLASS="dd-description"> The public messages are logged using <TT>mod_muc_log</TT>.
</DD><DT CLASS="dt-description"><B><TT>{max_users, 200}</TT></B></DT><DD CLASS="dd-description"> Maximum number of occupants in the room.
</DD><DT CLASS="dt-description"><B><TT>{members_by_default, true|false}</TT></B></DT><DD CLASS="dd-description"> The occupants that enter the room are participants by default, so they have &#X2019;voice&#X2019;.
@ -2967,9 +2975,11 @@ the processing discipline for In-Band Registration (<TT>jabber:iq:register</TT>)
</DD></DL><P>This module reads also another option defined globally for the server:
<TT>{registration_timeout, Timeout}</TT>.
This option limits the frequency of registration from a given IP or username.
So, a user can&#X2019;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 <TT>resource-constraint</TT> with the explanation:
&#X201C;Users are not allowed to register accounts so quickly&#X201D;.
The timeout is expressed in seconds, and it must be an integer.
To disable this limitation,
instead of an integer put a word like: <TT>infinity</TT>.
Default value: 600 seconds.</P><P>Examples:

View File

@ -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.

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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