25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

* src/acl.erl: Normalize ACL before adding to the configuration

tables (EJAB-521)

SVN Revision: 1185
This commit is contained in:
Badlop 2008-02-12 01:04:47 +00:00
parent edad54d961
commit 866e5c2d82
2 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2008-02-12 Badlop <badlop@process-one.net>
* src/acl.erl: Normalize ACL before adding to the configuration
tables (EJAB-521)
2008-02-11 Mickael Remond <mremond@process-one.net> 2008-02-11 Mickael Remond <mremond@process-one.net>
* src/ejabberd_auth.erl: Do not allow empty password at * src/ejabberd_auth.erl: Do not allow empty password at

View File

@ -48,12 +48,12 @@ start() ->
ok. ok.
to_record(Host, ACLName, ACLSpec) -> to_record(Host, ACLName, ACLSpec) ->
#acl{aclname = {ACLName, Host}, aclspec = ACLSpec}. #acl{aclname = {ACLName, Host}, aclspec = normalize_spec(ACLSpec)}.
add(Host, ACLName, ACLSpec) -> add(Host, ACLName, ACLSpec) ->
F = fun() -> F = fun() ->
mnesia:write(#acl{aclname = {ACLName, Host}, mnesia:write(#acl{aclname = {ACLName, Host},
aclspec = ACLSpec}) aclspec = normalize_spec(ACLSpec)})
end, end,
mnesia:transaction(F). mnesia:transaction(F).
@ -75,7 +75,7 @@ add_list(Host, ACLs, Clear) ->
aclspec = ACLSpec} -> aclspec = ACLSpec} ->
mnesia:write( mnesia:write(
#acl{aclname = {ACLName, Host}, #acl{aclname = {ACLName, Host},
aclspec = ACLSpec}) aclspec = normalize_spec(ACLSpec)})
end end
end, ACLs) end, ACLs)
end, end,
@ -86,6 +86,17 @@ add_list(Host, ACLs, Clear) ->
false false
end. end.
normalize(A) ->
jlib:nodeprep(A).
normalize_spec({A, B}) ->
{A, normalize(B)};
normalize_spec({A, B, C}) ->
{A, normalize(B), normalize(C)};
normalize_spec(all) ->
all;
normalize_spec(none) ->
none.
match_rule(global, Rule, JID) -> match_rule(global, Rule, JID) ->