Comparison

plugins/muc/muc.lib.lua @ 8836:564e897f0790

MUC: reject non-bare JIDs in set_affiliation requests with not-acceptable
author Jonas Wielicki <jonas@wielicki.name>
date Thu, 17 May 2018 17:11:25 +0200
parent 8835:a7221ada9368
child 8837:1b10802a770e
comparison
equal deleted inserted replaced
8835:a7221ada9368 8836:564e897f0790
1074 -- First let's see if there are any problems with the affiliations given 1074 -- First let's see if there are any problems with the affiliations given
1075 -- in jid_affiliation 1075 -- in jid_affiliation
1076 for jid, value in pairs(jid_affiliation) do 1076 for jid, value in pairs(jid_affiliation) do
1077 local affiliation = value["affiliation"]; 1077 local affiliation = value["affiliation"];
1078 1078
1079 if jid ~= jid_bare(jid) then
1080 return false, "modify", "not-acceptable";
1081 end
1079 jid = jid_bare(jid); 1082 jid = jid_bare(jid);
1080 if affiliation == "none" then affiliation = nil; end 1083 if affiliation == "none" then affiliation = nil; end
1081 if affiliation and affiliation ~= "outcast" and affiliation ~= "owner" and affiliation ~= "admin" and affiliation ~= "member" then 1084 if affiliation and affiliation ~= "outcast" and affiliation ~= "owner" and affiliation ~= "admin" and affiliation ~= "member" then
1082 return false, "modify", "not-acceptable"; 1085 return false, "modify", "not-acceptable";
1083 end 1086 end