aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in26
-rw-r--r--ejabberd.service.template16
-rw-r--r--include/ejabberd.hrl2
-rw-r--r--rebar.config4
-rw-r--r--src/ejabberd_bosh.erl2
-rw-r--r--src/ejabberd_commands_doc.erl2
-rw-r--r--src/mod_admin_extra.erl2
-rw-r--r--src/mod_irc.erl3
-rw-r--r--src/mod_last.erl2
-rw-r--r--src/mod_muc.erl3
-rw-r--r--src/mod_multicast.erl3
-rw-r--r--src/mod_offline.erl8
-rw-r--r--src/mod_privacy.erl6
-rw-r--r--src/mod_proxy65_service.erl3
-rw-r--r--src/mod_pubsub.erl3
-rw-r--r--src/mod_vcard.erl6
-rw-r--r--test/proxy65_tests.erl10
-rw-r--r--test/pubsub_tests.erl8
-rw-r--r--test/vcard_tests.erl12
19 files changed, 67 insertions, 54 deletions
diff --git a/Makefile.in b/Makefile.in
index 00fd4f62c..5ff3efe0b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -173,15 +173,15 @@ install: all copy-files
[ -f $(ETCDIR)/ejabberd.yml ] \
&& $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml-new \
|| $(INSTALL) -b -m 640 $(G_USER) ejabberd.yml.example $(ETCDIR)/ejabberd.yml
- $(SED) -e "s*{{rootdir}}*@prefix@*" \
- -e "s*{{installuser}}*@INSTALLUSER@*" \
- -e "s*{{bindir}}*@bindir@*" \
- -e "s*{{libdir}}*@libdir@*" \
- -e "s*{{sysconfdir}}*@sysconfdir@*" \
- -e "s*{{localstatedir}}*@localstatedir@*" \
- -e "s*{{docdir}}*@docdir@*" \
- -e "s*{{erl}}*@ERL@*" \
- -e "s*{{epmd}}*@EPMD@*" ejabberdctl.template \
+ $(SED) -e "s*{{rootdir}}*@prefix@*g" \
+ -e "s*{{installuser}}*@INSTALLUSER@*g" \
+ -e "s*{{bindir}}*@bindir@*g" \
+ -e "s*{{libdir}}*@libdir@*g" \
+ -e "s*{{sysconfdir}}*@sysconfdir@*g" \
+ -e "s*{{localstatedir}}*@localstatedir@*g" \
+ -e "s*{{docdir}}*@docdir@*g" \
+ -e "s*{{erl}}*@ERL@*g" \
+ -e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
> ejabberdctl.example
[ -f $(ETCDIR)/ejabberdctl.cfg ] \
&& $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new \
@@ -198,15 +198,15 @@ install: all copy-files
[ -f deps/elixir/bin/mix ] && $(INSTALL) -m 550 $(G_USER) deps/elixir/bin/mix $(BINDIR)/mix || true
#
# Init script
- $(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*" \
- -e "s*@installuser@*$(INIT_USER)*" ejabberd.init.template \
+ $(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*g" \
+ -e "s*@installuser@*$(INIT_USER)*g" ejabberd.init.template \
> ejabberd.init
chmod 755 ejabberd.init
#
# Service script
- $(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*" ejabberd.service.template \
+ $(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*g" ejabberd.service.template \
> ejabberd.service
- chmod 755 ejabberd.service
+ chmod 644 ejabberd.service
#
# Spool directory
$(INSTALL) -d -m 750 $(O_USER) $(SPOOLDIR)
diff --git a/ejabberd.service.template b/ejabberd.service.template
index 49ba14737..a70d2254d 100644
--- a/ejabberd.service.template
+++ b/ejabberd.service.template
@@ -3,22 +3,16 @@ Description=XMPP Server
After=network.target
[Service]
+Type=forking
User=ejabberd
Group=ejabberd
-LimitNOFILE=16000
+LimitNOFILE=65536
+Restart=on-failure
RestartSec=5
-ExecStart=@ctlscriptpath@/ejabberdctl start
-ExecStop=@ctlscriptpath@/ejabberdctl stop
-ExecReload=@ctlscriptpath@/ejabberdctl reload_config
-Type=oneshot
-RemainAfterExit=yes
-# The CAP_DAC_OVERRIDE capability is required for pam authentication to work
-CapabilityBoundingSet=CAP_DAC_OVERRIDE
-PrivateTmp=true
+ExecStart=/bin/sh -c '@ctlscriptpath@/ejabberdctl start && @ctlscriptpath@/ejabberdctl started'
+ExecStop=/bin/sh -c '@ctlscriptpath@/ejabberdctl stop && @ctlscriptpath@/ejabberdctl stopped'
PrivateDevices=true
-ProtectHome=true
ProtectSystem=full
-NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
diff --git a/include/ejabberd.hrl b/include/ejabberd.hrl
index 7a6df5644..391089a0e 100644
--- a/include/ejabberd.hrl
+++ b/include/ejabberd.hrl
@@ -39,6 +39,8 @@
-define(EJABBERD_URI, <<"http://www.process-one.net/en/ejabberd/">>).
+-define(COPYRIGHT, "Copyright (c) 2002-2016 ProcessOne").
+
-define(S2STIMEOUT, timer:minutes(10)).
%%-define(DBGFSM, true).
diff --git a/rebar.config b/rebar.config
index 6db14c87b..929c15304 100644
--- a/rebar.config
+++ b/rebar.config
@@ -12,8 +12,8 @@
{cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.4"}}},
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.7"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.6"}}},
- {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.16"}}},
- {xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.0.3"}}},
+ {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.17"}}},
+ {xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.0.4"}}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.7"}}},
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.8"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.6"}}},
diff --git a/src/ejabberd_bosh.erl b/src/ejabberd_bosh.erl
index d4fc6809d..1dc103aee 100644
--- a/src/ejabberd_bosh.erl
+++ b/src/ejabberd_bosh.erl
@@ -966,7 +966,7 @@ attrs_to_body_attrs(Attrs) ->
[], Attrs).
to_int(S, Min) ->
- case jlib:binary_to_integer(S) of
+ case binary_to_integer(S) of
I when I >= Min -> I;
_ -> erlang:error(badarg)
end.
diff --git a/src/ejabberd_commands_doc.erl b/src/ejabberd_commands_doc.erl
index 477e4f5d5..bb519a600 100644
--- a/src/ejabberd_commands_doc.erl
+++ b/src/ejabberd_commands_doc.erl
@@ -5,7 +5,7 @@
%%% Created : 20 May 2008 by Badlop <badlop@process-one.net>
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2015 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl
index 053ce8092..3c51e8c69 100644
--- a/src/mod_admin_extra.erl
+++ b/src/mod_admin_extra.erl
@@ -5,7 +5,7 @@
%%% Created : 10 Aug 2008 by Badlop <badlop@process-one.net>
%%%
%%%
-%%% ejabberd, Copyright (C) 2002-2008 ProcessOne
+%%% ejabberd, Copyright (C) 2002-2016 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
diff --git a/src/mod_irc.erl b/src/mod_irc.erl
index 2fb35414d..3dd0e492d 100644
--- a/src/mod_irc.erl
+++ b/src/mod_irc.erl
@@ -420,10 +420,9 @@ iq_disco(ServerHost, Node, Lang) ->
iq_get_vcard(Lang) ->
Desc = translate:translate(Lang, <<"ejabberd IRC module">>),
- Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
#vcard_temp{fn = <<"ejabberd/mod_irc">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>}.
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
command_items(ServerHost, Host, Lang) ->
lists:map(fun({Node, Name, _Function}) ->
diff --git a/src/mod_last.erl b/src/mod_last.erl
index 895a8e215..463eac051 100644
--- a/src/mod_last.erl
+++ b/src/mod_last.erl
@@ -217,7 +217,7 @@ import_start(LServer, DBType) ->
import(LServer, {sql, _}, DBType, <<"last">>, [LUser, TimeStamp, State]) ->
TS = case TimeStamp of
<<"">> -> 0;
- _ -> jlib:binary_to_integer(TimeStamp)
+ _ -> binary_to_integer(TimeStamp)
end,
LA = #last_activity{us = {LUser, LServer},
timestamp = TS,
diff --git a/src/mod_muc.erl b/src/mod_muc.erl
index 28008aaae..554a21704 100644
--- a/src/mod_muc.erl
+++ b/src/mod_muc.erl
@@ -429,11 +429,10 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
-spec process_vcard(iq()) -> iq().
process_vcard(#iq{type = get, lang = Lang, sub_els = [#vcard_temp{}]} = IQ) ->
Desc = translate:translate(Lang, <<"ejabberd MUC module">>),
- Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
xmpp:make_iq_result(
IQ, #vcard_temp{fn = <<"ejabberd/mod_muc">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>});
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>});
process_vcard(#iq{type = set, lang = Lang} = IQ) ->
Txt = <<"Value 'set' of 'type' attribute is not allowed">>,
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
diff --git a/src/mod_multicast.erl b/src/mod_multicast.erl
index 72046491f..0aa2270ae 100644
--- a/src/mod_multicast.erl
+++ b/src/mod_multicast.erl
@@ -268,10 +268,9 @@ iq_disco_info(From, Lang, State) ->
iq_vcard(Lang) ->
Desc = translate:translate(Lang, <<"ejabberd Multicast service">>),
- Copyright = <<"Copyright (c) 2002-2016 ProcessOne">>,
#vcard_temp{fn = <<"ejabberd/mod_multicast">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>}.
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
%%%-------------------------
%%% Route
diff --git a/src/mod_offline.erl b/src/mod_offline.erl
index 241677b2a..f620e73c5 100644
--- a/src/mod_offline.erl
+++ b/src/mod_offline.erl
@@ -868,10 +868,10 @@ import(LServer, {sql, _}, DBType, <<"spool">>,
fxml:get_attr_s(<<"to">>, El#xmlel.attrs)),
Stamp = fxml:get_path_s(El, [{elem, <<"delay">>},
{attr, <<"stamp">>}]),
- TS = case jlib:datetime_string_to_timestamp(Stamp) of
- {MegaSecs, Secs, _} ->
- {MegaSecs, Secs, 0};
- undefined ->
+ TS = try xmpp_util:decode_timestamp(Stamp) of
+ {MegaSecs, Secs, _} ->
+ {MegaSecs, Secs, 0}
+ catch _:_ ->
p1_time_compat:timestamp()
end,
US = {LUser, LServer},
diff --git a/src/mod_privacy.erl b/src/mod_privacy.erl
index f1b8411d2..d6936e1b7 100644
--- a/src/mod_privacy.erl
+++ b/src/mod_privacy.erl
@@ -552,13 +552,13 @@ numeric_to_binary(<<0, _, _:6/binary, T/binary>>) ->
fun(X, Sum) ->
Sum*10000 + X
end, 0, [X || <<X:16>> <= T]),
- jlib:integer_to_binary(Res).
+ integer_to_binary(Res).
bool_to_binary(<<0>>) -> <<"0">>;
bool_to_binary(<<1>>) -> <<"1">>.
prepare_list_data(mysql, [ID|Row]) ->
- [jlib:binary_to_integer(ID)|Row];
+ [binary_to_integer(ID)|Row];
prepare_list_data(pgsql, [<<ID:64>>,
SType, SValue, SAction, SOrder, SMatchAll,
SMatchIQ, SMatchMessage, SMatchPresenceIn,
@@ -572,7 +572,7 @@ prepare_list_data(pgsql, [<<ID:64>>,
bool_to_binary(SMatchPresenceOut)].
prepare_id(mysql, ID) ->
- jlib:binary_to_integer(ID);
+ binary_to_integer(ID);
prepare_id(pgsql, <<ID:32>>) ->
ID.
diff --git a/src/mod_proxy65_service.erl b/src/mod_proxy65_service.erl
index 789771d7d..0f69086e0 100644
--- a/src/mod_proxy65_service.erl
+++ b/src/mod_proxy65_service.erl
@@ -136,11 +136,10 @@ process_vcard(#iq{type = set, lang = Lang} = IQ) ->
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
process_vcard(#iq{type = get, lang = Lang} = IQ) ->
Desc = translate:translate(Lang, <<"ejabberd SOCKS5 Bytestreams module">>),
- Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
xmpp:make_iq_result(
IQ, #vcard_temp{fn = <<"ejabberd/mod_proxy65">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>}).
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>}).
-spec process_bytestreams(iq()) -> iq().
process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl
index a138b1896..c379760ed 100644
--- a/src/mod_pubsub.erl
+++ b/src/mod_pubsub.erl
@@ -1186,10 +1186,9 @@ iq_sm(#iq{to = To, sub_els = [SubEl]} = IQ) ->
-spec iq_get_vcard(binary()) -> vcard_temp().
iq_get_vcard(Lang) ->
Desc = translate:translate(Lang, <<"ejabberd Publish-Subscribe module">>),
- Copyright = <<"Copyright (c) 2004-2016 ProcessOne">>,
#vcard_temp{fn = <<"ejabberd/mod_pubsub">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>}.
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
-spec iq_pubsub(binary() | ljid(), atom(), iq()) ->
{result, pubsub()} | {error, stanza_error()}.
diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl
index dc9476206..843281ef8 100644
--- a/src/mod_vcard.erl
+++ b/src/mod_vcard.erl
@@ -191,11 +191,10 @@ process_local_iq(#iq{type = set, lang = Lang} = IQ) ->
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
process_local_iq(#iq{type = get, lang = Lang} = IQ) ->
Desc = translate:translate(Lang, <<"Erlang Jabber Server">>),
- Copyright = <<"Copyright (c) 2002-2016 ProcessOne">>,
xmpp:make_iq_result(
IQ, #vcard_temp{fn = <<"ejabberd">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>,
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>,
bday = <<"2002-11-16">>}).
-spec process_sm_iq(iq()) -> iq().
@@ -228,11 +227,10 @@ process_vcard(#iq{type = set, lang = Lang} = IQ) ->
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
process_vcard(#iq{type = get, lang = Lang} = IQ) ->
Desc = translate:translate(Lang, <<"ejabberd vCard module">>),
- Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
xmpp:make_iq_result(
IQ, #vcard_temp{fn = <<"ejabberd/mod_vcard">>,
url = ?EJABBERD_URI,
- desc = <<Desc/binary, $\n, Copyright/binary>>}).
+ desc = <<Desc/binary, $\n, ?COPYRIGHT>>}).
-spec process_search(iq()) -> iq().
process_search(#iq{type = get, to = To, lang = Lang} = IQ) ->
diff --git a/test/proxy65_tests.erl b/test/proxy65_tests.erl
index 01292f508..49e195d38 100644
--- a/test/proxy65_tests.erl
+++ b/test/proxy65_tests.erl
@@ -24,12 +24,20 @@
%%%===================================================================
single_cases() ->
{proxy65_single, [sequence],
- [single_test(feature_enabled)]}.
+ [single_test(feature_enabled),
+ single_test(service_vcard)]}.
feature_enabled(Config) ->
true = is_feature_advertised(Config, ?NS_BYTESTREAMS, proxy_jid(Config)),
disconnect(Config).
+service_vcard(Config) ->
+ JID = proxy_jid(Config),
+ ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+ #iq{type = result, sub_els = [#vcard_temp{}]} =
+ send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
+ disconnect(Config).
+
%%%===================================================================
%%% Master-slave tests
%%%===================================================================
diff --git a/test/pubsub_tests.erl b/test/pubsub_tests.erl
index fae7234e4..daffc29ec 100644
--- a/test/pubsub_tests.erl
+++ b/test/pubsub_tests.erl
@@ -25,6 +25,7 @@
single_cases() ->
{pubsub_single, [sequence],
[single_test(test_features),
+ single_test(test_vcard),
single_test(test_create),
single_test(test_configure),
single_test(test_delete),
@@ -67,6 +68,13 @@ test_features(Config) ->
true = sets:is_subset(NeededFeatures, AllFeatures),
disconnect(Config).
+test_vcard(Config) ->
+ JID = pubsub_jid(Config),
+ ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+ #iq{type = result, sub_els = [#vcard_temp{}]} =
+ send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
+ disconnect(Config).
+
test_create(Config) ->
Node = ?config(pubsub_node, Config),
Node = create_node(Config, Node),
diff --git a/test/vcard_tests.erl b/test/vcard_tests.erl
index bb3efb475..26cfdc92b 100644
--- a/test/vcard_tests.erl
+++ b/test/vcard_tests.erl
@@ -11,7 +11,7 @@
%% API
-compile(export_all).
-import(suite, [send_recv/2, disconnect/1, is_feature_advertised/2,
- is_feature_advertised/3,
+ is_feature_advertised/3, server_jid/1,
my_jid/1, wait_for_slave/1, wait_for_master/1,
recv_presence/1, recv/1]).
@@ -26,7 +26,8 @@
single_cases() ->
{vcard_single, [sequence],
[single_test(feature_enabled),
- single_test(get_set)]}.
+ single_test(get_set),
+ single_test(service_vcard)]}.
feature_enabled(Config) ->
BareMyJID = jid:remove_resource(my_jid(Config)),
@@ -72,6 +73,13 @@ get_set(Config) ->
send_recv(Config, #iq{type = get, sub_els = [#vcard_temp{}]}),
disconnect(Config).
+service_vcard(Config) ->
+ JID = server_jid(Config),
+ ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+ #iq{type = result, sub_els = [#vcard_temp{}]} =
+ send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
+ disconnect(Config).
+
%%%===================================================================
%%% Master-slave tests
%%%===================================================================