From 041e886b8702c556fcc37d655212839db8d91004 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Thu, 11 Feb 2016 22:24:14 +0100 Subject: [PATCH] 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. --- src/mod_muc_room.erl | 3 ++- test/ejabberd_SUITE.erl | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 17b88bc5b..f25f33656 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -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}; diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl index 339a47f00..947bc4bd5 100644 --- a/test/ejabberd_SUITE.erl +++ b/test/ejabberd_SUITE.erl @@ -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}]}),