25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Fix access_commands option in ejabberd_xmlrpc, now it works

This commit is contained in:
Badlop 2015-01-15 17:39:12 +01:00
parent 4575649e10
commit 7690320f0f
3 changed files with 13 additions and 9 deletions

View File

@ -399,7 +399,14 @@ check_auth({User, Server, Password}) ->
check_access(all, _) ->
true;
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
case acl:match_rule(Server, Access, jlib:make_jid(User, Server, <<"">>)) of
allow -> true;

View File

@ -299,13 +299,16 @@ process_header(State, Data) ->
_ -> ok
end,
#state{sockmod = SockMod, socket = Socket,
options = State#state.options,
request_handlers = State#state.request_handlers};
_ ->
#state{end_of_request = true,
options = State#state.options,
request_handlers = State#state.request_handlers}
end;
_ ->
#state{end_of_request = true,
options = State#state.options,
request_handlers = State#state.request_handlers}
end.

View File

@ -360,23 +360,17 @@ build_fault_response(Code, ParseString, ParseArgs) ->
FaultString = "Error " ++ integer_to_list(Code) ++ "\n"
++ lists:flatten(io_lib:format(ParseString, ParseArgs)),
?WARNING_MSG(FaultString, []),
{false, {response, {fault, Code, FaultString}}}.
{false, {response, {fault, Code, list_to_binary(FaultString)}}}.
do_command(AccessCommands, Auth, Command, AttrL, ArgsF,
ResultF) ->
ArgsFormatted = format_args(AttrL, ArgsF),
AuthBin = convert_auth(Auth),
Result =
ejabberd_commands:execute_command(AccessCommands, AuthBin,
ejabberd_commands:execute_command(AccessCommands, Auth,
Command, ArgsFormatted),
ResultFormatted = format_result(Result, ResultF),
{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
%%-----------------------------