1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-06 03:50:15 +02:00

Compare commits

...

5 commits

Author SHA1 Message Date
Paweł Chmielowski
dafb344fd8 Bump version in mix.exs 2019-10-15 09:41:31 +02:00
Paweł Chmielowski
50d64d4f50 Update changelog 2019-10-15 09:38:41 +02:00
Paweł Chmielowski
19637ce17d Verify http host in web admin only if authentication is missing host
This should allow access to web admin through ip address or just served
from domain not defined in ejabberd hosts
2019-10-15 09:35:06 +02:00
Badlop
43b97bd9d2 Update Guide links in WebAdmin to website, as local file isn't included 2019-10-15 09:34:53 +02:00
Evgeny Khramtsov
7b22031c60 Re-tag xmpp dep 2019-10-15 09:34:14 +02:00
6 changed files with 42 additions and 60 deletions

View file

@ -1,3 +1,9 @@
# Version 19.09.1
* Bugfixes
- Fix issue with webadmin returning 404 when 'Host' header doesn't match anything in configured hosts
- Change url to guide in webadmin to working one
# Version 19.09
* Admin

View file

@ -93,7 +93,7 @@
-define(GL(Ref, Title),
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
[?XAE(<<"a">>,
[{<<"href">>, <<"/admin/doc/guide.html#", Ref/binary>>},
[{<<"href">>, <<"https://docs.ejabberd.im/admin/configuration/#", Ref/binary>>},
{<<"target">>, <<"_blank">>}],
[?C(<<"[Guide: ", Title/binary, "]">>)])])).

View file

@ -3,7 +3,7 @@ defmodule Ejabberd.Mixfile do
def project do
[app: :ejabberd,
version: "19.9.0",
version: "19.9.1",
description: description(),
elixir: "~> 1.4",
elixirc_paths: ["lib"],

View file

@ -33,6 +33,6 @@
"stringprep": {:hex, :stringprep, "1.0.17", "bf962fe2a4d01298d220b6474689755103f703942a043908ca6cd323e8fa0947", [:rebar3], [{:p1_utils, "1.0.16", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm"},
"stun": {:hex, :stun, "1.0.29", "9678aa90302bda43af86949a6253b82c84535bd1aacdd8de7f052b68234f91b3", [:rebar3], [{:fast_tls, "1.1.2", [hex: :fast_tls, repo: "hexpm", optional: false]}, {:p1_utils, "1.0.16", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"},
"xmpp": {:hex, :xmpp, "1.4.1", "7a41bbeaebaceadcc16128449e1b6d535bb1b9479739064288abbe93f8870170", [:rebar3], [{:ezlib, "1.0.6", [hex: :ezlib, repo: "hexpm", optional: false]}, {:fast_tls, "1.1.2", [hex: :fast_tls, repo: "hexpm", optional: false]}, {:fast_xml, "1.1.37", [hex: :fast_xml, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:p1_utils, "1.0.16", [hex: :p1_utils, repo: "hexpm", optional: false]}, {:stringprep, "1.0.17", [hex: :stringprep, repo: "hexpm", optional: false]}], "hexpm"},
"xmpp": {:hex, :xmpp, "1.4.2", "7a41bbeaebaceadcc16128449e1b6d535bb1b9479739064288abbe93f8870170", [:rebar3], [{:ezlib, "1.0.6", [hex: :ezlib, repo: "hexpm", optional: false]}, {:fast_tls, "1.1.2", [hex: :fast_tls, repo: "hexpm", optional: false]}, {:fast_xml, "1.1.37", [hex: :fast_xml, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:p1_utils, "1.0.16", [hex: :p1_utils, repo: "hexpm", optional: false]}, {:stringprep, "1.0.17", [hex: :stringprep, repo: "hexpm", optional: false]}], "hexpm"},
"yconf": {:hex, :yconf, "1.0.1", "970fbbe53df7113914488909943abbbe788fff94166b4e39afaebc3e73f2a4f7", [:rebar3], [{:fast_yaml, "1.0.21", [hex: :fast_yaml, repo: "hexpm", optional: false]}], "hexpm"},
}

View file

@ -25,7 +25,7 @@
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.17"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.37"}}},
{idna, ".*", {git, "https://github.com/benoitc/erlang-idna", {tag, "6.0.0"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.4.1"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.4.2"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.21"}}},
{yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.1"}}},
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},

View file

@ -150,30 +150,6 @@ url_to_path(URL) -> str:tokens(URL, <<"/">>).
%%%==================================
%%%% process/2
process([<<"doc">>, LocalFile], _Request) ->
DocPath = case os:getenv("EJABBERD_DOC_PATH") of
P when is_list(P) -> P;
false -> <<"/share/doc/ejabberd/">>
end,
FileName = filename:join(DocPath, LocalFile),
case file:read_file(FileName) of
{ok, FileContents} ->
?DEBUG("Delivering content.", []),
{200, [{<<"Server">>, <<"ejabberd">>}], FileContents};
{error, Error} ->
Help = <<" ", FileName/binary,
" - Try to specify the path to ejabberd "
"documentation with the environment variable "
"EJABBERD_DOC_PATH. Check the ejabberd "
"Guide for more information.">>,
?WARNING_MSG("Problem '~p' accessing the local Guide file ~ts", [Error, Help]),
case Error of
eacces -> {403, [], <<"Forbidden", Help/binary>>};
enoent -> {307, [{<<"Location">>, <<"http://docs.ejabberd.im/admin/guide/configuration/">>}], <<"Not found", Help/binary>>};
_Else ->
{404, [], <<(iolist_to_binary(atom_to_list(Error)))/binary, Help/binary>>}
end
end;
process([<<"server">>, SHost | RPath] = Path,
#request{auth = Auth, lang = Lang, host = HostHTTP,
method = Method} =
@ -213,8 +189,6 @@ process(RPath,
#request{auth = Auth, lang = Lang, host = HostHTTP,
method = Method} =
Request) ->
case ejabberd_router:is_my_host(HostHTTP) of
true ->
case get_auth_admin(Auth, HostHTTP, RPath, Method) of
{ok, {User, Server}} ->
AJID = get_jid(Auth, HostHTTP, Method),
@ -240,9 +214,6 @@ process(RPath,
"to ejabberd\"">>}],
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
?T("Unauthorized"))])}
end;
false ->
ejabberd_web:error(not_found)
end.
get_auth_admin(Auth, HostHTTP, RPath, Method) ->
@ -251,8 +222,13 @@ get_auth_admin(Auth, HostHTTP, RPath, Method) ->
{HostOfRule, AccessRule} = get_acl_rule(RPath, Method),
try jid:decode(SJID) of
#jid{user = <<"">>, server = User} ->
case ejabberd_router:is_my_host(HostHTTP) of
true ->
get_auth_account(HostOfRule, AccessRule, User, HostHTTP,
Pass);
_ ->
{unauthorized, <<"missing-server">>}
end;
#jid{user = User, server = Server} ->
get_auth_account(HostOfRule, AccessRule, User, Server,
Pass)