diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/acl.erl | 11 | ||||
-rw-r--r-- | src/mod_admin_extra.erl | 7 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/acl.erl b/src/acl.erl index 0c1071d15..58b80b6ad 100644 --- a/src/acl.erl +++ b/src/acl.erl @@ -34,7 +34,7 @@ match_rule/3, match_acl/3, transform_options/1, opt_type/1]). --export([add_access/3]). +-export([add_access/3, clear/0]). -include("ejabberd.hrl"). -include("logger.hrl"). @@ -45,6 +45,7 @@ rules = [] :: [access_rule()]}). -type regexp() :: binary(). +-type iprange() :: {inet:ip_address(), integer()} | binary(). -type glob() :: binary(). -type access_name() :: atom(). -type access_rule() :: {atom(), any()}. @@ -63,7 +64,7 @@ {user_glob, {glob(), host()} | glob()} | {server_glob, glob()} | {resource_glob, glob()} | - {ip, {inet:ip_address(), integer()}} | + {ip, iprange()} | {node_glob, {glob(), glob()}}. -type acl() :: #acl{aclname :: aclname(), @@ -206,6 +207,12 @@ load_from_config() -> end, AccessRules) end, Hosts). +%% Delete all previous set ACLs and Access rules +clear() -> + mnesia:clear_table(acl), + mnesia:clear_table(access), + ok. + b(S) -> iolist_to_binary(S). diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index feff8af8a..cb7947876 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -600,9 +600,9 @@ check_password_hash(User, Host, PasswordHash, HashMethod) -> {A, _} when is_tuple(A) -> scrammed; {_, <<"md5">>} -> get_md5(AccountPass); {_, <<"sha">>} -> get_sha(AccountPass); - {_, _Method} -> + {_, Method} -> ?ERROR_MSG("check_password_hash called " - "with hash method", [_Method]), + "with hash method: ~p", [Method]), undefined end, case AccountPassHash of @@ -1309,8 +1309,7 @@ srg_get_info(Group, Host) -> Os when is_list(Os) -> Os; error -> [] end, - [{jlib:atom_to_binary(Title), - io_lib:format("~p", [btl(Value)])} || {Title, Value} <- Opts]. + [{jlib:atom_to_binary(Title), btl(Value)} || {Title, Value} <- Opts]. btl([]) -> []; btl([B|L]) -> [btl(B)|btl(L)]; |