mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
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
This commit is contained in:
parent
584a4b0a2b
commit
8d571adca8
@ -189,8 +189,6 @@ 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
|
|
||||||
true ->
|
|
||||||
case get_auth_admin(Auth, HostHTTP, RPath, Method) of
|
case get_auth_admin(Auth, HostHTTP, RPath, Method) of
|
||||||
{ok, {User, Server}} ->
|
{ok, {User, Server}} ->
|
||||||
AJID = get_jid(Auth, HostHTTP, Method),
|
AJID = get_jid(Auth, HostHTTP, Method),
|
||||||
@ -216,9 +214,6 @@ process(RPath,
|
|||||||
"to ejabberd\"">>}],
|
"to ejabberd\"">>}],
|
||||||
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
ejabberd_web:make_xhtml([?XCT(<<"h1">>,
|
||||||
?T("Unauthorized"))])}
|
?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) ->
|
||||||
@ -227,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} ->
|
||||||
|
case ejabberd_router:is_my_host(HostHTTP) of
|
||||||
|
true ->
|
||||||
get_auth_account(HostOfRule, AccessRule, User, HostHTTP,
|
get_auth_account(HostOfRule, AccessRule, User, HostHTTP,
|
||||||
Pass);
|
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…
Reference in New Issue
Block a user