mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix access_commands option in ejabberd_xmlrpc, now it works
This commit is contained in:
parent
4575649e10
commit
7690320f0f
@ -399,7 +399,14 @@ check_auth({User, Server, Password}) ->
|
|||||||
check_access(all, _) ->
|
check_access(all, _) ->
|
||||||
true;
|
true;
|
||||||
check_access(Access, Auth) ->
|
check_access(Access, Auth) ->
|
||||||
{ok, User, Server} = check_auth(Auth),
|
case check_auth(Auth) of
|
||||||
|
{ok, User, Server} ->
|
||||||
|
check_access(Access, User, Server);
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end.
|
||||||
|
|
||||||
|
check_access(Access, User, Server) ->
|
||||||
%% Check this user has access permission
|
%% Check this user has access permission
|
||||||
case acl:match_rule(Server, Access, jlib:make_jid(User, Server, <<"">>)) of
|
case acl:match_rule(Server, Access, jlib:make_jid(User, Server, <<"">>)) of
|
||||||
allow -> true;
|
allow -> true;
|
||||||
|
@ -299,13 +299,16 @@ process_header(State, Data) ->
|
|||||||
_ -> ok
|
_ -> ok
|
||||||
end,
|
end,
|
||||||
#state{sockmod = SockMod, socket = Socket,
|
#state{sockmod = SockMod, socket = Socket,
|
||||||
|
options = State#state.options,
|
||||||
request_handlers = State#state.request_handlers};
|
request_handlers = State#state.request_handlers};
|
||||||
_ ->
|
_ ->
|
||||||
#state{end_of_request = true,
|
#state{end_of_request = true,
|
||||||
|
options = State#state.options,
|
||||||
request_handlers = State#state.request_handlers}
|
request_handlers = State#state.request_handlers}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
#state{end_of_request = true,
|
#state{end_of_request = true,
|
||||||
|
options = State#state.options,
|
||||||
request_handlers = State#state.request_handlers}
|
request_handlers = State#state.request_handlers}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -360,23 +360,17 @@ build_fault_response(Code, ParseString, ParseArgs) ->
|
|||||||
FaultString = "Error " ++ integer_to_list(Code) ++ "\n"
|
FaultString = "Error " ++ integer_to_list(Code) ++ "\n"
|
||||||
++ lists:flatten(io_lib:format(ParseString, ParseArgs)),
|
++ lists:flatten(io_lib:format(ParseString, ParseArgs)),
|
||||||
?WARNING_MSG(FaultString, []),
|
?WARNING_MSG(FaultString, []),
|
||||||
{false, {response, {fault, Code, FaultString}}}.
|
{false, {response, {fault, Code, list_to_binary(FaultString)}}}.
|
||||||
|
|
||||||
do_command(AccessCommands, Auth, Command, AttrL, ArgsF,
|
do_command(AccessCommands, Auth, Command, AttrL, ArgsF,
|
||||||
ResultF) ->
|
ResultF) ->
|
||||||
ArgsFormatted = format_args(AttrL, ArgsF),
|
ArgsFormatted = format_args(AttrL, ArgsF),
|
||||||
AuthBin = convert_auth(Auth),
|
|
||||||
Result =
|
Result =
|
||||||
ejabberd_commands:execute_command(AccessCommands, AuthBin,
|
ejabberd_commands:execute_command(AccessCommands, Auth,
|
||||||
Command, ArgsFormatted),
|
Command, ArgsFormatted),
|
||||||
ResultFormatted = format_result(Result, ResultF),
|
ResultFormatted = format_result(Result, ResultF),
|
||||||
{command_result, ResultFormatted}.
|
{command_result, ResultFormatted}.
|
||||||
|
|
||||||
convert_auth(noauth) ->
|
|
||||||
noauth;
|
|
||||||
convert_auth({UserT, ServerT, PasswordT}) ->
|
|
||||||
{list_to_binary(UserT), list_to_binary(ServerT), list_to_binary(PasswordT)}.
|
|
||||||
|
|
||||||
%%-----------------------------
|
%%-----------------------------
|
||||||
%% Format arguments
|
%% Format arguments
|
||||||
%%-----------------------------
|
%%-----------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user