mirror of
https://github.com/processone/ejabberd
synced 2025-10-06 03:50:15 +02:00
Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dafb344fd8 | ||
![]() |
50d64d4f50 | ||
![]() |
19637ce17d | ||
![]() |
43b97bd9d2 | ||
![]() |
7b22031c60 |
6 changed files with 42 additions and 60 deletions
|
@ -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
|
# Version 19.09
|
||||||
|
|
||||||
* Admin
|
* Admin
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
-define(GL(Ref, Title),
|
-define(GL(Ref, Title),
|
||||||
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
|
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
|
||||||
[?XAE(<<"a">>,
|
[?XAE(<<"a">>,
|
||||||
[{<<"href">>, <<"/admin/doc/guide.html#", Ref/binary>>},
|
[{<<"href">>, <<"https://docs.ejabberd.im/admin/configuration/#", Ref/binary>>},
|
||||||
{<<"target">>, <<"_blank">>}],
|
{<<"target">>, <<"_blank">>}],
|
||||||
[?C(<<"[Guide: ", Title/binary, "]">>)])])).
|
[?C(<<"[Guide: ", Title/binary, "]">>)])])).
|
||||||
|
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -3,7 +3,7 @@ defmodule Ejabberd.Mixfile do
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[app: :ejabberd,
|
[app: :ejabberd,
|
||||||
version: "19.9.0",
|
version: "19.9.1",
|
||||||
description: description(),
|
description: description(),
|
||||||
elixir: "~> 1.4",
|
elixir: "~> 1.4",
|
||||||
elixirc_paths: ["lib"],
|
elixirc_paths: ["lib"],
|
||||||
|
|
2
mix.lock
2
mix.lock
|
@ -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"},
|
"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"},
|
"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"},
|
"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"},
|
"yconf": {:hex, :yconf, "1.0.1", "970fbbe53df7113914488909943abbbe788fff94166b4e39afaebc3e73f2a4f7", [:rebar3], [{:fast_yaml, "1.0.21", [hex: :fast_yaml, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.17"}}},
|
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.17"}}},
|
||||||
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.37"}}},
|
{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"}}},
|
{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"}}},
|
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.21"}}},
|
||||||
{yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.1"}}},
|
{yconf, ".*", {git, "https://github.com/processone/yconf", {tag, "1.0.1"}}},
|
||||||
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
|
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
|
||||||
|
|
|
@ -150,30 +150,6 @@ url_to_path(URL) -> str:tokens(URL, <<"/">>).
|
||||||
%%%==================================
|
%%%==================================
|
||||||
%%%% process/2
|
%%%% 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,
|
process([<<"server">>, SHost | RPath] = Path,
|
||||||
#request{auth = Auth, lang = Lang, host = HostHTTP,
|
#request{auth = Auth, lang = Lang, host = HostHTTP,
|
||||||
method = Method} =
|
method = Method} =
|
||||||
|
@ -213,36 +189,31 @@ process(RPath,
|
||||||
#request{auth = Auth, lang = Lang, host = HostHTTP,
|
#request{auth = Auth, lang = Lang, host = HostHTTP,
|
||||||
method = Method} =
|
method = Method} =
|
||||||
Request) ->
|
Request) ->
|
||||||
case ejabberd_router:is_my_host(HostHTTP) of
|
case get_auth_admin(Auth, HostHTTP, RPath, Method) of
|
||||||
true ->
|
{ok, {User, Server}} ->
|
||||||
case get_auth_admin(Auth, HostHTTP, RPath, Method) of
|
AJID = get_jid(Auth, HostHTTP, Method),
|
||||||
{ok, {User, Server}} ->
|
process_admin(global,
|
||||||
AJID = get_jid(Auth, HostHTTP, Method),
|
Request#request{path = RPath,
|
||||||
process_admin(global,
|
us = {User, Server}},
|
||||||
Request#request{path = RPath,
|
AJID);
|
||||||
us = {User, Server}},
|
{unauthorized, <<"no-auth-provided">>} ->
|
||||||
AJID);
|
{401,
|
||||||
{unauthorized, <<"no-auth-provided">>} ->
|
[{<<"WWW-Authenticate">>,
|
||||||
{401,
|
<<"basic realm=\"ejabberd\"">>}],
|
||||||
[{<<"WWW-Authenticate">>,
|
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||||
<<"basic realm=\"ejabberd\"">>}],
|
?T("Unauthorized"))])};
|
||||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
{unauthorized, Error} ->
|
||||||
?T("Unauthorized"))])};
|
{BadUser, _BadPass} = Auth,
|
||||||
{unauthorized, Error} ->
|
{IPT, _Port} = Request#request.ip,
|
||||||
{BadUser, _BadPass} = Auth,
|
IPS = ejabberd_config:may_hide_data(misc:ip_to_list(IPT)),
|
||||||
{IPT, _Port} = Request#request.ip,
|
?WARNING_MSG("Access of ~p from ~p failed with error: ~p",
|
||||||
IPS = ejabberd_config:may_hide_data(misc:ip_to_list(IPT)),
|
[BadUser, IPS, Error]),
|
||||||
?WARNING_MSG("Access of ~p from ~p failed with error: ~p",
|
{401,
|
||||||
[BadUser, IPS, Error]),
|
[{<<"WWW-Authenticate">>,
|
||||||
{401,
|
<<"basic realm=\"auth error, retry login "
|
||||||
[{<<"WWW-Authenticate">>,
|
"to ejabberd\"">>}],
|
||||||
<<"basic realm=\"auth error, retry login "
|
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||||
"to ejabberd\"">>}],
|
?T("Unauthorized"))])}
|
||||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
|
||||||
?T("Unauthorized"))])}
|
|
||||||
end;
|
|
||||||
false ->
|
|
||||||
ejabberd_web:error(not_found)
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_auth_admin(Auth, HostHTTP, RPath, Method) ->
|
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),
|
{HostOfRule, AccessRule} = get_acl_rule(RPath, Method),
|
||||||
try jid:decode(SJID) of
|
try jid:decode(SJID) of
|
||||||
#jid{user = <<"">>, server = User} ->
|
#jid{user = <<"">>, server = User} ->
|
||||||
get_auth_account(HostOfRule, AccessRule, User, HostHTTP,
|
case ejabberd_router:is_my_host(HostHTTP) of
|
||||||
Pass);
|
true ->
|
||||||
|
get_auth_account(HostOfRule, AccessRule, User, HostHTTP,
|
||||||
|
Pass);
|
||||||
|
_ ->
|
||||||
|
{unauthorized, <<"missing-server">>}
|
||||||
|
end;
|
||||||
#jid{user = User, server = Server} ->
|
#jid{user = User, server = Server} ->
|
||||||
get_auth_account(HostOfRule, AccessRule, User, Server,
|
get_auth_account(HostOfRule, AccessRule, User, Server,
|
||||||
Pass)
|
Pass)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue