From 574dbbfd08378de06e47763956e8b3dff5dce47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Tue, 15 Jul 2008 08:45:05 +0000 Subject: [PATCH] Merge revisions from 1434 to revision 1444 from trunk. SVN Revision: 1445 --- ChangeLog | 63 +++++++ doc/Makefile | 2 +- doc/guide.html | 63 ++++--- doc/guide.tex | 64 ++++--- {src => include}/adhoc.hrl | 0 {src => include}/ejabberd.hrl | 0 {src => include}/ejabberd_config.hrl | 0 {src => include}/ejabberd_ctl.hrl | 0 {src/web => include}/ejabberd_http.hrl | 0 {src/web => include}/ejabberd_web_admin.hrl | 0 {src/eldap => include}/eldap.hrl | 0 {src => include}/jlib.hrl | 0 {src => include}/mod_privacy.hrl | 0 {src/mod_proxy65 => include}/mod_proxy65.hrl | 0 {src => include}/mod_roster.hrl | 0 {src/mod_pubsub => include}/pubsub.hrl | 0 src/Makefile.in | 171 +++++++++++++++---- src/aclocal.m4 | 15 +- src/configure | 150 +++++++++++----- src/configure.ac | 26 ++- src/ejabberd.cfg.example | 2 +- src/ejabberd_auth_ldap.erl | 2 +- src/ejabberd_zlib/Makefile.in | 3 +- src/ejabberdctl.template | 98 ++++++----- src/eldap/Makefile.in | 3 +- src/mod_irc/Makefile.in | 4 +- src/mod_muc/Makefile.in | 4 +- src/mod_offline.erl | 4 +- src/mod_offline_odbc.erl | 4 +- src/mod_proxy65/Makefile.in | 4 +- src/mod_proxy65/mod_proxy65_service.erl | 4 +- src/mod_proxy65/mod_proxy65_stream.erl | 2 +- src/mod_pubsub/Makefile.in | 4 +- src/mod_register.erl | 3 +- src/mod_roster.erl | 4 +- src/mod_roster_odbc.erl | 4 +- src/mod_shared_roster.erl | 4 +- src/mod_vcard_ldap.erl | 2 +- src/odbc/Makefile.in | 4 +- src/pam/Makefile.in | 4 +- src/tls/Makefile.in | 4 +- src/web/Makefile.in | 6 +- 42 files changed, 525 insertions(+), 202 deletions(-) rename {src => include}/adhoc.hrl (100%) rename {src => include}/ejabberd.hrl (100%) rename {src => include}/ejabberd_config.hrl (100%) rename {src => include}/ejabberd_ctl.hrl (100%) rename {src/web => include}/ejabberd_http.hrl (100%) rename {src/web => include}/ejabberd_web_admin.hrl (100%) rename {src/eldap => include}/eldap.hrl (100%) rename {src => include}/jlib.hrl (100%) rename {src => include}/mod_privacy.hrl (100%) rename {src/mod_proxy65 => include}/mod_proxy65.hrl (100%) rename {src => include}/mod_roster.hrl (100%) rename {src/mod_pubsub => include}/pubsub.hrl (100%) diff --git a/ChangeLog b/ChangeLog index 72fe05cb9..ae52d1fa1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,66 @@ +2008-07-15 Jean-Sébastien Pédron + + Merge revisions from 1434 to revision 1444 from trunk. + + * configure: Recreated with autoconf(1) after merge. + +2008-07-14 Badlop + + * doc/guide.tex: Update what permissions does enable-user grant + * doc/guide.html: Likewise + + * src/configure.ac: Don't explicitely put root privileges when a + user is not explicitely enabled + * src/configure: Likewise + * src/Makefile.in: Likewise + + * src/Makefile.in: Fix docdir so it recognizes prefix. If sbin dir + does not exist, create it. Fix cookiefile permission + check. (EJAB-696) + +2008-07-13 Badlop + + * src/configure.ac: Update installation permissions (EJAB-402) + * src/configure: Likewise + + * src/Makefile.in: The mnesia, ebin and priv dirs are now + installed in different locations. Install header files and + documentation (EJAB-696) + * doc/guide.tex: Likewise + * doc/guide.html: Likewise + + * include/*.hrl: Place for all ejabberd header files (EJAB-696) + * src/*/*.erl: Update references to header files + * src/*/Makefile.in: Include the include/ dir + + * src/configure.ac: Allow to execute ejabberd with a normal + system user (thanks to Viq)(EJAB-402) + * src/configure: Likewise + * src/ejabberdctl.template: Likewise + * src/Makefile.in: Likewise + * doc/guide.tex: Likewise + * doc/guide.html: Likewise + +2008-07-12 Badlop + + * src/configure.ac: Improve legibility + * src/aclocal.m4: Likewise + * src/configure: Likewise + + * src/ejabberdctl.template: Remove garbage variable. Document node + option + + * doc/guide.tex: Add references to sections. + * doc/guide.html: Likewise + +2008-07-11 Badlop + + * src/mod_register.erl: Revert support for io_lib newline, since + there is a standard character that representes newline (EJAB-501) + * doc/guide.tex: Update documentation to explain newline character + * doc/guide.html: Likewise + * src/ejabberd.cfg.example: Likewise + 2008-07-11 Jean-Sébastien Pédron Merge revisions from 1362 to revision 1434 from trunk. diff --git a/doc/Makefile b/doc/Makefile index c1f35fdff..2fda395a0 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,7 +16,7 @@ all: release pdf html release: @echo "Notes for the releaser:" @echo "* Do not forget to add a link to the release notes in guide.tex" - @echo "* Do not forget to update the version number in src/ejabberd.hrl!" + @echo "* Do not forget to update the version number in src/ejabberd.app!" @echo "* Do not forget to update the features in introduction.tex (including \new{} and \improved{} tags)." @echo "Press any key to continue" @read foo diff --git a/doc/guide.html b/doc/guide.html index b7f10839b..735fc1f8c 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -333,14 +333,24 @@ Alternatively, the latest development version can be retrieved from the Subversi

To compile ejabberd execute the commands:

./configure
 make
-

The build configuration script provides several parameters. +

The build configuration script allows several options. To get the full list run the command:

./configure --help
 

Some options that you may be interested in modifying:

--prefix=/
- Specify the path prefix where the files will be copied when running the make install command.

--enable-pam
- Enable the PAM authentication method.

--enable-odbc or --enable-mssql
+ Specify the path prefix where the files will be copied when running + the make install command.

--enable-user[=USER]
+ Allow this normal system user to execute the ejabberdctl script + (see section 4.1), + read the configuration files, + read and write in the spool directory, + read and write in the log directory. + The account user and group must exist in the machine + before running make install. + This account doesn’t need an explicit HOME directory, because + /var/lib/ejabberd/ will be used by default.

--enable-pam
+ Enable the PAM authentication method (see section 3.1.4).

--enable-odbc or --enable-mssql
Required if you want to use an external database. See section 3.2 for more information.

--enable-full-xml
Enable the use of XML based optimisations. @@ -351,34 +361,43 @@ To get the full list run the command:

2.4.4  Install

To install ejabberd in the destination directories, run the command:

make install
-

Note that you may need to have administrative privileges in the system.

The files and directories created are, by default: +

Note that you probably need administrative privileges in the system +to install ejabberd.

The files and directories created are, by default:

- /etc/ejabberd/
Configuration files: + /etc/ejabberd/
Configuration directory:
ejabberd.cfg
ejabberd configuration file
ejabberdctl.cfg
Configuration file of the administration script -
inetrc
Network DNS configuration +
inetrc
Network DNS configuration file
-
/sbin/ejabberdctl
Administration script -
/var/lib/ejabberd/
+
/lib/ejabberd/
- .erlang.cookie
Erlang cookie file (see section 5.3) -
db
Mnesia database spool files -
ebin
Binary Erlang files (*.beam) -
priv
+ ebin/
Erlang binary files (*.beam) +
include/
Erlang header files (*.hrl) +
priv/
Additional files required at runtime
- lib
Binary system libraries (*.so) -
msgs
Translated strings (*.msgs) + bin/
Binary C programs +
lib/
Binary system libraries (*.so) +
msgs/
Translation files (*.msgs)
-
/var/log/ejabberd/
Log files (see section 7.2): +
/sbin/ejabberdctl
Administration script (see section 4.1) +
/share/doc/ejabberd/
Documentation of ejabberd +
/var/lib/ejabberd/
Spool directory: +
+ .erlang.cookie
Erlang cookie file (see section 5.3) +
acl.DCD, ...
Mnesia database spool files (*.DCD, *.DCL, *.DAT) +
+
/var/log/ejabberd/
Log directory (see section 7.2):
ejabberd.log
ejabberd service log
sasl.log
Erlang/OTP system log

2.4.5  Start

-

You can use the ejabberdctl command line administration script to start and stop ejabberd.

Usage example: +

You can use the ejabberdctl command line administration script to start and stop ejabberd. +If you provided the configure option --enable-user=USER (see 2.4.3), +you can execute ejabberdctl with either that system account or root.

Usage example:

ejabberdctl start
 
 ejabberdctl status
@@ -939,7 +958,7 @@ for more information.
 

Though it is quite easy to set up PAM support in ejabberd, PAM itself introduces some security issues:

  • To perform PAM authentication ejabberd uses external C-program called -epam. By default, it is located in /var/lib/ejabberd/priv/lib/ +epam. By default, it is located in /var/lib/ejabberd/priv/bin/ directory. You have to set it root on execution in the case when your PAM module requires root privileges (pam_unix.so for example). Also you have to grant access for ejabberd to this file and remove all other permissions from it. @@ -2363,7 +2382,7 @@ restrictions by default).
welcome_message
Set a welcome message that is sent to each newly registered account. The first string is the subject, and the second string is the message body. -In the body you can set a newline with the characters: ~n. +In the body you can set a newline with the characters: \n
registration_watchers
This option defines a list of JIDs which will be notified each time a new account is registered.
iqdisc
This specifies @@ -2414,7 +2433,7 @@ Also define a registration timeout of one hour: ... {mod_register, [ - {welcome_message, {"Welcome!", "Hi.~nWelcome to this Jabber server.~n Check http://www.jabber.org~n~nBye"}}, + {welcome_message, {"Welcome!", "Hi.\nWelcome to this Jabber server.\n Check http://www.jabber.org\n\nBye"}}, {registration_watchers, ["admin1@example.org", "boss@example.net"]} ]}, ... @@ -2895,7 +2914,7 @@ Starts the Erlang system detached from the system console. Specify the directory where Erlang binary files (*.beam) are located.
-s ejabberd
Tell Erlang runtime system to start the ejabberd application. -
-mnesia dir "/var/lib/ejabberd/db/nodename"
+
-mnesia dir "/var/lib/ejabberd/"
Specify the Mnesia database directory.
-sasl sasl_error_logger {file, "/var/log/ejabberd/sasl.log"}
Path to the Erlang/OTP system log file. @@ -3065,10 +3084,10 @@ Contains IP addresses of clients. If the loglevel is set to 5, it contains whole conversations and passwords. If a logrotate system is used, there may be several log files with similar information, so it is preferable to secure the whole /var/log/ejabberd/ directory. -
Mnesia database spool files: /var/lib/ejabberd/db/*
+
Mnesia database spool files in /var/lib/ejabberd/
The files store binary data, but some parts are still readable. The files are generated by Mnesia and their permissions cannot be set directly, -so it is preferable to secure the whole /var/lib/ejabberd/db/ directory. +so it is preferable to secure the whole /var/lib/ejabberd/ directory.
Erlang cookie file: /var/lib/ejabberd/.erlang.cookie
See section 5.3.

diff --git a/doc/guide.tex b/doc/guide.tex index 5a23a359a..3831ac024 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -313,7 +313,7 @@ To compile \ejabberd{} execute the commands: make \end{verbatim} -The build configuration script provides several parameters. +The build configuration script allows several options. To get the full list run the command: \begin{verbatim} ./configure --help @@ -322,10 +322,22 @@ To get the full list run the command: Some options that you may be interested in modifying: \begin{description} \titem{--prefix=/} - Specify the path prefix where the files will be copied when running the make install command. + Specify the path prefix where the files will be copied when running + the \term{make install} command. + + \titem{--enable-user[=USER]} + Allow this normal system user to execute the ejabberdctl script + (see section~\ref{ejabberdctl}), + read the configuration files, + read and write in the spool directory, + read and write in the log directory. + The account user and group must exist in the machine + before running \term{make install}. + This account doesn't need an explicit HOME directory, because + \term{/var/lib/ejabberd/} will be used by default. \titem{--enable-pam} - Enable the PAM authentication method. + Enable the PAM authentication method (see section \ref{pam}). \titem{--enable-odbc or --enable-mssql} Required if you want to use an external database. @@ -348,29 +360,36 @@ To install \ejabberd{} in the destination directories, run the command: \begin{verbatim} make install \end{verbatim} -Note that you may need to have administrative privileges in the system. +Note that you probably need administrative privileges in the system +to install \term{ejabberd}. The files and directories created are, by default: \begin{description} - \titem{/etc/ejabberd/} Configuration files: + \titem{/etc/ejabberd/} Configuration directory: \begin{description} \titem{ejabberd.cfg} ejabberd configuration file \titem{ejabberdctl.cfg} Configuration file of the administration script - \titem{inetrc} Network DNS configuration + \titem{inetrc} Network DNS configuration file \end{description} - \titem{/sbin/ejabberdctl} Administration script - \titem{/var/lib/ejabberd/} + \titem{/lib/ejabberd/} \begin{description} - \titem{.erlang.cookie} Erlang cookie file (see section \ref{cookie}) - \titem{db} Mnesia database spool files - \titem{ebin} Binary Erlang files (*.beam) - \titem{priv} + \titem{ebin/} Erlang binary files (*.beam) + \titem{include/} Erlang header files (*.hrl) + \titem{priv/} Additional files required at runtime \begin{description} - \titem{lib} Binary system libraries (*.so) - \titem{msgs} Translated strings (*.msgs) + \titem{bin/} Binary C programs + \titem{lib/} Binary system libraries (*.so) + \titem{msgs/} Translation files (*.msgs) \end{description} \end{description} - \titem{/var/log/ejabberd/} Log files (see section~\ref{logfiles}): + \titem{/sbin/ejabberdctl} Administration script (see section~\ref{ejabberdctl}) + \titem{/share/doc/ejabberd/} Documentation of ejabberd + \titem{/var/lib/ejabberd/} Spool directory: + \begin{description} + \titem{.erlang.cookie} Erlang cookie file (see section \ref{cookie}) + \titem{acl.DCD, ...} Mnesia database spool files (*.DCD, *.DCL, *.DAT) + \end{description} + \titem{/var/log/ejabberd/} Log directory (see section~\ref{logfiles}): \begin{description} \titem{ejabberd.log} ejabberd service log \titem{sasl.log} Erlang/OTP system log @@ -382,6 +401,8 @@ The files and directories created are, by default: \ind{install!start} You can use the \term{ejabberdctl} command line administration script to start and stop \ejabberd{}. +If you provided the configure option \term{--enable-user=USER} (see \ref{compile}), +you can execute \term{ejabberdctl} with either that system account or root. Usage example: \begin{verbatim} @@ -393,6 +414,7 @@ ejabberd is running ejabberdctl stop \end{verbatim} + Please refer to the section~\ref{ejabberdctl} for details about \term{ejabberdctl}, and configurable options to fine tune the Erlang runtime system. @@ -1117,7 +1139,7 @@ security issues: \begin{itemize} \item To perform PAM authentication \ejabberd{} uses external C-program called -\term{epam}. By default, it is located in \verb|/var/lib/ejabberd/priv/lib/| +\term{epam}. By default, it is located in \verb|/var/lib/ejabberd/priv/bin/| directory. You have to set it root on execution in the case when your PAM module requires root privileges (\term{pam\_unix.so} for example). Also you have to grant access for \ejabberd{} to this file and remove all other permissions from it. @@ -3036,7 +3058,7 @@ Options: \titem{welcome\_message} \ind{options!welcomem}Set a welcome message that is sent to each newly registered account. The first string is the subject, and the second string is the message body. - In the body you can set a newline with the characters: \term{\~\ n}. + In the body you can set a newline with the characters: \verb|\n| \titem{registration\_watchers} \ind{options!rwatchers}This option defines a list of JIDs which will be notified each time a new account is registered. \iqdiscitem{In-Band Registration (\ns{jabber:iq:register})} @@ -3095,7 +3117,7 @@ Also define a registration timeout of one hour: ... {mod_register, [ - {welcome_message, {"Welcome!", "Hi.~nWelcome to this Jabber server.~n Check http://www.jabber.org~n~nBye"}}, + {welcome_message, {"Welcome!", "Hi.\nWelcome to this Jabber server.\n Check http://www.jabber.org\n\nBye"}}, {registration_watchers, ["admin1@example.org", "boss@example.net"]} ]}, ... @@ -3708,7 +3730,7 @@ The command line parameters: Specify the directory where Erlang binary files (*.beam) are located. \titem{-s ejabberd} Tell Erlang runtime system to start the \ejabberd{} application. - \titem{-mnesia dir "/var/lib/ejabberd/db/nodename"} + \titem{-mnesia dir "/var/lib/ejabberd/"} Specify the Mnesia database directory. \titem{-sasl sasl\_error\_logger \{file, "/var/log/ejabberd/sasl.log"\}} Path to the Erlang/OTP system log file. @@ -3941,10 +3963,10 @@ write and execute those files and directories. If the loglevel is set to 5, it contains whole conversations and passwords. If a logrotate system is used, there may be several log files with similar information, so it is preferable to secure the whole \term{/var/log/ejabberd/} directory. - \titem{Mnesia database spool files: /var/lib/ejabberd/db/*} + \titem{Mnesia database spool files in /var/lib/ejabberd/} The files store binary data, but some parts are still readable. The files are generated by Mnesia and their permissions cannot be set directly, - so it is preferable to secure the whole \term{/var/lib/ejabberd/db/} directory. + so it is preferable to secure the whole \term{/var/lib/ejabberd/} directory. \titem{Erlang cookie file: /var/lib/ejabberd/.erlang.cookie} See section \ref{cookie}. \end{description} diff --git a/src/adhoc.hrl b/include/adhoc.hrl similarity index 100% rename from src/adhoc.hrl rename to include/adhoc.hrl diff --git a/src/ejabberd.hrl b/include/ejabberd.hrl similarity index 100% rename from src/ejabberd.hrl rename to include/ejabberd.hrl diff --git a/src/ejabberd_config.hrl b/include/ejabberd_config.hrl similarity index 100% rename from src/ejabberd_config.hrl rename to include/ejabberd_config.hrl diff --git a/src/ejabberd_ctl.hrl b/include/ejabberd_ctl.hrl similarity index 100% rename from src/ejabberd_ctl.hrl rename to include/ejabberd_ctl.hrl diff --git a/src/web/ejabberd_http.hrl b/include/ejabberd_http.hrl similarity index 100% rename from src/web/ejabberd_http.hrl rename to include/ejabberd_http.hrl diff --git a/src/web/ejabberd_web_admin.hrl b/include/ejabberd_web_admin.hrl similarity index 100% rename from src/web/ejabberd_web_admin.hrl rename to include/ejabberd_web_admin.hrl diff --git a/src/eldap/eldap.hrl b/include/eldap.hrl similarity index 100% rename from src/eldap/eldap.hrl rename to include/eldap.hrl diff --git a/src/jlib.hrl b/include/jlib.hrl similarity index 100% rename from src/jlib.hrl rename to include/jlib.hrl diff --git a/src/mod_privacy.hrl b/include/mod_privacy.hrl similarity index 100% rename from src/mod_privacy.hrl rename to include/mod_privacy.hrl diff --git a/src/mod_proxy65/mod_proxy65.hrl b/include/mod_proxy65.hrl similarity index 100% rename from src/mod_proxy65/mod_proxy65.hrl rename to include/mod_proxy65.hrl diff --git a/src/mod_roster.hrl b/include/mod_roster.hrl similarity index 100% rename from src/mod_roster.hrl rename to include/mod_roster.hrl diff --git a/src/mod_pubsub/pubsub.hrl b/include/pubsub.hrl similarity index 100% rename from src/mod_pubsub/pubsub.hrl rename to include/pubsub.hrl diff --git a/src/Makefile.in b/src/Makefile.in index 607af353e..3d398f569 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -12,37 +12,53 @@ ERLANG_CFLAGS= @ERLANG_CFLAGS@ EXPAT_LIBS = @EXPAT_LIBS@ ERLANG_LIBS = @ERLANG_LIBS@ -ERLC_FLAGS += @ERLANG_SSL39@ - ASN_FLAGS = -bber_bin +der +compact_bit_string +optimize +noobj + +INSTALLUSER=@INSTALLUSER@ +# if no user was enabled, don't set privileges or ownership +ifeq ($(INSTALLUSER),) + O_USER= + G_USER= + CHOWN_COMMAND=echo + CHOWN_OUTPUT=/dev/null +else + O_USER=-o $(INSTALLUSER) + G_USER=-g $(INSTALLUSER) + CHOWN_COMMAND=chown + CHOWN_OUTPUT=&1 +endif + +EFLAGS += @ERLANG_SSL39@ +EFLAGS += -I ../include + # make debug=true to compile Erlang module with debug informations. ifdef debug - ERLC_FLAGS+=+debug_info + EFLAGS+=+debug_info endif ifdef ejabberd_debug - ERLC_FLAGS+=-Dejabberd_debug + EFLAGS+=-Dejabberd_debug endif ifeq (@hipe@, true) - ERLC_FLAGS+=+native + EFLAGS+=+native endif ifeq (@roster_gateway_workaround@, true) - ERLC_FLAGS+=-DROSTER_GATEWAY_WORKAROUND + EFLAGS+=-DROSTER_GATEWAY_WORKAROUND endif ifeq (@full_xml@, true) - ERLC_FLAGS+=-DFULL_XML_SUPPORT + EFLAGS+=-DFULL_XML_SUPPORT endif ifeq (@transient_supervisors@, false) - ERLC_FLAGS+=-DNO_TRANSIENT_SUPERVISORS + EFLAGS+=-DNO_TRANSIENT_SUPERVISORS endif INSTALL_EPAM= ifeq (@pam@, pam) - INSTALL_EPAM=install -m 750 epam $(PBINDIR) + INSTALL_EPAM=install -m 750 $(O_USER) epam $(PBINDIR) endif prefix = @prefix@ @@ -58,17 +74,47 @@ BEAMS = $(SOURCES:.erl=.beam) DESTDIR = -EJABBERDDIR = $(DESTDIR)@localstatedir@/lib/ejabberd -BEAMDIR = $(EJABBERDDIR)/ebin -SPOOLDIR = $(EJABBERDDIR)/db -PRIVDIR = $(EJABBERDDIR)/priv -SODIR = $(PRIVDIR)/lib -PBINDIR = $(PRIVDIR)/bin -MSGSDIR = $(PRIVDIR)/msgs -LOGDIR = $(DESTDIR)@localstatedir@/log/ejabberd +# /etc/ejabberd/ ETCDIR = $(DESTDIR)@sysconfdir@/ejabberd + +# /sbin/ SBINDIR = $(DESTDIR)@sbindir@ +# /lib/ejabberd/ +EJABBERDDIR = $(DESTDIR)@libdir@/ejabberd + +# /share/doc/ejabberd +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +datarootdir = @datarootdir@ +DOCDIR = @docdir@ + +# /usr/lib/ejabberd/ebin/ +BEAMDIR = $(EJABBERDDIR)/ebin + +# /usr/lib/ejabberd/include/ +INCLUDEDIR = $(EJABBERDDIR)/include + +# /usr/lib/ejabberd/priv/ +PRIVDIR = $(EJABBERDDIR)/priv + +# /usr/lib/ejabberd/priv/bin +PBINDIR = $(PRIVDIR)/bin + +# /usr/lib/ejabberd/priv/lib +SODIR = $(PRIVDIR)/lib + +# /usr/lib/ejabberd/priv/msgs +MSGSDIR = $(PRIVDIR)/msgs + +# /var/lib/ejabberd/ +SPOOLDIR = $(DESTDIR)@localstatedir@/lib/ejabberd + +# /var/lib/ejabberd/.erlang.cookie +COOKIEFILE = $(SPOOLDIR)/.erlang.cookie + +# /var/log/ejabberd/ +LOGDIR = $(DESTDIR)@localstatedir@/log/ejabberd + ifeq ($(shell uname),Darwin) DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress else @@ -85,7 +131,7 @@ $(BEAMS): $(ERLBEHAVBEAMS) all-recursive: $(ERLBEHAVBEAMS) %.beam: %.erl - @ERLC@ -W $(ERLC_FLAGS) $< + @ERLC@ -W $(EFLAGS) $< all-recursive install-recursive uninstall-recursive \ @@ -100,7 +146,7 @@ mostlyclean-recursive maintainer-clean-recursive: %.hrl: %.asn1 @ERLC@ $(ASN_FLAGS) $< - @ERLC@ -W $(ERLC_FLAGS) $*.erl + @ERLC@ -W $(EFLAGS) $*.erl $(ERLSHLIBS): %.so: %.c $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) \ @@ -113,39 +159,90 @@ $(ERLSHLIBS): %.so: %.c $(DYNAMIC_LIB_CFLAGS) install: all + # + # Configuration files + install -d -m 750 $(G_USER) $(ETCDIR) + [ -f $(ETCDIR)/ejabberd.cfg ] \ + && install -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new \ + || install -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg + sed -e "s*@rootdir@*@prefix@*" \ + -e "s*@installuser@*@INSTALLUSER@*" \ + -e "s*@LIBDIR@*@libdir@*" \ + -e "s*@SYSCONFDIR@*@sysconfdir@*" \ + -e "s*@LOCALSTATEDIR@*@localstatedir@*" \ + -e "s*@erl@*@ERL@*" ejabberdctl.template \ + > ejabberdctl.example + [ -f $(ETCDIR)/ejabberdctl.cfg ] \ + && install -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new \ + || install -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg + install -b -m 644 $(G_USER) inetrc $(ETCDIR)/inetrc + # + # Administration script + [ -d $(SBINDIR) ] || install -d 750 $(SBINDIR) + install -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl + # + # Binary Erlang files install -d $(BEAMDIR) + install -m 644 *.app $(BEAMDIR) install -m 644 *.beam $(BEAMDIR) rm -f $(BEAMDIR)/configure.beam - install -m 644 *.app $(BEAMDIR) - install -d -m 750 $(SPOOLDIR) - install -d $(SODIR) + # + # ejabberd header files + install -d $(INCLUDEDIR) + install -m 644 ../include/*.hrl $(INCLUDEDIR) + # + # Binary C programs install -d $(PBINDIR) - install -m 644 *.so $(SODIR) $(INSTALL_EPAM) + # + # Binary system libraries + install -d $(SODIR) + install -m 644 *.so $(SODIR) + # + # Translated strings install -d $(MSGSDIR) install -m 644 msgs/*.msg $(MSGSDIR) - install -d -m 750 $(ETCDIR) - [ -f $(ETCDIR)/ejabberd.cfg ] && install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new || install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg - sed -e "s*@rootdir@*@prefix@*" ejabberdctl.template > ejabberdctl.example - [ -f $(ETCDIR)/ejabberdctl.cfg ] && install -b -m 644 ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new || install -b -m 644 ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg - install -b -m 644 inetrc $(ETCDIR)/inetrc - install -d $(SBINDIR) - install -m 755 ejabberdctl.example $(SBINDIR)/ejabberdctl - install -d -m 750 $(LOGDIR) + # + # Spool directory + install -d -m 750 $(O_USER) $(SPOOLDIR) + $(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT) + chmod -R 750 $(SPOOLDIR) + [ ! -f $(COOKIEFILE) ] || { $(CHOWN_COMMAND) @INSTALLUSER@ $(COOKIEFILE) >$(CHOWN_OUTPUT) ; chmod 400 $(COOKIEFILE) ; } + # + # Log directory + install -d -m 750 $(O_USER) $(LOGDIR) + $(CHOWN_COMMAND) -R @INSTALLUSER@ $(LOGDIR) >$(CHOWN_OUTPUT) + chmod -R 750 $(LOGDIR) + # + # Documentation + install -d $(DOCDIR) + install ../doc/guide.html $(DOCDIR) + install ../doc/*.png $(DOCDIR) + install ../doc/*.txt $(DOCDIR) uninstall: uninstall-binary uninstall-binary: - rm -rf $(BEAMDIR) - rm -rf $(SODIR) - rm -rf $(MSGSDIR) - rm -rf $(PRIVDIR) - rm -rf $(SBINDIR)/ejabberdctl + rm -f $(SBINDIR)/ejabberdctl + rm -fr $(DOCDIR) + rm -f $(BEAMDIR)/*.beam + rm -f $(BEAMDIR)/*.app + rm -fr $(BEAMDIR) + rm -f $(INCLUDEDIR)/*.hrl + rm -fr $(INCLUDEDIR) + rm -fr $(PBINDIR) + rm -f $(SODIR)/*.so + rm -fr $(SODIR) + rm -f $(MSGSDIR)/*.msgs + rm -fr $(MSGSDIR) + rm -fr $(PRIVDIR) + rm -fr $(EJABBERDDIR) uninstall-all: uninstall-binary rm -rf $(ETCDIR) - rm -rf $(LOGDIR) rm -rf $(EJABBERDDIR) + rm -rf $(SPOOLDIR) + rm -rf $(LOGDIR) clean: clean-recursive clean-local diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 65509eefc..10a9e4bd1 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -1,6 +1,6 @@ AC_DEFUN(AM_WITH_EXPAT, [ AC_ARG_WITH(expat, - [ --with-expat=PREFIX prefix where EXPAT is installed]) + [AC_HELP_STRING([--with-expat=PREFIX], [prefix where EXPAT is installed])]) EXPAT_CFLAGS= EXPAT_LIBS= @@ -34,7 +34,7 @@ AC_DEFUN(AM_WITH_EXPAT, AC_DEFUN(AM_WITH_ZLIB, [ AC_ARG_WITH(zlib, - [ --with-zlib=PREFIX prefix where zlib is installed]) + [AC_HELP_STRING([--with-zlib=PREFIX], [prefix where zlib is installed])]) ZLIB_CFLAGS= ZLIB_LIBS= @@ -68,7 +68,7 @@ AC_DEFUN(AM_WITH_ZLIB, AC_DEFUN(AM_WITH_PAM, [ AC_ARG_WITH(pam, - [ --with-pam=PREFIX prefix where PAM is installed]) + [AC_HELP_STRING([--with-pam=PREFIX], [prefix where PAM is installed])]) PAM_CFLAGS= PAM_LIBS= @@ -102,7 +102,7 @@ AC_DEFUN(AM_WITH_PAM, AC_DEFUN(AM_WITH_ERLANG, [ AC_ARG_WITH(erlang, - [ --with-erlang=PREFIX path to erlc and erl ]) + [AC_HELP_STRING([--with-erlang=PREFIX], [path to erlc and erl])]) AC_PATH_TOOL(ERLC, erlc, , $with_erlang:$with_erlang/bin:$PATH) AC_PATH_TOOL(ERL, erl, , $with_erlang:$with_erlang/bin:$PATH) @@ -204,14 +204,13 @@ _EOF AC_SUBST(ERL) ]) - AC_DEFUN(AC_MOD_ENABLE, [ $1= make_$1= AC_MSG_CHECKING([whether build $1]) AC_ARG_ENABLE($1, - [ --enable-$1 enable $1 (default: $2)], + [AC_HELP_STRING([--enable-$1], [enable $1 (default: $2)])], [mr_enable_$1="$enableval"], [mr_enable_$1=$2]) if test "$mr_enable_$1" = "yes"; then @@ -232,7 +231,7 @@ AC_DEFUN([AM_ICONV], dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). AC_ARG_WITH([libiconv-prefix], -[ --with-libiconv-prefix=PREFIX prefix where libiconv is installed], [ + [AC_HELP_STRING([--with-libiconv-prefix=PREFIX], [prefix where libiconv is installed])], [ for dir in `echo "$withval" | tr : ' '`; do if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi if test -d $dir/include; then CFLAGS="$CFLAGS -I$dir/include"; fi @@ -317,7 +316,7 @@ size_t iconv(); dnl AC_DEFUN(AM_WITH_OPENSSL, [ AC_ARG_WITH(openssl, - [ --with-openssl=PREFIX prefix where OPENSSL is installed ]) + [AC_HELP_STRING([--with-openssl=PREFIX], [prefix where OPENSSL is installed])]) unset SSL_LIBS; unset SSL_CFLAGS; have_openssl=no diff --git a/src/configure b/src/configure index 034868416..a6cc19b6c 100755 --- a/src/configure +++ b/src/configure @@ -1,6 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. +# Generated by GNU Autoconf 2.61 for ejabberd.erl version. +# +# Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -570,13 +572,12 @@ MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= +PACKAGE_NAME='ejabberd.erl' +PACKAGE_TARNAME='ejabberd' +PACKAGE_VERSION='version' +PACKAGE_STRING='ejabberd.erl version' +PACKAGE_BUGREPORT='ejabberd@process-one.net' -ac_unique_file="ejabberd.erl" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -703,6 +704,7 @@ transient_supervisors full_xml SSL_LIBS SSL_CFLAGS +INSTALLUSER LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias @@ -752,7 +754,7 @@ sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' @@ -1216,7 +1218,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 this package to adapt to many kinds of systems. +\`configure' configures ejabberd.erl version to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1264,7 +1266,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --docdir=DIR documentation root [DATAROOTDIR/doc/ejabberd] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1276,37 +1278,49 @@ _ACEOF fi if test -n "$ac_init_help"; then - + case $ac_init_help in + short | recursive ) echo "Configuration of ejabberd.erl version:";; + esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-mod_pubsub enable mod_pubsub (default: yes) + --enable-mod_pubsub enable mod_pubsub (default: yes) --enable-mod_irc enable mod_irc (default: yes) --enable-mod_muc enable mod_muc (default: yes) - --enable-mod_proxy65 enable mod_proxy65 (default: yes) - --enable-eldap enable eldap (default: yes) - --enable-pam enable pam (default: no) - --enable-web enable web (default: yes) - --enable-tls enable tls (default: yes) - --enable-odbc enable odbc (default: no) - --enable-ejabberd_zlib enable ejabberd_zlib (default: yes) - --enable-hipe Compile natively with HiPE, not recommended (default: no) - --enable-roster-gateway-workaround Turn on workaround for processing gateway subscriptions (default: no) - --enable-mssql Use Microsoft SQL Server database (default: no, requires --enable-odbc) - --enable-transient_supervisors Use Erlang supervision for transient process (default: yes) - --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients) + --enable-mod_proxy65 enable mod_proxy65 (default: yes) + --enable-eldap enable eldap (default: yes) + --enable-pam enable pam (default: no) + --enable-web enable web (default: yes) + --enable-tls enable tls (default: yes) + --enable-odbc enable odbc (default: no) + --enable-ejabberd_zlib enable ejabberd_zlib (default: yes) + --enable-hipe compile natively with HiPE, not recommended + (default: no) + --enable-roster-gateway-workaround + turn on workaround for processing gateway + subscriptions (default: no) + --enable-mssql use Microsoft SQL Server database (default: no, + requires --enable-odbc) + --enable-transient_supervisors + use Erlang supervision for transient process + (default: yes) + --enable-full-xml use XML features in XMPP stream (ex: CDATA) + (default: no, requires XML compliant clients) + --enable-user[=USER] allow this system user to start ejabberd (default: + no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-erlang=PREFIX path to erlc and erl - --with-libiconv-prefix=PREFIX prefix where libiconv is installed - --with-expat=PREFIX prefix where EXPAT is installed - --with-zlib=PREFIX prefix where zlib is installed - --with-pam=PREFIX prefix where PAM is installed - --with-openssl=PREFIX prefix where OPENSSL is installed + --with-libiconv-prefix=PREFIX + prefix where libiconv is installed + --with-expat=PREFIX prefix where EXPAT is installed + --with-zlib=PREFIX prefix where zlib is installed + --with-pam=PREFIX prefix where PAM is installed + --with-openssl=PREFIX prefix where OPENSSL is installed Some influential environment variables: CC C compiler command @@ -1321,6 +1335,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to . _ACEOF ac_status=$? fi @@ -1381,7 +1396,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -configure +ejabberd.erl configure version generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1395,7 +1410,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 $as_me, which was +It was created by ejabberd.erl $as_me version, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1728,6 +1743,14 @@ fi + + + + + + + + @@ -4131,7 +4154,12 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to ejabberd@process-one.net ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -4376,7 +4404,12 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to ejabberd@process-one.net ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -4620,7 +4653,12 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to ejabberd@process-one.net ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -4888,7 +4926,12 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to ejabberd@process-one.net ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -5676,7 +5719,12 @@ echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to ejabberd@process-one.net ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -5849,7 +5897,12 @@ echo "$as_me: WARNING: krb5.h: section \"Present But Cannot Be Compiled\"" > echo "$as_me: WARNING: krb5.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: krb5.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: krb5.h: in the future, the compiler will take precedence" >&2;} - + ( cat <<\_ASBOX +## --------------------------------------- ## +## Report this to ejabberd@process-one.net ## +## --------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for krb5.h" >&5 @@ -5866,6 +5919,22 @@ fi +ENABLEUSER="" +# Check whether --enable-user was given. +if test "${enable_user+set}" = set; then + enableval=$enable_user; case "${enableval}" in + yes) ENABLEUSER=`whoami` ;; + no) ENABLEUSER="" ;; + *) ENABLEUSER=$enableval + esac +fi + +if test "$ENABLEUSER" != ""; then + echo "allow this system user to start ejabberd: $ENABLEUSER" + INSTALLUSER=$ENABLEUSER + +fi + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -6292,7 +6361,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by $as_me, which was +This file was extended by ejabberd.erl $as_me version, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6335,7 +6404,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -config.status +ejabberd.erl config.status version configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -6594,10 +6663,11 @@ transient_supervisors!$transient_supervisors$ac_delim full_xml!$full_xml$ac_delim SSL_LIBS!$SSL_LIBS$ac_delim SSL_CFLAGS!$SSL_CFLAGS$ac_delim +INSTALLUSER!$INSTALLUSER$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/src/configure.ac b/src/configure.ac index 254b16b06..ba6384633 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.53) -AC_INIT(ejabberd.erl,, ejabberd@process-one.net) +AC_INIT(ejabberd.erl, version, [ejabberd@process-one.net], [ejabberd]) # Checks for programs. AC_PROG_CC @@ -48,7 +48,7 @@ AC_MOD_ENABLE(odbc, no) AC_MOD_ENABLE(ejabberd_zlib, yes) AC_ARG_ENABLE(hipe, -[ --enable-hipe Compile natively with HiPE, not recommended (default: no)], +[AC_HELP_STRING([--enable-hipe], [compile natively with HiPE, not recommended (default: no)])], [case "${enableval}" in yes) hipe=true ;; no) hipe=false ;; @@ -57,7 +57,7 @@ esac],[hipe=false]) AC_SUBST(hipe) AC_ARG_ENABLE(roster_gateway_workaround, -[ --enable-roster-gateway-workaround Turn on workaround for processing gateway subscriptions (default: no)], +[AC_HELP_STRING([--enable-roster-gateway-workaround], [turn on workaround for processing gateway subscriptions (default: no)])], [case "${enableval}" in yes) roster_gateway_workaround=true ;; no) roster_gateway_workaround=false ;; @@ -66,7 +66,7 @@ esac],[roster_gateway_workaround=false]) AC_SUBST(roster_gateway_workaround) AC_ARG_ENABLE(mssql, -[ --enable-mssql Use Microsoft SQL Server database (default: no, requires --enable-odbc)], +[AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])], [case "${enableval}" in yes) db_type=mssql ;; no) db_type=generic ;; @@ -75,7 +75,7 @@ esac],[db_type=generic]) AC_SUBST(db_type) AC_ARG_ENABLE(transient_supervisors, -[ --enable-transient_supervisors Use Erlang supervision for transient process (default: yes)], +[AC_HELP_STRING([--enable-transient_supervisors], [use Erlang supervision for transient process (default: yes)])], [case "${enableval}" in yes) transient_supervisors=true ;; no) transient_supervisors=false ;; @@ -84,7 +84,7 @@ esac],[transient_supervisors=true]) AC_SUBST(transient_supervisors) AC_ARG_ENABLE(full_xml, -[ --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)], +[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])], [case "${enableval}" in yes) full_xml=true ;; no) full_xml=false ;; @@ -122,4 +122,18 @@ else fi AC_CHECK_HEADER(krb5.h,,) +ENABLEUSER="" +AC_ARG_ENABLE(user, + [AS_HELP_STRING([--enable-user[[[[=USER]]]]], [allow this system user to start ejabberd (default: no)])], + [case "${enableval}" in + yes) ENABLEUSER=`whoami` ;; + no) ENABLEUSER="" ;; + *) ENABLEUSER=$enableval + esac], + []) +if test "$ENABLEUSER" != ""; then + echo "allow this system user to start ejabberd: $ENABLEUSER" + AC_SUBST([INSTALLUSER], [$ENABLEUSER]) +fi + AC_OUTPUT diff --git a/src/ejabberd.cfg.example b/src/ejabberd.cfg.example index eb43bb3ca..022a9ebc2 100644 --- a/src/ejabberd.cfg.example +++ b/src/ejabberd.cfg.example @@ -459,7 +459,7 @@ %% a message with this subject and body. %% {welcome_message, {"Welcome!", - "Hi.~nWelcome to this Jabber server."}}, + "Hi.\nWelcome to this Jabber server."}}, %% %% When a user registers, send a notification to diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl index d576a82fd..b9bf3b477 100644 --- a/src/ejabberd_auth_ldap.erl +++ b/src/ejabberd_auth_ldap.erl @@ -58,7 +58,7 @@ ]). -include("ejabberd.hrl"). --include("eldap/eldap.hrl"). +-include("eldap.hrl"). -record(state, {host, eldap_id, diff --git a/src/ejabberd_zlib/Makefile.in b/src/ejabberd_zlib/Makefile.in index f24addbc3..3a70186bd 100644 --- a/src/ejabberd_zlib/Makefile.in +++ b/src/ejabberd_zlib/Makefile.in @@ -19,7 +19,8 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/ejabberdctl.template b/src/ejabberdctl.template index e086d1ef4..fcf0a80cc 100644 --- a/src/ejabberdctl.template +++ b/src/ejabberdctl.template @@ -11,13 +11,15 @@ ERL_MAX_ETS_TABLES=1400 NODE=ejabberd HOST=localhost ERLANG_NODE=$NODE@$HOST -ROOTDIR=@rootdir@ -EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg -LOGS_DIR=$ROOTDIR/var/log/ejabberd/ -EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE +ERL=@erl@ +INSTALLUSER=@installuser@ +ETCDIR=@SYSCONFDIR@/ejabberd +EJABBERD_CONFIG_PATH=$ETCDIR/ejabberd.cfg +LOGDIR=@LOCALSTATEDIR@/log/ejabberd +SPOOLDIR=@LOCALSTATEDIR@/lib/ejabberd # read custom configuration -CONFIG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg +CONFIG=$ETCDIR/ejabberdctl.cfg [ -f "$CONFIG" ] && . "$CONFIG" # parse command line parameters @@ -30,12 +32,27 @@ while [ $# -ne 0 ] ; do --node) ERLANG_NODE=$1; shift ;; --config) EJABBERD_CONFIG_PATH=$1 ; shift ;; --ctl-config) CONFIG=$1 ; shift ;; - --logs) LOGS_DIR=$1 ; shift ;; - --spool) EJABBERD_DB=$1 ; shift ;; + --logs) LOGDIR=$1 ; shift ;; + --spool) SPOOLDIR=$1 ; shift ;; *) ARGS="$ARGS $PARAM" ;; esac done +# check the proper system user is used +ID=`id -g` +EJID=`id -g $INSTALLUSER` +EXEC_CMD="false" +if [ $ID -eq 0 ] ; then + EXEC_CMD="su ${INSTALLUSER} -c" +fi +if [ "$ID" -eq "$EJID" ] ; then + EXEC_CMD="sh -c" +fi +if [ "$EXEC_CMD" = "false" ] ; then + echo "This command can only be run by root or the user $INSTALLUSER" >&2 + exit 1 +fi + NAME=-name [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && NAME=-sname @@ -48,31 +65,36 @@ fi ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $KERNEL_OPTS" # define additional environment variables -EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin -EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs -EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib -EJABBERD_BIN_PATH=$ROOTDIR/var/lib/ejabberd/priv/bin -EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log -SASL_LOG_PATH=$LOGS_DIR/sasl.log +EJABBERDDIR=@LIBDIR@/ejabberd +BEAMDIR=$EJABBERDDIR/ebin +PRIVDIR=$EJABBERDDIR/priv +PBINDIR=$PRIVDIR/bin +SODIR=$PRIVDIR/lib +MSGSDIR=$PRIVDIR/msgs + +EJABBERD_LOG_PATH=$LOGDIR/ejabberd.log +SASL_LOG_PATH=$LOGDIR/sasl.log DATETIME=`date "+%Y%m%d-%H%M%S"` -ERL_CRASH_DUMP=$LOGS_DIR/erl_crash_$DATETIME.dump -ERL_INETRC=$ROOTDIR/etc/ejabberd/inetrc -HOME=$ROOTDIR/var/lib/ejabberd +ERL_CRASH_DUMP=$LOGDIR/erl_crash_$DATETIME.dump +ERL_INETRC=$ETCDIR/inetrc +HOME=$SPOOLDIR + +# create the home dir with the proper user if doesn't exist, because it stores cookie file +[ -d $HOME ] || $EXEC_CMD "mkdir -p $HOME" # export global variables export EJABBERD_CONFIG_PATH -export EJABBERD_MSGS_PATH +export MSGSDIR export EJABBERD_LOG_PATH -export EJABBERD_SO_PATH -export EJABBERD_BIN_PATH +export SODIR +export PBINDIR export ERL_CRASH_DUMP export ERL_INETRC export ERL_MAX_PORTS export ERL_MAX_ETS_TABLES export HOME +export EXEC_CMD -[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB -[ -d $LOGS_DIR ] || mkdir -p $LOGS_DIR # Compatibility in ZSH #setopt shwordsplit 2>/dev/null @@ -80,14 +102,14 @@ export HOME # start server start () { - erl \ + $EXEC_CMD "$ERL \ $NAME $ERLANG_NODE \ -noinput -detached \ - -pa $EJABBERD_EBIN \ - -mnesia dir "\"$EJABBERD_DB\"" \ + -pa $BEAMDIR \ + -mnesia dir \"\\\"$SPOOLDIR\\\"\" \ -s ejabberd \ - -sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\} \ - $ERLANG_OPTS $ARGS "$@" + -sasl sasl_error_logger \\{file,\\\"$SASL_LOG_PATH\\\"\\} \ + $ERLANG_OPTS $ARGS \"$@\"" } # attach to server @@ -109,10 +131,10 @@ debug () echo "Press any key to continue" read foo echo "" - erl \ + $EXEC_CMD "$ERL \ $NAME ${NODE}debug \ -remsh $ERLANG_NODE \ - $ERLANG_OPTS $ARGS "$@" + $ERLANG_OPTS $ARGS \"$@\"" } # start interactive server @@ -133,23 +155,22 @@ live () echo "Press any key to continue" read foo echo "" - erl \ + $EXEC_CMD "$ERL \ $NAME $ERLANG_NODE \ - $ERLANG_OPTS \ - -pa $EJABBERD_EBIN \ - -mnesia dir "\"$EJABBERD_DB\"" \ + -pa $BEAMDIR \ + -mnesia dir \"\\\"$SPOOLDIR\\\"\" \ -s ejabberd \ - $ERLANG_OPTS $ARGS "$@" + $ERLANG_OPTS $ARGS \"$@\"" } # common control function ctl () { - erl \ + $EXEC_CMD "$ERL \ $NAME ejabberdctl \ -noinput \ - -pa $EJABBERD_EBIN \ - -s ejabberd_ctl -extra $ERLANG_NODE $@ + -pa $BEAMDIR \ + -s ejabberd_ctl -extra $ERLANG_NODE $@" result=$? case $result in 0) :;; @@ -163,8 +184,9 @@ ctl () echo "Optional parameters when starting an ejabberd node:" echo " --config file Config file of ejabberd: $EJABBERD_CONFIG_PATH" echo " --ctl-config file Config file of ejabberdctl: $CONFIG" - echo " --logs dir Directory for logs: $LOGS_DIR" - echo " --spool dir Database spool dir: $EJABBERD_DB" + echo " --logs dir Directory for logs: $LOGDIR" + echo " --spool dir Database spool dir: $SPOOLDIR" + echo " --node nodename ejabberd node name: $ERLANG_NODE" echo "";; esac return $result diff --git a/src/eldap/Makefile.in b/src/eldap/Makefile.in index 1c9b7ca22..4c9c33c22 100644 --- a/src/eldap/Makefile.in +++ b/src/eldap/Makefile.in @@ -9,7 +9,8 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/mod_irc/Makefile.in b/src/mod_irc/Makefile.in index 5000721a6..86212e45c 100644 --- a/src/mod_irc/Makefile.in +++ b/src/mod_irc/Makefile.in @@ -16,7 +16,9 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/mod_muc/Makefile.in b/src/mod_muc/Makefile.in index 8aa3bf5e1..80725d33d 100644 --- a/src/mod_muc/Makefile.in +++ b/src/mod_muc/Makefile.in @@ -9,7 +9,9 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 3a751c328..3db29844b 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -43,8 +43,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). --include("web/ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_http.hrl"). +-include("ejabberd_web_admin.hrl"). -record(offline_msg, {us, timestamp, expire, from, to, packet}). diff --git a/src/mod_offline_odbc.erl b/src/mod_offline_odbc.erl index c3d0513d0..79d7c51ae 100644 --- a/src/mod_offline_odbc.erl +++ b/src/mod_offline_odbc.erl @@ -42,8 +42,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). --include("web/ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_http.hrl"). +-include("ejabberd_web_admin.hrl"). -record(offline_msg, {user, timestamp, expire, from, to, packet}). diff --git a/src/mod_proxy65/Makefile.in b/src/mod_proxy65/Makefile.in index b9eba4267..62ae77c9f 100644 --- a/src/mod_proxy65/Makefile.in +++ b/src/mod_proxy65/Makefile.in @@ -9,7 +9,9 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/mod_proxy65/mod_proxy65_service.erl b/src/mod_proxy65/mod_proxy65_service.erl index 41c3af7d5..4ee3ec61a 100644 --- a/src/mod_proxy65/mod_proxy65_service.erl +++ b/src/mod_proxy65/mod_proxy65_service.erl @@ -41,8 +41,8 @@ %% API. -export([start_link/2]). --include("../ejabberd.hrl"). --include("../jlib.hrl"). +-include("ejabberd.hrl"). +-include("jlib.hrl"). -define(PROCNAME, ejabberd_mod_proxy65_service). diff --git a/src/mod_proxy65/mod_proxy65_stream.erl b/src/mod_proxy65/mod_proxy65_stream.erl index ccc060afe..046ac8e71 100644 --- a/src/mod_proxy65/mod_proxy65_stream.erl +++ b/src/mod_proxy65/mod_proxy65_stream.erl @@ -58,7 +58,7 @@ ]). -include("mod_proxy65.hrl"). --include("../ejabberd.hrl"). +-include("ejabberd.hrl"). -define(WAIT_TIMEOUT, 60000). %% 1 minute (is it enough?) diff --git a/src/mod_pubsub/Makefile.in b/src/mod_pubsub/Makefile.in index 39f6a16e8..25dbf57a5 100644 --- a/src/mod_pubsub/Makefile.in +++ b/src/mod_pubsub/Makefile.in @@ -9,7 +9,9 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/mod_register.erl b/src/mod_register.erl index 21080c8a2..a936ea5e1 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -241,13 +241,12 @@ send_welcome_message(JID) -> {"", ""} -> ok; {Subj, Body} -> - BodyFormatted = io_lib:format(Body, []), ejabberd_router:route( jlib:make_jid("", Host, ""), JID, {xmlelement, "message", [{"type", "normal"}], [{xmlelement, "subject", [], [{xmlcdata, Subj}]}, - {xmlelement, "body", [], [{xmlcdata, BodyFormatted}]}]}); + {xmlelement, "body", [], [{xmlcdata, Body}]}]}); _ -> ok end. diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 038de586a..c1569bb61 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -47,8 +47,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("web/ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_http.hrl"). +-include("ejabberd_web_admin.hrl"). start(Host, Opts) -> diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index d38121560..dfb76dcbe 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -46,8 +46,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("web/ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_http.hrl"). +-include("ejabberd_web_admin.hrl"). start(Host, Opts) -> diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index ff378010d..f363bd22e 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -52,8 +52,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("web/ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_http.hrl"). +-include("ejabberd_web_admin.hrl"). -record(sr_group, {group_host, opts}). -record(sr_user, {us, group_host}). diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index 2b5e7faac..2225f7c86 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -50,7 +50,7 @@ ]). -include("ejabberd.hrl"). --include("eldap/eldap.hrl"). +-include("eldap.hrl"). -include("jlib.hrl"). -define(PROCNAME, ejabberd_mod_vcard_ldap). diff --git a/src/odbc/Makefile.in b/src/odbc/Makefile.in index 974517c5b..5bd130b6e 100644 --- a/src/odbc/Makefile.in +++ b/src/odbc/Makefile.in @@ -9,7 +9,9 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in index d86b119b9..57c1ab78a 100644 --- a/src/pam/Makefile.in +++ b/src/pam/Makefile.in @@ -9,7 +9,9 @@ LIBS = @LIBS@ @PAM_LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in index dfb8c87d0..db4a874e1 100644 --- a/src/tls/Makefile.in +++ b/src/tls/Makefile.in @@ -19,7 +19,9 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/web/Makefile.in b/src/web/Makefile.in index 7c4732da8..3a75f7e17 100644 --- a/src/web/Makefile.in +++ b/src/web/Makefile.in @@ -9,7 +9,9 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS = -I .. -pz .. +EFLAGS += -I ../../include +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info @@ -21,7 +23,7 @@ BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) all: $(BEAMS) -$(OUTDIR)/%.beam: %.erl ejabberd_http.hrl +$(OUTDIR)/%.beam: %.erl @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< clean: