case Spec of
all -> all;
none -> none;
- {acl, N} -> {acl, N};
- {user, {U, S}} -> {user, {nodeprep(U), nameprep(S)}};
- {user, U} -> {user, split_user_server(U, fun nodeprep/1, fun nameprep/1)};
- {shared_group, {G, H}} -> {shared_group, {b(G), nameprep(H)}};
- {shared_group, G} -> {shared_group, split_user_server(G, fun b/1, fun nameprep/1)};
- {user_regexp, {UR, S}} -> {user_regexp, {b(UR), nameprep(S)}};
- {user_regexp, UR} -> {user_regexp, split_user_server(UR, fun b/1, fun nameprep/1)};
- {node_regexp, {UR, SR}} -> {node_regexp, {b(UR), b(SR)}};
- {user_glob, {UR, S}} -> {user_glob, {b(UR), nameprep(S)}};
- {user_glob, UR} -> {user_glob, split_user_server(UR, fun b/1, fun nameprep/1)};
- {node_glob, {UR, SR}} -> {node_glob, {b(UR), b(SR)}};
- {server, S} -> {server, nameprep(S)};
- {resource, R} -> {resource, resourceprep(R)};
- {server_regexp, SR} -> {server_regexp, b(SR)};
- {resource_regexp, R} -> {resource_regexp, b(R)};
- {server_glob, S} -> {server_glob, b(S)};
- {resource_glob, R} -> {resource_glob, b(R)};
- {ip, {Net, Mask}} -> {ip, {Net, Mask}};
+ {acl, N} when is_atom(N) ->
+ {acl, N};
+ {user, {U, S}} when is_binary(U), is_binary(S) ->
+ {user, {nodeprep(U), nameprep(S)}};
+ {user, U} when is_binary(U) ->
+ {user, split_user_server(U, fun nodeprep/1, fun nameprep/1)};
+ {shared_group, {G, H}} when is_binary(G), is_binary(H) ->
+ {shared_group, {b(G), nameprep(H)}};
+ {shared_group, G} when is_binary(G) ->
+ {shared_group, split_user_server(G, fun b/1, fun nameprep/1)};
+ {user_regexp, {UR, S}} when is_binary(UR), is_binary(S) ->
+ {user_regexp, {b(UR), nameprep(S)}};
+ {user_regexp, UR} when is_binary(UR) ->
+ {user_regexp, split_user_server(UR, fun b/1, fun nameprep/1)};
+ {node_regexp, {UR, SR}} when is_binary(UR), is_binary(SR) ->
+ {node_regexp, {b(UR), b(SR)}};
+ {user_glob, {UR, S}} when is_binary(UR), is_binary(S) ->
+ {user_glob, {b(UR), nameprep(S)}};
+ {user_glob, UR} when is_binary(UR) ->
+ {user_glob, split_user_server(UR, fun b/1, fun nameprep/1)};
+ {node_glob, {UR, SR}} when is_binary(UR), is_binary(SR) ->
+ {node_glob, {b(UR), b(SR)}};
+ {server, S} when is_binary(S) ->
+ {server, nameprep(S)};
+ {resource, R} when is_binary(R) ->
+ {resource, resourceprep(R)};
+ {server_regexp, SR} when is_binary(SR) ->
+ {server_regexp, b(SR)};
+ {resource_regexp, R} when is_binary(R) ->
+ {resource_regexp, b(R)};
+ {server_glob, S} when is_binary(S) ->
+ {server_glob, b(S)};
+ {resource_glob, R} when is_binary(R) ->
+ {resource_glob, b(R)};
+ {ip, {Net, Mask}} when is_binary(Net), is_integer(Mask) ->
+ {ip, {Net, Mask}};
{ip, S} ->
case parse_ip_netmask(b(S)) of
{ok, Net, Mask} ->
error ->
?INFO_MSG("Invalid network address: ~p", [S]),
none
- end
+ end;
+ BadVal ->
+ throw({<<"Invalid acl value">>, BadVal})
end.
-spec any_rules_allowed(global | binary(), [access_name()],