mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +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, _) ->
|
||||
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;
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
%%-----------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user