Skip to content

Commit 7d0c20e

Browse files
committed
mod_shared_roster: The name of a new group is lowercased
Until now it was possible to create a shared roster group with name "Group1", and it was a different group that "group1". From now on, new group names will be stored lowercase, just like the username in a Jabber ID. This only affects commands srg_add and srg_create. All the other commands are still case sensitive, to allow admins of existing databases with case-sensitive groups manage them.
1 parent ab5a2e8 commit 7d0c20e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/mod_shared_roster.erl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,19 @@ create_group(Host, Group) ->
381381
create_group(Host, Group, []).
382382

383383
create_group(Host, Group, Opts) ->
384+
case jid:nodeprep(Group) of
385+
error ->
386+
{error, invalid_group_name};
387+
LGroup ->
388+
case jid:nameprep(Host) of
389+
error ->
390+
{error, invalid_group_host};
391+
LHost ->
392+
create_group2(LHost, LGroup, Opts)
393+
end
394+
end.
395+
396+
create_group2(Host, Group, Opts) ->
384397
Mod = gen_mod:db_mod(Host, ?MODULE),
385398
case proplists:get_value(all_users, Opts, false) orelse
386399
proplists:get_value(online_users, Opts, false) of

0 commit comments

Comments
 (0)