mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-16 22:05:29 +02:00
6557136426
If flock is available, ejabberdctl will use it to grab one of a bound number of connection names. This allows concurrent connections while using a bound number of atoms. Using PID, timestamps or random strings for transient connection IDs (which would avoid the need for flock) uses an unbound number of atoms. This can effectively DoS servers, as these connection names are not garbage collected.
391 lines
13 KiB
Makefile
391 lines
13 KiB
Makefile
# $Id$
|
|
|
|
CC = @CC@
|
|
CFLAGS = @CFLAGS@
|
|
CPPFLAGS = @CPPFLAGS@
|
|
LDFLAGS = @LDFLAGS@
|
|
LIBS = @LIBS@
|
|
|
|
ERLANG_CFLAGS= @ERLANG_CFLAGS@
|
|
|
|
ERLANG_LIBS = @ERLANG_LIBS@
|
|
|
|
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
|
|
INIT_USER=root
|
|
else
|
|
O_USER=-o $(INSTALLUSER)
|
|
G_USER=-g $(INSTALLUSER)
|
|
CHOWN_COMMAND=chown
|
|
CHOWN_OUTPUT=&1
|
|
INIT_USER=$(INSTALLUSER)
|
|
endif
|
|
|
|
EFLAGS += -pa .
|
|
|
|
# make debug=true to compile Erlang module with debug informations.
|
|
ifdef debug
|
|
EFLAGS+=+debug_info +export_all
|
|
endif
|
|
|
|
ifdef ejabberd_debug
|
|
EFLAGS+=-Dejabberd_debug
|
|
endif
|
|
|
|
ifeq (@hipe@, true)
|
|
EFLAGS+=+native
|
|
endif
|
|
|
|
ifeq (@roster_gateway_workaround@, true)
|
|
EFLAGS+=-DROSTER_GATEWAY_WORKAROUND
|
|
endif
|
|
|
|
ifeq (@full_xml@, true)
|
|
EFLAGS+=-DFULL_XML_SUPPORT
|
|
endif
|
|
|
|
ifeq (@transient_supervisors@, false)
|
|
EFLAGS+=-DNO_TRANSIENT_SUPERVISORS
|
|
endif
|
|
|
|
INSTALL_EPAM=
|
|
ifeq (@pam@, pam)
|
|
INSTALL_EPAM=install -m 750 $(O_USER) epam $(PBINDIR)
|
|
endif
|
|
|
|
prefix = @prefix@
|
|
exec_prefix = @exec_prefix@
|
|
|
|
SUBDIRS = stun @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @pam@ @web@ @tls@ @odbc@ @ejabberd_zlib@
|
|
ERLSHLIBS =
|
|
ERLBEHAVS = cyrsasl.erl gen_mod.erl p1_fsm.erl
|
|
SOURCES_ALL = $(wildcard *.erl)
|
|
SOURCES = $(filter-out $(ERLBEHAVS),$(SOURCES_ALL))
|
|
ERLBEHAVBEAMS = $(ERLBEHAVS:.erl=.beam)
|
|
BEAMS = $(SOURCES:.erl=.beam)
|
|
|
|
DESTDIR =
|
|
|
|
# /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 = $(DESTDIR)@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/lock/ejabberdctl
|
|
CTLLOCKDIR = $(DESTDIR)@localstatedir@/lock/ejabberdctl
|
|
|
|
# /var/lib/ejabberd/.erlang.cookie
|
|
COOKIEFILE = $(SPOOLDIR)/.erlang.cookie
|
|
|
|
# /var/log/ejabberd/
|
|
LOGDIR = $(DESTDIR)@localstatedir@/log/ejabberd
|
|
|
|
# Assume Linux-style dynamic library flags
|
|
DYNAMIC_LIB_CFLAGS = -fpic -shared
|
|
ifeq ($(shell uname),Darwin)
|
|
DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress
|
|
endif
|
|
ifeq ($(shell uname),SunOs)
|
|
DYNAMIC_LIB_CFLAGS = -KPIC -G -z text
|
|
endif
|
|
|
|
all: $(ERLSHLIBS) compile-beam all-recursive
|
|
|
|
compile-beam: XmppAddr.hrl $(ERLBEHAVBEAMS) $(BEAMS)
|
|
|
|
$(BEAMS): $(ERLBEHAVBEAMS)
|
|
|
|
all-recursive: $(ERLBEHAVBEAMS)
|
|
|
|
%.beam: %.erl
|
|
@ERLC@ -W $(EFLAGS) $<
|
|
|
|
|
|
all-recursive install-recursive uninstall-recursive \
|
|
clean-recursive distclean-recursive devdoc-recursive \
|
|
mostlyclean-recursive maintainer-clean-recursive:
|
|
@subdirs="$(SUBDIRS)"; for subdir in $$subdirs; do \
|
|
target=`echo $@|sed 's,-recursive,,'`; \
|
|
echo making $$target in $$subdir; \
|
|
(cd $$subdir && $(MAKE) $$target) || exit 1; \
|
|
done
|
|
|
|
|
|
%.hrl: %.asn1
|
|
@ERLC@ $(ASN_FLAGS) $<
|
|
@ERLC@ -W $(EFLAGS) $*.erl
|
|
|
|
$(ERLSHLIBS): %.so: %.c
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) \
|
|
$(subst ../,,$(subst .so,.c,$@)) \
|
|
$(ERLANG_LIBS) \
|
|
$(ERLANG_CFLAGS) \
|
|
-o $@ \
|
|
$(DYNAMIC_LIB_CFLAGS)
|
|
|
|
translations:
|
|
../contrib/extract_translations/prepare-translation.sh -updateall
|
|
|
|
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*@DOCDIR@*@docdir@*" \
|
|
-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 -m 755 $(SBINDIR)
|
|
install -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl
|
|
#
|
|
# Init script
|
|
sed -e "s*@ctlscriptpath@*$(SBINDIR)*" \
|
|
-e "s*@installuser@*$(INIT_USER)*" ejabberd.init.template \
|
|
> ejabberd.init
|
|
#
|
|
# Binary Erlang files
|
|
install -d $(BEAMDIR)
|
|
install -m 644 *.app $(BEAMDIR)
|
|
install -m 644 *.beam $(BEAMDIR)
|
|
rm -f $(BEAMDIR)/configure.beam
|
|
#
|
|
# ejabberd header files
|
|
install -d $(INCLUDEDIR)
|
|
install -m 644 *.hrl $(INCLUDEDIR)
|
|
install -d $(INCLUDEDIR)/eldap/
|
|
install -m 644 eldap/*.hrl $(INCLUDEDIR)/eldap/
|
|
install -d $(INCLUDEDIR)/mod_muc/
|
|
install -m 644 mod_muc/*.hrl $(INCLUDEDIR)/mod_muc/
|
|
install -d $(INCLUDEDIR)/mod_proxy65/
|
|
install -m 644 mod_proxy65/*.hrl $(INCLUDEDIR)/mod_proxy65/
|
|
install -d $(INCLUDEDIR)/mod_pubsub/
|
|
install -m 644 mod_pubsub/*.hrl $(INCLUDEDIR)/mod_pubsub/
|
|
install -d $(INCLUDEDIR)/web/
|
|
install -m 644 web/*.hrl $(INCLUDEDIR)/web/
|
|
#
|
|
# Binary C programs
|
|
install -d $(PBINDIR)
|
|
install -m 750 $(O_USER) ../tools/captcha.sh $(PBINDIR)
|
|
$(INSTALL_EPAM)
|
|
#
|
|
# Binary system libraries
|
|
install -d $(SODIR)
|
|
install -m 644 *.so $(SODIR)
|
|
#
|
|
# Translated strings
|
|
install -d $(MSGSDIR)
|
|
install -m 644 msgs/*.msg $(MSGSDIR)
|
|
#
|
|
# Spool directory
|
|
install -d -m 750 $(O_USER) $(SPOOLDIR)
|
|
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT)
|
|
chmod -R 750 $(SPOOLDIR)
|
|
|
|
# ejabberdctl lock directory
|
|
install -d -m 750 $(O_USER) $(CTLLOCKDIR)
|
|
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(CTLLOCKDIR) >$(CHOWN_OUTPUT)
|
|
chmod -R 750 $(CTLLOCKDIR)
|
|
|
|
[ ! -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 -m 644 ../doc/guide.html $(DOCDIR)
|
|
install -m 644 ../doc/*.png $(DOCDIR)
|
|
install -m 644 ../doc/*.txt $(DOCDIR)
|
|
|
|
uninstall: uninstall-binary
|
|
|
|
uninstall-binary:
|
|
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 $(EJABBERDDIR)
|
|
rm -rf $(SPOOLDIR)
|
|
rm -rf $(CTLLOCKDIR)
|
|
rm -rf $(LOGDIR)
|
|
|
|
clean: clean-recursive clean-local clean-devdoc
|
|
|
|
clean-local:
|
|
rm -f *.beam $(ERLSHLIBS) epam ejabberdctl.example
|
|
rm -f XmppAddr.asn1db XmppAddr.erl XmppAddr.hrl
|
|
|
|
distclean: distclean-recursive clean-local
|
|
rm -f config.status
|
|
rm -f config.log
|
|
rm -f Makefile
|
|
|
|
TAGS:
|
|
etags *.erl
|
|
|
|
Makefile: Makefile.in
|
|
|
|
dialyzer: $(BEAMS)
|
|
@dialyzer -c .
|
|
|
|
LASTSVNREVCHANGELOG = 2075
|
|
changelog:
|
|
svn up -r $(LASTSVNREVCHANGELOG) ../ChangeLog
|
|
mv ../ChangeLog ../ChangeLog.old
|
|
svn2cl -r BASE:$(LASTSVNREVCHANGELOG) -o ../ChangeLog --group-by-day \
|
|
--separate-daylogs --break-before-msg --reparagraph ..
|
|
cat ../ChangeLog.old >> ../ChangeLog
|
|
rm ../ChangeLog.old
|
|
|
|
|
|
## Devdoc definitions
|
|
SRCDIR=.
|
|
DDTDIR=.
|
|
DEVDOCDIR=../doc/devdoc
|
|
DEVDOC_ERLS = $(wildcard ../doc/devdoc/*.erl)
|
|
DEVDOC_BEAMS = $(DEVDOC_ERLS:.erl=.beam)
|
|
APPNAME = ejabberd
|
|
VSN = $(shell sed '/vsn/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ./ejabberd.app)
|
|
.PHONY = all
|
|
HTMLS = $(SOURCES:%.erl=../doc/devdoc/%.html)
|
|
ERLHTMLS = $(SOURCES:%.erl=../doc/devdoc/%.erl.html)
|
|
SVGS = $(SOURCES:%.erl=../doc/devdoc/%.svg)
|
|
EDOCINDEX = $(DEVDOCDIR)/index.html
|
|
|
|
## Devdoc rules
|
|
devdoc: compile-devdoc devdoc-root devdoc-recursive
|
|
$(devdoc-customize)
|
|
$(devdoc-move)
|
|
devdoc-root: $(EDOCINDEX) $(HTMLS) $(ERLHTMLS) $(SVGS)
|
|
|
|
define devdoc-customize
|
|
find $(DDTDIR) -type f -name '*.erl.html' -exec sed -i 's/<span class="attribute" >module<\/span>(\([A-Za-z0-9_]*\))/<span class="attribute" >module<\/span>(<a href="\1.html">\1<\/a>)/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.erl.html' -exec sed -i 's/arity="\([0-9]*\)" >\([A-Za-z0-9_]*\)</><a class="function" id="\2-\1" href="EDOCFILENAME#\2-\1">\2<\/a></g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.erl.html' -exec sed -i 's/class="export" >\([A-Za-z0-9_]*\)\/\([0-9]*\)</class="export" ><a href="#\1-\2">\1\/\2<\/a></g;' {} \;
|
|
for fn in *.erl.html; do \
|
|
sed -i 's/EDOCFILENAME/'$${fn%.erl.html}.html'/g;' $${fn} ; \
|
|
sed = $${fn} | sed 'N;s/\n/ /;s/^\([0-9_]*\)/<a href="#\1" name="\1" class="l">\1<\/a>/' >$${fn}.tmp ; \
|
|
mv $${fn}.tmp $${fn} ; \
|
|
sed -i 's/<a href="#1" name="1" class="l">1<\/a> <html><link rel="stylesheet" type="text\/css"href="escobar.css"><\/link><body><pre><span class="comment" >/<html><link rel="stylesheet" type="text\/css" href="escobar.css"><\/link><body><pre><span class="comment" ><a href="#1" name="1" class="l">1<\/a> /g;' $${fn} ; \
|
|
done
|
|
-mv *.erl.html $(DEVDOCDIR)
|
|
|
|
find $(DDTDIR) -type f -name '*.html' -exec sed -i 's/<a href="overview-summary.html" target="overviewFrame">/<a href="index.html" target="_parent">/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.html' -exec sed -i 's/align=\"right\" border=\"0\" alt=\"erlang logo\"/alt=\"erlang logo\"><\/a><a href=\"http:\/\/www.ejabberd.im\/\"><img src=\"ejabberd-im.png\" alt=\"ejabberd Community\"><\/a><a href=\"http:\/\/www.process-one.net\/en\/ejabberd\/\"><img src=\"ejabberd-p1.png\" alt=\"ejabberd home\"><\/a><a href=\"http:\/\/www.process-one.net\/\"><img src=\"process-one.png\" alt=\"ProcessOne\"/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.html' -exec sed -i 's/^<h1>Module \([A-Za-z0-9_]*\)<\/h1>/<h1>Module \1 [<a href="\1.erl.html">erl<\/a> <a href="\1.svg">svg<\/a>]<\/h1>/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.html' -exec sed -i 's/class="function"><a name="\([A-Za-z0-9_]*\)-\([0-9_]*\)">/class="function"><a name="\1-\2" href="ESCOFILENAME#\1-\2">/g;' {} \;
|
|
-for fn in *.html; do sed -i 's/ESCOFILENAME/'$${fn%.html}.erl.html'/g;' $${fn} ; done
|
|
|
|
find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="EXP\([A-Za-z0-9_]*\).html#\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="\1.html#\2-\3"/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="PRI\([A-Za-z0-9_]*\).html#\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="\1.html#\2-\3"/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="APP\([A-Za-z0-9_]*\):\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="\1.html#\2-\3"/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="EXM\([A-Za-z0-9_]*\):\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="http:\/\/www.process-one.net\/docs\/exmpp\/devdoc\/trunk\/\1.html#\2-\3"/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="OTP\([A-Za-z0-9_]*\):\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="http:\/\/www.erlang.org\/doc\/man\/\1.html#\2-\3"/g;' {} \;
|
|
find $(DDTDIR) -type f -name '*.svg' -exec sed -i 's/xlink:href="OTP\([A-Za-z0-9_]*\)\/\([0-9_]*\)"/xlink:href="http:\/\/www.erlang.org\/doc\/man\/erlang.html#\1-\2"/g;' {} \;
|
|
endef
|
|
|
|
define devdoc-move
|
|
-rm *.dot
|
|
-mv *.html $(DEVDOCDIR)
|
|
-mv *.svg $(DEVDOCDIR)
|
|
endef
|
|
|
|
compile-devdoc: $(DEVDOC_BEAMS)
|
|
[ ! -f funrelg.beam ] || mv funrelg.beam $(DEVDOCDIR)
|
|
[ ! -f escobar_hilite.beam ] || mv escobar_hilite.beam $(DEVDOCDIR)
|
|
[ ! -f escobar_run.beam ] || mv escobar_run.beam $(DEVDOCDIR)
|
|
|
|
$(EDOCINDEX):
|
|
@ERL@ -noshell -run edoc_run application "'$(APPNAME)'" '"$(SRCDIR)"' \
|
|
'[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop
|
|
sed -i 's/<title>The ejabberd application<\/title>/<title>ejabberd devdoc<\/title><link rel="shortcut icon" href="favicon.ico" type="image\/x-icon"\/>/g;' $(DDTDIR)/index.html
|
|
mv edoc-info $(DEVDOCDIR)
|
|
mv *.png $(DEVDOCDIR)
|
|
cp *.html $(DEVDOCDIR)
|
|
@ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run dir $(SRCDIR) $(SRCDIR) -s init stop
|
|
@ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $(SRCDIR) $(SRCDIR) -s init stop
|
|
$(devdoc-customize)
|
|
$(devdoc-move)
|
|
|
|
$(DEVDOCDIR)/%.erl.html: %.erl
|
|
@ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(SRCDIR) -s init stop
|
|
|
|
$(DEVDOCDIR)/%.html: %.erl
|
|
@ERL@ -noshell -run edoc_run file $< \
|
|
'[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop
|
|
|
|
$(DEVDOCDIR)/%.svg: %.erl
|
|
@ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg file $< $(SRCDIR) -s init stop
|
|
|
|
clean-devdoc:
|
|
rm -f $(DEVDOCDIR)/edoc-info
|
|
rm -f $(DEVDOCDIR)/erlang.png
|
|
rm -f $(DEVDOCDIR)/*.beam
|
|
rm -f $(DEVDOCDIR)/*.dot
|
|
rm -f $(DEVDOCDIR)/*.html
|
|
rm -f $(DEVDOCDIR)/*.svg
|