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

Accept atoms in api_permission command lists and commands with numbers in them

This commit is contained in:
Paweł Chmielowski 2018-03-21 12:53:46 +01:00
parent b293e99aee
commit 96c183c04b

View File

@ -492,6 +492,8 @@ parse_single_what(Binary) when is_binary(Binary) ->
_ -> _ ->
{error, <<"Invalid value">>} {error, <<"Invalid value">>}
end; end;
parse_single_what(Atom) when is_atom(Atom) ->
parse_single_what(atom_to_binary(Atom, latin1));
parse_single_what(_) -> parse_single_what(_) ->
{error, <<"Invalid value">>}. {error, <<"Invalid value">>}.
@ -502,7 +504,9 @@ is_valid_command_name(Val) ->
is_valid_command_name2(<<>>) -> is_valid_command_name2(<<>>) ->
true; true;
is_valid_command_name2(<<K:8, Rest/binary>>) when K >= $a andalso K =< $z orelse K == $_ -> is_valid_command_name2(<<K:8, Rest/binary>>) when (K >= $a andalso K =< $z)
orelse (K >= $0 andalso K =< $9)
orelse K == $_ ->
is_valid_command_name2(Rest); is_valid_command_name2(Rest);
is_valid_command_name2(_) -> is_valid_command_name2(_) ->
false. false.