summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2021-01-21 14:20:30 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2021-01-21 14:20:30 +0100
commit5212b0aaa6a9e35ec7f3fd075d19b44a362b1d03 (patch)
tree3ca393f3740622f7f72f09c0eb2b2a7874e8e12c /src
parentUpdate xmpp (diff)
Validate affiliations in set_room_affiliation command
Diffstat (limited to 'src')
-rw-r--r--src/mod_muc_admin.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl
index d80e7158..e35b1941 100644
--- a/src/mod_muc_admin.erl
+++ b/src/mod_muc_admin.erl
@@ -1237,7 +1237,15 @@ get_room_affiliation(Name, Service, JID) ->
%% If the affiliation is 'none', the action is to remove,
%% In any other case the action will be to create the affiliation.
set_room_affiliation(Name, Service, JID, AffiliationString) ->
- Affiliation = misc:binary_to_atom(AffiliationString),
+ Affiliation = case AffiliationString of
+ <<"outcast">> -> outcast;
+ <<"none">> -> none;
+ <<"member">> -> member;
+ <<"admin">> -> admin;
+ <<"owner">> -> owner;
+ _ ->
+ throw({error, "Invalid affiliation"})
+ end,
case get_room_pid(Name, Service) of
Pid when is_pid(Pid) ->
%% Get the PID for the online room so we can get the state of the room