]> granicus.if.org Git - ejabberd/commitdiff
Fix access_commands option in ejabberd_xmlrpc, now it works
authorBadlop <badlop@process-one.net>
Thu, 15 Jan 2015 16:39:12 +0000 (17:39 +0100)
committerBadlop <badlop@process-one.net>
Thu, 15 Jan 2015 16:39:12 +0000 (17:39 +0100)
src/ejabberd_commands.erl
src/ejabberd_http.erl
src/ejabberd_xmlrpc.erl

index 6c8d0b921b44dcf29f5402c338ce31069dc67cb3..c279f2d0f6fab5454c520612cc1d610cc9662d2f 100644 (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;
index 9509038f57efcbf5cbb980bbf9a5ce1d33a5ce68..289d541271404ba656987afaff5c96d3358c91ad 100644 (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.
 
index b59001819cf079e3d3c7cd01b59316fd6031b0e2..b1bd164a68157a73149f1549354cac8b975e6627 100644 (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
 %%-----------------------------