From 96c183c04b46d3f2dee352c4ff494609c95e2cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Wed, 21 Mar 2018 12:53:46 +0100 Subject: [PATCH] Accept atoms in api_permission command lists and commands with numbers in them --- src/ejabberd_access_permissions.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ejabberd_access_permissions.erl b/src/ejabberd_access_permissions.erl index a863e1557..3a7f81d53 100644 --- a/src/ejabberd_access_permissions.erl +++ b/src/ejabberd_access_permissions.erl @@ -492,6 +492,8 @@ parse_single_what(Binary) when is_binary(Binary) -> _ -> {error, <<"Invalid value">>} end; +parse_single_what(Atom) when is_atom(Atom) -> + parse_single_what(atom_to_binary(Atom, latin1)); parse_single_what(_) -> {error, <<"Invalid value">>}. @@ -502,7 +504,9 @@ is_valid_command_name(Val) -> is_valid_command_name2(<<>>) -> true; -is_valid_command_name2(<>) when K >= $a andalso K =< $z orelse K == $_ -> +is_valid_command_name2(<>) when (K >= $a andalso K =< $z) + orelse (K >= $0 andalso K =< $9) + orelse K == $_ -> is_valid_command_name2(Rest); is_valid_command_name2(_) -> false.