25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

mod_muc_room: Don't expose JIDs in anonymous rooms

Don't let room members retrieve the member list unless the room is
non-anonymous.
This commit is contained in:
Holger Weiss 2016-02-11 22:24:14 +01:00
parent 3908c9710c
commit 041e886b87
2 changed files with 12 additions and 11 deletions

View File

@ -2569,7 +2569,8 @@ process_iq_admin(From, get, Lang, SubEl, StateData) ->
SAffiliation ->
if (FAffiliation == owner) or
(FAffiliation == admin) or
((FAffiliation == member) and (SAffiliation == member)) ->
((FAffiliation == member) and (SAffiliation == member) and
not (StateData#state.config)#config.anonymous) ->
Items = items_with_affiliation(SAffiliation,
StateData),
{result, Items, StateData};

View File

@ -1210,6 +1210,16 @@ muc_master(Config) ->
%% Receive groupchat message from the peer
?recv1(#message{type = groupchat, from = PeerNickJID,
body = [#text{data = Subject}]}),
%% Retrieving a member list
#iq{type = result, sub_els = [#muc_admin{items = MemberList}]} =
send_recv(Config,
#iq{type = get, to = Room,
sub_els =
[#muc_admin{items = [#muc_item{affiliation = member}]}]}),
[#muc_item{affiliation = member,
jid = Localhost},
#muc_item{affiliation = member,
jid = MyBareJID}] = lists:keysort(#muc_item.jid, MemberList),
%% Kick the peer
I2 = send(Config,
#iq{type = set, to = Room,
@ -1329,16 +1339,6 @@ muc_slave(Config) ->
#muc_user{
items = [#muc_item{role = participant,
affiliation = member}]}]}),
%% Retrieving a member list
#iq{type = result, sub_els = [#muc_admin{items = MemberList}]} =
send_recv(Config,
#iq{type = get, to = Room,
sub_els =
[#muc_admin{items = [#muc_item{affiliation = member}]}]}),
[#muc_item{affiliation = member,
jid = Localhost},
#muc_item{affiliation = member,
jid = MyBareJID}] = lists:keysort(#muc_item.jid, MemberList),
%% Sending groupchat message
send(Config, #message{to = Room, type = groupchat,
body = [#text{data = Subject}]}),