Compare commits
145 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c058687bf9 | |||
| aa47033fa1 | |||
| 3f93931409 | |||
| 426f1107c5 | |||
| 2704378d43 | |||
| e500fd74ad | |||
| e7f85411fe | |||
| 15073aafa5 | |||
| 0ae400533c | |||
| d47dee8009 | |||
| d5506a3ff0 | |||
| d81eb95cab | |||
| 1f290c8a29 | |||
| be33ab890e | |||
| 2c26926689 | |||
| 9208f4dd50 | |||
| dfcdf1ca7a | |||
| ec51ba7bc6 | |||
| 625e801431 | |||
| 2dc2769c92 | |||
| 8a737f875f | |||
| 4147081f0b | |||
| a47fd96cc8 | |||
| 4d54bce621 | |||
| 5e7a1c8829 | |||
| bc65b5008e | |||
| a407382d9f | |||
| d2d51381ec | |||
| e06c1c49c1 | |||
| 0cc920579c | |||
| efc0b0ba5a | |||
| 4e6eff3f1a | |||
| 2bf8125abf | |||
| 75756f0fc9 | |||
| bc077266d9 | |||
| a99c1e7031 | |||
| bb026ef598 | |||
| e5d5ea49be | |||
| 6c94d040fa | |||
| e8921d79ba | |||
| 6719d9669b | |||
| 8b13226d00 | |||
| 437f68a9f3 | |||
| 453e249de3 | |||
| 8688030d7a | |||
| 6e2003c2e2 | |||
| 5ed8959eba | |||
| 7623ebd327 | |||
| 522eb0fe9d | |||
| 7dd171322d | |||
| 752652e56c | |||
| 2582a478ab | |||
| 52ff5de564 | |||
| ba793af8b7 | |||
| 3304ecd1f0 | |||
| 4e0394cab3 | |||
| eaa963a840 | |||
| 31c13cc1c8 | |||
| 310aa7a00d | |||
| fafd605d4d | |||
| 078f3583f0 | |||
| 0b337329ba | |||
| f5df63554f | |||
| 46c4f46451 | |||
| e034864c12 | |||
| 91f38cc849 | |||
| e616d2686f | |||
| 5a09d671ab | |||
| 58d49d2867 | |||
| 8bb58ba3c3 | |||
| 017ce4e092 | |||
| 49859683b0 | |||
| 169b83b36d | |||
| 86435ba9aa | |||
| e2d6bc95a4 | |||
| 06f570f4ff | |||
| 730dfe8fc7 | |||
| 5619d39bd3 | |||
| 959e0ff1c9 | |||
| 2c228e6414 | |||
| 82468bff00 | |||
| 5f82846732 | |||
| 09c75af15c | |||
| 91964b1aba | |||
| af2e9169e6 | |||
| 4637e2c66b | |||
| 1f1a98d7ae | |||
| cea23b055b | |||
| 41a0eae0bd | |||
| 5fab00011e | |||
| ca5f028016 | |||
| b43444f674 | |||
| 866085c918 | |||
| 585c5afd1a | |||
| 6ec5c7c4d8 | |||
| 6b3875814c | |||
| 3a51c801e1 | |||
| 983da9c887 | |||
| f7b6446c74 | |||
| deb87f2dfa | |||
| b1e2538488 | |||
| 7b9e59d15d | |||
| 794d0bbe69 | |||
| f7ffdfa15d | |||
| 4900ac31a7 | |||
| 112a18f966 | |||
| 7d623d5eb4 | |||
| 4819738e8f | |||
| 948318ca19 | |||
| 89aa7baa5b | |||
| 95928a7cd4 | |||
| 1ecc9ac48c | |||
| 288196c7e8 | |||
| 0283c6cdfe | |||
| d4e7b0cda0 | |||
| bcdae19141 | |||
| 6edbbded40 | |||
| 684cac274d | |||
| ce7b008b8f | |||
| a3c58f2896 | |||
| 3839f1055a | |||
| 94350ddb3a | |||
| 919cdc27db | |||
| 2029e39299 | |||
| 707bb0a321 | |||
| 298a4a3acf | |||
| 262157c88d | |||
| 37107af7b4 | |||
| 13a9ca65a4 | |||
| d3369c83e7 | |||
| 48308042b6 | |||
| d30ad8ba28 | |||
| cf973f27bb | |||
| 87df27109a | |||
| 89e4e822bf | |||
| b89d4c7476 | |||
| ee968b5573 | |||
| 1f97740cfa | |||
| 07cfc000ea | |||
| 944791e888 | |||
| 0656377165 | |||
| 1a419972d2 | |||
| 98b150e1a4 | |||
| 96800e9b75 | |||
| c1d479f863 |
@@ -9,7 +9,7 @@ To compile ejabberd you need:
|
||||
- GNU Make
|
||||
- GCC
|
||||
- Libexpat 1.95 or higher
|
||||
- Erlang/OTP R10B-9 or higher. Recommended: R12B-5 and R13B04.
|
||||
- Erlang/OTP R10B-9 or higher. Recommended: R13B04 and R14B04.
|
||||
Avoid R14A and R14B.
|
||||
- OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption.
|
||||
- Zlib 1.2.3 or higher, for Stream Compression support
|
||||
|
||||
@@ -281,14 +281,14 @@ build_additional_translators(List) ->
|
||||
List).
|
||||
|
||||
print_translation(File, Line, Str, StrT) ->
|
||||
{ok, StrQ, _} = regexp:gsub(Str, "\"", "\\\""),
|
||||
{ok, StrTQ, _} = regexp:gsub(StrT, "\"", "\\\""),
|
||||
StrQ = ejabberd_regexp:greplace(Str, "\\\"", "\\\\\""),
|
||||
StrTQ = ejabberd_regexp:greplace(StrT, "\\\"", "\\\\\""),
|
||||
io:format("#: ~s:~p~nmsgid \"~s\"~nmsgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).
|
||||
|
||||
print_translation_obsolete(Str, StrT) ->
|
||||
File = "unknown.erl",
|
||||
Line = 1,
|
||||
{ok, StrQ, _} = regexp:gsub(Str, "\"", "\\\""),
|
||||
{ok, StrTQ, _} = regexp:gsub(StrT, "\"", "\\\""),
|
||||
StrQ = ejabberd_regexp:greplace(Str, "\\\"", "\\\\\""),
|
||||
StrTQ = ejabberd_regexp:greplace(StrT, "\\\"", "\\\\\""),
|
||||
io:format("#: ~s:~p~n#~~ msgid \"~s\"~n#~~ msgstr \"~s\"~n~n", [File, Line, StrQ, StrTQ]).
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ extract_lang_all ()
|
||||
cd $MSGS_DIR
|
||||
for i in $( ls *.msg ) ; do
|
||||
MISSING=`cat $i.translate | grep "\", \"\"}." | wc -l`
|
||||
LANGUAGE=`grep "Language:" $i.translate | sed 's/% Language: //g'`
|
||||
LANGUAGE=`grep "X-Language:" $i.translate | sed 's/% Language: //g'`
|
||||
LASTAUTH=`grep "Author:" $i.translate | head -n 1 | sed 's/% Author: //g'`
|
||||
echo -e "$i\t$MISSING\t$LANGUAGE\t$LASTAUTH"
|
||||
done
|
||||
@@ -258,7 +258,7 @@ extract_lang_updateall ()
|
||||
MISSING=`msgfmt --statistics $PO 2>&1 | awk '{printf "%5s", $4 }'`
|
||||
echo -n " $MISSING"
|
||||
|
||||
LANGUAGE=`grep "Language:" $PO | sed 's/\"X-Language: //g' | sed 's/\\\\n\"//g' | awk '{printf "%-12s", $1}'`
|
||||
LANGUAGE=`grep "X-Language:" $PO | sed 's/\"X-Language: //g' | sed 's/\\\\n\"//g' | awk '{printf "%-12s", $1}'`
|
||||
echo -n " $LANGUAGE"
|
||||
|
||||
LASTAUTH=`grep "Last-Translator" $PO | sed 's/\"Last-Translator: //g' | sed 's/\\\\n\"//g'`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@author Mickael Remond <mickael.remond@process-one.net>
|
||||
[http://www.process-one.net/]
|
||||
@copyright 2007 ProcessOne
|
||||
@copyright 2013 ProcessOne
|
||||
@version {@vsn}, {@date} {@time}
|
||||
@title ejabberd Development API Documentation
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Ejabberd 2.1.9 Developers Guide
|
||||
<TITLE>Ejabberd 2.1.12 Developers Guide
|
||||
</TITLE>
|
||||
|
||||
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
@@ -49,7 +49,7 @@ TD P{margin:0px;}
|
||||
<!--HEVEA command line is: /usr/bin/hevea -fix -pedantic dev.tex -->
|
||||
<!--CUT DEF section 1 --><P><A NAME="titlepage"></A>
|
||||
|
||||
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.9 Developers Guide</H1><H3 CLASS="titlerest">Alexey Shchepin<BR>
|
||||
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.12 Developers Guide</H1><H3 CLASS="titlerest">Alexey Shchepin<BR>
|
||||
<A HREF="mailto:alexey@sevcom.net"><TT>mailto:alexey@sevcom.net</TT></A><BR>
|
||||
<A HREF="xmpp:aleksey@jabber.ru"><TT>xmpp:aleksey@jabber.ru</TT></A></H3></TD></TR>
|
||||
</TABLE><DIV CLASS="center">
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Ejabberd 2.1.9 Feature Sheet
|
||||
<TITLE>Ejabberd 2.1.12 Feature Sheet
|
||||
</TITLE>
|
||||
|
||||
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
@@ -50,7 +50,7 @@ SPAN{width:20%; float:right; text-align:left; margin-left:auto;}
|
||||
<!--HEVEA command line is: /usr/bin/hevea -fix -pedantic features.tex -->
|
||||
<!--CUT DEF section 1 --><P><A NAME="titlepage"></A>
|
||||
|
||||
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.9 Feature Sheet</H1><H3 CLASS="titlerest">Sander Devrieze<BR>
|
||||
</P><TABLE CLASS="title"><TR><TD><H1 CLASS="titlemain">Ejabberd 2.1.12 Feature Sheet</H1><H3 CLASS="titlerest">Sander Devrieze<BR>
|
||||
<A HREF="mailto:s.devrieze@pandora.be"><TT>mailto:s.devrieze@pandora.be</TT></A><BR>
|
||||
<A HREF="xmpp:sander@devrieze.dyndns.org"><TT>xmpp:sander@devrieze.dyndns.org</TT></A></H3></TD></TR>
|
||||
</TABLE><DIV CLASS="center">
|
||||
|
||||
+135
-105
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
ejabberd 2.1.9
|
||||
ejabberd 2.1.12
|
||||
|
||||
Installation and Operation Guide
|
||||
|
||||
@@ -76,7 +76,7 @@ BLOCKQUOTE.figure DIV.center DIV.center HR{display:none;}
|
||||
<HR SIZE=2><BR>
|
||||
<BR>
|
||||
|
||||
<TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=right NOWRAP> <FONT SIZE=6><B>ejabberd 2.1.9 </B></FONT></TD></TR>
|
||||
<TABLE CELLSPACING=6 CELLPADDING=0><TR><TD ALIGN=right NOWRAP> <FONT SIZE=6><B>ejabberd 2.1.12 </B></FONT></TD></TR>
|
||||
<TR><TD ALIGN=right NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=right NOWRAP> <FONT SIZE=6>Installation and Operation Guide</FONT></TD></TR>
|
||||
</TABLE><BR>
|
||||
@@ -109,7 +109,7 @@ BLOCKQUOTE.figure DIV.center DIV.center HR{display:none;}
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc15">2.4.7  Specific Notes for Sun Solaris</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc16">2.4.8  Specific Notes for Microsoft Windows</A>
|
||||
</LI></UL>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc17">2.5  Create a XMPP Account for Administration</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc17">2.5  Create an XMPP Account for Administration</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc18">2.6  Upgrading <TT>ejabberd</TT></A>
|
||||
</LI></UL>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc19">Chapter 3  Configuring <TT>ejabberd</TT></A>
|
||||
@@ -207,21 +207,20 @@ BLOCKQUOTE.figure DIV.center DIV.center HR{display:none;}
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc92">6.2  Clustering Setup</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc93">6.3  Service Load-Balancing</A>
|
||||
<UL CLASS="toc"><LI CLASS="li-toc">
|
||||
<A HREF="#htoc94">6.3.1  Components Load-Balancing</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc95">6.3.2  Domain Load-Balancing Algorithm</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc96">6.3.3  Load-Balancing Buckets</A>
|
||||
<A HREF="#htoc94">6.3.1  Domain Load-Balancing Algorithm</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc95">6.3.2  Load-Balancing Buckets</A>
|
||||
</LI></UL>
|
||||
</LI></UL>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc97">Chapter 7  Debugging</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc96">Chapter 7  Debugging</A>
|
||||
<UL CLASS="toc"><LI CLASS="li-toc">
|
||||
<A HREF="#htoc98">7.1  Log Files</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc99">7.2  Debug Console</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc100">7.3  Watchdog Alerts</A>
|
||||
<A HREF="#htoc97">7.1  Log Files</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc98">7.2  Debug Console</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc99">7.3  Watchdog Alerts</A>
|
||||
</LI></UL>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc101">Appendix A  Internationalization and Localization</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc102">Appendix B  Release Notes</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc103">Appendix C  Acknowledgements</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc104">Appendix D  Copyright Information</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc100">Appendix A  Internationalization and Localization</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc101">Appendix B  Release Notes</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc102">Appendix C  Acknowledgements</A>
|
||||
</LI><LI CLASS="li-toc"><A HREF="#htoc103">Appendix D  Copyright Information</A>
|
||||
</LI></UL><!--TOC chapter Introduction-->
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc1">Chapter 1</A>  Introduction</H1><!--SEC END --><P>
|
||||
<A NAME="intro"></A></P><P><TT>ejabberd</TT> is a free and open source instant messaging server written in <A HREF="http://www.erlang.org/">Erlang/OTP</A>.</P><P><TT>ejabberd</TT> is cross-platform, distributed, fault-tolerant, and based on open standards to achieve real-time communication.</P><P><TT>ejabberd</TT> is designed to be a rock-solid and feature rich XMPP server.</P><P><TT>ejabberd</TT> is suitable for small deployments, whether they need to be scalable or not, as well as extremely big deployments.</P><!--TOC section Key Features-->
|
||||
@@ -349,7 +348,7 @@ as long as your system have all the dependencies.</P><P> <A NAME="installreq"></
|
||||
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">Erlang/OTP R10B-9 or higher. The recommended versions are R13B04 and R14B04.
|
||||
Don’t use R14A or R14B because <A HREF="http://www.erlang.org/cgi-bin/ezmlm-cgi/4/54598">they have a bug</A>.
|
||||
</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.
|
||||
@@ -514,16 +513,16 @@ variable.
|
||||
nmake -f Makefile.win32
|
||||
</PRE></LI><LI CLASS="li-enumerate">Edit the file <CODE>ejabberd\src\ejabberd.cfg</CODE> and run
|
||||
<PRE CLASS="verbatim">werl -s ejabberd -name ejabberd
|
||||
</PRE></LI></OL><P> <A NAME="initialadmin"></A> </P><!--TOC section Create a XMPP Account for Administration-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc17">2.5</A>  <A HREF="#initialadmin">Create a XMPP Account for Administration</A></H2><!--SEC END --><P> <A NAME="initialadmin"></A> </P><P>You need a XMPP account and grant him administrative privileges
|
||||
</PRE></LI></OL><P> <A NAME="initialadmin"></A> </P><!--TOC section Create an XMPP Account for Administration-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc17">2.5</A>  <A HREF="#initialadmin">Create an XMPP Account for Administration</A></H2><!--SEC END --><P> <A NAME="initialadmin"></A> </P><P>You need an XMPP account and grant him administrative privileges
|
||||
to enter the <TT>ejabberd</TT> Web Admin:
|
||||
</P><OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
|
||||
Register a XMPP account on your <TT>ejabberd</TT> server, for example <TT>admin1@example.org</TT>.
|
||||
There are two ways to register a XMPP account:
|
||||
Register an XMPP account on your <TT>ejabberd</TT> server, for example <TT>admin1@example.org</TT>.
|
||||
There are two ways to register an XMPP account:
|
||||
<OL CLASS="enumerate" type=a><LI CLASS="li-enumerate">
|
||||
Using <TT>ejabberdctl</TT> (see section <A HREF="#ejabberdctl">4.1</A>):
|
||||
<PRE CLASS="verbatim">ejabberdctl register admin1 example.org FgT5bk3
|
||||
</PRE></LI><LI CLASS="li-enumerate">Using a XMPP client and In-Band Registration (see section <A HREF="#modregister">3.3.19</A>).
|
||||
</PRE></LI><LI CLASS="li-enumerate">Using an XMPP client and In-Band Registration (see section <A HREF="#modregister">3.3.19</A>).
|
||||
</LI></OL>
|
||||
</LI><LI CLASS="li-enumerate">Edit the <TT>ejabberd</TT> configuration file to give administration rights to the XMPP account you created:
|
||||
<PRE CLASS="verbatim">{acl, admin, {user, "admin1", "example.org"}}.
|
||||
@@ -696,7 +695,7 @@ Handles STUN Binding requests as defined in
|
||||
Options: <TT>certfile</TT>
|
||||
</DD><DT CLASS="dt-description"><B><TT>ejabberd_http</TT></B></DT><DD CLASS="dd-description">
|
||||
Handles incoming HTTP connections.<BR>
|
||||
Options: <TT>captcha</TT>, <TT>certfile</TT>, <TT>http_bind</TT>, <TT>http_poll</TT>,
|
||||
Options: <TT>captcha</TT>, <TT>certfile</TT>, <TT>default_host</TT>, <TT>http_bind</TT>, <TT>http_poll</TT>,
|
||||
<TT>request_handlers</TT>, <TT>tls</TT>, <TT>trusted_proxies</TT>, <TT>web_admin</TT><BR>
|
||||
</DD></DL><P> <A NAME="listened-options"></A> </P><!--TOC subsubsection Options-->
|
||||
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A HREF="#listened-options">Options</A></H4><!--SEC END --><P> <A NAME="listened-options"></A> </P><P>This is a detailed description of each option allowed by the listening modules:
|
||||
@@ -713,6 +712,11 @@ immediately). Default value is 5.
|
||||
Simple web page that allows a user to fill a CAPTCHA challenge (see section <A HREF="#captcha">3.1.8</A>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{certfile, Path}</TT></B></DT><DD CLASS="dd-description"> Full path to a file containing the default SSL certificate.
|
||||
To define a certificate file specific for a given domain, use the global option <TT>domain_certfile</TT>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{default_host, undefined|HostName}</TT></B></DT><DD CLASS="dd-description">
|
||||
If the HTTP request received by ejabberd contains the HTTP header <TT>Host</TT>
|
||||
with an ambiguous virtual host that doesn’t match any one defined in ejabberd (see <A HREF="#hostnames">3.1.1</A>),
|
||||
then this configured HostName is set as the request Host.
|
||||
The default value of this option is: <TT>undefined</TT>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{hosts, [Hostname, ...], [HostOption, ...]}</TT></B></DT><DD CLASS="dd-description">
|
||||
The external Jabber component that connects to this <TT>ejabberd_service</TT>
|
||||
can serve one or more hostnames.
|
||||
@@ -1060,7 +1064,11 @@ The possible values match exactly the three possibilities described in
|
||||
<A HREF="http://tools.ietf.org/html/rfc6120#section-7.7.2.2">XMPP Core: section 7.7.2.2</A>.
|
||||
The default value is <TT>closeold</TT>.
|
||||
If the client uses old Jabber Non-SASL authentication (<A HREF="http://xmpp.org/extensions/xep-0078.html">XEP-0078</A>),
|
||||
then this option is not respected, and the action performed is <TT>closeold</TT>.</P><P> <A NAME="internalauth"></A> </P><!--TOC subsubsection Internal-->
|
||||
then this option is not respected, and the action performed is <TT>closeold</TT>.</P><P>The option <TT>fqdn</TT> allows you to define the Fully Qualified Domain Name
|
||||
of the machine, in case it isn’t detected automatically.
|
||||
The FQDN is used to authenticate some clients that use the DIGEST-MD5 SASL mechanism.
|
||||
The option syntax is:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description"><B><TT>{fqdn, undefined|FqdnString|[FqdnString]}.</TT></B></DT></DL><P> <A NAME="internalauth"></A> </P><!--TOC subsubsection Internal-->
|
||||
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A HREF="#internalauth">Internal</A></H4><!--SEC END --><P> <A NAME="internalauth"></A>
|
||||
</P><P><TT>ejabberd</TT> uses its internal Mnesia database as the default authentication method.
|
||||
The value <TT>internal</TT> will enable the internal authentication method.</P><P>The option <TT>{auth_password_format, plain|scram}</TT>
|
||||
@@ -1107,7 +1115,7 @@ the CacheTimeInteger indicates the number of seconds that ejabberd can reuse
|
||||
the authentication information since the user last disconnected,
|
||||
to verify again the user authentication without querying again the extauth script.
|
||||
Note: caching should not be enabled in a host if internal auth is also enabled.
|
||||
If caching is enabled, <TT>mod_last</TT> or <TT>mod_last_odbc</TT> must be enabled also in that vhost.
|
||||
If caching is enabled, <TT>mod_last</TT> must be enabled also in that vhost.
|
||||
</DD></DL><P>This example sets external authentication, the extauth script, enables caching for 10 minutes,
|
||||
and starts three instances of the script for each virtual host defined in ejabberd:
|
||||
</P><PRE CLASS="verbatim">{auth_method, [external]}.
|
||||
@@ -1202,7 +1210,7 @@ attacks.
|
||||
</LI><LI CLASS="li-itemize">You may want to allow login access only for certain users. <TT>pam_listfile.so</TT>
|
||||
module provides such functionality.
|
||||
</LI><LI CLASS="li-itemize">If you use <TT>pam_winbind</TT> to authorise against a Windows Active Directory,
|
||||
then <TT>/etc/nssswitch.conf</TT> must be configured to use <TT>winbind</TT> as well.
|
||||
then <TT>/etc/nsswitch.conf</TT> must be configured to use <TT>winbind</TT> as well.
|
||||
</LI></UL><P> <A NAME="accessrules"></A> </P><!--TOC subsection Access Rules-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc25">3.1.5</A>  <A HREF="#accessrules">Access Rules</A></H3><!--SEC END --><P> <A NAME="accessrules"></A>
|
||||
</P><P> <A NAME="ACLDefinition"></A> </P><!--TOC subsubsection ACL Definition-->
|
||||
@@ -1341,7 +1349,7 @@ using ImageMagick’s Convert program.</P><P>The configurable options are:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{captcha_cmd, Path}</TT></B></DT><DD CLASS="dd-description">
|
||||
Full path to a script that generates the image.
|
||||
The default value is an empty string: <TT>""</TT>
|
||||
The default value disables the feature: <TT>undefined</TT>
|
||||
</DD><DT CLASS="dt-description"><B><TT>{captcha_host, ProtocolHostPort}</TT></B></DT><DD CLASS="dd-description">
|
||||
ProtocolHostPort is a string with the host, and optionally the Protocol and Port number.
|
||||
It must identify where ejabberd listens for CAPTCHA requests.
|
||||
@@ -1561,12 +1569,10 @@ MySQL interface. Anyway, the first configuration step is to define the odbc
|
||||
</PRE><P> <A NAME="mysqlstorage"></A> </P><!--TOC subsubsection Storage-->
|
||||
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A HREF="#mysqlstorage">Storage</A></H4><!--SEC END --><P> <A NAME="mysqlstorage"></A>
|
||||
</P><P>MySQL also can be used to store information into from several <TT>ejabberd</TT>
|
||||
modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules have a version
|
||||
with the ‘_odbc’. This suffix indicates that the module can be used with
|
||||
modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and replace the
|
||||
suffix-less or ldap module variant with the odbc module variant. Keep in mind
|
||||
that you cannot have several variants of the same module loaded!</P><P> <A NAME="mssql"></A> </P><!--TOC subsection Microsoft SQL Server-->
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option <TT>{db_type, odbc}</TT>.</P><P> <A NAME="mssql"></A> </P><!--TOC subsection Microsoft SQL Server-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc34">3.2.2</A>  <A HREF="#mssql">Microsoft SQL Server</A></H3><!--SEC END --><P> <A NAME="mssql"></A>
|
||||
</P><P>Although this section will describe <TT>ejabberd</TT>’s configuration when you want to
|
||||
use Microsoft SQL Server, it does not describe Microsoft SQL Server’s
|
||||
@@ -1593,13 +1599,10 @@ is the same as the configuration for
|
||||
ODBC compatible servers (see section <A HREF="#odbcauth">3.2.4</A>).</P><P> <A NAME="mssqlstorage"></A> </P><!--TOC subsubsection Storage-->
|
||||
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A HREF="#mssqlstorage">Storage</A></H4><!--SEC END --><P> <A NAME="mssqlstorage"></A>
|
||||
</P><P>Microsoft SQL Server also can be used to store information into from several
|
||||
<TT>ejabberd</TT> modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules have
|
||||
a version with the ‘_odbc’. This suffix indicates that the module can be used
|
||||
with relational databases like Microsoft SQL Server. To enable storage to your
|
||||
database, just make sure that your database is running well (see previous
|
||||
sections), and replace the suffix-less or ldap module variant with the odbc
|
||||
module variant. Keep in mind that you cannot have several variants of the same
|
||||
module loaded!</P><P> <A NAME="pgsql"></A> </P><!--TOC subsection PostgreSQL-->
|
||||
modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option <TT>{db_type, odbc}</TT>.</P><P> <A NAME="pgsql"></A> </P><!--TOC subsection PostgreSQL-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc35">3.2.3</A>  <A HREF="#pgsql">PostgreSQL</A></H3><!--SEC END --><P> <A NAME="pgsql"></A>
|
||||
</P><P>Although this section will describe <TT>ejabberd</TT>’s configuration when you want to
|
||||
use the native PostgreSQL driver, it does not describe PostgreSQL’s installation
|
||||
@@ -1651,12 +1654,10 @@ PostgreSQL interface. Anyway, the first configuration step is to define the odbc
|
||||
</PRE><P> <A NAME="pgsqlstorage"></A> </P><!--TOC subsubsection Storage-->
|
||||
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A HREF="#pgsqlstorage">Storage</A></H4><!--SEC END --><P> <A NAME="pgsqlstorage"></A>
|
||||
</P><P>PostgreSQL also can be used to store information into from several <TT>ejabberd</TT>
|
||||
modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules have a version
|
||||
with the ‘_odbc’. This suffix indicates that the module can be used with
|
||||
relational databases like PostgreSQL. To enable storage to your database, just
|
||||
make sure that your database is running well (see previous sections), and
|
||||
replace the suffix-less or ldap module variant with the odbc module variant.
|
||||
Keep in mind that you cannot have several variants of the same module loaded!</P><P> <A NAME="odbc"></A> </P><!--TOC subsection ODBC Compatible-->
|
||||
modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option <TT>{db_type, odbc}</TT>.</P><P> <A NAME="odbc"></A> </P><!--TOC subsection ODBC Compatible-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc36">3.2.4</A>  <A HREF="#odbc">ODBC Compatible</A></H3><!--SEC END --><P> <A NAME="odbc"></A>
|
||||
</P><P>Although this section will describe <TT>ejabberd</TT>’s configuration when you want to
|
||||
use the ODBC driver, it does not describe the installation and database creation
|
||||
@@ -1695,13 +1696,11 @@ example:
|
||||
</PRE><P> <A NAME="odbcstorage"></A> </P><!--TOC subsubsection Storage-->
|
||||
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A HREF="#odbcstorage">Storage</A></H4><!--SEC END --><P> <A NAME="odbcstorage"></A>
|
||||
</P><P>An ODBC compatible database also can be used to store information into from
|
||||
several <TT>ejabberd</TT> modules. See section <A HREF="#modoverview">3.3.1</A> to see which
|
||||
modules have a version with the ‘_odbc’. This suffix indicates that the module
|
||||
can be used with ODBC compatible relational databases. To enable storage to your
|
||||
database, just make sure that your database is running well (see previous
|
||||
sections), and replace the suffix-less or ldap module variant with the odbc
|
||||
module variant. Keep in mind that you cannot have several variants of the same
|
||||
module loaded!</P><P> <A NAME="ldap"></A> </P><!--TOC subsection LDAP-->
|
||||
several <TT>ejabberd</TT>
|
||||
modules. See section <A HREF="#modoverview">3.3.1</A> to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option <TT>{db_type, odbc}</TT>.</P><P> <A NAME="ldap"></A> </P><!--TOC subsection LDAP-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc37">3.2.5</A>  <A HREF="#ldap">LDAP</A></H3><!--SEC END --><P> <A NAME="ldap"></A>
|
||||
</P><P><TT>ejabberd</TT> has built-in LDAP support. You can authenticate users against LDAP
|
||||
server and use LDAP directory as vCard storage.</P><P>Usually <TT>ejabberd</TT> treats LDAP as a read-only storage:
|
||||
@@ -1960,61 +1959,37 @@ all entries end with a comma:
|
||||
<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> </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> </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> </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>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modmuc"><TT>mod_muc</TT></A></TD><TD ALIGN=left NOWRAP>Multi-User Chat (<A HREF="http://xmpp.org/extensions/xep-0045.html">XEP-0045</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modmuclog"><TT>mod_muc_log</TT></A></TD><TD ALIGN=left NOWRAP>Multi-User Chat room logging</TD><TD ALIGN=left NOWRAP><TT>mod_muc</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modoffline"><TT>mod_offline</TT></A></TD><TD ALIGN=left NOWRAP>Offline message storage (<A HREF="http://xmpp.org/extensions/xep-0160.html">XEP-0160</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modoffline"><TT>mod_offline_odbc</TT></A></TD><TD ALIGN=left NOWRAP>Offline message storage (<A HREF="http://xmpp.org/extensions/xep-0160.html">XEP-0160</A>)</TD><TD ALIGN=left NOWRAP>supported DB (*)</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modping"><TT>mod_ping</TT></A></TD><TD ALIGN=left NOWRAP>XMPP Ping and periodic keepalives (<A HREF="http://xmpp.org/extensions/xep-0199.html">XEP-0199</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modprescounter"><TT>mod_pres_counter</TT></A></TD><TD ALIGN=left NOWRAP>Detect presence subscription flood</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modprivacy"><TT>mod_privacy</TT></A></TD><TD ALIGN=left NOWRAP>Blocking Communication (<A HREF="http://xmpp.org/extensions/xep-0016.html">XEP-0016</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modprivacy"><TT>mod_privacy_odbc</TT></A></TD><TD ALIGN=left NOWRAP>Blocking Communication (<A HREF="http://xmpp.org/extensions/xep-0016.html">XEP-0016</A>)</TD><TD ALIGN=left NOWRAP>supported DB (*)</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modprivate"><TT>mod_private</TT></A></TD><TD ALIGN=left NOWRAP>Private XML Storage (<A HREF="http://xmpp.org/extensions/xep-0049.html">XEP-0049</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modprivate"><TT>mod_private_odbc</TT></A></TD><TD ALIGN=left NOWRAP>Private XML Storage (<A HREF="http://xmpp.org/extensions/xep-0049.html">XEP-0049</A>)</TD><TD ALIGN=left NOWRAP>supported DB (*)</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modproxy"><TT>mod_proxy65</TT></A></TD><TD ALIGN=left NOWRAP>SOCKS5 Bytestreams (<A HREF="http://xmpp.org/extensions/xep-0065.html">XEP-0065</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modpubsub"><TT>mod_pubsub</TT></A></TD><TD ALIGN=left NOWRAP>Pub-Sub (<A HREF="http://xmpp.org/extensions/xep-0060.html">XEP-0060</A>), PEP (<A HREF="http://xmpp.org/extensions/xep-0163.html">XEP-0163</A>)</TD><TD ALIGN=left NOWRAP><TT>mod_caps</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modpubsub"><TT>mod_pubsub_odbc</TT></A></TD><TD ALIGN=left NOWRAP>Pub-Sub (<A HREF="http://xmpp.org/extensions/xep-0060.html">XEP-0060</A>), PEP (<A HREF="http://xmpp.org/extensions/xep-0163.html">XEP-0163</A>)</TD><TD ALIGN=left NOWRAP>supported DB (*) and <TT>mod_caps</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modregister"><TT>mod_register</TT></A></TD><TD ALIGN=left NOWRAP>In-Band Registration (<A HREF="http://xmpp.org/extensions/xep-0077.html">XEP-0077</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modregisterweb"><TT>mod_register_web</TT></A></TD><TD ALIGN=left NOWRAP>Web for Account Registrations</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modroster"><TT>mod_roster</TT></A></TD><TD ALIGN=left NOWRAP>Roster management (XMPP IM)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modroster"><TT>mod_roster_odbc</TT></A></TD><TD ALIGN=left NOWRAP>Roster management (XMPP IM)</TD><TD ALIGN=left NOWRAP>supported DB (*)</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modservicelog"><TT>mod_service_log</TT></A></TD><TD ALIGN=left NOWRAP>Copy user messages to logger service</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modsharedroster"><TT>mod_shared_roster</TT></A></TD><TD ALIGN=left NOWRAP>Shared roster management</TD><TD ALIGN=left NOWRAP><TT>mod_roster</TT> or</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP> </TD><TD ALIGN=left NOWRAP> </TD><TD ALIGN=left NOWRAP><TT>mod_roster_odbc</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modsharedrosterldap"><TT>mod_shared_roster_ldap</TT></A></TD><TD ALIGN=left NOWRAP>LDAP Shared roster management</TD><TD ALIGN=left NOWRAP><TT>mod_roster</TT> or</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP> </TD><TD ALIGN=left NOWRAP> </TD><TD ALIGN=left NOWRAP><TT>mod_roster_odbc</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modsharedroster"><TT>mod_shared_roster</TT></A></TD><TD ALIGN=left NOWRAP>Shared roster management</TD><TD ALIGN=left NOWRAP><TT>mod_roster</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modsharedrosterldap"><TT>mod_shared_roster_ldap</TT></A></TD><TD ALIGN=left NOWRAP>LDAP Shared roster management</TD><TD ALIGN=left NOWRAP><TT>mod_roster</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modsic"><TT>mod_sic</TT></A></TD><TD ALIGN=left NOWRAP>Server IP Check (<A HREF="http://xmpp.org/extensions/xep-0279.html">XEP-0279</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modstats"><TT>mod_stats</TT></A></TD><TD ALIGN=left NOWRAP>Statistics Gathering (<A HREF="http://xmpp.org/extensions/xep-0039.html">XEP-0039</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modtime"><TT>mod_time</TT></A></TD><TD ALIGN=left NOWRAP>Entity Time (<A HREF="http://xmpp.org/extensions/xep-0202.html">XEP-0202</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modvcard"><TT>mod_vcard</TT></A></TD><TD ALIGN=left NOWRAP>vcard-temp (<A HREF="http://xmpp.org/extensions/xep-0054.html">XEP-0054</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modvcardldap"><TT>mod_vcard_ldap</TT></A></TD><TD ALIGN=left NOWRAP>vcard-temp (<A HREF="http://xmpp.org/extensions/xep-0054.html">XEP-0054</A>)</TD><TD ALIGN=left NOWRAP>LDAP server</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modvcard"><TT>mod_vcard_odbc</TT></A></TD><TD ALIGN=left NOWRAP>vcard-temp (<A HREF="http://xmpp.org/extensions/xep-0054.html">XEP-0054</A>)</TD><TD ALIGN=left NOWRAP>supported DB (*)</TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modvcardxupdate"><TT>mod_vcard_xupdate</TT></A></TD><TD ALIGN=left NOWRAP>vCard-Based Avatars (<A HREF="http://xmpp.org/extensions/xep-0153.html">XEP-0153</A>)</TD><TD ALIGN=left NOWRAP><TT>mod_vcard</TT> or <TT>mod_vcard_odbc</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modvcardxupdate"><TT>mod_vcard_xupdate</TT></A></TD><TD ALIGN=left NOWRAP>vCard-Based Avatars (<A HREF="http://xmpp.org/extensions/xep-0153.html">XEP-0153</A>)</TD><TD ALIGN=left NOWRAP><TT>mod_vcard</TT></TD></TR>
|
||||
<TR><TD ALIGN=left NOWRAP><A HREF="#modversion"><TT>mod_version</TT></A></TD><TD ALIGN=left NOWRAP>Software Version (<A HREF="http://xmpp.org/extensions/xep-0092.html">XEP-0092</A>)</TD><TD ALIGN=left NOWRAP> </TD></TR>
|
||||
</TABLE>
|
||||
<DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV></DIV></BLOCKQUOTE><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
(*) This module requires a supported database. For a list of supported databases, see section <A HREF="#database">3.2</A>.
|
||||
</LI></UL><P>You can see which database backend each module needs by looking at the suffix:
|
||||
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
No suffix, this means that the modules uses Erlang’s built-in database
|
||||
Mnesia as backend.
|
||||
</LI><LI CLASS="li-itemize">‘_odbc’, this means that the module needs a supported database
|
||||
(see <A HREF="#database">3.2</A>) as backend.
|
||||
No suffix, this means that the module uses Erlang’s built-in database
|
||||
Mnesia as backend, or a ODBC database in some cases (see <A HREF="#database">3.2</A>).
|
||||
</LI><LI CLASS="li-itemize">‘_ldap’, this means that the module needs an LDAP server as backend.
|
||||
</LI></UL><P>If you want to,
|
||||
it is possible to use a relational database to store the tables created by some ejabberd modules.
|
||||
You can do this by changing the module name to a name with an
|
||||
<TT>_odbc</TT> suffix in <TT>ejabberd</TT> config file. You can use a relational
|
||||
database for the following data:</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
Last connection date and time: Use <TT>mod_last_odbc</TT> instead of
|
||||
<TT>mod_last</TT>.
|
||||
</LI><LI CLASS="li-itemize">Offline messages: Use <TT>mod_offline_odbc</TT> instead of
|
||||
<TT>mod_offline</TT>.
|
||||
</LI><LI CLASS="li-itemize">Rosters: Use <TT>mod_roster_odbc</TT> instead of <TT>mod_roster</TT>.
|
||||
</LI><LI CLASS="li-itemize">Users’ VCARD: Use <TT>mod_vcard_odbc</TT> instead of <TT>mod_vcard</TT>.
|
||||
</LI><LI CLASS="li-itemize">Private XML storage: Use <TT>mod_private_odbc</TT> instead of <TT>mod_private</TT>.
|
||||
</LI><LI CLASS="li-itemize">User rules for blocking communications: Use <TT>mod_privacy_odbc</TT> instead of <TT>mod_privacy</TT>.
|
||||
</LI><LI CLASS="li-itemize">Pub-Sub nodes, items and subscriptions: Use <TT>mod_pubsub_odbc</TT> instead of <TT>mod_pubsub</TT>.
|
||||
</LI></UL><P>You can find more
|
||||
<A HREF="http://www.ejabberd.im/contributions">contributed modules</A> on the
|
||||
<TT>ejabberd</TT> website. Please remember that these contributions might not work or
|
||||
@@ -2106,7 +2081,11 @@ login. The message is <EM>not sent</EM> to any currently connected user.
|
||||
Any message sent to this JID removes the existing message of the day (MOTD).
|
||||
</DD></DL><P>Options:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{access, AccessName}</TT></B></DT><DD CLASS="dd-description"> This option specifies who is allowed to
|
||||
<B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{access, AccessName}</TT></B></DT><DD CLASS="dd-description"> This option specifies who is allowed to
|
||||
send announcements and to set the message of the day (by default, nobody is
|
||||
able to send such messages).
|
||||
</DD></DL><P>Examples:
|
||||
@@ -2382,6 +2361,10 @@ service. If the <TT>host</TT> option is not specified, the Jabber ID will be the
|
||||
hostname of the virtual host with the prefix ‘<TT>irc.</TT>’. The keyword "@HOST@"
|
||||
is replaced at start time with the real virtual host name.
|
||||
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{access, AccessName}</TT></B></DT><DD CLASS="dd-description"> This option can be used to specify who
|
||||
may use the IRC transport (default value: <TT>all</TT>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{default_encoding, Encoding}</TT></B></DT><DD CLASS="dd-description"> Set the default IRC encoding.
|
||||
@@ -2422,6 +2405,10 @@ connected user was last active on the server, or to query the uptime of the
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{iqdisc, Discipline}</TT></B></DT><DD CLASS="dd-description"> This specifies
|
||||
the processing discipline for Last activity (<TT>jabber:iq:last</TT>) IQ queries (see section <A HREF="#modiqdiscoption">3.3.2</A>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD></DL><P> <A NAME="modmuc"></A> </P><!--TOC subsection <TT>mod_muc</TT>-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc48">3.3.10</A>  <A HREF="#modmuc"><TT>mod_muc</TT></A></H3><!--SEC END --><P> <A NAME="modmuc"></A>
|
||||
</P><P>This module provides a Multi-User Chat (<A HREF="http://xmpp.org/extensions/xep-0045.html">XEP-0045</A>) service.
|
||||
@@ -2450,6 +2437,10 @@ service. If the <TT>host</TT> option is not specified, the Jabber ID will be the
|
||||
hostname of the virtual host with the prefix ‘<TT>conference.</TT>’. The keyword "@HOST@"
|
||||
is replaced at start time with the real virtual host name.
|
||||
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{access, AccessName}</TT></B></DT><DD CLASS="dd-description"> You can specify who is allowed to use
|
||||
the Multi-User Chat service. By default everyone is allowed to use it.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{access_create, AccessName}</TT></B></DT><DD CLASS="dd-description"> To configure who is
|
||||
@@ -2527,7 +2518,7 @@ discarded. A good value for this option is 4 seconds.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{default_room_options, [ {OptionName, OptionValue}, ...]}</TT></B></DT><DD CLASS="dd-description">
|
||||
This module option allows to define the desired default room options.
|
||||
Note that the creator of a room can modify the options of his room
|
||||
at any time using a XMPP client with MUC capability.
|
||||
at any time using an XMPP client with MUC capability.
|
||||
The available room options and the default values are:
|
||||
<DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{allow_change_subj, true|false}</TT></B></DT><DD CLASS="dd-description"> Allow occupants to change the subject.
|
||||
@@ -2703,6 +2694,10 @@ Define the format of the log files:
|
||||
<TT>html</TT> stores in HTML format,
|
||||
<TT>plaintext</TT> stores in plain text.
|
||||
The default value is <TT>html</TT>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{file_permissions, {Mode, Group}}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the permissions that must be used when creating the log files:
|
||||
the number of the mode, and the numeric id of the group that will own the files.
|
||||
The default value is <TT>{644, 33}</TT>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{outdir, Path}</TT></B></DT><DD CLASS="dd-description">
|
||||
This option sets the full path to the directory in which the HTML files should
|
||||
be stored. Make sure the <TT>ejabberd</TT> daemon user has write access on that
|
||||
@@ -2764,6 +2759,8 @@ top link will be the default <CODE><a href="/">Home</a></CODE>.
|
||||
{access_log, muc_log},
|
||||
{cssfile, false},
|
||||
{dirtype, subdirs},
|
||||
{dirtype, subdirs},
|
||||
{file_permissions, {644, 33}},
|
||||
{outdir, "/var/www/muclogs"},
|
||||
{timezone, local}
|
||||
]},
|
||||
@@ -2777,7 +2774,11 @@ sent to an offline user will be stored on the server until that user comes
|
||||
online again. Thus it is very similar to how email works. Note that
|
||||
<TT>ejabberdctl</TT> has a command to delete expired messages
|
||||
(see section <A HREF="#ejabberdctl">4.1</A>).</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{access_max_user_messages, AccessName}</TT></B></DT><DD CLASS="dd-description">
|
||||
<B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{access_max_user_messages, AccessName}</TT></B></DT><DD CLASS="dd-description">
|
||||
This option defines which access rule will be enforced to limit
|
||||
the maximum number of offline messages that a user can have (quota).
|
||||
When a user has too many offline messages, any new messages that he receive are discarded,
|
||||
@@ -2882,6 +2883,10 @@ subscription type (or globally).
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{iqdisc, Discipline}</TT></B></DT><DD CLASS="dd-description"> This specifies
|
||||
the processing discipline for Blocking Communication (<TT>jabber:iq:privacy</TT>) IQ queries (see section <A HREF="#modiqdiscoption">3.3.2</A>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD></DL><P> <A NAME="modprivate"></A> </P><!--TOC subsection <TT>mod_private</TT>-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc54">3.3.16</A>  <A HREF="#modprivate"><TT>mod_private</TT></A></H3><!--SEC END --><P> <A NAME="modprivate"></A>
|
||||
</P><P>This module adds support for Private XML Storage (<A HREF="http://xmpp.org/extensions/xep-0049.html">XEP-0049</A>):
|
||||
@@ -2894,6 +2899,10 @@ of client-specific preferences; another is Bookmark Storage (<A HREF="http://xmp
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{iqdisc, Discipline}</TT></B></DT><DD CLASS="dd-description"> This specifies
|
||||
the processing discipline for Private XML Storage (<TT>jabber:iq:private</TT>) IQ queries (see section <A HREF="#modiqdiscoption">3.3.2</A>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD></DL><P> <A NAME="modproxy"></A> </P><!--TOC subsection <TT>mod_proxy65</TT>-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc55">3.3.17</A>  <A HREF="#modproxy"><TT>mod_proxy65</TT></A></H3><!--SEC END --><P> <A NAME="modproxy"></A>
|
||||
</P><P>This module implements SOCKS5 Bytestreams (<A HREF="http://xmpp.org/extensions/xep-0065.html">XEP-0065</A>).
|
||||
@@ -3180,6 +3189,10 @@ It also supports Roster Versioning (<A HREF="http://xmpp.org/extensions/xep-0237
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{iqdisc, Discipline}</TT></B></DT><DD CLASS="dd-description"> This specifies
|
||||
the processing discipline for Roster Management (<TT>jabber:iq:roster</TT>) IQ queries (see section <A HREF="#modiqdiscoption">3.3.2</A>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{versioning, false|true}</TT></B></DT><DD CLASS="dd-description"> Enables
|
||||
Roster Versioning.
|
||||
This option is disabled by default.
|
||||
@@ -3238,7 +3251,13 @@ manually add all users to their rosters, and that they cannot permanently delete
|
||||
users from the shared roster groups.
|
||||
A shared roster group can have members from any XMPP server,
|
||||
but the presence will only be available from and to members
|
||||
of the same virtual host where the group is created.</P><P>Shared roster groups can be edited <EM>only</EM> via the Web Admin. Each group
|
||||
of the same virtual host where the group is created.</P><P>Options:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD></DL><P>Shared roster groups can be edited <EM>only</EM> via the Web Admin. Each group
|
||||
has a unique identification and the following parameters:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B>Name</B></DT><DD CLASS="dd-description"> The name of the group, which will be displayed in the roster.
|
||||
@@ -3251,8 +3270,9 @@ represents all the registered users in the virtual host;
|
||||
which is only recommended for a small server with just a few hundred users.
|
||||
The special member directive <TT>@online@</TT>
|
||||
represents the online users in the virtual host.
|
||||
</DD><DT CLASS="dt-description"><B>Displayed groups</B></DT><DD CLASS="dd-description"> A list of groups that will be in the rosters of this
|
||||
group’s members.
|
||||
</DD><DT CLASS="dt-description"><B>Displayed groups</B></DT><DD CLASS="dd-description">
|
||||
A list of groups that will be in the rosters of this group’s members.
|
||||
A group of other vhost can be identified with <TT>groupid@vhost</TT>
|
||||
</DD></DL><P>Examples:
|
||||
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
Take the case of a computer club that wants all its members seeing each
|
||||
@@ -3584,6 +3604,10 @@ is replaced at start time with the real virtual host name.
|
||||
|
||||
</DD><DT CLASS="dt-description"><B><TT>{iqdisc, Discipline}</TT></B></DT><DD CLASS="dd-description"> This specifies
|
||||
the processing discipline for <TT>vcard-temp</TT> IQ queries (see section <A HREF="#modiqdiscoption">3.3.2</A>).
|
||||
</DD><DT CLASS="dt-description"><B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>{search, true|false}</TT></B></DT><DD CLASS="dd-description">This option specifies whether the search
|
||||
functionality is enabled or not
|
||||
If disabled, the option <TT>host</TT> will be ignored and the
|
||||
@@ -3599,7 +3623,7 @@ users who added some information to their vCard. The default value is
|
||||
</DD><DT CLASS="dt-description"><B><TT>{search_all_hosts, true|false}</TT></B></DT><DD CLASS="dd-description">If this option is set
|
||||
to <TT>true</TT>, search operations will apply to all virtual hosts. Otherwise
|
||||
only the current host will be searched. The default value is <TT>true</TT>.
|
||||
This option is available in <TT>mod_vcard</TT>, but not available in <TT>mod_vcard_odbc</TT>.
|
||||
This option is available in <TT>mod_vcard</TT>when using Mnesia, but not when using ODBC storage.
|
||||
</DD></DL><P>Examples:
|
||||
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
In this first situation, search results are limited to twenty items,
|
||||
@@ -3821,7 +3845,13 @@ it is replaced with the element generated by ejabberd.</P><P>By enabling this mo
|
||||
and each presence sent by a client produces hash retrieval and a
|
||||
presence stanza rewrite.
|
||||
For this reason, enabling this module will introduce a computational overhead
|
||||
in servers with clients that change frequently their presence.</P><P> <A NAME="modversion"></A> </P><!--TOC subsection <TT>mod_version</TT>-->
|
||||
in servers with clients that change frequently their presence.</P><P>Options:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>{db_type, mnesia|odbc}</TT></B></DT><DD CLASS="dd-description">
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If <TT>odbc</TT> value is defined, make sure you have defined the database, see <A HREF="#database">3.2</A>.
|
||||
</DD></DL><P> <A NAME="modversion"></A> </P><!--TOC subsection <TT>mod_version</TT>-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc69">3.3.31</A>  <A HREF="#modversion"><TT>mod_version</TT></A></H3><!--SEC END --><P> <A NAME="modversion"></A>
|
||||
</P><P>This module implements Software Version (<A HREF="http://xmpp.org/extensions/xep-0092.html">XEP-0092</A>). Consequently, it
|
||||
answers <TT>ejabberd</TT>’s version when queried.</P><P>Options:
|
||||
@@ -3866,7 +3896,6 @@ Add the option to the file <TT>ejabberd.cfg</TT>.
|
||||
In this example there is no restriction:
|
||||
</P><PRE CLASS="verbatim">{ejabberdctl_access_commands, []}.
|
||||
</PRE><P>If account <TT>robot1@example.org</TT> is registered in <TT>ejabberd</TT> with password <TT>abcdef</TT>
|
||||
(which MD5 is E8B501798950FC58AAD83C8C14978E),
|
||||
and <TT>ejabberd.cfg</TT> contains this setting:
|
||||
</P><PRE CLASS="verbatim">{hosts, ["example.org"]}.
|
||||
{acl, bots, {user, "robot1", "example.org"}}.
|
||||
@@ -3875,7 +3904,7 @@ and <TT>ejabberd.cfg</TT> contains this setting:
|
||||
</PRE><P>then you can do this in the shell:
|
||||
</P><PRE CLASS="verbatim">$ ejabberdctl registered_users example.org
|
||||
Error: no_auth_provided
|
||||
$ ejabberdctl --auth robot1 example.org E8B501798950FC58AAD83C8C14978E registered_users example.org
|
||||
$ ejabberdctl --auth robot1 example.org abcdef registered_users example.org
|
||||
robot1
|
||||
testuser1
|
||||
testuser2
|
||||
@@ -4015,6 +4044,8 @@ using jabberd1.4 formatted XML files.
|
||||
from other Jabber/XMPP servers
|
||||
There exist tutorials to
|
||||
<A HREF="http://www.ejabberd.im/migrate-to-ejabberd">migrate from other software to ejabberd</A>.
|
||||
</DD><DT CLASS="dt-description"><B><TT>export2odbc virtualhost directory</TT></B></DT><DD CLASS="dd-description">
|
||||
Export virtual host information from Mnesia tables to SQL files.
|
||||
</DD><DT CLASS="dt-description"><B><TT>delete_expired_messages</TT></B></DT><DD CLASS="dd-description"> 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.
|
||||
@@ -4038,8 +4069,7 @@ The authentication information is provided when executing a command,
|
||||
and is Username, Hostname and Password of a local XMPP account
|
||||
that has permission to execute the corresponding command.
|
||||
This means that the account must be registered in the local ejabberd,
|
||||
because the information will be verified.
|
||||
It is possible to provide the plaintext password or its MD5 sum.</P><P>When one or several access restrictions are defined and the
|
||||
because the information will be verified.</P><P>When one or several access restrictions are defined and the
|
||||
authentication information is provided,
|
||||
each restriction is verified until one matches completely:
|
||||
the account matches the Access rule,
|
||||
@@ -4146,7 +4176,7 @@ the environment variable <TT>EJABBERD_DOC_PATH</TT>.
|
||||
See section <A HREF="#erlangconfiguration">4.1.2</A>.</P><P> <A NAME="adhoccommands"></A> </P><!--TOC section Ad-hoc Commands-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc78">4.4</A>  <A HREF="#adhoccommands">Ad-hoc Commands</A></H2><!--SEC END --><P> <A NAME="adhoccommands"></A> </P><P>If you enable <TT>mod_configure</TT> and <TT>mod_adhoc</TT>,
|
||||
you can perform several administrative tasks in <TT>ejabberd</TT>
|
||||
with a XMPP client.
|
||||
with an XMPP client.
|
||||
The client must support Ad-Hoc Commands (<A HREF="http://xmpp.org/extensions/xep-0050.html">XEP-0050</A>),
|
||||
and you must login in the XMPP server with
|
||||
an account with proper privileges.</P><P> <A NAME="changeerlangnodename"></A> </P><!--TOC section Change Computer Hostname-->
|
||||
@@ -4359,9 +4389,8 @@ enabled only on one machine in the cluster.
|
||||
</LI></OL><P>You can repeat these steps for other machines supposed to serve this
|
||||
domain.</P><P> <A NAME="servicelb"></A> </P><!--TOC section Service Load-Balancing-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc93">6.3</A>  <A HREF="#servicelb">Service Load-Balancing</A></H2><!--SEC END --><P> <A NAME="servicelb"></A>
|
||||
</P><P> <A NAME="componentlb"></A> </P><!--TOC subsection Components Load-Balancing-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc94">6.3.1</A>  <A HREF="#componentlb">Components Load-Balancing</A></H3><!--SEC END --><P> <A NAME="componentlb"></A> </P><P> <A NAME="domainlb"></A> </P><!--TOC subsection Domain Load-Balancing Algorithm-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc95">6.3.2</A>  <A HREF="#domainlb">Domain Load-Balancing Algorithm</A></H3><!--SEC END --><P> <A NAME="domainlb"></A>
|
||||
</P><P> <A NAME="domainlb"></A> </P><!--TOC subsection Domain Load-Balancing Algorithm-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc94">6.3.1</A>  <A HREF="#domainlb">Domain Load-Balancing Algorithm</A></H3><!--SEC END --><P> <A NAME="domainlb"></A>
|
||||
</P><P><TT>ejabberd</TT> includes an algorithm to load balance the components that are plugged on an <TT>ejabberd</TT> cluster. It means that you can plug one or several instances of the same component on each <TT>ejabberd</TT> cluster and that the traffic will be automatically distributed.</P><P>The default distribution algorithm try to deliver to a local instance of a component. If several local instances are available, one instance is chosen randomly. If no instance is available locally, one instance is chosen randomly among the remote component instances.</P><P>If you need a different behaviour, you can change the load balancing behaviour with the option <TT>domain_balancing</TT>. The syntax of the option is the following:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description"><B><TT>{domain_balancing, "component.example.com", BalancingCriteria}.</TT></B></DT></DL><P>Several balancing criteria are available:
|
||||
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
@@ -4370,12 +4399,12 @@ domain.</P><P> <A NAME="servicelb"></A> </P><!--TOC section Service Load-Balanci
|
||||
</LI><LI CLASS="li-itemize"><TT>bare_destination</TT>: the bare JID (without resource) of the packet <TT>to</TT> attribute is used.
|
||||
</LI><LI CLASS="li-itemize"><TT>bare_source</TT>: the bare JID (without resource) of the packet <TT>from</TT> attribute is used.
|
||||
</LI></UL><P>If the value corresponding to the criteria is the same, the same component instance in the cluster will be used.</P><P> <A NAME="lbbuckets"></A> </P><!--TOC subsection Load-Balancing Buckets-->
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc96">6.3.3</A>  <A HREF="#lbbuckets">Load-Balancing Buckets</A></H3><!--SEC END --><P> <A NAME="lbbuckets"></A>
|
||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc95">6.3.2</A>  <A HREF="#lbbuckets">Load-Balancing Buckets</A></H3><!--SEC END --><P> <A NAME="lbbuckets"></A>
|
||||
</P><P>When there is a risk of failure for a given component, domain balancing can cause service trouble. If one component is failing the service will not work correctly unless the sessions are rebalanced.</P><P>In this case, it is best to limit the problem to the sessions handled by the failing component. This is what the <TT>domain_balancing_component_number</TT> option does, making the load balancing algorithm not dynamic, but sticky on a fix number of component instances.</P><P>The syntax is:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description"><B><TT>{domain_balancing_component_number, "component.example.com", Number}.</TT></B></DT></DL><P> <A NAME="debugging"></A> </P><!--TOC chapter Debugging-->
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc97">Chapter 7</A>  <A HREF="#debugging">Debugging</A></H1><!--SEC END --><P> <A NAME="debugging"></A>
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc96">Chapter 7</A>  <A HREF="#debugging">Debugging</A></H1><!--SEC END --><P> <A NAME="debugging"></A>
|
||||
</P><P> <A NAME="logfiles"></A> </P><!--TOC section Log Files-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc98">7.1</A>  <A HREF="#logfiles">Log Files</A></H2><!--SEC END --><P> <A NAME="logfiles"></A> </P><P>An <TT>ejabberd</TT> node writes two log files:
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc97">7.1</A>  <A HREF="#logfiles">Log Files</A></H2><!--SEC END --><P> <A NAME="logfiles"></A> </P><P>An <TT>ejabberd</TT> node writes two log files:
|
||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||
<B><TT>ejabberd.log</TT></B></DT><DD CLASS="dd-description"> is the ejabberd service log, with the messages reported by <TT>ejabberd</TT> code
|
||||
</DD><DT CLASS="dt-description"><B><TT>erlang.log</TT></B></DT><DD CLASS="dd-description"> is the Erlang/OTP system log, with the messages reported by Erlang/OTP using SASL (System Architecture Support Libraries)
|
||||
@@ -4400,12 +4429,12 @@ The ejabberdctl command <TT>reopen-log</TT>
|
||||
(please refer to section <A HREF="#ectl-commands">4.1.1</A>)
|
||||
reopens the log files,
|
||||
and also renames the old ones if you didn’t rename them.</P><P> <A NAME="debugconsole"></A> </P><!--TOC section Debug Console-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc99">7.2</A>  <A HREF="#debugconsole">Debug Console</A></H2><!--SEC END --><P> <A NAME="debugconsole"></A> </P><P>The Debug Console is an Erlang shell attached to an already running <TT>ejabberd</TT> server.
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc98">7.2</A>  <A HREF="#debugconsole">Debug Console</A></H2><!--SEC END --><P> <A NAME="debugconsole"></A> </P><P>The Debug Console is an Erlang shell attached to an already running <TT>ejabberd</TT> server.
|
||||
With this Erlang shell, an experienced administrator can perform complex tasks.</P><P>This shell gives complete control over the <TT>ejabberd</TT> server,
|
||||
so it is important to use it with extremely care.
|
||||
There are some simple and safe examples in the article
|
||||
<A HREF="http://www.ejabberd.im/interconnect-erl-nodes">Interconnecting Erlang Nodes</A></P><P>To exit the shell, close the window or press the keys: control+c control+c.</P><P> <A NAME="watchdog"></A> </P><!--TOC section Watchdog Alerts-->
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc100">7.3</A>  <A HREF="#watchdog">Watchdog Alerts</A></H2><!--SEC END --><P> <A NAME="watchdog"></A>
|
||||
<H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc99">7.3</A>  <A HREF="#watchdog">Watchdog Alerts</A></H2><!--SEC END --><P> <A NAME="watchdog"></A>
|
||||
</P><P><TT>ejabberd</TT> includes a watchdog mechanism that may be useful to developers
|
||||
when troubleshooting a problem related to memory usage.
|
||||
If a process in the <TT>ejabberd</TT> server consumes more memory than the configured threshold,
|
||||
@@ -4425,7 +4454,7 @@ or in a conversation with the watchdog alert bot.</P><P>The syntax is:
|
||||
To remove all watchdog admins, set the option with an empty list:
|
||||
</P><PRE CLASS="verbatim">{watchdog_admins, []}.
|
||||
</PRE><P> <A NAME="i18ni10n"></A> </P><!--TOC chapter Internationalization and Localization-->
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc101">Appendix A</A>  <A HREF="#i18ni10n">Internationalization and Localization</A></H1><!--SEC END --><P> <A NAME="i18ni10n"></A>
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc100">Appendix A</A>  <A HREF="#i18ni10n">Internationalization and Localization</A></H1><!--SEC END --><P> <A NAME="i18ni10n"></A>
|
||||
</P><P>The source code of <TT>ejabberd</TT> supports localization.
|
||||
The translators can edit the
|
||||
<A HREF="http://www.gnu.org/software/gettext/">gettext</A> .po files
|
||||
@@ -4460,14 +4489,15 @@ HTTP header ‘Accept-Language: ru’</TD></TR>
|
||||
</TABLE></DIV>
|
||||
<A NAME="fig:webadmmainru"></A>
|
||||
<DIV CLASS="center"><HR WIDTH="80%" SIZE=2></DIV></DIV></BLOCKQUOTE><P> <A NAME="releasenotes"></A> </P><!--TOC chapter Release Notes-->
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc102">Appendix B</A>  <A HREF="#releasenotes">Release Notes</A></H1><!--SEC END --><P> <A NAME="releasenotes"></A>
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc101">Appendix B</A>  <A HREF="#releasenotes">Release Notes</A></H1><!--SEC END --><P> <A NAME="releasenotes"></A>
|
||||
</P><P>Release notes are available from <A HREF="http://www.process-one.net/en/ejabberd/release_notes/">ejabberd Home Page</A></P><P> <A NAME="acknowledgements"></A> </P><!--TOC chapter Acknowledgements-->
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc103">Appendix C</A>  <A HREF="#acknowledgements">Acknowledgements</A></H1><!--SEC END --><P> <A NAME="acknowledgements"></A> </P><P>Thanks to all people who contributed to this guide:
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc102">Appendix C</A>  <A HREF="#acknowledgements">Acknowledgements</A></H1><!--SEC END --><P> <A NAME="acknowledgements"></A> </P><P>Thanks to all people who contributed to this guide:
|
||||
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
||||
Alexey Shchepin (<A HREF="xmpp:aleksey@jabber.ru"><TT>xmpp:aleksey@jabber.ru</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Badlop (<A HREF="xmpp:badlop@jabberes.org"><TT>xmpp:badlop@jabberes.org</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Evgeniy Khramtsov (<A HREF="xmpp:xram@jabber.ru"><TT>xmpp:xram@jabber.ru</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Florian Zumbiehl (<A HREF="xmpp:florz@florz.de"><TT>xmpp:florz@florz.de</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Ludovic Bocquet (<A HREF="xmpp:lbocquet@jabber.org"><TT>xmpp:lbocquet@jabber.org</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Marcin Owsiany (<A HREF="xmpp:marcin.owsiany@gmail.com"><TT>xmpp:marcin.owsiany@gmail.com</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Michael Grigutsch (<A HREF="xmpp:migri@jabber.i-pobox.net"><TT>xmpp:migri@jabber.i-pobox.net</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Mickael Remond (<A HREF="xmpp:mremond@process-one.net"><TT>xmpp:mremond@process-one.net</TT></A>)
|
||||
@@ -4475,8 +4505,8 @@ Alexey Shchepin (<A HREF="xmpp:aleksey@jabber.ru"><TT>xmpp:aleksey@jabber.ru</TT
|
||||
</LI><LI CLASS="li-itemize">Sergei Golovan (<A HREF="xmpp:sgolovan@nes.ru"><TT>xmpp:sgolovan@nes.ru</TT></A>)
|
||||
</LI><LI CLASS="li-itemize">Vsevolod Pelipas (<A HREF="xmpp:vsevoload@jabber.ru"><TT>xmpp:vsevoload@jabber.ru</TT></A>)
|
||||
</LI></UL><P> <A NAME="copyright"></A> </P><!--TOC chapter Copyright Information-->
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc104">Appendix D</A>  <A HREF="#copyright">Copyright Information</A></H1><!--SEC END --><P> <A NAME="copyright"></A> </P><P>Ejabberd Installation and Operation Guide.<BR>
|
||||
Copyright © 2003 — 2010 ProcessOne</P><P>This document is free software; you can redistribute it and/or
|
||||
<H1 CLASS="chapter"><!--SEC ANCHOR --><A NAME="htoc103">Appendix D</A>  <A HREF="#copyright">Copyright Information</A></H1><!--SEC END --><P> <A NAME="copyright"></A> </P><P>Ejabberd Installation and Operation Guide.<BR>
|
||||
Copyright © 2003 — 2013 ProcessOne</P><P>This document 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.</P><P>This document is distributed in the hope that it will be useful,
|
||||
|
||||
+85
-84
@@ -75,24 +75,19 @@
|
||||
\newcommand{\modhttpfileserver}{\module{mod\_http\_fileserver}}
|
||||
\newcommand{\modirc}{\module{mod\_irc}}
|
||||
\newcommand{\modlast}{\module{mod\_last}}
|
||||
\newcommand{\modlastodbc}{\module{mod\_last\_odbc}}
|
||||
\newcommand{\modmuc}{\module{mod\_muc}}
|
||||
\newcommand{\modmuclog}{\module{mod\_muc\_log}}
|
||||
\newcommand{\modoffline}{\module{mod\_offline}}
|
||||
\newcommand{\modofflineodbc}{\module{mod\_offline\_odbc}}
|
||||
\newcommand{\modping}{\module{mod\_ping}}
|
||||
\newcommand{\modprescounter}{\module{mod\_pres\_counter}}
|
||||
\newcommand{\modprivacy}{\module{mod\_privacy}}
|
||||
\newcommand{\modprivacyodbc}{\module{mod\_privacy\_odbc}}
|
||||
\newcommand{\modprivate}{\module{mod\_private}}
|
||||
\newcommand{\modprivateodbc}{\module{mod\_private\_odbc}}
|
||||
\newcommand{\modproxy}{\module{mod\_proxy65}}
|
||||
\newcommand{\modpubsub}{\module{mod\_pubsub}}
|
||||
\newcommand{\modpubsubodbc}{\module{mod\_pubsub\_odbc}}
|
||||
\newcommand{\modregister}{\module{mod\_register}}
|
||||
\newcommand{\modregisterweb}{\module{mod\_register\_web}}
|
||||
\newcommand{\modroster}{\module{mod\_roster}}
|
||||
\newcommand{\modrosterodbc}{\module{mod\_roster\_odbc}}
|
||||
\newcommand{\modservicelog}{\module{mod\_service\_log}}
|
||||
\newcommand{\modsharedroster}{\module{mod\_shared\_roster}}
|
||||
\newcommand{\modsharedrosterldap}{\module{mod\_shared\_roster\_ldap}}
|
||||
@@ -101,7 +96,6 @@
|
||||
\newcommand{\modtime}{\module{mod\_time}}
|
||||
\newcommand{\modvcard}{\module{mod\_vcard}}
|
||||
\newcommand{\modvcardldap}{\module{mod\_vcard\_ldap}}
|
||||
\newcommand{\modvcardodbc}{\module{mod\_vcard\_odbc}}
|
||||
\newcommand{\modvcardxupdate}{\module{mod\_vcard\_xupdate}}
|
||||
\newcommand{\modversion}{\module{mod\_version}}
|
||||
|
||||
@@ -123,6 +117,11 @@ the processing discipline for #1 IQ queries (see section~\ref{modiqdiscoption}).
|
||||
hostname of the virtual host with the prefix `\jid{#1.}'. The keyword "@HOST@"
|
||||
is replaced at start time with the real virtual host name.
|
||||
}
|
||||
\newcommand{\dbtype}{\titem{\{db\_type, mnesia|odbc\}} \ind{options!dbtype}
|
||||
Define the type of storage where the module will create the tables and store user information.
|
||||
The default is to store in the internal Mnesia database.
|
||||
If \term{odbc} value is defined, make sure you have defined the database, see~\ref{database}.
|
||||
}
|
||||
|
||||
%% Title page
|
||||
\include{version}
|
||||
@@ -315,7 +314,7 @@ To compile \ejabberd{} on a `Unix-like' operating system, you need:
|
||||
\item GNU Make
|
||||
\item GCC
|
||||
\item Libexpat 1.95 or higher
|
||||
\item Erlang/OTP R10B-9 or higher. The recommended versions are R12B-5 and R13B04.
|
||||
\item Erlang/OTP R10B-9 or higher. The recommended versions are R13B04 and R14B04.
|
||||
Don't use R14A or R14B because \footahref{http://www.erlang.org/cgi-bin/ezmlm-cgi/4/54598}{they have a bug}.
|
||||
\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.
|
||||
@@ -569,19 +568,19 @@ werl -s ejabberd -name ejabberd
|
||||
%TODO: how to compile database support on windows?
|
||||
|
||||
|
||||
\makesection{initialadmin}{Create a XMPP Account for Administration}
|
||||
\makesection{initialadmin}{Create an XMPP Account for Administration}
|
||||
|
||||
You need a XMPP account and grant him administrative privileges
|
||||
You need an XMPP account and grant him administrative privileges
|
||||
to enter the \ejabberd{} Web Admin:
|
||||
\begin{enumerate}
|
||||
\item Register a XMPP account on your \ejabberd{} server, for example \term{admin1@example.org}.
|
||||
There are two ways to register a XMPP account:
|
||||
\item Register an XMPP account on your \ejabberd{} server, for example \term{admin1@example.org}.
|
||||
There are two ways to register an XMPP account:
|
||||
\begin{enumerate}
|
||||
\item Using \term{ejabberdctl}\ind{ejabberdctl} (see section~\ref{ejabberdctl}):
|
||||
\begin{verbatim}
|
||||
ejabberdctl register admin1 example.org FgT5bk3
|
||||
\end{verbatim}
|
||||
\item Using a XMPP client and In-Band Registration (see section~\ref{modregister}).
|
||||
\item Using an XMPP client and In-Band Registration (see section~\ref{modregister}).
|
||||
\end{enumerate}
|
||||
\item Edit the \ejabberd{} configuration file to give administration rights to the XMPP account you created:
|
||||
\begin{verbatim}
|
||||
@@ -826,7 +825,7 @@ The available modules, their purpose and the options allowed by each one are:
|
||||
Options: \texttt{certfile}
|
||||
\titem{\texttt{ejabberd\_http}}
|
||||
Handles incoming HTTP connections.\\
|
||||
Options: \texttt{captcha}, \texttt{certfile}, \texttt{http\_bind}, \texttt{http\_poll},
|
||||
Options: \texttt{captcha}, \texttt{certfile}, \texttt{default\_host}, \texttt{http\_bind}, \texttt{http\_poll},
|
||||
\texttt{request\_handlers}, \texttt{tls}, \texttt{trusted\_proxies}, \texttt{web\_admin}\\
|
||||
\end{description}
|
||||
|
||||
@@ -847,6 +846,11 @@ This is a detailed description of each option allowed by the listening modules:
|
||||
Simple web page that allows a user to fill a CAPTCHA challenge (see section \ref{captcha}).
|
||||
\titem{\{certfile, Path\}} Full path to a file containing the default SSL certificate.
|
||||
To define a certificate file specific for a given domain, use the global option \term{domain\_certfile}.
|
||||
\titem{\{default\_host, undefined|HostName\}}
|
||||
If the HTTP request received by ejabberd contains the HTTP header \term{Host}
|
||||
with an ambiguous virtual host that doesn't match any one defined in ejabberd (see \ref{hostnames}),
|
||||
then this configured HostName is set as the request Host.
|
||||
The default value of this option is: \term{undefined}.
|
||||
\titem{\{hosts, [Hostname, ...], [HostOption, ...]\}} \ind{options!hosts}
|
||||
The external Jabber component that connects to this \term{ejabberd\_service}
|
||||
can serve one or more hostnames.
|
||||
@@ -1226,6 +1230,12 @@ The default value is \term{closeold}.
|
||||
If the client uses old Jabber Non-SASL authentication (\xepref{0078}),
|
||||
then this option is not respected, and the action performed is \term{closeold}.
|
||||
|
||||
The option \option{fqdn} allows you to define the Fully Qualified Domain Name
|
||||
of the machine, in case it isn't detected automatically.
|
||||
The FQDN is used to authenticate some clients that use the DIGEST-MD5 SASL mechanism.
|
||||
The option syntax is:
|
||||
\esyntax{\{fqdn, undefined|FqdnString|[FqdnString]\}.}
|
||||
|
||||
\makesubsubsection{internalauth}{Internal}
|
||||
\ind{internal authentication}\ind{Mnesia}
|
||||
|
||||
@@ -1295,7 +1305,7 @@ These are the specific options:
|
||||
the authentication information since the user last disconnected,
|
||||
to verify again the user authentication without querying again the extauth script.
|
||||
Note: caching should not be enabled in a host if internal auth is also enabled.
|
||||
If caching is enabled, \term{mod\_last} or \term{mod\_last\_odbc} must be enabled also in that vhost.
|
||||
If caching is enabled, \term{mod\_last} must be enabled also in that vhost.
|
||||
\end{description}
|
||||
|
||||
This example sets external authentication, the extauth script, enables caching for 10 minutes,
|
||||
@@ -1434,7 +1444,7 @@ attacks.
|
||||
\item You may want to allow login access only for certain users. \term{pam\_listfile.so}
|
||||
module provides such functionality.
|
||||
\item If you use \term{pam\_winbind} to authorise against a Windows Active Directory,
|
||||
then \term{/etc/nssswitch.conf} must be configured to use \term{winbind} as well.
|
||||
then \term{/etc/nsswitch.conf} must be configured to use \term{winbind} as well.
|
||||
\end{itemize}
|
||||
|
||||
\makesubsection{accessrules}{Access Rules}
|
||||
@@ -1664,7 +1674,7 @@ The configurable options are:
|
||||
\begin{description}
|
||||
\titem{\{captcha\_cmd, Path\}}
|
||||
Full path to a script that generates the image.
|
||||
The default value is an empty string: \term{""}
|
||||
The default value disables the feature: \term{undefined}
|
||||
\titem{\{captcha\_host, ProtocolHostPort\}}
|
||||
ProtocolHostPort is a string with the host, and optionally the Protocol and Port number.
|
||||
It must identify where ejabberd listens for CAPTCHA requests.
|
||||
@@ -2011,12 +2021,10 @@ MySQL interface. Anyway, the first configuration step is to define the odbc
|
||||
\ind{MySQL!storage}
|
||||
|
||||
MySQL also can be used to store information into from several \ejabberd{}
|
||||
modules. See section~\ref{modoverview} to see which modules have a version
|
||||
with the `\_odbc'. This suffix indicates that the module can be used with
|
||||
modules. See section~\ref{modoverview} to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and replace the
|
||||
suffix-less or ldap module variant with the odbc module variant. Keep in mind
|
||||
that you cannot have several variants of the same module loaded!
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option \term{\{db\_type, odbc\}}.
|
||||
|
||||
\makesubsection{mssql}{Microsoft SQL Server}
|
||||
\ind{Microsoft SQL Server}\ind{Microsoft SQL Server!schema}
|
||||
@@ -2068,13 +2076,10 @@ ODBC compatible servers (see section~\ref{odbcauth}).
|
||||
\ind{Microsoft SQL Server!storage}
|
||||
|
||||
Microsoft SQL Server also can be used to store information into from several
|
||||
\ejabberd{} modules. See section~\ref{modoverview} to see which modules have
|
||||
a version with the `\_odbc'. This suffix indicates that the module can be used
|
||||
with relational databases like Microsoft SQL Server. To enable storage to your
|
||||
database, just make sure that your database is running well (see previous
|
||||
sections), and replace the suffix-less or ldap module variant with the odbc
|
||||
module variant. Keep in mind that you cannot have several variants of the same
|
||||
module loaded!
|
||||
modules. See section~\ref{modoverview} to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option \term{\{db\_type, odbc\}}.
|
||||
|
||||
\makesubsection{pgsql}{PostgreSQL}
|
||||
\ind{PostgreSQL}\ind{PostgreSQL!schema}
|
||||
@@ -2166,12 +2171,10 @@ PostgreSQL interface. Anyway, the first configuration step is to define the odbc
|
||||
\ind{PostgreSQL!storage}
|
||||
|
||||
PostgreSQL also can be used to store information into from several \ejabberd{}
|
||||
modules. See section~\ref{modoverview} to see which modules have a version
|
||||
with the `\_odbc'. This suffix indicates that the module can be used with
|
||||
relational databases like PostgreSQL. To enable storage to your database, just
|
||||
make sure that your database is running well (see previous sections), and
|
||||
replace the suffix-less or ldap module variant with the odbc module variant.
|
||||
Keep in mind that you cannot have several variants of the same module loaded!
|
||||
modules. See section~\ref{modoverview} to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option \term{\{db\_type, odbc\}}.
|
||||
|
||||
\makesubsection{odbc}{ODBC Compatible}
|
||||
\ind{databases!ODBC}
|
||||
@@ -2243,13 +2246,11 @@ example:
|
||||
\ind{ODBC!storage}
|
||||
|
||||
An ODBC compatible database also can be used to store information into from
|
||||
several \ejabberd{} modules. See section~\ref{modoverview} to see which
|
||||
modules have a version with the `\_odbc'. This suffix indicates that the module
|
||||
can be used with ODBC compatible relational databases. To enable storage to your
|
||||
database, just make sure that your database is running well (see previous
|
||||
sections), and replace the suffix-less or ldap module variant with the odbc
|
||||
module variant. Keep in mind that you cannot have several variants of the same
|
||||
module loaded!
|
||||
several \ejabberd{}
|
||||
modules. See section~\ref{modoverview} to see which modules can be used with
|
||||
relational databases like MySQL. To enable storage to your database, just make
|
||||
sure that your database is running well (see previous sections), and add the
|
||||
module option \term{\{db\_type, odbc\}}.
|
||||
|
||||
\makesubsection{ldap}{LDAP}
|
||||
\ind{databases!LDAP}
|
||||
@@ -2576,36 +2577,28 @@ The following table lists all modules included in \ejabberd{}.
|
||||
\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 (*) \\
|
||||
\hline \ahrefloc{modmuc}{\modmuc{}} & Multi-User Chat (\xepref{0045}) & \\
|
||||
\hline \ahrefloc{modmuclog}{\modmuclog{}} & Multi-User Chat room logging & \modmuc{} \\
|
||||
\hline \ahrefloc{modoffline}{\modoffline{}} & Offline message storage (\xepref{0160}) & \\
|
||||
\hline \ahrefloc{modoffline}{\modofflineodbc{}} & Offline message storage (\xepref{0160}) & supported DB (*) \\
|
||||
\hline \ahrefloc{modping}{\modping{}} & XMPP Ping and periodic keepalives (\xepref{0199}) & \\
|
||||
\hline \ahrefloc{modprescounter}{\modprescounter{}} & Detect presence subscription flood & \\
|
||||
\hline \ahrefloc{modprivacy}{\modprivacy{}} & Blocking Communication (\xepref{0016}) & \\
|
||||
\hline \ahrefloc{modprivacy}{\modprivacyodbc{}} & Blocking Communication (\xepref{0016}) & supported DB (*) \\
|
||||
\hline \ahrefloc{modprivate}{\modprivate{}} & Private XML Storage (\xepref{0049}) & \\
|
||||
\hline \ahrefloc{modprivate}{\modprivateodbc{}} & Private XML Storage (\xepref{0049}) & supported DB (*) \\
|
||||
\hline \ahrefloc{modproxy}{\modproxy{}} & SOCKS5 Bytestreams (\xepref{0065}) & \\
|
||||
\hline \ahrefloc{modpubsub}{\modpubsub{}} & Pub-Sub (\xepref{0060}), PEP (\xepref{0163}) & \modcaps{} \\
|
||||
\hline \ahrefloc{modpubsub}{\modpubsubodbc{}} & Pub-Sub (\xepref{0060}), PEP (\xepref{0163}) & supported DB (*) and \modcaps{} \\
|
||||
\hline \ahrefloc{modregister}{\modregister{}} & In-Band Registration (\xepref{0077}) & \\
|
||||
\hline \ahrefloc{modregisterweb}{\modregisterweb{}} & Web for Account Registrations & \\
|
||||
\hline \ahrefloc{modroster}{\modroster{}} & Roster management (XMPP IM) & \\
|
||||
\hline \ahrefloc{modroster}{\modrosterodbc{}} & Roster management (XMPP IM) & supported DB (*) \\
|
||||
\hline \ahrefloc{modservicelog}{\modservicelog{}} & Copy user messages to logger service & \\
|
||||
\hline \ahrefloc{modsharedroster}{\modsharedroster{}} & Shared roster management & \modroster{} or \\
|
||||
& & \modrosterodbc\\
|
||||
\hline \ahrefloc{modsharedrosterldap}{\modsharedrosterldap{}} & LDAP Shared roster management & \modroster{} or \\
|
||||
& & \modrosterodbc\\
|
||||
\hline \ahrefloc{modsharedroster}{\modsharedroster{}} & Shared roster management & \modroster{} \\
|
||||
\hline \ahrefloc{modsharedrosterldap}{\modsharedrosterldap{}} & LDAP Shared roster management & \modroster{} \\
|
||||
\hline \ahrefloc{modsic}{\modsic{}} & Server IP Check (\xepref{0279}) & \\
|
||||
\hline \ahrefloc{modstats}{\modstats{}} & Statistics Gathering (\xepref{0039}) & \\
|
||||
\hline \ahrefloc{modtime}{\modtime{}} & Entity Time (\xepref{0202}) & \\
|
||||
\hline \ahrefloc{modvcard}{\modvcard{}} & vcard-temp (\xepref{0054}) & \\
|
||||
\hline \ahrefloc{modvcardldap}{\modvcardldap{}} & vcard-temp (\xepref{0054}) & LDAP server \\
|
||||
\hline \ahrefloc{modvcard}{\modvcardodbc{}} & vcard-temp (\xepref{0054}) & supported DB (*) \\
|
||||
\hline \ahrefloc{modvcardxupdate}{\modvcardxupdate{}} & vCard-Based Avatars (\xepref{0153}) & \modvcard{} or \modvcardodbc{} \\
|
||||
\hline \ahrefloc{modvcardxupdate}{\modvcardxupdate{}} & vCard-Based Avatars (\xepref{0153}) & \modvcard{} \\
|
||||
\hline \ahrefloc{modversion}{\modversion{}} & Software Version (\xepref{0092}) & \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
@@ -2617,31 +2610,11 @@ The following table lists all modules included in \ejabberd{}.
|
||||
|
||||
You can see which database backend each module needs by looking at the suffix:
|
||||
\begin{itemize}
|
||||
\item No suffix, this means that the modules uses Erlang's built-in database
|
||||
Mnesia as backend.
|
||||
\item `\_odbc', this means that the module needs a supported database
|
||||
(see~\ref{database}) as backend.
|
||||
\item No suffix, this means that the module uses Erlang's built-in database
|
||||
Mnesia as backend, or a ODBC database in some cases (see~\ref{database}).
|
||||
\item `\_ldap', this means that the module needs an LDAP server as backend.
|
||||
\end{itemize}
|
||||
|
||||
If you want to,
|
||||
it is possible to use a relational database to store the tables created by some ejabberd modules.
|
||||
You can do this by changing the module name to a name with an
|
||||
\term{\_odbc} suffix in \ejabberd{} config file. You can use a relational
|
||||
database for the following data:
|
||||
|
||||
\begin{itemize}
|
||||
\item Last connection date and time: Use \term{mod\_last\_odbc} instead of
|
||||
\term{mod\_last}.
|
||||
\item Offline messages: Use \term{mod\_offline\_odbc} instead of
|
||||
\term{mod\_offline}.
|
||||
\item Rosters: Use \term{mod\_roster\_odbc} instead of \term{mod\_roster}.
|
||||
\item Users' VCARD: Use \term{mod\_vcard\_odbc} instead of \term{mod\_vcard}.
|
||||
\item Private XML storage: Use \term{mod\_private\_odbc} instead of \term{mod\_private}.
|
||||
\item User rules for blocking communications: Use \term{mod\_privacy\_odbc} instead of \term{mod\_privacy}.
|
||||
\item Pub-Sub nodes, items and subscriptions: Use \term{mod\_pubsub\_odbc} instead of \term{mod\_pubsub}.
|
||||
\end{itemize}
|
||||
|
||||
You can find more
|
||||
\footahref{http://www.ejabberd.im/contributions}{contributed modules} on the
|
||||
\ejabberd{} website. Please remember that these contributions might not work or
|
||||
@@ -2769,6 +2742,7 @@ hosts in ejabberd.
|
||||
|
||||
Options:
|
||||
\begin{description}
|
||||
\dbtype
|
||||
\titem{\{access, AccessName\}} \ind{options!access}This option specifies who is allowed to
|
||||
send announcements and to set the message of the day (by default, nobody is
|
||||
able to send such messages).
|
||||
@@ -3099,6 +3073,7 @@ End user information:
|
||||
Options:
|
||||
\begin{description}
|
||||
\hostitem{irc}
|
||||
\dbtype
|
||||
\titem{\{access, AccessName\}} \ind{options!access}This option can be used to specify who
|
||||
may use the IRC transport (default value: \term{all}).
|
||||
\titem{\{default\_encoding, Encoding\}} \ind{options!defaultencoding}Set the default IRC encoding.
|
||||
@@ -3149,6 +3124,7 @@ connected user was last active on the server, or to query the uptime of the
|
||||
Options:
|
||||
\begin{description}
|
||||
\iqdiscitem{Last activity (\ns{jabber:iq:last})}
|
||||
\dbtype
|
||||
\end{description}
|
||||
|
||||
\makesubsection{modmuc}{\modmuc{}}
|
||||
@@ -3183,6 +3159,7 @@ on an available node on first connection attempt.
|
||||
Module options:
|
||||
\begin{description}
|
||||
\hostitem{conference}
|
||||
\dbtype
|
||||
\titem{\{access, AccessName\}} \ind{options!access}You can specify who is allowed to use
|
||||
the Multi-User Chat service. By default everyone is allowed to use it.
|
||||
\titem{\{access\_create, AccessName\}} \ind{options!access\_create}To configure who is
|
||||
@@ -3260,7 +3237,7 @@ Module options:
|
||||
\titem{\{default\_room\_options, [ \{OptionName, OptionValue\}, ...]\}} \ind{options!default\_room\_options}
|
||||
This module option allows to define the desired default room options.
|
||||
Note that the creator of a room can modify the options of his room
|
||||
at any time using a XMPP client with MUC capability.
|
||||
at any time using an XMPP client with MUC capability.
|
||||
The available room options and the default values are:
|
||||
\begin{description}
|
||||
\titem{\{allow\_change\_subj, true|false\}} Allow occupants to change the subject.
|
||||
@@ -3457,6 +3434,10 @@ Options:
|
||||
\term{html} stores in HTML format,
|
||||
\term{plaintext} stores in plain text.
|
||||
The default value is \term{html}.
|
||||
\titem{\{file\_permissions, \{Mode, Group\}\}}\ind{options!file\_permissions}
|
||||
Define the permissions that must be used when creating the log files:
|
||||
the number of the mode, and the numeric id of the group that will own the files.
|
||||
The default value is \term{\{644, 33\}}.
|
||||
\titem{\{outdir, Path\}}\ind{options!outdir}
|
||||
This option sets the full path to the directory in which the HTML files should
|
||||
be stored. Make sure the \ejabberd{} daemon user has write access on that
|
||||
@@ -3523,6 +3504,8 @@ Examples:
|
||||
{access_log, muc_log},
|
||||
{cssfile, false},
|
||||
{dirtype, subdirs},
|
||||
{dirtype, subdirs},
|
||||
{file_permissions, {644, 33}},
|
||||
{outdir, "/var/www/muclogs"},
|
||||
{timezone, local}
|
||||
]},
|
||||
@@ -3542,6 +3525,7 @@ online again. Thus it is very similar to how email works. Note that
|
||||
(see section~\ref{ejabberdctl}).
|
||||
|
||||
\begin{description}
|
||||
\dbtype
|
||||
\titem{\{access\_max\_user\_messages, AccessName\}}\ind{options!access\_max\_user\_messages}
|
||||
This option defines which access rule will be enforced to limit
|
||||
the maximum number of offline messages that a user can have (quota).
|
||||
@@ -3672,6 +3656,7 @@ their \XMPP{} client, they will be able to:
|
||||
Options:
|
||||
\begin{description}
|
||||
\iqdiscitem{Blocking Communication (\ns{jabber:iq:privacy})}
|
||||
\dbtype
|
||||
\end{description}
|
||||
|
||||
\makesubsection{modprivate}{\modprivate{}}
|
||||
@@ -3688,6 +3673,7 @@ of client-specific preferences; another is Bookmark Storage (\xepref{0048}).
|
||||
Options:
|
||||
\begin{description}
|
||||
\iqdiscitem{Private XML Storage (\ns{jabber:iq:private})}
|
||||
\dbtype
|
||||
\end{description}
|
||||
|
||||
\makesubsection{modproxy}{\modproxy{}}
|
||||
@@ -4028,6 +4014,7 @@ It also supports Roster Versioning (\xepref{0237}).
|
||||
Options:
|
||||
\begin{description}
|
||||
\iqdiscitem{Roster Management (\ns{jabber:iq:roster})}
|
||||
\dbtype
|
||||
\titem{\{versioning, false|true\}} \ind{options!versioning}Enables
|
||||
Roster Versioning.
|
||||
This option is disabled by default.
|
||||
@@ -4105,6 +4092,11 @@ A shared roster group can have members from any XMPP server,
|
||||
but the presence will only be available from and to members
|
||||
of the same virtual host where the group is created.
|
||||
|
||||
Options:
|
||||
\begin{description}
|
||||
\dbtype
|
||||
\end{description}
|
||||
|
||||
Shared roster groups can be edited \emph{only} via the Web Admin. Each group
|
||||
has a unique identification and the following parameters:
|
||||
\begin{description}
|
||||
@@ -4118,8 +4110,9 @@ has a unique identification and the following parameters:
|
||||
which is only recommended for a small server with just a few hundred users.
|
||||
The special member directive \term{@online@}
|
||||
represents the online users in the virtual host.
|
||||
\item[Displayed groups] A list of groups that will be in the rosters of this
|
||||
group's members.
|
||||
\item[Displayed groups]
|
||||
A list of groups that will be in the rosters of this group's members.
|
||||
A group of other vhost can be identified with \term{groupid@vhost}
|
||||
\end{description}
|
||||
|
||||
Examples:
|
||||
@@ -4622,6 +4615,7 @@ Options:
|
||||
\begin{description}
|
||||
\hostitem{vjud}
|
||||
\iqdiscitem{\ns{vcard-temp}}
|
||||
\dbtype
|
||||
\titem{\{search, true|false\}}\ind{options!search}This option specifies whether the search
|
||||
functionality is enabled or not
|
||||
If disabled, the option \term{host} will be ignored and the
|
||||
@@ -4637,7 +4631,7 @@ Options:
|
||||
\titem{\{search\_all\_hosts, true|false\}}\ind{options!search\_all\_hosts}If this option is set
|
||||
to \term{true}, search operations will apply to all virtual hosts. Otherwise
|
||||
only the current host will be searched. The default value is \term{true}.
|
||||
This option is available in \modvcard, but not available in \modvcardodbc.
|
||||
This option is available in \modvcard when using Mnesia, but not when using ODBC storage.
|
||||
\end{description}
|
||||
|
||||
Examples:
|
||||
@@ -4910,6 +4904,11 @@ presence stanza rewrite.
|
||||
For this reason, enabling this module will introduce a computational overhead
|
||||
in servers with clients that change frequently their presence.
|
||||
|
||||
Options:
|
||||
\begin{description}
|
||||
\dbtype
|
||||
\end{description}
|
||||
|
||||
\makesubsection{modversion}{\modversion{}}
|
||||
\ind{modules!\modversion{}}\ind{protocols!XEP-0092: Software Version}
|
||||
|
||||
@@ -4978,7 +4977,6 @@ In this example there is no restriction:
|
||||
\end{verbatim}
|
||||
|
||||
If account \term{robot1@example.org} is registered in \ejabberd{} with password \term{abcdef}
|
||||
(which MD5 is E8B501798950FC58AAD83C8C14978E),
|
||||
and \term{ejabberd.cfg} contains this setting:
|
||||
\begin{verbatim}
|
||||
{hosts, ["example.org"]}.
|
||||
@@ -4990,7 +4988,7 @@ then you can do this in the shell:
|
||||
\begin{verbatim}
|
||||
$ ejabberdctl registered_users example.org
|
||||
Error: no_auth_provided
|
||||
$ ejabberdctl --auth robot1 example.org E8B501798950FC58AAD83C8C14978E registered_users example.org
|
||||
$ ejabberdctl --auth robot1 example.org abcdef registered_users example.org
|
||||
robot1
|
||||
testuser1
|
||||
testuser2
|
||||
@@ -5153,6 +5151,8 @@ 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{export2odbc virtualhost directory} \ind{export mnesia data to SQL files}
|
||||
Export virtual host information from Mnesia tables to SQL files.
|
||||
\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.
|
||||
@@ -5183,7 +5183,6 @@ and is Username, Hostname and Password of a local XMPP account
|
||||
that has permission to execute the corresponding command.
|
||||
This means that the account must be registered in the local ejabberd,
|
||||
because the information will be verified.
|
||||
It is possible to provide the plaintext password or its MD5 sum.
|
||||
|
||||
When one or several access restrictions are defined and the
|
||||
authentication information is provided,
|
||||
@@ -5319,7 +5318,7 @@ See section \ref{erlangconfiguration}.
|
||||
|
||||
If you enable \modconfigure\ and \modadhoc,
|
||||
you can perform several administrative tasks in \ejabberd{}
|
||||
with a XMPP client.
|
||||
with an XMPP client.
|
||||
The client must support Ad-Hoc Commands (\xepref{0050}),
|
||||
and you must login in the XMPP server with
|
||||
an account with proper privileges.
|
||||
@@ -5685,7 +5684,8 @@ domain.
|
||||
\makesection{servicelb}{Service Load-Balancing}
|
||||
\ind{component load-balancing}
|
||||
|
||||
\makesubsection{componentlb}{Components Load-Balancing}
|
||||
% This section never had content, should it?
|
||||
% \makesubsection{componentlb}{Components Load-Balancing}
|
||||
|
||||
\makesubsection{domainlb}{Domain Load-Balancing Algorithm}
|
||||
\ind{options!domain\_balancing}
|
||||
@@ -5871,6 +5871,7 @@ Thanks to all people who contributed to this guide:
|
||||
\item Badlop (\ahrefurl{xmpp:badlop@jabberes.org})
|
||||
\item Evgeniy Khramtsov (\ahrefurl{xmpp:xram@jabber.ru})
|
||||
\item Florian Zumbiehl (\ahrefurl{xmpp:florz@florz.de})
|
||||
\item Ludovic Bocquet (\ahrefurl{xmpp:lbocquet@jabber.org})
|
||||
\item Marcin Owsiany (\ahrefurl{xmpp:marcin.owsiany@gmail.com})
|
||||
\item Michael Grigutsch (\ahrefurl{xmpp:migri@jabber.i-pobox.net})
|
||||
\item Mickael Remond (\ahrefurl{xmpp:mremond@process-one.net})
|
||||
@@ -5883,7 +5884,7 @@ Thanks to all people who contributed to this guide:
|
||||
\makechapter{copyright}{Copyright Information}
|
||||
|
||||
Ejabberd Installation and Operation Guide.\\
|
||||
Copyright \copyright{} 2003 --- 2010 ProcessOne
|
||||
Copyright \copyright{} 2003 --- 2013 ProcessOne
|
||||
|
||||
This document is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
Release Notes
|
||||
ejabberd 2.1.10
|
||||
|
||||
ejabberd 2.1.10 includes a few bugfixes and improvements.
|
||||
|
||||
Read more details about the changes in:
|
||||
http://redir.process-one.net/ejabberd-2.1.10
|
||||
|
||||
Download the source code and installers from:
|
||||
http://www.process-one.net/en/ejabberd/
|
||||
|
||||
|
||||
The major changes are:
|
||||
|
||||
* Erlang/OTP compatibility
|
||||
- Support Erlang/OTP R15B regexp and drivers (EJAB-1521)
|
||||
- Fix modules update in R14B04 and higher
|
||||
- Fix modules update of stripped beams (EJAB-1520)
|
||||
|
||||
* XMPP Core
|
||||
- Fix presence problem in C2S after first unavailable (EJAB-1466)
|
||||
- Fix bug on S2S shaper when TLS is used
|
||||
- Prevent overload of incoming S2S connections
|
||||
|
||||
* XEPs
|
||||
- BOSH: Get rid of useless mnesia transaction (EJAB-1502)
|
||||
- MUC: Don't reveal invitee resource when room informs invitor
|
||||
- Privacy: Activate "Blocked Contacts" to current c2s connection (EJAB-1519)
|
||||
- Privacy: Always allow packets from user's server and bare jid (EJAB-1441)
|
||||
- Pubsub: Add hooks for node creation/deletion (EJAB-1470)
|
||||
- Shared Rosters: support groupname@vhost in Displayed Groups (EJAB-506)
|
||||
- Vcard: Fix error when lowercasing some search results (EJAB-1490)
|
||||
|
||||
|
||||
Bug reports
|
||||
|
||||
You can officially report bugs on ProcessOne support site:
|
||||
http://support.process-one.net/
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
Release Notes
|
||||
ejabberd 2.1.11
|
||||
|
||||
ejabberd 2.1.11 includes a few bugfixes and improvements.
|
||||
|
||||
Read more details about the changes in:
|
||||
http://redir.process-one.net/ejabberd-2.1.11
|
||||
|
||||
Download the source code and installers from:
|
||||
http://www.process-one.net/en/ejabberd/
|
||||
|
||||
|
||||
The major changes are:
|
||||
|
||||
* HTTP service
|
||||
- Fix ejabberd_http:get_line
|
||||
- Don't use binary:match to extract lines from binaries
|
||||
- Parse and encode https header names like native http parser does
|
||||
- Parse correctly https request split into multiple packets
|
||||
- Properly handle HEAD request in mod_http_bind (EJAB-1538)
|
||||
- New option default_host for handling requests with ambiguous Host (EJAB-1261)
|
||||
|
||||
* ODBC
|
||||
- New ODBC support for mod_announce
|
||||
- New ODBC support for mod_blocking
|
||||
- New ODBC support for mod_irc
|
||||
- New ODBC support for mod_muc
|
||||
- New ODBC support for mod_shared_roster
|
||||
- New ODBC support for mod_vcard_xupdate
|
||||
- Add ODBC exporting function for privacy table
|
||||
- Work also with some unicode strings in PgSQL (EJAB-1490)
|
||||
- Replace a single quote with double quotes in an ODBC escape
|
||||
|
||||
* SSL
|
||||
- Make sure that res is initialized in all cases
|
||||
- Parse correctly https request split into multiple packets (EJAB-1537)
|
||||
- Added missed tls:recv_data/2
|
||||
- Don't ignore Length parameter in tls:recv
|
||||
- Avoid quadratic behavior in reading SSL data
|
||||
- Dix http_bind webserver TLS fail on Chrome (EJAB-1530)
|
||||
|
||||
* Miscelanea
|
||||
- Assume we have only one CPU when an auto-detection fails (EJAB-1516)
|
||||
- Auth: Relax digest-uri handling (EJAB-1529)
|
||||
- Caps: Cache caps timestamp before the IQ-request is done
|
||||
- IRC: Use of MUC password
|
||||
- Private: misc errors cases fixes
|
||||
- Pubsub: return user affiliation for a specified node (EJAB-1294)
|
||||
- Shared Roster: Foreign items were not pushed (EJAB-1509)
|
||||
- Shared Roster LDAP: user substitution in ldap_rfilter (EJAB-1555)
|
||||
- Windows: Fix makefile rules for building DLLs
|
||||
|
||||
|
||||
Bug reports
|
||||
|
||||
You can officially report bugs on ProcessOne support site:
|
||||
http://support.process-one.net/
|
||||
@@ -0,0 +1,67 @@
|
||||
|
||||
Release Notes
|
||||
ejabberd 2.1.12
|
||||
|
||||
ejabberd 2.1.12 includes a many bugfixes and a few improvements.
|
||||
|
||||
Read more details about the changes in:
|
||||
http://redir.process-one.net/ejabberd-2.1.12
|
||||
|
||||
Download the source code and installers from:
|
||||
http://www.process-one.net/en/ejabberd/
|
||||
|
||||
|
||||
The changes are:
|
||||
|
||||
* Core ejabberd
|
||||
- Make terms serialization faster
|
||||
- Reduce size of XML stream state
|
||||
|
||||
* Administration
|
||||
- Add SCRAM and remove MD5 support to ejabberd commands auth verification
|
||||
- Added command to list all the vhosts registered in an ejabberd node
|
||||
- Added export2odbc command, copied from mod_admin_extra.erl
|
||||
- Fix ejabberdctl number of arguments error report with R15
|
||||
- Check node name is available before starting ejabberd (EJAB-1572)
|
||||
- Fix ejabberd_xmlrpc commands authentication with SCRAM
|
||||
- Fix mod_offline:store_offline_msg argument (EJAB-1581)
|
||||
- Log IP address when auth attempt fails
|
||||
- Make sure update_info returns atoms only (EJAB-1595)
|
||||
- On shutdown, first stop listeners, then modules
|
||||
|
||||
* Encryption
|
||||
- Detect OpenSSL version at runtime, not at compile time
|
||||
- Fixed signedness issue in tls_drv GET_DESCRYPTED_INPUT (EJAB-1591)
|
||||
- Enable DHE key exchange in TLS driver
|
||||
- Enable ECDHE key exchange in TSL driver
|
||||
- Disable old and unsecure ciphers in TLS driver
|
||||
- Disable SSL 2.0 in TLS driver
|
||||
|
||||
* HTTP-Bind
|
||||
- Do not trigger item-not-found errors in mod_http_bind
|
||||
- Repeated http-bind request should abort only requests with same rid
|
||||
- Receiving missing request shouldn't close waiting out-ouf-order request
|
||||
|
||||
* XMPP
|
||||
- Allow multiple fqdn values in configuration (EJAB-1578)
|
||||
- Fix get_subscription_lists/4
|
||||
- Fix account registration
|
||||
- Send announce Message stanzas as Headline type instead of Normal
|
||||
|
||||
* Other
|
||||
- Guide: Fix file name of Name Service Switch
|
||||
- Guide: Document the db_type modules option (EJAB-1560)
|
||||
- LDAP: Fix broken JPEG photo (EJAB-1526)
|
||||
- LDAP: Fix compatibility with Erlang R16A (EJAB-1612)
|
||||
- MUC: Fix angle brackets handle in plaintext log (EJAB-1610)
|
||||
- MUC: Fix MUC start when Mnesia tables don't exist yet
|
||||
- MUC: New mod_muc_log option file_permissions (EJAB-1588)
|
||||
- ODBC: Merge SQL and Mnesia code into one module (EJAB-1560)
|
||||
- Translation: New Hebrew
|
||||
- Translation: Update Slovak
|
||||
|
||||
|
||||
Bug reports
|
||||
|
||||
You can officially report bugs on ProcessOne support site:
|
||||
http://support.process-one.net/
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
% ejabberd version (automatically generated).
|
||||
\newcommand{\version}{2.1.9}
|
||||
\newcommand{\version}{2.1.12}
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ LD=link.exe
|
||||
LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" "$(EXPAT_LIB)" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib
|
||||
|
||||
$(DLL) : $(OBJECT)
|
||||
$(LD) $(LD_FLAGS) -out:$(DLL) $(OBJECT)
|
||||
$(LD) $(LD_FLAGS) -out:$@ $<
|
||||
|
||||
$(OBJECT) : $(SOURCE)
|
||||
$(CC) $(CC_FLAGS) -c -Fo$(OBJECT) $(SOURCE)
|
||||
$(CC) $(CC_FLAGS) -c -Fo$@ $<
|
||||
|
||||
+16
-8
@@ -5,7 +5,7 @@
|
||||
%%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -181,9 +181,11 @@ match_acl(ACL, JID, Host) ->
|
||||
lists:member(Server, ?MYHOSTS)))
|
||||
andalso is_regexp_match(User, UR);
|
||||
{shared_group, G} ->
|
||||
mod_shared_roster:is_user_in_group({User, Server}, G, Host);
|
||||
Mod = loaded_shared_roster_module(Host),
|
||||
Mod:is_user_in_group({User, Server}, G, Host);
|
||||
{shared_group, G, H} ->
|
||||
mod_shared_roster:is_user_in_group({User, Server}, G, H);
|
||||
Mod = loaded_shared_roster_module(H),
|
||||
Mod:is_user_in_group({User, Server}, G, H);
|
||||
{user_regexp, UR, S} ->
|
||||
(S == Server) andalso
|
||||
is_regexp_match(User, UR);
|
||||
@@ -223,19 +225,25 @@ match_acl(ACL, JID, Host) ->
|
||||
end.
|
||||
|
||||
is_regexp_match(String, RegExp) ->
|
||||
case regexp:first_match(String, RegExp) of
|
||||
case ejabberd_regexp:run(String, RegExp) of
|
||||
nomatch ->
|
||||
false;
|
||||
{match, _, _} ->
|
||||
match ->
|
||||
true;
|
||||
{error, ErrDesc} ->
|
||||
?ERROR_MSG(
|
||||
"Wrong regexp ~p in ACL: ~p",
|
||||
[RegExp, lists:flatten(regexp:format_error(ErrDesc))]),
|
||||
[RegExp, ErrDesc]),
|
||||
false
|
||||
end.
|
||||
|
||||
is_glob_match(String, Glob) ->
|
||||
is_regexp_match(String, regexp:sh_to_awk(Glob)).
|
||||
|
||||
is_regexp_match(String, ejabberd_regexp:sh_to_awk(Glob)).
|
||||
|
||||
loaded_shared_roster_module(Host) ->
|
||||
case gen_mod:is_loaded(Host, mod_shared_roster_ldap) of
|
||||
true ->
|
||||
mod_shared_roster_ldap;
|
||||
false ->
|
||||
mod_shared_roster
|
||||
end.
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 31 Oct 2005 by Magnus Henoch <henoch@dtek.chalmers.se>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+7
-2
@@ -6,7 +6,7 @@
|
||||
%%% Created : 29 Aug 2010 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -380,7 +380,12 @@ do_setopts(#state{procs_num = N} = State, Opts) ->
|
||||
shrink_size = ShrinkSize}.
|
||||
|
||||
get_proc_num() ->
|
||||
erlang:system_info(logical_processors).
|
||||
case erlang:system_info(logical_processors) of
|
||||
unknown ->
|
||||
1;
|
||||
Num ->
|
||||
Num
|
||||
end.
|
||||
|
||||
get_proc_by_hash(Tab, Term) ->
|
||||
N = erlang:phash2(Term, get_proc_num()) + 1,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
%%% Created : 30 Aug 2010 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
Vendored
+9
-9
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for ejabberd 2.1.x.
|
||||
# Generated by GNU Autoconf 2.68 for ejabberd 2.1.12.
|
||||
#
|
||||
# Report bugs to <ejabberd@process-one.net>.
|
||||
#
|
||||
@@ -560,8 +560,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='ejabberd'
|
||||
PACKAGE_TARNAME='ejabberd'
|
||||
PACKAGE_VERSION='2.1.x'
|
||||
PACKAGE_STRING='ejabberd 2.1.x'
|
||||
PACKAGE_VERSION='2.1.12'
|
||||
PACKAGE_STRING='ejabberd 2.1.12'
|
||||
PACKAGE_BUGREPORT='ejabberd@process-one.net'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1288,7 +1288,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures ejabberd 2.1.x to adapt to many kinds of systems.
|
||||
\`configure' configures ejabberd 2.1.12 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1354,7 +1354,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of ejabberd 2.1.x:";;
|
||||
short | recursive ) echo "Configuration of ejabberd 2.1.12:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1479,7 +1479,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
ejabberd configure 2.1.x
|
||||
ejabberd configure 2.1.12
|
||||
generated by GNU Autoconf 2.68
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
@@ -1823,7 +1823,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by ejabberd $as_me 2.1.x, which was
|
||||
It was created by ejabberd $as_me 2.1.12, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -5690,7 +5690,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by ejabberd $as_me 2.1.x, which was
|
||||
This file was extended by ejabberd $as_me 2.1.12, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -5743,7 +5743,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
ejabberd config.status 2.1.x
|
||||
ejabberd config.status 2.1.12
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 27 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
@@ -5,7 +5,7 @@
|
||||
%%% Created : 8 Mar 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
%%% Created : 23 Aug 2005 by Magnus Henoch <henoch@dtek.chalmers.se>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+41
-12
@@ -5,7 +5,7 @@
|
||||
%%% Created : 11 Mar 2003 by Alexey Shchepin <alexey@sevcom.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -37,9 +37,11 @@
|
||||
-behaviour(cyrsasl).
|
||||
|
||||
-record(state, {step, nonce, username, authzid, get_password, check_password, auth_module,
|
||||
host}).
|
||||
host, hostfqdn}).
|
||||
|
||||
start(_Opts) ->
|
||||
Fqdn = get_local_fqdn(),
|
||||
?INFO_MSG("FQDN used to check DIGEST-MD5 SASL authentication: ~p", [Fqdn]),
|
||||
cyrsasl:register_mechanism("DIGEST-MD5", ?MODULE, digest).
|
||||
|
||||
stop() ->
|
||||
@@ -49,6 +51,7 @@ mech_new(Host, GetPassword, _CheckPassword, CheckPasswordDigest) ->
|
||||
{ok, #state{step = 1,
|
||||
nonce = randoms:get_string(),
|
||||
host = Host,
|
||||
hostfqdn = get_local_fqdn(),
|
||||
get_password = GetPassword,
|
||||
check_password = CheckPasswordDigest}}.
|
||||
|
||||
@@ -64,10 +67,11 @@ mech_step(#state{step = 3, nonce = Nonce} = State, ClientIn) ->
|
||||
KeyVals ->
|
||||
DigestURI = xml:get_attr_s("digest-uri", KeyVals),
|
||||
UserName = xml:get_attr_s("username", KeyVals),
|
||||
case is_digesturi_valid(DigestURI, State#state.host) of
|
||||
case is_digesturi_valid(DigestURI, State#state.host, State#state.hostfqdn) of
|
||||
false ->
|
||||
?DEBUG("User login not authorized because digest-uri "
|
||||
"seems invalid: ~p", [DigestURI]),
|
||||
"seems invalid: ~p (checking for Host ~p, FQDN ~p)", [DigestURI,
|
||||
State#state.host, State#state.hostfqdn]),
|
||||
{error, "not-authorized", UserName};
|
||||
true ->
|
||||
AuthzId = xml:get_attr_s("authzid", KeyVals),
|
||||
@@ -154,21 +158,46 @@ parse4([], Key, Val, Ts) ->
|
||||
%% however ejabberd doesn't allow that.
|
||||
%% If the service (for example jabber.example.org)
|
||||
%% is provided by several hosts (being one of them server3.example.org),
|
||||
%% then digest-uri can be like xmpp/server3.example.org/jabber.example.org
|
||||
%% In that case, ejabberd only checks the service name, not the host.
|
||||
is_digesturi_valid(DigestURICase, JabberHost) ->
|
||||
%% then acceptable digest-uris would be:
|
||||
%% xmpp/server3.example.org/jabber.example.org, xmpp/server3.example.org and
|
||||
%% xmpp/jabber.example.org
|
||||
%% The last version is not actually allowed by the RFC, but implemented by popular clients
|
||||
is_digesturi_valid(DigestURICase, JabberDomain, JabberFQDN) ->
|
||||
DigestURI = stringprep:tolower(DigestURICase),
|
||||
case catch string:tokens(DigestURI, "/") of
|
||||
["xmpp", Host] when Host == JabberHost ->
|
||||
true;
|
||||
["xmpp", _Host, ServName] when ServName == JabberHost ->
|
||||
true;
|
||||
["xmpp", Host] ->
|
||||
IsHostFqdn = is_host_fqdn(Host, JabberFQDN),
|
||||
(Host == JabberDomain) or IsHostFqdn;
|
||||
["xmpp", Host, ServName] ->
|
||||
IsHostFqdn = is_host_fqdn(Host, JabberFQDN),
|
||||
(ServName == JabberDomain) and IsHostFqdn;
|
||||
_ ->
|
||||
false
|
||||
end.
|
||||
|
||||
is_host_fqdn(Host, [Letter | _Tail] = Fqdn) when not is_list(Letter) ->
|
||||
Host == Fqdn;
|
||||
is_host_fqdn(_Host, []) ->
|
||||
false;
|
||||
is_host_fqdn(Host, [Fqdn | _FqdnTail]) when Host == Fqdn ->
|
||||
true;
|
||||
is_host_fqdn(Host, [Fqdn | FqdnTail]) when Host /= Fqdn ->
|
||||
is_host_fqdn(Host, FqdnTail).
|
||||
|
||||
|
||||
get_local_fqdn() ->
|
||||
case (catch get_local_fqdn2()) of
|
||||
Str when is_list(Str) -> Str;
|
||||
_ -> "unknown-fqdn, please configure fqdn option in ejabberd.cfg!"
|
||||
end.
|
||||
get_local_fqdn2() ->
|
||||
case ejabberd_config:get_local_option(fqdn) of
|
||||
ConfiguredFqdn when is_list(ConfiguredFqdn) ->
|
||||
ConfiguredFqdn;
|
||||
_undefined ->
|
||||
{ok, Hostname} = inet:gethostname(),
|
||||
{ok, {hostent, Fqdn, _, _, _, _}} = inet:gethostbyname(Hostname),
|
||||
Fqdn
|
||||
end.
|
||||
|
||||
digit_to_xchar(D) when (D >= 0) and (D < 10) ->
|
||||
D + 48;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 8 Mar 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 7 Aug 2011 by Stephen Röttger <stephen.roettger@googlemail.com>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
{application, ejabberd,
|
||||
[{description, "ejabberd"},
|
||||
{vsn, "2.1.9"},
|
||||
{vsn, "2.1.12"},
|
||||
{modules, [acl,
|
||||
adhoc,
|
||||
configure,
|
||||
@@ -78,16 +78,12 @@
|
||||
mod_irc,
|
||||
mod_irc_connection,
|
||||
mod_last,
|
||||
mod_last_odbc,
|
||||
mod_muc,
|
||||
mod_muc_log,
|
||||
mod_muc_room,
|
||||
mod_offline,
|
||||
mod_offline_odbc,
|
||||
mod_privacy,
|
||||
mod_privacy_odbc,
|
||||
mod_private,
|
||||
mod_private_odbc,
|
||||
mod_proxy65,
|
||||
mod_proxy65_lib,
|
||||
mod_proxy65_service,
|
||||
@@ -96,14 +92,12 @@
|
||||
mod_pubsub,
|
||||
mod_register,
|
||||
mod_roster,
|
||||
mod_roster_odbc,
|
||||
mod_service_log,
|
||||
mod_shared_roster,
|
||||
mod_stats,
|
||||
mod_time,
|
||||
mod_vcard,
|
||||
mod_vcard_ldap,
|
||||
mod_vcard_odbc,
|
||||
mod_version,
|
||||
node_buddy,
|
||||
node_club,
|
||||
|
||||
@@ -222,6 +222,9 @@
|
||||
%% Store the plain passwords or hashed for SCRAM:
|
||||
%%{auth_password_format, plain}.
|
||||
%%{auth_password_format, scram}.
|
||||
%%
|
||||
%% Define the FQDN if ejabberd doesn't detect it:
|
||||
%%{fqdn, "server3.example.com"}.
|
||||
|
||||
%%
|
||||
%% Authentication using external script
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+48
-9
@@ -5,7 +5,7 @@
|
||||
%%% Created : 7 May 2006 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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 @@
|
||||
%% Server
|
||||
status/0, reopen_log/0,
|
||||
stop_kindly/2, send_service_message_all_mucs/2,
|
||||
registered_vhosts/0,
|
||||
%% Erlang
|
||||
update_list/0, update/1,
|
||||
%% Accounts
|
||||
@@ -41,6 +42,7 @@
|
||||
%% Purge DB
|
||||
delete_expired_messages/0, delete_old_messages/1,
|
||||
%% Mnesia
|
||||
export2odbc/2,
|
||||
set_master/1,
|
||||
backup_mnesia/1, restore_mnesia/1,
|
||||
dump_mnesia/1, dump_table/2, load_mnesia/1,
|
||||
@@ -85,6 +87,10 @@ commands() ->
|
||||
args = [], result = {res, rescode}},
|
||||
#ejabberd_commands{name = stop_kindly, tags = [server],
|
||||
desc = "Inform users and rooms, wait, and stop the server",
|
||||
longdesc = "Provide the delay in seconds, and the "
|
||||
"announcement quoted, for example: \n"
|
||||
"ejabberdctl stop_kindly 60 "
|
||||
"\\\"The server will stop in one minute.\\\"",
|
||||
module = ?MODULE, function = stop_kindly,
|
||||
args = [{delay, integer}, {announcement, string}],
|
||||
result = {res, rescode}},
|
||||
@@ -123,6 +129,11 @@ commands() ->
|
||||
module = ?MODULE, function = registered_users,
|
||||
args = [{host, string}],
|
||||
result = {users, {list, {username, string}}}},
|
||||
#ejabberd_commands{name = registered_vhosts, tags = [server],
|
||||
desc = "List all registered vhosts in SERVER",
|
||||
module = ?MODULE, function = registered_vhosts,
|
||||
args = [],
|
||||
result = {vhosts, {list, {vhost, string}}}},
|
||||
|
||||
#ejabberd_commands{name = import_file, tags = [mnesia],
|
||||
desc = "Import user data from jabberd14 spool file",
|
||||
@@ -161,6 +172,11 @@ commands() ->
|
||||
module = mod_pubsub, function = rename_default_nodeplugin,
|
||||
args = [], result = {res, rescode}},
|
||||
|
||||
#ejabberd_commands{name = export2odbc, tags = [mnesia],
|
||||
desc = "Export virtual host information from Mnesia tables to SQL files",
|
||||
module = ?MODULE, function = export2odbc,
|
||||
args = [{host, string}, {directory, string}],
|
||||
result = {res, rescode}},
|
||||
#ejabberd_commands{name = set_master, tags = [mnesia],
|
||||
desc = "Set master node of the clustered Mnesia tables",
|
||||
longdesc = "If you provide as nodename \"self\", this "
|
||||
@@ -271,7 +287,7 @@ stop_kindly(DelaySeconds, AnnouncementText) ->
|
||||
- TimestampStart,
|
||||
io:format("[~p/~p ~ps] ~s... ",
|
||||
[NumberThis, NumberLast, SecondsDiff, Desc]),
|
||||
Result = apply(Mod, Func, Args),
|
||||
Result = (catch apply(Mod, Func, Args)),
|
||||
io:format("~p~n", [Result]),
|
||||
NumberThis+1
|
||||
end,
|
||||
@@ -299,14 +315,15 @@ update_list() ->
|
||||
[atom_to_list(Beam) || Beam <- UpdatedBeams].
|
||||
|
||||
update("all") ->
|
||||
[update_module(ModStr) || ModStr <- update_list()];
|
||||
[update_module(ModStr) || ModStr <- update_list()],
|
||||
{ok, []};
|
||||
update(ModStr) ->
|
||||
update_module(ModStr).
|
||||
|
||||
update_module(ModuleNameString) ->
|
||||
ModuleName = list_to_atom(ModuleNameString),
|
||||
case ejabberd_update:update([ModuleName]) of
|
||||
{ok, Res} -> {ok, io_lib:format("Updated: ~p", [Res])};
|
||||
{ok, _Res} -> {ok, []};
|
||||
{error, Reason} -> {error, Reason}
|
||||
end.
|
||||
|
||||
@@ -337,6 +354,8 @@ registered_users(Host) ->
|
||||
SUsers = lists:sort(Users),
|
||||
lists:map(fun({U, _S}) -> U end, SUsers).
|
||||
|
||||
registered_vhosts() ->
|
||||
?MYHOSTS.
|
||||
|
||||
%%%
|
||||
%%% Migration management
|
||||
@@ -368,18 +387,38 @@ import_dir(Path) ->
|
||||
%%%
|
||||
|
||||
delete_expired_messages() ->
|
||||
{atomic, ok} = mod_offline:remove_expired_messages(),
|
||||
ok.
|
||||
lists:foreach(
|
||||
fun(Host) ->
|
||||
{atomic, ok} = mod_offline:remove_expired_messages(Host)
|
||||
end, ?MYHOSTS).
|
||||
|
||||
delete_old_messages(Days) ->
|
||||
{atomic, _} = mod_offline:remove_old_messages(Days),
|
||||
ok.
|
||||
|
||||
lists:foreach(
|
||||
fun(Host) ->
|
||||
{atomic, _} = mod_offline:remove_old_messages(Days, Host)
|
||||
end, ?MYHOSTS).
|
||||
|
||||
%%%
|
||||
%%% Mnesia management
|
||||
%%%
|
||||
|
||||
export2odbc(Host, Directory) ->
|
||||
Tables = [{export_last, last},
|
||||
{export_offline, offline},
|
||||
{export_private_storage, private_storage},
|
||||
{export_roster, roster},
|
||||
{export_vcard, vcard},
|
||||
{export_vcard_search, vcard_search},
|
||||
{export_passwd, passwd}],
|
||||
Export = fun({TableFun, Table}) ->
|
||||
Filename = filename:join([Directory, atom_to_list(Table)++".txt"]),
|
||||
io:format("Trying to export Mnesia table '~p' on Host '~s' to file '~s'~n", [Table, Host, Filename]),
|
||||
Res = (catch ejd2odbc:TableFun(Host, Filename)),
|
||||
io:format(" Result: ~p~n", [Res])
|
||||
end,
|
||||
lists:foreach(Export, Tables),
|
||||
ok.
|
||||
|
||||
set_master("self") ->
|
||||
set_master(node());
|
||||
set_master(NodeString) when is_list(NodeString) ->
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -78,6 +78,7 @@ start(_, _) ->
|
||||
%% This function is called when an application is about to be stopped,
|
||||
%% before shutting down the processes of the application.
|
||||
prep_stop(State) ->
|
||||
ejabberd_listener:stop_listeners(),
|
||||
stop_modules(),
|
||||
ejabberd_admin:stop(),
|
||||
broadcast_c2s_shutdown(),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 23 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 17 Feb 2006 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -293,27 +293,20 @@ get_last_access(User, Server) ->
|
||||
get_last_info(User, Server) ->
|
||||
case get_mod_last_enabled(Server) of
|
||||
mod_last -> mod_last:get_last_info(User, Server);
|
||||
mod_last_odbc -> mod_last_odbc:get_last_info(User, Server);
|
||||
no_mod_last -> mod_last_required
|
||||
end.
|
||||
|
||||
%% @spec (Server) -> mod_last | mod_last_odbc | no_mod_last
|
||||
%% @spec (Server) -> mod_last | no_mod_last
|
||||
get_mod_last_enabled(Server) ->
|
||||
ML = gen_mod:is_loaded(Server, mod_last),
|
||||
MLO = gen_mod:is_loaded(Server, mod_last_odbc),
|
||||
case {ML, MLO} of
|
||||
{true, _} -> mod_last;
|
||||
{false, true} -> mod_last_odbc;
|
||||
{false, false} -> no_mod_last
|
||||
case gen_mod:is_loaded(Server, mod_last) of
|
||||
true -> mod_last;
|
||||
false -> no_mod_last
|
||||
end.
|
||||
|
||||
get_mod_last_configured(Server) ->
|
||||
ML = is_configured(Server, mod_last),
|
||||
MLO = is_configured(Server, mod_last_odbc),
|
||||
case {ML, MLO} of
|
||||
{true, _} -> mod_last;
|
||||
{false, true} -> mod_last_odbc;
|
||||
{false, false} -> no_mod_last
|
||||
case is_configured(Server, mod_last) of
|
||||
true -> mod_last;
|
||||
false -> no_mod_last
|
||||
end.
|
||||
|
||||
is_configured(Host, Module) ->
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 12 Dec 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 5 Jul 2007 by Evgeniy Khramtsov <xram@jabber.ru>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+13
-10
@@ -5,7 +5,7 @@
|
||||
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -556,10 +556,11 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
||||
fsm_next_state_pack(session_established,
|
||||
NewStateData);
|
||||
_ ->
|
||||
IP = peerip(StateData#state.sockmod, StateData#state.socket),
|
||||
?INFO_MSG(
|
||||
"(~w) Failed legacy authentication for ~s",
|
||||
"(~w) Failed legacy authentication for ~s from IP ~s (~w)",
|
||||
[StateData#state.socket,
|
||||
jlib:jid_to_string(JID)]),
|
||||
jlib:jid_to_string(JID), jlib:ip_to_list(IP), IP]),
|
||||
Err = jlib:make_error_reply(
|
||||
El, ?ERR_NOT_AUTHORIZED),
|
||||
send_element(StateData, Err),
|
||||
@@ -646,10 +647,11 @@ wait_for_feature_request({xmlstreamelement, El}, StateData) ->
|
||||
StateData#state{
|
||||
sasl_state = NewSASLState});
|
||||
{error, Error, Username} ->
|
||||
IP = peerip(StateData#state.sockmod, StateData#state.socket),
|
||||
?INFO_MSG(
|
||||
"(~w) Failed authentication for ~s@~s",
|
||||
"(~w) Failed authentication for ~s@~s from IP ~s (~w)",
|
||||
[StateData#state.socket,
|
||||
Username, StateData#state.server]),
|
||||
Username, StateData#state.server, jlib:ip_to_list(IP), IP]),
|
||||
send_element(StateData,
|
||||
{xmlelement, "failure",
|
||||
[{"xmlns", ?NS_SASL}],
|
||||
@@ -799,10 +801,11 @@ wait_for_sasl_response({xmlstreamelement, El}, StateData) ->
|
||||
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",
|
||||
"(~w) Failed authentication for ~s@~s from IP ~s (~w)",
|
||||
[StateData#state.socket,
|
||||
Username, StateData#state.server]),
|
||||
Username, StateData#state.server, jlib:ip_to_list(IP), IP]),
|
||||
send_element(StateData,
|
||||
{xmlelement, "failure",
|
||||
[{"xmlns", ?NS_SASL}],
|
||||
@@ -1785,10 +1788,10 @@ presence_update(From, Packet, StateData) ->
|
||||
FromUnavail = (StateData#state.pres_last == undefined) or
|
||||
StateData#state.pres_invis,
|
||||
?DEBUG("from unavail = ~p~n", [FromUnavail]),
|
||||
NewStateData = StateData#state{pres_last = Packet,
|
||||
pres_invis = false,
|
||||
pres_timestamp = Timestamp},
|
||||
NewState =
|
||||
NewStateData = StateData#state{pres_last = Packet,
|
||||
pres_invis = false,
|
||||
pres_timestamp = Timestamp},
|
||||
if
|
||||
FromUnavail ->
|
||||
ejabberd_hooks:run(user_available_hook,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
%%% Created : 2 Nov 2007 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 26 Apr 2008 by Evgeniy Khramtsov <xramtsov@gmail.com>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -304,7 +304,7 @@ process(_Handlers, #request{method='POST', q=Q, lang=Lang, path=[_, Id]}) ->
|
||||
Form =
|
||||
{xmlelement, "p", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(Lang, "The captcha is valid.")
|
||||
translate:translate(Lang, "The CAPTCHA is valid.")
|
||||
}]},
|
||||
ejabberd_web:make_xhtml([Form]);
|
||||
captcha_non_valid ->
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 27 Feb 2008 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 20 May 2008 by Badlop <badlop@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -381,18 +381,11 @@ check_auth(noauth) ->
|
||||
no_auth_provided;
|
||||
check_auth({User, Server, Password}) ->
|
||||
%% Check the account exists and password is valid
|
||||
AccountPass = ejabberd_auth:get_password_s(User, Server),
|
||||
AccountPassMD5 = get_md5(AccountPass),
|
||||
case Password of
|
||||
AccountPass -> {ok, User, Server};
|
||||
AccountPassMD5 -> {ok, User, Server};
|
||||
case ejabberd_auth:check_password(User, Server, Password) of
|
||||
true -> {ok, User, Server};
|
||||
_ -> throw({error, invalid_account_data})
|
||||
end.
|
||||
|
||||
get_md5(AccountPass) ->
|
||||
lists:flatten([io_lib:format("~.16B", [X])
|
||||
|| X <- binary_to_list(crypto:md5(AccountPass))]).
|
||||
|
||||
check_access(all, _) ->
|
||||
true;
|
||||
check_access(Access, Auth) ->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+33
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 14 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,6 +374,9 @@ process_term(Term, State) ->
|
||||
State;
|
||||
{hosts, _Hosts} ->
|
||||
State;
|
||||
{fqdn, HostFQDN} ->
|
||||
?DEBUG("FQDN set to: ~p", [HostFQDN]),
|
||||
add_option(fqdn, HostFQDN, State);
|
||||
{host_config, Host, Terms} ->
|
||||
lists:foldl(fun(T, S) -> process_host_term(T, Host, S) end,
|
||||
State, Terms);
|
||||
@@ -464,6 +467,8 @@ process_host_term(Term, Host, State) ->
|
||||
State;
|
||||
{odbc_server, ODBC_server} ->
|
||||
add_option({odbc_server, Host}, ODBC_server, State);
|
||||
{modules, Modules} ->
|
||||
add_option({modules, Host}, replace_modules(Modules), State);
|
||||
{Opt, Val} ->
|
||||
add_option({Opt, Host}, Val, State)
|
||||
end.
|
||||
@@ -607,3 +612,30 @@ is_file_readable(Path) ->
|
||||
{error, _Reason} ->
|
||||
false
|
||||
end.
|
||||
|
||||
replace_module(mod_announce_odbc) -> {mod_announce, odbc};
|
||||
replace_module(mod_blocking_odbc) -> {mod_blocking, odbc};
|
||||
replace_module(mod_irc_odbc) -> {mod_irc, odbc};
|
||||
replace_module(mod_last_odbc) -> {mod_last, odbc};
|
||||
replace_module(mod_muc_odbc) -> {mod_muc, odbc};
|
||||
replace_module(mod_offline_odbc) -> {mod_offline, odbc};
|
||||
replace_module(mod_privacy_odbc) -> {mod_privacy, odbc};
|
||||
replace_module(mod_private_odbc) -> {mod_private, odbc};
|
||||
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_modules(Modules) ->
|
||||
lists:map(
|
||||
fun({Module, Opts}) ->
|
||||
case replace_module(Module) of
|
||||
{NewModule, DBType} ->
|
||||
NewOpts = [{db_type, DBType} |
|
||||
lists:keydelete(db_type, 1, Opts)],
|
||||
{NewModule, NewOpts};
|
||||
NewModule ->
|
||||
{NewModule, Opts}
|
||||
end
|
||||
end, Modules).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+18
-7
@@ -5,7 +5,7 @@
|
||||
%%% Created : 11 Jan 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -190,7 +190,7 @@ process(["help" | Mode]) ->
|
||||
print_usage_help(MaxC, ShCode),
|
||||
?STATUS_SUCCESS;
|
||||
[CmdString | _] ->
|
||||
{ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"),
|
||||
CmdStringU = ejabberd_regexp:greplace(CmdString, "-", "_"),
|
||||
print_usage_commands(CmdStringU, MaxC, ShCode),
|
||||
?STATUS_SUCCESS
|
||||
end;
|
||||
@@ -281,7 +281,7 @@ try_call_command(Args, Auth, AccessCommands) ->
|
||||
|
||||
%% @spec (Args::[string()], Auth, AccessCommands) -> string() | integer() | {string(), integer()} | {error, ErrorType}
|
||||
call_command([CmdString | Args], Auth, AccessCommands) ->
|
||||
{ok, CmdStringU, _} = regexp:gsub(CmdString, "-", "_"),
|
||||
CmdStringU = ejabberd_regexp:greplace(CmdString, "-", "_"),
|
||||
Command = list_to_atom(CmdStringU),
|
||||
case ejabberd_commands:get_command_format(Command) of
|
||||
{error, command_unknown} ->
|
||||
@@ -292,7 +292,18 @@ call_command([CmdString | Args], Auth, AccessCommands) ->
|
||||
Result = ejabberd_commands:execute_command(AccessCommands, Auth, Command,
|
||||
ArgsFormatted),
|
||||
format_result(Result, ResultFormat);
|
||||
%% This case clause is for Erlang R14 and older
|
||||
{'EXIT', {function_clause,[{lists,zip,[A1, A2]} | _]}} ->
|
||||
{NumCompa, TextCompa} =
|
||||
case {length(A1), length(A2)} of
|
||||
{L1, L2} when L1 < L2 -> {L2-L1, "less argument"};
|
||||
{L1, L2} when L1 > L2 -> {L1-L2, "more argument"}
|
||||
end,
|
||||
{io_lib:format("Error: the command ~p requires ~p ~s.",
|
||||
[CmdString, NumCompa, TextCompa]),
|
||||
wrong_command_arguments};
|
||||
%% This case clause is for Erlang R15 and newer
|
||||
{'EXIT', {function_clause,[{lists,zip,[A1, A2],_} | _]}} ->
|
||||
{NumCompa, TextCompa} =
|
||||
case {length(A1), length(A2)} of
|
||||
{L1, L2} when L1 < L2 -> {L2-L1, "less argument"};
|
||||
@@ -678,13 +689,13 @@ filter_commands(All, SubString) ->
|
||||
end.
|
||||
|
||||
filter_commands_regexp(All, Glob) ->
|
||||
RegExp = regexp:sh_to_awk(Glob),
|
||||
RegExp = ejabberd_regexp:sh_to_awk(Glob),
|
||||
lists:filter(
|
||||
fun(Command) ->
|
||||
case regexp:first_match(Command, RegExp) of
|
||||
{match, _, _} ->
|
||||
case ejabberd_regexp:run(Command, RegExp) of
|
||||
match ->
|
||||
true;
|
||||
_ ->
|
||||
nomatch ->
|
||||
false
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 23 Aug 2006 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 8 Aug 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -290,8 +290,8 @@ accept(ListenSocket, Module, Opts) ->
|
||||
CallMod:start(strip_frontend(Module), gen_tcp, Socket, Opts),
|
||||
accept(ListenSocket, Module, Opts);
|
||||
{error, Reason} ->
|
||||
?INFO_MSG("(~w) Failed TCP accept: ~w",
|
||||
[ListenSocket, Reason]),
|
||||
?ERROR_MSG("(~w) Failed TCP accept: ~w",
|
||||
[ListenSocket, Reason]),
|
||||
accept(ListenSocket, Module, Opts)
|
||||
end.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 30 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 23 Oct 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
%%% Created : 29 Nov 2006 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 1 Nov 2006 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
-36
@@ -5,7 +5,7 @@
|
||||
%%% Created : 17 Jul 2008 by Pablo Polvorin <pablo.polvorin@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -289,9 +289,10 @@ create_user(User,Password,Domain) ->
|
||||
|
||||
populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) ->
|
||||
io:format("Trying to add/update roster list...",[]),
|
||||
case loaded_module(Domain,[mod_roster_odbc,mod_roster]) of
|
||||
{ok, M} ->
|
||||
case M:set_items(User, Domain, exmpp_xml:xmlel_to_xmlelement(El)) of
|
||||
case loaded_module(Domain, mod_roster) of
|
||||
{ok, _DBType} ->
|
||||
case mod_roster:set_items(User, Domain,
|
||||
exmpp_xml:xmlel_to_xmlelement(El)) of
|
||||
{atomic, ok} ->
|
||||
io:format(" DONE.~n",[]),
|
||||
ok;
|
||||
@@ -302,7 +303,7 @@ populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) ->
|
||||
{error, not_found}
|
||||
end;
|
||||
E -> io:format(" ERROR: ~p~n",[E]),
|
||||
?ERROR_MSG("No modules loaded [mod_roster, mod_roster_odbc] ~s ~n",
|
||||
?ERROR_MSG("No modules loaded [mod_roster] ~s ~n",
|
||||
[exmpp_xml:document_to_list(El)]),
|
||||
{error, not_found}
|
||||
end;
|
||||
@@ -330,10 +331,10 @@ populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:roster'}) ->
|
||||
|
||||
populate_user(User,Domain,El=#xmlel{name='vCard', ns='vcard-temp'}) ->
|
||||
io:format("Trying to add/update vCards...",[]),
|
||||
case loaded_module(Domain,[mod_vcard,mod_vcard_odbc]) of
|
||||
{ok, M} -> FullUser = jid_to_old_jid(exmpp_jid:make(User, Domain)),
|
||||
case loaded_module(Domain, mod_vcard) of
|
||||
{ok, _} -> FullUser = jid_to_old_jid(exmpp_jid:make(User, Domain)),
|
||||
IQ = iq_to_old_iq(#iq{type = set, payload = El}),
|
||||
case M:process_sm_iq(FullUser, FullUser , IQ) of
|
||||
case mod_vcard:process_sm_iq(FullUser, FullUser , IQ) of
|
||||
{error,_Err} ->
|
||||
io:format(" ERROR.~n",[]),
|
||||
?ERROR_MSG("Error processing vcard ~s : ~p ~n",
|
||||
@@ -343,7 +344,7 @@ populate_user(User,Domain,El=#xmlel{name='vCard', ns='vcard-temp'}) ->
|
||||
end;
|
||||
_ ->
|
||||
io:format(" ERROR.~n",[]),
|
||||
?ERROR_MSG("No modules loaded [mod_vcard, mod_vcard_odbc] ~s ~n",
|
||||
?ERROR_MSG("No modules loaded [mod_vcard] ~s ~n",
|
||||
[exmpp_xml:document_to_list(El)]),
|
||||
{error, not_found}
|
||||
end;
|
||||
@@ -356,8 +357,8 @@ populate_user(User,Domain,El=#xmlel{name='vCard', ns='vcard-temp'}) ->
|
||||
|
||||
populate_user(User,Domain,El=#xmlel{name='offline-messages'}) ->
|
||||
io:format("Trying to add/update offline-messages...",[]),
|
||||
case loaded_module(Domain, [mod_offline, mod_offline_odbc]) of
|
||||
{ok, M} ->
|
||||
case loaded_module(Domain, mod_offline) of
|
||||
{ok, _DBType} ->
|
||||
ok = exmpp_xml:foreach(
|
||||
fun (_Element, {xmlcdata, _}) ->
|
||||
ok;
|
||||
@@ -367,11 +368,11 @@ populate_user(User,Domain,El=#xmlel{name='offline-messages'}) ->
|
||||
FullUser = jid_to_old_jid(exmpp_jid:make(User,
|
||||
Domain)),
|
||||
OldChild = exmpp_xml:xmlel_to_xmlelement(Child),
|
||||
_R = M:store_packet(FullFrom, FullUser, OldChild)
|
||||
_R = mod_offline:store_packet(FullFrom, FullUser, OldChild)
|
||||
end, El), io:format(" DONE.~n",[]);
|
||||
_ ->
|
||||
io:format(" ERROR.~n",[]),
|
||||
?ERROR_MSG("No modules loaded [mod_offline, mod_offline_odbc] ~s ~n",
|
||||
?ERROR_MSG("No modules loaded [mod_offline] ~s ~n",
|
||||
[exmpp_xml:document_to_list(El)]),
|
||||
{error, not_found}
|
||||
end;
|
||||
@@ -384,15 +385,15 @@ populate_user(User,Domain,El=#xmlel{name='offline-messages'}) ->
|
||||
|
||||
populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:private'}) ->
|
||||
io:format("Trying to add/update private storage...",[]),
|
||||
case loaded_module(Domain,[mod_private_odbc,mod_private]) of
|
||||
{ok, M} ->
|
||||
case loaded_module(Domain, mod_private) of
|
||||
{ok, _DBType} ->
|
||||
FullUser = jid_to_old_jid(exmpp_jid:make(User, Domain)),
|
||||
IQ = iq_to_old_iq(#iq{type = set,
|
||||
ns = 'jabber:iq:private',
|
||||
kind = request,
|
||||
iq_ns = 'jabberd:client',
|
||||
payload = El}),
|
||||
case M:process_sm_iq(FullUser, FullUser, IQ ) of
|
||||
case mod_private:process_sm_iq(FullUser, FullUser, IQ ) of
|
||||
{error, _Err} ->
|
||||
io:format(" ERROR.~n",[]),
|
||||
?ERROR_MSG("Error processing private storage ~s : ~p ~n",
|
||||
@@ -401,7 +402,7 @@ populate_user(User,Domain,El=#xmlel{name='query', ns='jabber:iq:private'}) ->
|
||||
end;
|
||||
_ ->
|
||||
io:format(" ERROR.~n",[]),
|
||||
?ERROR_MSG("No modules loaded [mod_private, mod_private_odbc] ~s ~n",
|
||||
?ERROR_MSG("No modules loaded [mod_private] ~s ~n",
|
||||
[exmpp_xml:document_to_list(El)]),
|
||||
{error, not_found}
|
||||
end;
|
||||
@@ -415,13 +416,12 @@ populate_user(_User, _Domain, _El) ->
|
||||
%%%==================================
|
||||
%%%% Utilities
|
||||
|
||||
loaded_module(Domain,Options) ->
|
||||
LoadedModules = gen_mod:loaded_modules(Domain),
|
||||
case lists:filter(fun(Module) ->
|
||||
lists:member(Module, LoadedModules)
|
||||
end, Options) of
|
||||
[M|_] -> {ok, M};
|
||||
[] -> {error,not_found}
|
||||
loaded_module(Domain, Module) ->
|
||||
case gen_mod:is_loaded(Domain, Module) of
|
||||
true ->
|
||||
{ok, gen_mod:db_type(Domain, Module)};
|
||||
false ->
|
||||
{error, not_found}
|
||||
end.
|
||||
|
||||
jid_to_old_jid(Jid) ->
|
||||
@@ -574,13 +574,13 @@ build_password_string(Password) when is_list(Password) ->
|
||||
|
||||
%% @spec (InfoName::atom(), Username::string(), Host::string()) -> string()
|
||||
extract_user_info(roster, Username, Host) ->
|
||||
case loaded_module(Host,[mod_roster_odbc,mod_roster]) of
|
||||
{ok, M} ->
|
||||
case loaded_module(Host, mod_roster) of
|
||||
{ok, _DBType} ->
|
||||
From = To = jlib:make_jid(Username, Host, ""),
|
||||
SubelGet = {xmlelement, "query", [{"xmlns",?NS_ROSTER}], []},
|
||||
%%IQGet = #iq{type=get, xmlns=?NS_ROSTER, payload=SubelGet}, % this is for 3.0.0 version
|
||||
IQGet = {iq, "", get, ?NS_ROSTER, "" , SubelGet},
|
||||
Res = M:process_local_iq(From, To, IQGet),
|
||||
Res = mod_roster:process_local_iq(From, To, IQGet),
|
||||
%%[El] = Res#iq.payload, % this is for 3.0.0 version
|
||||
{iq, _, result, _, _, Els} = Res,
|
||||
case Els of
|
||||
@@ -592,8 +592,8 @@ extract_user_info(roster, Username, Host) ->
|
||||
end;
|
||||
|
||||
extract_user_info(offline, Username, Host) ->
|
||||
case loaded_module(Host,[mod_offline,mod_offline_odbc]) of
|
||||
{ok, mod_offline} ->
|
||||
case loaded_module(Host, mod_offline) of
|
||||
{ok, mnesia} ->
|
||||
Els = mnesia_pop_offline_messages([], Username, Host),
|
||||
case Els of
|
||||
[] -> "";
|
||||
@@ -601,30 +601,30 @@ extract_user_info(offline, Username, Host) ->
|
||||
OfEl = {xmlelement, "offline-messages", [], Els},
|
||||
exmpp_xml:document_to_list(OfEl)
|
||||
end;
|
||||
{ok, mod_offline_odbc} ->
|
||||
{ok, odbc} ->
|
||||
"";
|
||||
_E ->
|
||||
""
|
||||
end;
|
||||
|
||||
extract_user_info(private, Username, Host) ->
|
||||
case loaded_module(Host,[mod_private,mod_private_odbc]) of
|
||||
{ok, mod_private} ->
|
||||
case loaded_module(Host, mod_private) of
|
||||
{ok, mnesia} ->
|
||||
get_user_private_mnesia(Username, Host);
|
||||
{ok, mod_private_odbc} ->
|
||||
{ok, odbc} ->
|
||||
"";
|
||||
_E ->
|
||||
""
|
||||
end;
|
||||
|
||||
extract_user_info(vcard, Username, Host) ->
|
||||
case loaded_module(Host,[mod_vcard, mod_vcard_odbc, mod_vcard_odbc]) of
|
||||
{ok, M} ->
|
||||
case loaded_module(Host, mod_vcard) of
|
||||
{ok, _DBType} ->
|
||||
From = To = jlib:make_jid(Username, Host, ""),
|
||||
SubelGet = {xmlelement, "vCard", [{"xmlns",?NS_VCARD}], []},
|
||||
%%IQGet = #iq{type=get, xmlns=?NS_VCARD, payload=SubelGet}, % this is for 3.0.0 version
|
||||
IQGet = {iq, "", get, ?NS_VCARD, "" , SubelGet},
|
||||
Res = M:process_sm_iq(From, To, IQGet),
|
||||
Res = mod_vcard:process_sm_iq(From, To, IQGet),
|
||||
%%[El] = Res#iq.payload, % this is for 3.0.0 version
|
||||
{iq, _, result, _, _, Els} = Res,
|
||||
case Els of
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 10 Nov 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -84,16 +84,16 @@ change_shaper(Pid, Shaper) ->
|
||||
gen_server:cast(Pid, {change_shaper, Shaper}).
|
||||
|
||||
reset_stream(Pid) ->
|
||||
gen_server:call(Pid, reset_stream).
|
||||
do_call(Pid, reset_stream).
|
||||
|
||||
starttls(Pid, TLSSocket) ->
|
||||
gen_server:call(Pid, {starttls, TLSSocket}).
|
||||
do_call(Pid, {starttls, TLSSocket}).
|
||||
|
||||
compress(Pid, ZlibSocket) ->
|
||||
gen_server:call(Pid, {compress, ZlibSocket}).
|
||||
do_call(Pid, {compress, ZlibSocket}).
|
||||
|
||||
become_controller(Pid, C2SPid) ->
|
||||
gen_server:call(Pid, {become_controller, C2SPid}).
|
||||
do_call(Pid, {become_controller, C2SPid}).
|
||||
|
||||
close(Pid) ->
|
||||
gen_server:cast(Pid, close).
|
||||
@@ -345,3 +345,11 @@ close_stream(undefined) ->
|
||||
ok;
|
||||
close_stream(XMLStreamState) ->
|
||||
xml_stream:close(XMLStreamState).
|
||||
|
||||
do_call(Pid, Msg) ->
|
||||
case catch gen_server:call(Pid, Msg) of
|
||||
{'EXIT', Why} ->
|
||||
{error, Why};
|
||||
Res ->
|
||||
Res
|
||||
end.
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% File : ejabberd_regexp.erl
|
||||
%%% Author : Badlop
|
||||
%%% Purpose : Frontend to Re and Regexp OTP modules
|
||||
%%% Created : 8 Dec 2011 by Badlop
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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., 59 Temple Place, Suite 330, Boston, MA
|
||||
%%% 02111-1307 USA
|
||||
%%%
|
||||
%%%----------------------------------------------------------------------
|
||||
|
||||
-module(ejabberd_regexp).
|
||||
-compile([export_all]).
|
||||
|
||||
exec(ReM, ReF, ReA, RgM, RgF, RgA) ->
|
||||
try apply(ReM, ReF, ReA)
|
||||
catch
|
||||
error:undef ->
|
||||
apply(RgM, RgF, RgA);
|
||||
A:B ->
|
||||
{error, {A, B}}
|
||||
end.
|
||||
|
||||
run(String, Regexp) ->
|
||||
case exec(re, run, [String, Regexp, [{capture, none}]], regexp, first_match, [String, Regexp]) of
|
||||
{match, _, _} -> match;
|
||||
{match, _} -> match;
|
||||
match -> match;
|
||||
nomatch -> nomatch;
|
||||
{error, Error} -> {error, Error}
|
||||
end.
|
||||
|
||||
split(String, Regexp) ->
|
||||
case exec(re, split, [String, Regexp, [{return, list}]], regexp, split, [String, Regexp]) of
|
||||
{ok, FieldList} -> FieldList;
|
||||
{error, Error} -> throw(Error);
|
||||
A -> A
|
||||
end.
|
||||
|
||||
replace(String, Regexp, New) ->
|
||||
case exec(re, replace, [String, Regexp, New, [{return, list}]], regexp, sub, [String, Regexp, New]) of
|
||||
{ok, NewString, _RepCount} -> NewString;
|
||||
{error, Error} -> throw(Error);
|
||||
A -> A
|
||||
end.
|
||||
|
||||
greplace(String, Regexp, New) ->
|
||||
case exec(re, replace, [String, Regexp, New, [global, {return, list}]], regexp, sub, [String, Regexp, New]) of
|
||||
{ok, NewString, _RepCount} -> NewString;
|
||||
{error, Error} -> throw(Error);
|
||||
A -> A
|
||||
end.
|
||||
|
||||
sh_to_awk(ShRegExp) ->
|
||||
case exec(xmerl_regexp, sh_to_awk, [ShRegExp], regexp, sh_to_awk, [ShRegExp]) of
|
||||
A -> A
|
||||
end.
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 27 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+40
-2
@@ -5,7 +5,7 @@
|
||||
%%% Created : 7 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -41,7 +41,11 @@
|
||||
dirty_get_connections/0,
|
||||
allow_host/2,
|
||||
incoming_s2s_number/0,
|
||||
outgoing_s2s_number/0
|
||||
outgoing_s2s_number/0,
|
||||
clean_temporarily_blocked_table/0,
|
||||
list_temporarily_blocked_hosts/0,
|
||||
external_host_overloaded/1,
|
||||
is_temporarly_blocked/1
|
||||
]).
|
||||
|
||||
%% gen_server callbacks
|
||||
@@ -57,9 +61,14 @@
|
||||
-define(DEFAULT_MAX_S2S_CONNECTIONS_NUMBER, 1).
|
||||
-define(DEFAULT_MAX_S2S_CONNECTIONS_NUMBER_PER_NODE, 1).
|
||||
|
||||
-define(S2S_OVERLOAD_BLOCK_PERIOD, 60).
|
||||
%% once a server is temporarly blocked, it stay blocked for 60 seconds
|
||||
|
||||
-record(s2s, {fromto, pid, key}).
|
||||
-record(state, {}).
|
||||
|
||||
-record(temporarily_blocked, {host, timestamp}).
|
||||
|
||||
%%====================================================================
|
||||
%% API
|
||||
%%====================================================================
|
||||
@@ -79,6 +88,31 @@ route(From, To, Packet) ->
|
||||
ok
|
||||
end.
|
||||
|
||||
clean_temporarily_blocked_table() ->
|
||||
mnesia:clear_table(temporarily_blocked).
|
||||
list_temporarily_blocked_hosts() ->
|
||||
ets:tab2list(temporarily_blocked).
|
||||
|
||||
external_host_overloaded(Host) ->
|
||||
?INFO_MSG("Disabling connections from ~s for ~p seconds", [Host, ?S2S_OVERLOAD_BLOCK_PERIOD]),
|
||||
mnesia:transaction( fun() ->
|
||||
mnesia:write(#temporarily_blocked{host = Host, timestamp = now()})
|
||||
end).
|
||||
|
||||
is_temporarly_blocked(Host) ->
|
||||
case mnesia:dirty_read(temporarily_blocked, Host) of
|
||||
[] -> false;
|
||||
[#temporarily_blocked{timestamp = T}=Entry] ->
|
||||
case timer:now_diff(now(), T) of
|
||||
N when N > ?S2S_OVERLOAD_BLOCK_PERIOD * 1000 * 1000 ->
|
||||
mnesia:dirty_delete_object(Entry),
|
||||
false;
|
||||
_ ->
|
||||
true
|
||||
end
|
||||
end.
|
||||
|
||||
|
||||
remove_connection(FromTo, Pid, Key) ->
|
||||
case catch mnesia:dirty_match_object(s2s, #s2s{fromto = FromTo,
|
||||
pid = Pid,
|
||||
@@ -169,6 +203,7 @@ init([]) ->
|
||||
mnesia:add_table_copy(s2s, node(), ram_copies),
|
||||
mnesia:subscribe(system),
|
||||
ejabberd_commands:register_commands(commands()),
|
||||
mnesia:create_table(temporarily_blocked, [{ram_copies, [node()]}, {attributes, record_info(fields, temporarily_blocked)}]),
|
||||
{ok, #state{}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
@@ -486,6 +521,9 @@ update_tables() ->
|
||||
|
||||
%% Check if host is in blacklist or white list
|
||||
allow_host(MyServer, S2SHost) ->
|
||||
allow_host2(MyServer, S2SHost) andalso (not is_temporarly_blocked(S2SHost)).
|
||||
|
||||
allow_host2(MyServer, S2SHost) ->
|
||||
Hosts = ?MYHOSTS,
|
||||
case lists:dropwhile(
|
||||
fun(ParentDomain) ->
|
||||
|
||||
+44
-18
@@ -5,7 +5,7 @@
|
||||
%%% Created : 6 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -27,7 +27,7 @@
|
||||
-module(ejabberd_s2s_in).
|
||||
-author('alexey@process-one.net').
|
||||
|
||||
-behaviour(gen_fsm).
|
||||
-behaviour(p1_fsm).
|
||||
|
||||
%% External exports
|
||||
-export([start/2,
|
||||
@@ -44,6 +44,7 @@
|
||||
handle_sync_event/4,
|
||||
code_change/4,
|
||||
handle_info/3,
|
||||
print_state/1,
|
||||
terminate/3]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
@@ -92,10 +93,12 @@
|
||||
-define(FSMOPTS, []).
|
||||
-endif.
|
||||
|
||||
-define(FSMLIMITS, [{max_queue, 2000}]). %% if queue grows more than this, we shutdown this connection.
|
||||
|
||||
%% Module start with or without supervisor:
|
||||
-ifdef(NO_TRANSIENT_SUPERVISORS).
|
||||
-define(SUPERVISOR_START, gen_fsm:start(ejabberd_s2s_in, [SockData, Opts],
|
||||
?FSMOPTS)).
|
||||
-define(SUPERVISOR_START, p1_fsm:start(ejabberd_s2s_in, [SockData, Opts],
|
||||
?FSMOPTS ++ ?FSMLIMITS)).
|
||||
-else.
|
||||
-define(SUPERVISOR_START, supervisor:start_child(ejabberd_s2s_in_sup,
|
||||
[SockData, Opts])).
|
||||
@@ -131,7 +134,7 @@ start(SockData, Opts) ->
|
||||
?SUPERVISOR_START.
|
||||
|
||||
start_link(SockData, Opts) ->
|
||||
gen_fsm:start_link(ejabberd_s2s_in, [SockData, Opts], ?FSMOPTS).
|
||||
p1_fsm:start_link(ejabberd_s2s_in, [SockData, Opts], ?FSMOPTS ++ ?FSMLIMITS).
|
||||
|
||||
socket_type() ->
|
||||
xml_stream.
|
||||
@@ -347,8 +350,9 @@ wait_for_feature_request({xmlstreamelement, El}, StateData) ->
|
||||
error ->
|
||||
false
|
||||
end,
|
||||
AllowRemoteHost = ejabberd_s2s:allow_host("", AuthDomain),
|
||||
if
|
||||
AuthRes ->
|
||||
AuthRes andalso AllowRemoteHost ->
|
||||
(StateData#state.sockmod):reset_stream(
|
||||
StateData#state.socket),
|
||||
send_element(StateData,
|
||||
@@ -356,6 +360,12 @@ wait_for_feature_request({xmlstreamelement, El}, StateData) ->
|
||||
[{"xmlns", ?NS_SASL}], []}),
|
||||
?DEBUG("(~w) Accepted s2s authentication for ~s",
|
||||
[StateData#state.socket, AuthDomain]),
|
||||
|
||||
%% acess rules are first checked against the globally defined ones, that have precedence over
|
||||
%% domain-specific ones.. http://www.process-one.net/docs/ejabberd/guide_en.html#AccessRights
|
||||
%% since there is allways a shaper defined globally for s2s, it doesn't matter the actual
|
||||
%% local host, since the globall one will be used, even if this domain has a special rule
|
||||
change_shaper(StateData, "", jlib:make_jid("", AuthDomain, "")),
|
||||
{next_state, wait_for_stream,
|
||||
StateData#state{streamid = new_id(),
|
||||
authenticated = true,
|
||||
@@ -584,14 +594,7 @@ handle_sync_event(get_state_infos, _From, StateName, StateData) ->
|
||||
catch
|
||||
_:_ -> {unknown,unknown}
|
||||
end,
|
||||
Domains = case StateData#state.authenticated of
|
||||
true ->
|
||||
[StateData#state.auth_domain];
|
||||
false ->
|
||||
Connections = StateData#state.connections,
|
||||
[D || {{D, _}, established} <-
|
||||
dict:to_list(Connections)]
|
||||
end,
|
||||
Domains = get_external_hosts(StateData),
|
||||
Infos = [
|
||||
{direction, in},
|
||||
{statename, StateName},
|
||||
@@ -650,9 +653,32 @@ handle_info(_, StateName, StateData) ->
|
||||
%%----------------------------------------------------------------------
|
||||
terminate(Reason, _StateName, StateData) ->
|
||||
?DEBUG("terminated: ~p", [Reason]),
|
||||
case Reason of
|
||||
{process_limit, _} ->
|
||||
[ejabberd_s2s:external_host_overloaded(Host) || Host <- get_external_hosts(StateData)];
|
||||
_ ->
|
||||
ok
|
||||
end,
|
||||
(StateData#state.sockmod):close(StateData#state.socket),
|
||||
ok.
|
||||
|
||||
get_external_hosts(StateData) ->
|
||||
case StateData#state.authenticated of
|
||||
true ->
|
||||
[StateData#state.auth_domain];
|
||||
false ->
|
||||
Connections = StateData#state.connections,
|
||||
[D || {{D, _}, established} <- dict:to_list(Connections)]
|
||||
end.
|
||||
|
||||
%%----------------------------------------------------------------------
|
||||
%% Func: print_state/1
|
||||
%% Purpose: Prepare the state to be printed on error log
|
||||
%% Returns: State to print
|
||||
%%----------------------------------------------------------------------
|
||||
print_state(State) ->
|
||||
State.
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% Internal functions
|
||||
%%%----------------------------------------------------------------------
|
||||
@@ -805,11 +831,11 @@ match_labels([DL | DLabels], [PL | PLabels]) ->
|
||||
orelse (C == $-) orelse (C == $*)
|
||||
end, PL) of
|
||||
true ->
|
||||
Regexp = regexp:sh_to_awk(PL),
|
||||
case regexp:match(DL, Regexp) of
|
||||
{match, _, _} ->
|
||||
Regexp = ejabberd_regexp:sh_to_awk(PL),
|
||||
case ejabberd_regexp:run(DL, Regexp) of
|
||||
match ->
|
||||
match_labels(DLabels, PLabels);
|
||||
_ ->
|
||||
nomatch ->
|
||||
false
|
||||
end;
|
||||
false ->
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 6 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 6 Dec 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
@@ -5,7 +5,7 @@
|
||||
%%% Created : 24 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 23 Aug 2006 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 21 Mar 2007 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 18 Jul 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+40
-18
@@ -5,7 +5,7 @@
|
||||
%%% Created : 27 Jan 2006 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -41,10 +41,10 @@ update() ->
|
||||
case update_info() of
|
||||
{ok, Dir, _UpdatedBeams, _Script, LowLevelScript, _Check} ->
|
||||
Eval =
|
||||
release_handler_1:eval_script(
|
||||
eval_script(
|
||||
LowLevelScript, [],
|
||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||
?INFO_MSG("eval: ~p~n", [Eval]),
|
||||
?DEBUG("eval: ~p~n", [Eval]),
|
||||
Eval;
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
@@ -58,15 +58,26 @@ update(ModulesToUpdate) ->
|
||||
[A || A <- UpdatedBeamsAll, B <- ModulesToUpdate, A == B],
|
||||
{_, LowLevelScript, _} = build_script(Dir, UpdatedBeamsNow),
|
||||
Eval =
|
||||
release_handler_1:eval_script(
|
||||
eval_script(
|
||||
LowLevelScript, [],
|
||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||
?INFO_MSG("eval: ~p~n", [Eval]),
|
||||
?DEBUG("eval: ~p~n", [Eval]),
|
||||
Eval;
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
end.
|
||||
|
||||
%% OTP R14B03 and older provided release_handler_1:eval_script/3
|
||||
%% But OTP R14B04 and newer provide release_handler_1:eval_script/5
|
||||
%% Dialyzer reports a call to missing function; don't worry.
|
||||
eval_script(Script, Apps, LibDirs) ->
|
||||
case lists:member({eval_script, 5}, release_handler_1:module_info(exports)) of
|
||||
true ->
|
||||
release_handler_1:eval_script(Script, Apps, LibDirs, [], []);
|
||||
false ->
|
||||
release_handler_1:eval_script(Script, Apps, LibDirs)
|
||||
end.
|
||||
|
||||
%% Get information about the modified modules
|
||||
update_info() ->
|
||||
Dir = filename:dirname(code:which(ejabberd)),
|
||||
@@ -118,8 +129,10 @@ get_new_version(Module) ->
|
||||
|
||||
get_current_version(Module) ->
|
||||
Attrs = Module:module_info(attributes),
|
||||
{value, {vsn, CurVsn}} = lists:keysearch(vsn, 1, Attrs),
|
||||
CurVsn.
|
||||
case lists:keysearch(vsn, 1, Attrs) of
|
||||
{value, {vsn, CurVsn}} -> CurVsn;
|
||||
_ -> unknown_version
|
||||
end.
|
||||
|
||||
%% @spec(Dir::string(), UpdatedBeams::[atom()]) -> {Script,LowLevelScript,Check}
|
||||
build_script(Dir, UpdatedBeams) ->
|
||||
@@ -129,17 +142,26 @@ build_script(Dir, UpdatedBeams) ->
|
||||
release_handler_1:check_script(
|
||||
LowLevelScript,
|
||||
[{ejabberd, "", filename:join(Dir, "..")}]),
|
||||
case Check of
|
||||
ok ->
|
||||
?DEBUG("script: ~p~n", [Script]),
|
||||
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
||||
?DEBUG("check: ~p~n", [Check]);
|
||||
_ ->
|
||||
?ERROR_MSG("script: ~p~n", [Script]),
|
||||
?ERROR_MSG("low level script: ~p~n", [LowLevelScript]),
|
||||
?ERROR_MSG("check: ~p~n", [Check])
|
||||
end,
|
||||
{Script, LowLevelScript, Check}.
|
||||
Check1 = case Check of
|
||||
ok ->
|
||||
%% This clause is for OTP R14B03 and older.
|
||||
%% Newer Dialyzer reports a never match pattern; don't worry.
|
||||
?DEBUG("script: ~p~n", [Script]),
|
||||
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
||||
?DEBUG("check: ~p~n", [Check]),
|
||||
ok;
|
||||
{ok, []} ->
|
||||
?DEBUG("script: ~p~n", [Script]),
|
||||
?DEBUG("low level script: ~p~n", [LowLevelScript]),
|
||||
?DEBUG("check: ~p~n", [Check]),
|
||||
ok;
|
||||
_ ->
|
||||
?ERROR_MSG("script: ~p~n", [Script]),
|
||||
?ERROR_MSG("low level script: ~p~n", [LowLevelScript]),
|
||||
?ERROR_MSG("check: ~p~n", [Check]),
|
||||
error
|
||||
end,
|
||||
{Script, LowLevelScript, Check1}.
|
||||
|
||||
%% Copied from Erlang/OTP file: lib/sasl/src/systools.hrl
|
||||
-record(application,
|
||||
|
||||
@@ -29,8 +29,8 @@ LD=link.exe
|
||||
LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" "$(ZLIB_LIB)" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib
|
||||
|
||||
$(DLL) : $(OBJECT)
|
||||
$(LD) $(LD_FLAGS) -out:$(DLL) $(OBJECT)
|
||||
$(LD) $(LD_FLAGS) -out:$@ $<
|
||||
|
||||
$(OBJECT) : $(SOURCE)
|
||||
$(CC) $(CC_FLAGS) -c -Fo$(OBJECT) $(SOURCE)
|
||||
$(CC) $(CC_FLAGS) -c -Fo$@ $<
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 19 Jan 2006 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,5 +1,5 @@
|
||||
/*
|
||||
* ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
* ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
@@ -23,6 +23,15 @@
|
||||
#include <erl_driver.h>
|
||||
#include <zlib.h>
|
||||
|
||||
/*
|
||||
* R15B changed several driver callbacks to use ErlDrvSizeT and
|
||||
* ErlDrvSSizeT typedefs instead of int.
|
||||
* This provides missing typedefs on older OTP versions.
|
||||
*/
|
||||
#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2
|
||||
typedef int ErlDrvSizeT;
|
||||
typedef int ErlDrvSSizeT;
|
||||
#endif
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
|
||||
@@ -98,10 +107,10 @@ static void ejabberd_zlib_drv_stop(ErlDrvData handle)
|
||||
}
|
||||
|
||||
|
||||
static int ejabberd_zlib_drv_control(ErlDrvData handle,
|
||||
static ErlDrvSSizeT ejabberd_zlib_drv_control(ErlDrvData handle,
|
||||
unsigned int command,
|
||||
char *buf, int len,
|
||||
char **rbuf, int rlen)
|
||||
char *buf, ErlDrvSizeT len,
|
||||
char **rbuf, ErlDrvSizeT rlen)
|
||||
{
|
||||
ejabberd_zlib_data *d = (ejabberd_zlib_data *)handle;
|
||||
int err;
|
||||
@@ -187,7 +196,19 @@ ErlDrvEntry ejabberd_zlib_driver_entry = {
|
||||
NULL, /* handle */
|
||||
ejabberd_zlib_drv_control, /* F_PTR control, port_command callback */
|
||||
NULL, /* F_PTR timeout, reserved */
|
||||
NULL /* F_PTR outputv, reserved */
|
||||
NULL, /* F_PTR outputv, reserved */
|
||||
/* Added in Erlang/OTP R15B: */
|
||||
NULL, /* ready_async */
|
||||
NULL, /* flush */
|
||||
NULL, /* call */
|
||||
NULL, /* event */
|
||||
ERL_DRV_EXTENDED_MARKER, /* extended_marker */
|
||||
ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */
|
||||
ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */
|
||||
0, /* driver_flags */
|
||||
NULL, /* handle2 */
|
||||
NULL, /* process_exit */
|
||||
NULL /* stop_select */
|
||||
};
|
||||
|
||||
DRIVER_INIT(ejabberd_zlib_drv) /* must match name in driver_entry */
|
||||
|
||||
@@ -143,6 +143,9 @@ export EXEC_CMD
|
||||
# start server
|
||||
start ()
|
||||
{
|
||||
checknodenameusage
|
||||
[ "$?" -eq 0 ] && echo "\nERROR: The node '$ERLANG_NODE' is already running." && return 1
|
||||
|
||||
$EXEC_CMD "$ERL \
|
||||
$NAME $ERLANG_NODE \
|
||||
-noinput -detached \
|
||||
@@ -189,6 +192,9 @@ debug ()
|
||||
# start interactive server
|
||||
live ()
|
||||
{
|
||||
checknodenameusage
|
||||
[ "$?" -eq 0 ] && echo "\nERROR: The node '$ERLANG_NODE' is already running." && return 1
|
||||
|
||||
echo "--------------------------------------------------------------------"
|
||||
echo ""
|
||||
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
|
||||
@@ -362,6 +368,15 @@ wait_for_status()
|
||||
return $status
|
||||
}
|
||||
|
||||
# check node name is used or not
|
||||
# $? --> 0=alreadyused 1=available
|
||||
checknodenameusage ()
|
||||
{
|
||||
$EXEC_CMD "$ERL \
|
||||
$NAME $ERLANG_NODE \
|
||||
-s erlang halt | grep -c duplicate_name > /dev/null "
|
||||
}
|
||||
|
||||
case $ARGS in
|
||||
' start') start;;
|
||||
' debug') debug;;
|
||||
|
||||
+207
-3
@@ -5,7 +5,7 @@
|
||||
%%% Created : 22 Aug 2005 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -34,15 +34,26 @@
|
||||
export_last/2,
|
||||
export_vcard/2,
|
||||
export_vcard_search/2,
|
||||
export_private_storage/2]).
|
||||
export_vcard_xupdate/2,
|
||||
export_private_storage/2,
|
||||
export_privacy/2,
|
||||
export_motd/2,
|
||||
export_motd_users/2,
|
||||
export_irc_custom/2,
|
||||
export_sr_group/2,
|
||||
export_sr_user/2,
|
||||
export_muc_room/2,
|
||||
export_muc_registered/2]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
-include("jlib.hrl").
|
||||
-include("mod_roster.hrl").
|
||||
-include("mod_privacy.hrl").
|
||||
|
||||
-record(offline_msg, {us, timestamp, expire, from, to, packet}).
|
||||
-record(last_activity, {us, timestamp, status}).
|
||||
-record(vcard, {us, vcard}).
|
||||
-record(vcard_xupdate, {us, hash}).
|
||||
-record(vcard_search, {us,
|
||||
user, luser,
|
||||
fn, lfn,
|
||||
@@ -58,6 +69,13 @@
|
||||
orgunit, lorgunit
|
||||
}).
|
||||
-record(private_storage, {usns, xml}).
|
||||
-record(irc_custom, {us_host, data}).
|
||||
-record(muc_room, {name_host, opts}).
|
||||
-record(muc_registered, {us_host, nick}).
|
||||
-record(sr_group, {group_host, opts}).
|
||||
-record(sr_user, {us, group_host}).
|
||||
-record(motd, {server, packet}).
|
||||
-record(motd_users, {us, dummy = []}).
|
||||
|
||||
-define(MAX_RECORDS_PER_TRANSACTION, 1000).
|
||||
|
||||
@@ -74,7 +92,13 @@
|
||||
export_passwd(Server, Output) ->
|
||||
export_common(
|
||||
Server, passwd, Output,
|
||||
fun(Host, {passwd, {LUser, LServer}, Password} = _R)
|
||||
fun(_Host, {passwd, {LUser, LServer}, {scram, _, _, _, _}} = _R) ->
|
||||
?INFO_MSG("You are trying to export the authentication "
|
||||
"information of the account ~s@~s, but his password "
|
||||
"is stored as SCRAM, and ejabberd ODBC authentication "
|
||||
"doesn't support SCRAM.", [LUser, LServer]),
|
||||
[];
|
||||
(Host, {passwd, {LUser, LServer}, Password} = _R)
|
||||
when LServer == Host ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
Pass = ejabberd_odbc:escape(Password),
|
||||
@@ -250,6 +274,20 @@ export_vcard_search(Server, Output) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_vcard_xupdate(Server, Output) ->
|
||||
export_common(
|
||||
Server, vcard_xupdate, Output,
|
||||
fun(Host, #vcard_xupdate{us = {LUser, LServer}, hash = Hash})
|
||||
when LServer == Host ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
SHash = ejabberd_odbc:escape(Hash),
|
||||
["delete from vcard_xupdate where username='", Username, "';"
|
||||
"insert into vcard_xupdate(username, hash) "
|
||||
"values ('", Username, "', '", SHash, "');"];
|
||||
(_Host, _R) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_private_storage(Server, Output) ->
|
||||
export_common(
|
||||
Server, private_storage, Output,
|
||||
@@ -265,6 +303,167 @@ export_private_storage(Server, Output) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_muc_room(Server, Output) ->
|
||||
export_common(
|
||||
Server, muc_room, Output,
|
||||
fun(Host, #muc_room{name_host = {Name, RoomHost}, opts = Opts}) ->
|
||||
case lists:suffix(Host, RoomHost) of
|
||||
true ->
|
||||
SName = ejabberd_odbc:escape(Name),
|
||||
SRoomHost = ejabberd_odbc:escape(RoomHost),
|
||||
SOpts = ejabberd_odbc:encode_term(Opts),
|
||||
["delete from muc_room where name='", SName,
|
||||
"' and host='", SRoomHost, "';",
|
||||
"insert into muc_room(name, host, opts) values (",
|
||||
"'", SName, "', '", SRoomHost, "', '", SOpts, "');"];
|
||||
false ->
|
||||
[]
|
||||
end
|
||||
end).
|
||||
|
||||
export_muc_registered(Server, Output) ->
|
||||
export_common(
|
||||
Server, muc_registered, Output,
|
||||
fun(Host, #muc_registered{us_host = {{U, S}, RoomHost}, nick = Nick}) ->
|
||||
case lists:suffix(Host, RoomHost) of
|
||||
true ->
|
||||
SJID = ejabberd_odbc:escape(
|
||||
jlib:jid_to_string(
|
||||
jlib:make_jid(U, S, ""))),
|
||||
SNick = ejabberd_odbc:escape(Nick),
|
||||
SRoomHost = ejabberd_odbc:escape(RoomHost),
|
||||
["delete from muc_registered where jid='", SJID,
|
||||
"' and host='", SRoomHost, "';"
|
||||
"insert into muc_registered(jid, host, nick) values ("
|
||||
"'", SJID, "', '", SRoomHost, "', '", SNick, "');"];
|
||||
false ->
|
||||
[]
|
||||
end
|
||||
end).
|
||||
|
||||
export_irc_custom(Server, Output) ->
|
||||
export_common(
|
||||
Server, irc_custom, Output,
|
||||
fun(Host, #irc_custom{us_host = {{U, S}, IRCHost}, data = Data}) ->
|
||||
case lists:suffix(Host, IRCHost) of
|
||||
true ->
|
||||
SJID = ejabberd_odbc:escape(
|
||||
jlib:jid_to_string(
|
||||
jlib:make_jid(U, S, ""))),
|
||||
SIRCHost = ejabberd_odbc:escape(IRCHost),
|
||||
SData = ejabberd_odbc:encode_term(Data),
|
||||
["delete from irc_custom where jid='", SJID,
|
||||
"' and host='", SIRCHost, "';"
|
||||
"insert into irc_custom(jid, host, data) values ("
|
||||
"'", SJID, "', '", SIRCHost, "', '", SData, "');"];
|
||||
false ->
|
||||
[]
|
||||
end
|
||||
end).
|
||||
|
||||
export_privacy(Server, Output) ->
|
||||
case ejabberd_odbc:sql_query(
|
||||
jlib:nameprep(Server),
|
||||
["select id from privacy_list order by id desc limit 1;"]) of
|
||||
{selected, ["id"], [{I}]} ->
|
||||
put(id, list_to_integer(I));
|
||||
_ ->
|
||||
put(id, 0)
|
||||
end,
|
||||
export_common(
|
||||
Server, privacy, Output,
|
||||
fun(Host, #privacy{us = {LUser, LServer},
|
||||
lists = Lists,
|
||||
default = Default}) when LServer == Host ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
if Default /= none ->
|
||||
SDefault = ejabberd_odbc:escape(Default),
|
||||
["delete from privacy_default_list where ",
|
||||
"username='", Username, "';",
|
||||
"insert into privacy_default_list(username, name) ",
|
||||
"values ('", Username, "', '", SDefault, "');"];
|
||||
true ->
|
||||
[]
|
||||
end ++
|
||||
lists:flatmap(
|
||||
fun({Name, List}) ->
|
||||
SName = ejabberd_odbc:escape(Name),
|
||||
RItems = lists:map(
|
||||
fun mod_privacy:item_to_raw/1,
|
||||
List),
|
||||
ID = integer_to_list(get_id()),
|
||||
["delete from privacy_list "
|
||||
"where username='", Username, "' and name='", SName, "';"
|
||||
"insert into privacy_list(username, name, id) "
|
||||
"values ('", Username, "', '", SName, "', '", ID, "');",
|
||||
"delete from privacy_list_data where id='", ID, "';"
|
||||
|[["insert into privacy_list_data("
|
||||
"id, t, value, action, ord, match_all, match_iq, "
|
||||
"match_message, match_presence_in, "
|
||||
"match_presence_out) values ('", ID, "', '",
|
||||
string:join(Items, "', '"), "');"] || Items <- RItems]]
|
||||
end, Lists);
|
||||
(_Host, _R) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_sr_group(Server, Output) ->
|
||||
export_common(
|
||||
Server, sr_group, Output,
|
||||
fun(Host, #sr_group{group_host = {Group, LServer}, opts = Opts})
|
||||
when LServer == Host ->
|
||||
SGroup = ejabberd_odbc:escape(Group),
|
||||
SOpts = ejabberd_odbc:encode_term(Opts),
|
||||
["delete from sr_group where name='", Group, "';"
|
||||
"insert into sr_group(name, opts) values ('",
|
||||
SGroup, "', '", SOpts, "');"];
|
||||
(_Host, _R) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_sr_user(Server, Output) ->
|
||||
export_common(
|
||||
Server, sr_user, Output,
|
||||
fun(Host, #sr_user{us = {U, S}, group_host = {Group, LServer}})
|
||||
when LServer == Host ->
|
||||
SGroup = ejabberd_odbc:escape(Group),
|
||||
SJID = ejabberd_odbc:escape(
|
||||
jlib:jid_to_string(
|
||||
jlib:jid_tolower(
|
||||
jlib:make_jid(U, S, "")))),
|
||||
["delete from sr_user where jid='", SJID,
|
||||
"'and grp='", Group, "';"
|
||||
"insert into sr_user(jid, grp) values ('",
|
||||
SJID, "', '", SGroup, "');"];
|
||||
(_Host, _R) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_motd(Server, Output) ->
|
||||
export_common(
|
||||
Server, motd, Output,
|
||||
fun(Host, #motd{server = LServer, packet = El})
|
||||
when LServer == Host ->
|
||||
["delete from motd where username='';"
|
||||
"insert into motd(username, xml) values ('', '",
|
||||
ejabberd_odbc:escape(xml:element_to_binary(El)), "');"];
|
||||
(_Host, _R) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
export_motd_users(Server, Output) ->
|
||||
export_common(
|
||||
Server, motd_users, Output,
|
||||
fun(Host, #motd_users{us = {LUser, LServer}})
|
||||
when LServer == Host, LUser /= "" ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
["delete from motd where username='", Username, "';"
|
||||
"insert into motd(username, xml) values ('",
|
||||
Username, "', '');"];
|
||||
(_Host, _R) ->
|
||||
[]
|
||||
end).
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% Internal functions
|
||||
%%%----------------------------------------------------------------------
|
||||
@@ -363,3 +562,8 @@ groups_to_string(#roster{usj = {User, _Server, JID},
|
||||
"'", Username, "',"
|
||||
"'", SJID, "',"
|
||||
"'", ejabberd_odbc:escape(Group), "')"] || Group <- Groups].
|
||||
|
||||
get_id() ->
|
||||
ID = get(id),
|
||||
put(id, ID+1),
|
||||
ID+1.
|
||||
|
||||
@@ -6,7 +6,7 @@ CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
ASN_FLAGS = -bber_bin +optimize +driver
|
||||
ASN_FLAGS = -bber_bin +optimize
|
||||
|
||||
ERLANG_CFLAGS = @ERLANG_CFLAGS@
|
||||
ERLANG_LIBS = @ERLANG_LIBS@
|
||||
|
||||
@@ -6,7 +6,7 @@ EFLAGS = -I .. -pz ..
|
||||
OUTDIR = ..
|
||||
BEAMS = ..\eldap.beam ..\eldap_filter.beam ..\eldap_pool.beam ..\eldap_utils.beam ..\eldap_filter_yecc.beam
|
||||
|
||||
ASN_FLAGS = -bber_bin +optimize +driver
|
||||
ASN_FLAGS = -bber_bin +optimize
|
||||
|
||||
ALL : $(BEAMS)
|
||||
|
||||
|
||||
+2
-9
@@ -439,7 +439,8 @@ init([]) ->
|
||||
end;
|
||||
init({Hosts, Port, Rootdn, Passwd, Opts}) ->
|
||||
catch ssl:start(),
|
||||
ssl:seed(randoms:get_string()),
|
||||
%% ssl:seed was removed in OTP R14B04, newer Dialyzer will complain
|
||||
catch ssl:seed(randoms:get_string()),
|
||||
Encrypt = case proplists:get_value(encrypt, Opts) of
|
||||
tls -> tls;
|
||||
_ -> none
|
||||
@@ -760,7 +761,6 @@ gen_req({bind, RootDN, Passwd}) ->
|
||||
%% {'EXIT', Reason} - Broke
|
||||
%%-----------------------------------------------------------------------
|
||||
recvd_packet(Pkt, S) ->
|
||||
check_tag(Pkt),
|
||||
case asn1rt:decode('ELDAPv3', 'LDAPMessage', Pkt) of
|
||||
{ok,Msg} ->
|
||||
Op = Msg#'LDAPMessage'.protocolOp,
|
||||
@@ -873,7 +873,6 @@ get_op_rec(Id, Dict) ->
|
||||
%% {'EXIT', Reason} - Broken packet
|
||||
%%-----------------------------------------------------------------------
|
||||
recvd_wait_bind_response(Pkt, S) ->
|
||||
check_tag(Pkt),
|
||||
case asn1rt:decode('ELDAPv3', 'LDAPMessage', Pkt) of
|
||||
{ok,Msg} ->
|
||||
?DEBUG("~p", [Msg]),
|
||||
@@ -906,12 +905,6 @@ cancel_timer(Timer) ->
|
||||
end.
|
||||
|
||||
|
||||
%%% Sanity check of received packet
|
||||
check_tag(Data) ->
|
||||
{_Tag, Data1, _Rb} = asn1rt_ber_bin:decode_tag(Data),
|
||||
{{_Len,_Data2}, _Rb2} = asn1rt_ber_bin:decode_length(Data1),
|
||||
ok.
|
||||
|
||||
close_and_retry(S, Timeout) ->
|
||||
catch (S#eldap.sockmod):close(S#eldap.fd),
|
||||
Queue = dict:fold(
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
-19
@@ -6,7 +6,7 @@
|
||||
%%% Author: Evgeniy Khramtsov <ekhramtsov@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -146,34 +146,41 @@ do_sub(S, [{RegExp, New, Times} | T]) ->
|
||||
do_sub(Result, T).
|
||||
|
||||
do_sub(S, {RegExp, New}, Iter) ->
|
||||
case regexp:sub(S, RegExp, New) of
|
||||
{ok, NewS, 0} ->
|
||||
NewS;
|
||||
{ok, NewS, _} when Iter =< ?MAX_RECURSION ->
|
||||
do_sub(NewS, {RegExp, New}, Iter+1);
|
||||
{ok, _, _} when Iter > ?MAX_RECURSION ->
|
||||
erlang:error(max_substitute_recursion);
|
||||
_ ->
|
||||
erlang:error(bad_regexp)
|
||||
case ejabberd_regexp:run(S, RegExp) of
|
||||
match ->
|
||||
case ejabberd_regexp:replace(S, RegExp, New) of
|
||||
NewS when Iter =< ?MAX_RECURSION ->
|
||||
do_sub(NewS, {RegExp, New}, Iter+1);
|
||||
_NewS when Iter > ?MAX_RECURSION ->
|
||||
erlang:error(max_substitute_recursion)
|
||||
end;
|
||||
nomatch ->
|
||||
S;
|
||||
_ ->
|
||||
erlang:error(bad_regexp)
|
||||
end;
|
||||
|
||||
do_sub(S, {_, _, N}, _) when N<1 ->
|
||||
S;
|
||||
|
||||
do_sub(S, {RegExp, New, Times}, Iter) ->
|
||||
case regexp:sub(S, RegExp, New) of
|
||||
{ok, NewS, 0} ->
|
||||
NewS;
|
||||
{ok, NewS, _} when Iter < Times ->
|
||||
do_sub(NewS, {RegExp, New, Times}, Iter+1);
|
||||
{ok, NewS, _} ->
|
||||
NewS;
|
||||
_ ->
|
||||
erlang:error(bad_regexp)
|
||||
case ejabberd_regexp:run(S, RegExp) of
|
||||
match ->
|
||||
case ejabberd_regexp:replace(S, RegExp, New) of
|
||||
NewS when Iter < Times ->
|
||||
do_sub(NewS, {RegExp, New, Times}, Iter+1);
|
||||
NewS ->
|
||||
NewS
|
||||
end;
|
||||
nomatch ->
|
||||
S;
|
||||
_ ->
|
||||
erlang:error(bad_regexp)
|
||||
end.
|
||||
|
||||
replace_amps(String) ->
|
||||
lists:flatmap(
|
||||
fun($&) -> "\\&";
|
||||
($\\) -> "\\\\";
|
||||
(Chr) -> [Chr]
|
||||
end, String).
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 12 Nov 2006 by Evgeniy Khramtsov <xram@jabber.ru>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 12 Oct 2006 by Mickael Remond <mremond@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -94,17 +94,18 @@ get_user_part(String, Pattern) ->
|
||||
{'EXIT', _} ->
|
||||
{error, badmatch};
|
||||
Result ->
|
||||
case regexp:sub(Pattern, "%u", Result) of
|
||||
{ok, StringRes, _} ->
|
||||
case catch ejabberd_regexp:replace(Pattern, "%u", Result) of
|
||||
{'EXIT', _} ->
|
||||
{error, badmatch};
|
||||
StringRes ->
|
||||
case (string:to_lower(StringRes) ==
|
||||
string:to_lower(String)) of
|
||||
true ->
|
||||
{ok, Result};
|
||||
false ->
|
||||
{error, badmatch}
|
||||
end;
|
||||
_ -> {error, badmatch}
|
||||
end
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
||||
make_filter(Data, UIDs) ->
|
||||
|
||||
+27
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
* ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
@@ -34,6 +34,16 @@
|
||||
#define PARSE_COMMAND 0
|
||||
#define PARSE_FINAL_COMMAND 1
|
||||
|
||||
/*
|
||||
* R15B changed several driver callbacks to use ErlDrvSizeT and
|
||||
* ErlDrvSSizeT typedefs instead of int.
|
||||
* This provides missing typedefs on older OTP versions.
|
||||
*/
|
||||
#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2
|
||||
typedef int ErlDrvSizeT;
|
||||
typedef int ErlDrvSSizeT;
|
||||
#endif
|
||||
|
||||
ei_x_buff event_buf;
|
||||
ei_x_buff xmlns_buf;
|
||||
|
||||
@@ -190,10 +200,10 @@ static void expat_erl_stop(ErlDrvData handle)
|
||||
driver_free((char*)handle);
|
||||
}
|
||||
|
||||
static int expat_erl_control(ErlDrvData drv_data,
|
||||
static ErlDrvSSizeT expat_erl_control(ErlDrvData drv_data,
|
||||
unsigned int command,
|
||||
char *buf, int len,
|
||||
char **rbuf, int rlen)
|
||||
char *buf, ErlDrvSizeT len,
|
||||
char **rbuf, ErlDrvSizeT rlen)
|
||||
{
|
||||
expat_data* d = (expat_data*)drv_data;
|
||||
int res, errcode;
|
||||
@@ -251,7 +261,19 @@ ErlDrvEntry expat_driver_entry = {
|
||||
NULL, /* handle */
|
||||
expat_erl_control, /* F_PTR control, port_command callback */
|
||||
NULL, /* F_PTR timeout, reserved */
|
||||
NULL /* F_PTR outputv, reserved */
|
||||
NULL, /* F_PTR outputv, reserved */
|
||||
/* Added in Erlang/OTP R15B: */
|
||||
NULL, /* ready_async */
|
||||
NULL, /* flush */
|
||||
NULL, /* call */
|
||||
NULL, /* event */
|
||||
ERL_DRV_EXTENDED_MARKER, /* extended_marker */
|
||||
ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */
|
||||
ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */
|
||||
0, /* driver_flags */
|
||||
NULL, /* handle2 */
|
||||
NULL, /* process_exit */
|
||||
NULL /* stop_select */
|
||||
};
|
||||
|
||||
DRIVER_INIT(expat_erl) /* must match name in driver_entry */
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 30 Jul 2004 by Leif Johansson <leifj@it.su.se>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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,7 +5,7 @@
|
||||
%%% Created : 22 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
-3
@@ -5,7 +5,7 @@
|
||||
%%% Created : 24 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -34,6 +34,8 @@
|
||||
get_opt/2,
|
||||
get_opt/3,
|
||||
get_opt_host/3,
|
||||
db_type/1,
|
||||
db_type/2,
|
||||
get_module_opt/4,
|
||||
get_module_opt_host/3,
|
||||
loaded_modules/1,
|
||||
@@ -186,11 +188,23 @@ get_module_opt(Host, Module, Opt, Default) ->
|
||||
|
||||
get_module_opt_host(Host, Module, Default) ->
|
||||
Val = get_module_opt(Host, Module, host, Default),
|
||||
element(2, regexp:gsub(Val, "@HOST@", Host)).
|
||||
ejabberd_regexp:greplace(Val, "@HOST@", Host).
|
||||
|
||||
get_opt_host(Host, Opts, Default) ->
|
||||
Val = get_opt(host, Opts, Default),
|
||||
element(2, regexp:gsub(Val, "@HOST@", Host)).
|
||||
ejabberd_regexp:greplace(Val, "@HOST@", Host).
|
||||
|
||||
db_type(Opts) ->
|
||||
case get_opt(db_type, Opts, mnesia) of
|
||||
odbc -> odbc;
|
||||
_ -> mnesia
|
||||
end.
|
||||
|
||||
db_type(Host, Module) ->
|
||||
case get_module_opt(Host, Module, db_type, mnesia) of
|
||||
odbc -> odbc;
|
||||
_ -> mnesia
|
||||
end.
|
||||
|
||||
loaded_modules(Host) ->
|
||||
ets:select(ejabberd_modules,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 10 Apr 2004 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+11
-37
@@ -5,7 +5,7 @@
|
||||
%%% Created : 2 Feb 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -116,54 +116,28 @@ xdb_data(_User, _Server, {xmlcdata, _CData}) ->
|
||||
ok;
|
||||
xdb_data(User, Server, {xmlelement, _Name, Attrs, _Els} = El) ->
|
||||
From = jlib:make_jid(User, Server, ""),
|
||||
LServer = jlib:nameprep(Server),
|
||||
case xml:get_attr_s("xmlns", Attrs) of
|
||||
?NS_AUTH ->
|
||||
Password = xml:get_tag_cdata(El),
|
||||
ejabberd_auth:set_password(User, Server, Password),
|
||||
ok;
|
||||
?NS_ROSTER ->
|
||||
case lists:member(mod_roster_odbc,
|
||||
gen_mod:loaded_modules(LServer)) of
|
||||
true ->
|
||||
catch mod_roster_odbc:set_items(User, Server, El);
|
||||
false ->
|
||||
catch mod_roster:set_items(User, Server, El)
|
||||
end,
|
||||
catch mod_roster:set_items(User, Server, El),
|
||||
ok;
|
||||
?NS_LAST ->
|
||||
TimeStamp = xml:get_attr_s("last", Attrs),
|
||||
Status = xml:get_tag_cdata(El),
|
||||
case lists:member(mod_last_odbc,
|
||||
gen_mod:loaded_modules(LServer)) of
|
||||
true ->
|
||||
catch mod_last_odbc:store_last_info(
|
||||
User,
|
||||
Server,
|
||||
list_to_integer(TimeStamp),
|
||||
Status);
|
||||
false ->
|
||||
catch mod_last:store_last_info(
|
||||
User,
|
||||
Server,
|
||||
list_to_integer(TimeStamp),
|
||||
Status)
|
||||
end,
|
||||
catch mod_last:store_last_info(
|
||||
User,
|
||||
Server,
|
||||
list_to_integer(TimeStamp),
|
||||
Status),
|
||||
ok;
|
||||
?NS_VCARD ->
|
||||
case lists:member(mod_vcard_odbc,
|
||||
gen_mod:loaded_modules(LServer)) of
|
||||
true ->
|
||||
catch mod_vcard_odbc:process_sm_iq(
|
||||
From,
|
||||
jlib:make_jid("", Server, ""),
|
||||
#iq{type = set, xmlns = ?NS_VCARD, sub_el = El});
|
||||
false ->
|
||||
catch mod_vcard:process_sm_iq(
|
||||
From,
|
||||
jlib:make_jid("", Server, ""),
|
||||
#iq{type = set, xmlns = ?NS_VCARD, sub_el = El})
|
||||
end,
|
||||
catch mod_vcard:process_sm_iq(
|
||||
From,
|
||||
jlib:make_jid("", Server, ""),
|
||||
#iq{type = set, xmlns = ?NS_VCARD, sub_el = El}),
|
||||
ok;
|
||||
"jabber:x:offline" ->
|
||||
process_offline(Server, From, El),
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 23 Nov 2002 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
-1
@@ -1,6 +1,6 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -100,6 +100,8 @@
|
||||
[{"code", Code}, {"type", Type}],
|
||||
[{xmlelement, Condition, [{"xmlns", ?NS_STANZAS}], []}]}).
|
||||
|
||||
-define(ERR_BAD_FORMAT,
|
||||
?STANZA_ERROR("406", "modify", "bad-format")).
|
||||
-define(ERR_BAD_REQUEST,
|
||||
?STANZA_ERROR("400", "modify", "bad-request")).
|
||||
-define(ERR_CONFLICT,
|
||||
@@ -154,6 +156,8 @@
|
||||
{xmlelement, "text", [{"xmlns", ?NS_STANZAS}],
|
||||
[{xmlcdata, translate:translate(Lang, Text)}]}]}).
|
||||
|
||||
-define(ERRT_BAD_FORMAT(Lang, Text),
|
||||
?STANZA_ERRORT("406", "modify", "bad-format", Lang, Text)).
|
||||
-define(ERRT_BAD_REQUEST(Lang, Text),
|
||||
?STANZA_ERRORT("400", "modify", "bad-request", Lang, Text)).
|
||||
-define(ERRT_CONFLICT(Lang, Text),
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
%%% Created : 15 Nov 2005 by Magnus Henoch <henoch@dtek.chalmers.se>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
|
||||
+145
-41
@@ -5,7 +5,7 @@
|
||||
%%% Created : 11 Aug 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -56,12 +56,21 @@
|
||||
-define(NS_ADMINL(Sub), ["http:","jabber.org","protocol","admin", Sub]).
|
||||
tokenize(Node) -> string:tokens(Node, "/#").
|
||||
|
||||
start(Host, _Opts) ->
|
||||
mnesia:create_table(motd, [{disc_copies, [node()]},
|
||||
{attributes, record_info(fields, motd)}]),
|
||||
mnesia:create_table(motd_users, [{disc_copies, [node()]},
|
||||
{attributes, record_info(fields, motd_users)}]),
|
||||
update_tables(),
|
||||
start(Host, Opts) ->
|
||||
case gen_mod:db_type(Opts) of
|
||||
mnesia ->
|
||||
mnesia:create_table(motd,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes,
|
||||
record_info(fields, motd)}]),
|
||||
mnesia:create_table(motd_users,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes,
|
||||
record_info(fields, motd_users)}]),
|
||||
update_tables();
|
||||
_ ->
|
||||
ok
|
||||
end,
|
||||
ejabberd_hooks:add(local_send_to_resource_hook, Host,
|
||||
?MODULE, announce, 50),
|
||||
ejabberd_hooks:add(disco_local_identity, Host, ?MODULE, disco_identity, 50),
|
||||
@@ -562,7 +571,7 @@ handle_adhoc_form(From, #jid{lserver = LServer} = To,
|
||||
node = Node,
|
||||
sessionid = SessionID,
|
||||
status = completed},
|
||||
Packet = {xmlelement, "message", [{"type", "normal"}],
|
||||
Packet = {xmlelement, "message", [{"type", "headline"}],
|
||||
if Subject /= [] ->
|
||||
[{xmlelement, "subject", [],
|
||||
[{xmlcdata, Subject}]}];
|
||||
@@ -743,16 +752,33 @@ announce_all_hosts_motd(From, To, Packet) ->
|
||||
end.
|
||||
|
||||
announce_motd(Host, Packet) ->
|
||||
announce_motd_update(Host, Packet),
|
||||
Sessions = ejabberd_sm:get_vh_session_list(Host),
|
||||
announce_online1(Sessions, Host, Packet),
|
||||
F = fun() ->
|
||||
lists:foreach(
|
||||
fun({U, S, _R}) ->
|
||||
mnesia:write(#motd_users{us = {U, S}})
|
||||
end, Sessions)
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
LServer = jlib:nameprep(Host),
|
||||
announce_motd_update(LServer, Packet),
|
||||
Sessions = ejabberd_sm:get_vh_session_list(LServer),
|
||||
announce_online1(Sessions, LServer, Packet),
|
||||
case gen_mod:db_type(LServer, ?MODULE) of
|
||||
mnesia ->
|
||||
F = fun() ->
|
||||
lists:foreach(
|
||||
fun({U, S, _R}) ->
|
||||
mnesia:write(#motd_users{us = {U, S}})
|
||||
end, Sessions)
|
||||
end,
|
||||
mnesia:transaction(F);
|
||||
odbc ->
|
||||
F = fun() ->
|
||||
lists:foreach(
|
||||
fun({U, _S, _R}) ->
|
||||
Username = ejabberd_odbc:escape(U),
|
||||
odbc_queries:update_t(
|
||||
"motd",
|
||||
["username", "xml"],
|
||||
[Username, ""],
|
||||
["username='", Username, "'"])
|
||||
end, Sessions)
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F)
|
||||
end.
|
||||
|
||||
announce_motd_update(From, To, Packet) ->
|
||||
Host = To#jid.lserver,
|
||||
@@ -778,10 +804,23 @@ announce_all_hosts_motd_update(From, To, Packet) ->
|
||||
|
||||
announce_motd_update(LServer, Packet) ->
|
||||
announce_motd_delete(LServer),
|
||||
F = fun() ->
|
||||
mnesia:write(#motd{server = LServer, packet = Packet})
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
case gen_mod:db_type(LServer, ?MODULE) of
|
||||
mnesia ->
|
||||
F = fun() ->
|
||||
mnesia:write(#motd{server = LServer, packet = Packet})
|
||||
end,
|
||||
mnesia:transaction(F);
|
||||
odbc ->
|
||||
XML = ejabberd_odbc:escape(xml:element_to_binary(Packet)),
|
||||
F = fun() ->
|
||||
odbc_queries:update_t(
|
||||
"motd",
|
||||
["username", "xml"],
|
||||
["", XML],
|
||||
["username=''"])
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F)
|
||||
end.
|
||||
|
||||
announce_motd_delete(From, To, Packet) ->
|
||||
Host = To#jid.lserver,
|
||||
@@ -806,21 +845,32 @@ announce_all_hosts_motd_delete(From, To, Packet) ->
|
||||
end.
|
||||
|
||||
announce_motd_delete(LServer) ->
|
||||
F = fun() ->
|
||||
mnesia:delete({motd, LServer}),
|
||||
mnesia:write_lock_table(motd_users),
|
||||
Users = mnesia:select(
|
||||
motd_users,
|
||||
[{#motd_users{us = '$1', _ = '_'},
|
||||
[{'==', {element, 2, '$1'}, LServer}],
|
||||
['$1']}]),
|
||||
lists:foreach(fun(US) ->
|
||||
mnesia:delete({motd_users, US})
|
||||
end, Users)
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
case gen_mod:db_type(LServer, ?MODULE) of
|
||||
mnesia ->
|
||||
F = fun() ->
|
||||
mnesia:delete({motd, LServer}),
|
||||
mnesia:write_lock_table(motd_users),
|
||||
Users = mnesia:select(
|
||||
motd_users,
|
||||
[{#motd_users{us = '$1', _ = '_'},
|
||||
[{'==', {element, 2, '$1'}, LServer}],
|
||||
['$1']}]),
|
||||
lists:foreach(fun(US) ->
|
||||
mnesia:delete({motd_users, US})
|
||||
end, Users)
|
||||
end,
|
||||
mnesia:transaction(F);
|
||||
odbc ->
|
||||
F = fun() ->
|
||||
ejabberd_odbc:sql_query_t(["delete from motd;"])
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F)
|
||||
end.
|
||||
|
||||
send_motd(#jid{luser = LUser, lserver = LServer} = JID) ->
|
||||
send_motd(JID) ->
|
||||
send_motd(JID, gen_mod:db_type(JID#jid.lserver, ?MODULE)).
|
||||
|
||||
send_motd(#jid{luser = LUser, lserver = LServer} = JID, mnesia) ->
|
||||
case catch mnesia:dirty_read({motd, LServer}) of
|
||||
[#motd{packet = Packet}] ->
|
||||
US = {LUser, LServer},
|
||||
@@ -837,15 +887,69 @@ send_motd(#jid{luser = LUser, lserver = LServer} = JID) ->
|
||||
end;
|
||||
_ ->
|
||||
ok
|
||||
end.
|
||||
end;
|
||||
send_motd(#jid{luser = LUser, lserver = LServer} = JID, odbc) when LUser /= "" ->
|
||||
case catch ejabberd_odbc:sql_query(
|
||||
LServer, ["select xml from motd where username='';"]) of
|
||||
{selected, ["xml"], [{XML}]} ->
|
||||
case xml_stream:parse_element(XML) of
|
||||
{error, _} ->
|
||||
ok;
|
||||
Packet ->
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
case catch ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
["select username from motd "
|
||||
"where username='", Username, "';"]) of
|
||||
{selected, ["username"], []} ->
|
||||
Local = jlib:make_jid("", LServer, ""),
|
||||
ejabberd_router:route(Local, JID, Packet),
|
||||
F = fun() ->
|
||||
odbc_queries:update_t(
|
||||
"motd",
|
||||
["username", "xml"],
|
||||
[Username, ""],
|
||||
["username='", Username, "'"])
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F);
|
||||
_ ->
|
||||
ok
|
||||
end
|
||||
end;
|
||||
_ ->
|
||||
ok
|
||||
end;
|
||||
send_motd(_, odbc) ->
|
||||
ok.
|
||||
|
||||
get_stored_motd(LServer) ->
|
||||
case get_stored_motd_packet(LServer, gen_mod:db_type(LServer, ?MODULE)) of
|
||||
{ok, Packet} ->
|
||||
{xml:get_subtag_cdata(Packet, "subject"),
|
||||
xml:get_subtag_cdata(Packet, "body")};
|
||||
error ->
|
||||
{"", ""}
|
||||
end.
|
||||
|
||||
get_stored_motd_packet(LServer, mnesia) ->
|
||||
case catch mnesia:dirty_read({motd, LServer}) of
|
||||
[#motd{packet = Packet}] ->
|
||||
{xml:get_subtag_cdata(Packet, "subject"),
|
||||
xml:get_subtag_cdata(Packet, "body")};
|
||||
{ok, Packet};
|
||||
_ ->
|
||||
{"", ""}
|
||||
error
|
||||
end;
|
||||
get_stored_motd_packet(LServer, odbc) ->
|
||||
case catch ejabberd_odbc:sql_query(
|
||||
LServer, ["select xml from motd where username='';"]) of
|
||||
{selected, ["xml"], [{XML}]} ->
|
||||
case xml_stream:parse_element(XML) of
|
||||
{error, _} ->
|
||||
error;
|
||||
Packet ->
|
||||
{ok, Packet}
|
||||
end;
|
||||
_ ->
|
||||
error
|
||||
end.
|
||||
|
||||
%% This function is similar to others, but doesn't perform any ACL verification
|
||||
@@ -860,7 +964,7 @@ send_announcement_to_all(Host, SubjectS, BodyS) ->
|
||||
true ->
|
||||
[]
|
||||
end,
|
||||
Packet = {xmlelement, "message", [{"type", "normal"}], SubjectEls ++ BodyEls},
|
||||
Packet = {xmlelement, "message", [{"type", "headline"}], SubjectEls ++ BodyEls},
|
||||
Sessions = ejabberd_sm:dirty_get_sessions_list(),
|
||||
Local = jlib:make_jid("", Host, ""),
|
||||
lists:foreach(
|
||||
|
||||
+241
-103
@@ -5,7 +5,7 @@
|
||||
%%% Created : 24 Aug 2008 by Stephan Maka <stephan@spaceboyz.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -64,7 +64,7 @@ process_iq_get(_, From, _To,
|
||||
sub_el = {xmlelement, "blocklist", _, _}},
|
||||
_) ->
|
||||
#jid{luser = LUser, lserver = LServer} = From,
|
||||
process_blocklist_get(LUser, LServer);
|
||||
{stop, process_blocklist_get(LUser, LServer)};
|
||||
|
||||
process_iq_get(Acc, _, _, _, _) ->
|
||||
Acc.
|
||||
@@ -72,34 +72,26 @@ process_iq_get(Acc, _, _, _, _) ->
|
||||
process_iq_set(_, From, _To, #iq{xmlns = ?NS_BLOCKING,
|
||||
sub_el = {xmlelement, SubElName, _, SubEls}}) ->
|
||||
#jid{luser = LUser, lserver = LServer} = From,
|
||||
case {SubElName, xml:remove_cdata(SubEls)} of
|
||||
{"block", []} ->
|
||||
{error, ?ERR_BAD_REQUEST};
|
||||
{"block", Els} ->
|
||||
JIDs = parse_blocklist_items(Els, []),
|
||||
process_blocklist_block(LUser, LServer, JIDs);
|
||||
{"unblock", []} ->
|
||||
process_blocklist_unblock_all(LUser, LServer);
|
||||
{"unblock", Els} ->
|
||||
JIDs = parse_blocklist_items(Els, []),
|
||||
process_blocklist_unblock(LUser, LServer, JIDs);
|
||||
_ ->
|
||||
{error, ?ERR_BAD_REQUEST}
|
||||
end;
|
||||
Res =
|
||||
case {SubElName, xml:remove_cdata(SubEls)} of
|
||||
{"block", []} ->
|
||||
{error, ?ERR_BAD_REQUEST};
|
||||
{"block", Els} ->
|
||||
JIDs = parse_blocklist_items(Els, []),
|
||||
process_blocklist_block(LUser, LServer, JIDs);
|
||||
{"unblock", []} ->
|
||||
process_blocklist_unblock_all(LUser, LServer);
|
||||
{"unblock", Els} ->
|
||||
JIDs = parse_blocklist_items(Els, []),
|
||||
process_blocklist_unblock(LUser, LServer, JIDs);
|
||||
_ ->
|
||||
{error, ?ERR_BAD_REQUEST}
|
||||
end,
|
||||
{stop, Res};
|
||||
|
||||
process_iq_set(Acc, _, _, _) ->
|
||||
Acc.
|
||||
|
||||
is_list_needdb(Items) ->
|
||||
lists:any(
|
||||
fun(X) ->
|
||||
case X#listitem.type of
|
||||
subscription -> true;
|
||||
group -> true;
|
||||
_ -> false
|
||||
end
|
||||
end, Items).
|
||||
|
||||
list_to_blocklist_jids([], JIDs) ->
|
||||
JIDs;
|
||||
|
||||
@@ -146,6 +138,35 @@ parse_blocklist_items([_ | Els], JIDs) ->
|
||||
parse_blocklist_items(Els, JIDs).
|
||||
|
||||
process_blocklist_block(LUser, LServer, JIDs) ->
|
||||
Filter = fun(List) ->
|
||||
AlreadyBlocked = list_to_blocklist_jids(List, []),
|
||||
lists:foldr(
|
||||
fun(JID, List1) ->
|
||||
case lists:member(JID, AlreadyBlocked) of
|
||||
true ->
|
||||
List1;
|
||||
false ->
|
||||
[#listitem{type = jid,
|
||||
value = JID,
|
||||
action = deny,
|
||||
order = 0,
|
||||
match_all = true}
|
||||
| List1]
|
||||
end
|
||||
end, List, JIDs)
|
||||
end,
|
||||
case process_blocklist_block(LUser, LServer, Filter,
|
||||
gen_mod:db_type(LServer, mod_privacy)) of
|
||||
{atomic, {ok, Default, List}} ->
|
||||
UserList = make_userlist(Default, List),
|
||||
broadcast_list_update(LUser, LServer, Default, UserList),
|
||||
broadcast_blocklist_event(LUser, LServer, {block, JIDs}),
|
||||
{result, [], UserList};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
|
||||
process_blocklist_block(LUser, LServer, Filter, mnesia) ->
|
||||
F =
|
||||
fun() ->
|
||||
case mnesia:wread({privacy, {LUser, LServer}}) of
|
||||
@@ -171,39 +192,72 @@ process_blocklist_block(LUser, LServer, JIDs) ->
|
||||
List = []
|
||||
end
|
||||
end,
|
||||
|
||||
AlreadyBlocked = list_to_blocklist_jids(List, []),
|
||||
NewList =
|
||||
lists:foldr(fun(JID, List1) ->
|
||||
case lists:member(JID, AlreadyBlocked) of
|
||||
true ->
|
||||
List1;
|
||||
false ->
|
||||
[#listitem{type = jid,
|
||||
value = JID,
|
||||
action = deny,
|
||||
order = 0,
|
||||
match_all = true
|
||||
} | List1]
|
||||
end
|
||||
end, List, JIDs),
|
||||
NewList = Filter(List),
|
||||
NewLists = [{NewDefault, NewList} | NewLists1],
|
||||
mnesia:write(P#privacy{default = NewDefault,
|
||||
lists = NewLists}),
|
||||
{ok, NewDefault, NewList}
|
||||
end,
|
||||
case mnesia:transaction(F) of
|
||||
{atomic, {error, _} = Error} ->
|
||||
Error;
|
||||
{atomic, {ok, Default, List}} ->
|
||||
broadcast_list_update(LUser, LServer, Default, List),
|
||||
broadcast_blocklist_event(LUser, LServer, {block, JIDs}),
|
||||
mnesia:transaction(F);
|
||||
process_blocklist_block(LUser, LServer, Filter, odbc) ->
|
||||
F = fun() ->
|
||||
Default =
|
||||
case mod_privacy:sql_get_default_privacy_list_t(LUser) of
|
||||
{selected, ["name"], []} ->
|
||||
Name = "Blocked contacts",
|
||||
mod_privacy:sql_add_privacy_list(LUser, Name),
|
||||
mod_privacy:sql_set_default_privacy_list(
|
||||
LUser, Name),
|
||||
Name;
|
||||
{selected, ["name"], [{Name}]} ->
|
||||
Name
|
||||
end,
|
||||
{selected, ["id"], [{ID}]} =
|
||||
mod_privacy:sql_get_privacy_list_id_t(LUser, Default),
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID) of
|
||||
{selected,
|
||||
["t", "value", "action", "ord",
|
||||
"match_all", "match_iq", "match_message",
|
||||
"match_presence_in",
|
||||
"match_presence_out"],
|
||||
RItems = [_|_]} ->
|
||||
List = lists:map(
|
||||
fun mod_privacy:raw_to_item/1,
|
||||
RItems);
|
||||
_ ->
|
||||
List = []
|
||||
end,
|
||||
NewList = Filter(List),
|
||||
NewRItems = lists:map(
|
||||
fun mod_privacy:item_to_raw/1,
|
||||
NewList),
|
||||
mod_privacy:sql_set_privacy_list(
|
||||
ID, NewRItems),
|
||||
{ok, Default, NewList}
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F).
|
||||
|
||||
process_blocklist_unblock_all(LUser, LServer) ->
|
||||
Filter = fun(List) ->
|
||||
lists:filter(
|
||||
fun(#listitem{action = A}) ->
|
||||
A =/= deny
|
||||
end, List)
|
||||
end,
|
||||
case process_blocklist_unblock_all(
|
||||
LUser, LServer, Filter, gen_mod:db_type(LServer, mod_privacy)) of
|
||||
{atomic, ok} ->
|
||||
{result, []};
|
||||
{atomic, {ok, Default, List}} ->
|
||||
UserList = make_userlist(Default, List),
|
||||
broadcast_list_update(LUser, LServer, Default, UserList),
|
||||
broadcast_blocklist_event(LUser, LServer, unblock_all),
|
||||
{result, [], UserList};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
|
||||
process_blocklist_unblock_all(LUser, LServer) ->
|
||||
process_blocklist_unblock_all(LUser, LServer, Filter, mnesia) ->
|
||||
F =
|
||||
fun() ->
|
||||
case mnesia:read({privacy, {LUser, LServer}}) of
|
||||
@@ -215,12 +269,7 @@ process_blocklist_unblock_all(LUser, LServer) ->
|
||||
case lists:keysearch(Default, 1, Lists) of
|
||||
{value, {_, List}} ->
|
||||
% Default list, remove all deny items
|
||||
NewList =
|
||||
lists:filter(
|
||||
fun(#listitem{action = A}) ->
|
||||
A =/= deny
|
||||
end, List),
|
||||
|
||||
NewList = Filter(List),
|
||||
NewLists1 = lists:keydelete(Default, 1, Lists),
|
||||
NewLists = [{Default, NewList} | NewLists1],
|
||||
mnesia:write(P#privacy{lists = NewLists}),
|
||||
@@ -232,20 +281,67 @@ process_blocklist_unblock_all(LUser, LServer) ->
|
||||
end
|
||||
end
|
||||
end,
|
||||
case mnesia:transaction(F) of
|
||||
{atomic, {error, _} = Error} ->
|
||||
Error;
|
||||
{atomic, ok} ->
|
||||
mnesia:transaction(F);
|
||||
process_blocklist_unblock_all(LUser, LServer, Filter, odbc) ->
|
||||
F = fun() ->
|
||||
case mod_privacy:sql_get_default_privacy_list_t(LUser) of
|
||||
{selected, ["name"], []} ->
|
||||
ok;
|
||||
{selected, ["name"], [{Default}]} ->
|
||||
{selected, ["id"], [{ID}]} =
|
||||
mod_privacy:sql_get_privacy_list_id_t(
|
||||
LUser, Default),
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID) of
|
||||
{selected,
|
||||
["t", "value", "action", "ord",
|
||||
"match_all", "match_iq", "match_message",
|
||||
"match_presence_in",
|
||||
"match_presence_out"],
|
||||
RItems = [_|_]} ->
|
||||
List = lists:map(
|
||||
fun mod_privacy:raw_to_item/1,
|
||||
RItems),
|
||||
NewList = Filter(List),
|
||||
NewRItems = lists:map(
|
||||
fun mod_privacy:item_to_raw/1,
|
||||
NewList),
|
||||
mod_privacy:sql_set_privacy_list(
|
||||
ID, NewRItems),
|
||||
{ok, Default, NewList};
|
||||
_ ->
|
||||
ok
|
||||
end;
|
||||
_ ->
|
||||
ok
|
||||
end
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F).
|
||||
|
||||
process_blocklist_unblock(LUser, LServer, JIDs) ->
|
||||
Filter = fun(List) ->
|
||||
lists:filter(
|
||||
fun(#listitem{action = deny,
|
||||
type = jid,
|
||||
value = JID}) ->
|
||||
not(lists:member(JID, JIDs));
|
||||
(_) ->
|
||||
true
|
||||
end, List)
|
||||
end,
|
||||
case process_blocklist_unblock(LUser, LServer, Filter,
|
||||
gen_mod:db_type(LServer, mod_privacy)) of
|
||||
{atomic, ok} ->
|
||||
{result, []};
|
||||
{atomic, {ok, Default, List}} ->
|
||||
broadcast_list_update(LUser, LServer, Default, List),
|
||||
broadcast_blocklist_event(LUser, LServer, unblock_all),
|
||||
{result, []};
|
||||
UserList = make_userlist(Default, List),
|
||||
broadcast_list_update(LUser, LServer, Default, UserList),
|
||||
broadcast_blocklist_event(LUser, LServer, {unblock, JIDs}),
|
||||
{result, [], UserList};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
|
||||
process_blocklist_unblock(LUser, LServer, JIDs) ->
|
||||
process_blocklist_unblock(LUser, LServer, Filter, mnesia) ->
|
||||
F =
|
||||
fun() ->
|
||||
case mnesia:read({privacy, {LUser, LServer}}) of
|
||||
@@ -257,16 +353,7 @@ process_blocklist_unblock(LUser, LServer, JIDs) ->
|
||||
case lists:keysearch(Default, 1, Lists) of
|
||||
{value, {_, List}} ->
|
||||
% Default list, remove matching deny items
|
||||
NewList =
|
||||
lists:filter(
|
||||
fun(#listitem{action = deny,
|
||||
type = jid,
|
||||
value = JID}) ->
|
||||
not(lists:member(JID, JIDs));
|
||||
(_) ->
|
||||
true
|
||||
end, List),
|
||||
|
||||
NewList = Filter(List),
|
||||
NewLists1 = lists:keydelete(Default, 1, Lists),
|
||||
NewLists = [{Default, NewList} | NewLists1],
|
||||
mnesia:write(P#privacy{lists = NewLists}),
|
||||
@@ -278,28 +365,52 @@ process_blocklist_unblock(LUser, LServer, JIDs) ->
|
||||
end
|
||||
end
|
||||
end,
|
||||
case mnesia:transaction(F) of
|
||||
{atomic, {error, _} = Error} ->
|
||||
Error;
|
||||
{atomic, ok} ->
|
||||
{result, []};
|
||||
{atomic, {ok, Default, List}} ->
|
||||
broadcast_list_update(LUser, LServer, Default, List),
|
||||
broadcast_blocklist_event(LUser, LServer, {unblock, JIDs}),
|
||||
{result, []};
|
||||
_ ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
mnesia:transaction(F);
|
||||
process_blocklist_unblock(LUser, LServer, Filter, odbc) ->
|
||||
F = fun() ->
|
||||
case mod_privacy:sql_get_default_privacy_list_t(LUser) of
|
||||
{selected, ["name"], []} ->
|
||||
ok;
|
||||
{selected, ["name"], [{Default}]} ->
|
||||
{selected, ["id"], [{ID}]} =
|
||||
mod_privacy:sql_get_privacy_list_id_t(
|
||||
LUser, Default),
|
||||
case mod_privacy:sql_get_privacy_list_data_by_id_t(ID) of
|
||||
{selected,
|
||||
["t", "value", "action", "ord",
|
||||
"match_all", "match_iq", "match_message",
|
||||
"match_presence_in",
|
||||
"match_presence_out"],
|
||||
RItems = [_|_]} ->
|
||||
List = lists:map(
|
||||
fun mod_privacy:raw_to_item/1,
|
||||
RItems),
|
||||
NewList = Filter(List),
|
||||
NewRItems = lists:map(
|
||||
fun mod_privacy:item_to_raw/1,
|
||||
NewList),
|
||||
mod_privacy:sql_set_privacy_list(
|
||||
ID, NewRItems),
|
||||
{ok, Default, NewList};
|
||||
_ ->
|
||||
ok
|
||||
end;
|
||||
_ ->
|
||||
ok
|
||||
end
|
||||
end,
|
||||
ejabberd_odbc:sql_transaction(LServer, F).
|
||||
|
||||
broadcast_list_update(LUser, LServer, Name, List) ->
|
||||
NeedDb = is_list_needdb(List),
|
||||
make_userlist(Name, List) ->
|
||||
NeedDb = mod_privacy:is_list_needdb(List),
|
||||
#userlist{name = Name, list = List, needdb = NeedDb}.
|
||||
|
||||
broadcast_list_update(LUser, LServer, Name, UserList) ->
|
||||
ejabberd_router:route(
|
||||
jlib:make_jid(LUser, LServer, ""),
|
||||
jlib:make_jid(LUser, LServer, ""),
|
||||
{xmlelement, "broadcast", [],
|
||||
[{privacy_list,
|
||||
#userlist{name = Name, list = List, needdb = NeedDb},
|
||||
Name}]}).
|
||||
[{privacy_list, UserList, Name}]}).
|
||||
|
||||
broadcast_blocklist_event(LUser, LServer, Event) ->
|
||||
JID = jlib:make_jid(LUser, LServer, ""),
|
||||
@@ -309,25 +420,52 @@ broadcast_blocklist_event(LUser, LServer, Event) ->
|
||||
[{blocking, Event}]}).
|
||||
|
||||
process_blocklist_get(LUser, LServer) ->
|
||||
case process_blocklist_get(
|
||||
LUser, LServer, gen_mod:db_type(LServer, mod_privacy)) of
|
||||
error ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
List ->
|
||||
JIDs = list_to_blocklist_jids(List, []),
|
||||
Items = lists:map(
|
||||
fun(JID) ->
|
||||
?DEBUG("JID: ~p",[JID]),
|
||||
{xmlelement, "item",
|
||||
[{"jid", jlib:jid_to_string(JID)}], []}
|
||||
end, JIDs),
|
||||
{result,
|
||||
[{xmlelement, "blocklist", [{"xmlns", ?NS_BLOCKING}],
|
||||
Items}]}
|
||||
end.
|
||||
|
||||
process_blocklist_get(LUser, LServer, mnesia) ->
|
||||
case catch mnesia:dirty_read(privacy, {LUser, LServer}) of
|
||||
{'EXIT', _Reason} ->
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
error;
|
||||
[] ->
|
||||
{result, [{xmlelement, "blocklist", [{"xmlns", ?NS_BLOCKING}], []}]};
|
||||
[];
|
||||
[#privacy{default = Default, lists = Lists}] ->
|
||||
case lists:keysearch(Default, 1, Lists) of
|
||||
{value, {_, List}} ->
|
||||
JIDs = list_to_blocklist_jids(List, []),
|
||||
Items = lists:map(
|
||||
fun(JID) ->
|
||||
?DEBUG("JID: ~p",[JID]),
|
||||
{xmlelement, "item",
|
||||
[{"jid", jlib:jid_to_string(JID)}], []}
|
||||
end, JIDs),
|
||||
{result,
|
||||
[{xmlelement, "blocklist", [{"xmlns", ?NS_BLOCKING}],
|
||||
Items}]};
|
||||
List;
|
||||
_ ->
|
||||
{result, [{xmlelement, "blocklist", [{"xmlns", ?NS_BLOCKING}], []}]}
|
||||
[]
|
||||
end
|
||||
end;
|
||||
process_blocklist_get(LUser, LServer, odbc) ->
|
||||
case catch mod_privacy:sql_get_default_privacy_list(LUser, LServer) of
|
||||
{selected, ["name"], []} ->
|
||||
[];
|
||||
{selected, ["name"], [{Default}]} ->
|
||||
case catch mod_privacy:sql_get_privacy_list_data(
|
||||
LUser, LServer, Default) of
|
||||
{selected, ["t", "value", "action", "ord", "match_all",
|
||||
"match_iq", "match_message",
|
||||
"match_presence_in", "match_presence_out"],
|
||||
RItems} ->
|
||||
lists:map(fun mod_privacy:raw_to_item/1, RItems);
|
||||
{'EXIT', _} ->
|
||||
error
|
||||
end;
|
||||
{'EXIT', _} ->
|
||||
error
|
||||
end.
|
||||
|
||||
+8
-12
@@ -5,7 +5,7 @@
|
||||
%%% Created : 7 Oct 2006 by Magnus Henoch <henoch@dtek.chalmers.se>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -375,6 +375,10 @@ feature_request(Host, From, Caps, [SubNode | Tail] = SubNodes) ->
|
||||
[{"xmlns", ?NS_DISCO_INFO},
|
||||
{"node", Node ++ "#" ++ SubNode}],
|
||||
[]}]},
|
||||
%% We cache current timestamp in order to avoid
|
||||
%% caps requests flood
|
||||
cache_tab:insert(caps_features, BinaryNode, now_ts(),
|
||||
caps_write_fun(BinaryNode, now_ts())),
|
||||
F = fun(IQReply) ->
|
||||
feature_response(
|
||||
IQReply, Host, From, Caps, SubNodes)
|
||||
@@ -405,19 +409,11 @@ feature_response(#iq{type = result,
|
||||
caps_features, BinaryNode, BinaryFeatures,
|
||||
caps_write_fun(BinaryNode, BinaryFeatures));
|
||||
false ->
|
||||
%% We cache current timestamp and will probe the client
|
||||
%% after BAD_HASH_LIFETIME seconds.
|
||||
cache_tab:insert(caps_features, BinaryNode, now_ts(),
|
||||
caps_write_fun(BinaryNode, now_ts()))
|
||||
ok
|
||||
end,
|
||||
feature_request(Host, From, Caps, SubNodes);
|
||||
feature_response(_IQResult, Host, From, Caps, [SubNode | SubNodes]) ->
|
||||
%% We got type=error or invalid type=result stanza or timeout,
|
||||
%% so we cache current timestamp and will probe the client
|
||||
%% after BAD_HASH_LIFETIME seconds.
|
||||
BinaryNode = node_to_binary(Caps#caps.node, SubNode),
|
||||
cache_tab:insert(caps_features, BinaryNode, now_ts(),
|
||||
caps_write_fun(BinaryNode, now_ts())),
|
||||
feature_response(_IQResult, Host, From, Caps, [_SubNode | SubNodes]) ->
|
||||
%% We got type=error or invalid type=result stanza or timeout.
|
||||
feature_request(Host, From, Caps, SubNodes).
|
||||
|
||||
node_to_binary(Node, SubNode) ->
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 19 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -542,7 +542,7 @@ get_local_items({_, Host}, ["all users", [$@ | Diap]], _Server, _Lang) ->
|
||||
Users ->
|
||||
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
|
||||
case catch begin
|
||||
{ok, [S1, S2]} = regexp:split(Diap, "-"),
|
||||
[S1, S2] = ejabberd_regexp:split(Diap, "-"),
|
||||
N1 = list_to_integer(S1),
|
||||
N2 = list_to_integer(S2),
|
||||
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
||||
@@ -1782,15 +1782,13 @@ stop_node(From, Host, ENode, Action, XData) ->
|
||||
|
||||
|
||||
get_last_info(User, Server) ->
|
||||
ML = lists:member(mod_last, gen_mod:loaded_modules(Server)),
|
||||
MLO = lists:member(mod_last_odbc, gen_mod:loaded_modules(Server)),
|
||||
case {ML, MLO} of
|
||||
{true, _} -> mod_last:get_last_info(User, Server);
|
||||
{false, true} -> mod_last_odbc:get_last_info(User, Server);
|
||||
{false, false} -> not_found
|
||||
case gen_mod:is_loaded(Server, mod_last) of
|
||||
true ->
|
||||
mod_last:get_last_info(User, Server);
|
||||
false ->
|
||||
not_found
|
||||
end.
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
adhoc_sm_commands(_Acc, From,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%%% Created : 26 Oct 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
@@ -5,7 +5,7 @@
|
||||
%%% Created : 1 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
@@ -5,7 +5,7 @@
|
||||
%%% Created : 15 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 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
-10
@@ -7,7 +7,7 @@
|
||||
%%% {mod_ip_blacklist, []}
|
||||
%%%
|
||||
%%%
|
||||
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne
|
||||
%%% ejabberd, Copyright (C) 2002-2013 ProcessOne
|
||||
%%%
|
||||
%%% This program is free software; you can redistribute it and/or
|
||||
%%% modify it under the terms of the GNU General Public License as
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
%% API:
|
||||
-export([start/2,
|
||||
preinit/2,
|
||||
init/1,
|
||||
stop/1]).
|
||||
-export([update_bl_c2s/0]).
|
||||
@@ -49,14 +50,20 @@
|
||||
-record(bl_c2s, {ip}).
|
||||
|
||||
%% Start once for all vhost
|
||||
start(Host, Opts) ->
|
||||
case whereis(?PROCNAME) of
|
||||
undefined ->
|
||||
?DEBUG("Starting mod_ip_blacklist ~p ~p~n", [Host, Opts]),
|
||||
register(?PROCNAME,
|
||||
spawn(?MODULE, init, [#state{}]));
|
||||
_ ->
|
||||
ok
|
||||
start(_Host, _Opts) ->
|
||||
Pid = spawn(?MODULE, preinit, [self(), #state{}]),
|
||||
receive {ok, Pid, PreinitResult} ->
|
||||
PreinitResult
|
||||
end.
|
||||
|
||||
preinit(Parent, State) ->
|
||||
Pid = self(),
|
||||
try register(?PROCNAME, Pid) of
|
||||
true ->
|
||||
Parent ! {ok, Pid, true},
|
||||
init(State)
|
||||
catch error:_ ->
|
||||
Parent ! {ok, Pid, true}
|
||||
end.
|
||||
|
||||
%% TODO:
|
||||
@@ -85,7 +92,7 @@ loop(_State) ->
|
||||
%% TODO: Support comment lines starting by %
|
||||
update_bl_c2s() ->
|
||||
?INFO_MSG("Updating C2S Blacklist", []),
|
||||
case http:request(?BLC2S) of
|
||||
case httpc:request(?BLC2S) of
|
||||
{ok, {{_Version, 200, _Reason}, _Headers, Body}} ->
|
||||
IPs = string:tokens(Body,"\n"),
|
||||
ets:delete_all_objects(bl_c2s),
|
||||
|
||||
@@ -35,8 +35,8 @@ LD=link.exe
|
||||
LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" "$(ICONV_LIB)" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib
|
||||
|
||||
$(DLL) : $(OBJECT)
|
||||
$(LD) $(LD_FLAGS) -out:$(DLL) $(OBJECT)
|
||||
$(LD) $(LD_FLAGS) -out:$@ $<
|
||||
|
||||
$(OBJECT) : $(SOURCE)
|
||||
$(CC) $(CC_FLAGS) -c -Fo$(OBJECT) $(SOURCE)
|
||||
$(CC) $(CC_FLAGS) -c -Fo$@ $<
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user