comparison mod_cloud_notify/mod_cloud_notify.lua @ 3996:42682505e692

mod_cloud_notify: Forbid user from registering their own JID as their push server
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 27 Apr 2020 23:07:01 +0200
parents 6bf362008052
children fa79d19d0fdd
comparison
equal deleted inserted replaced
3995:4c9805f29f2d 3996:42682505e692
171 if not push_jid then 171 if not push_jid then
172 origin.log("debug", "Push notification enable request missing the 'jid' field"); 172 origin.log("debug", "Push notification enable request missing the 'jid' field");
173 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing jid")); 173 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing jid"));
174 return true; 174 return true;
175 end 175 end
176 if push_jid == stanza.attr.from then
177 origin.log("debug", "Push notification enable request 'jid' field identical to our own");
178 origin.send(st.error_reply(stanza, "modify", "bad-request", "JID must be different from ours"));
179 return true;
180 end
176 local publish_options = enable:get_child("x", "jabber:x:data"); 181 local publish_options = enable:get_child("x", "jabber:x:data");
177 if not publish_options then 182 if not publish_options then
178 -- Could be intentional 183 -- Could be intentional
179 origin.log("debug", "No publish options in request"); 184 origin.log("debug", "No publish options in request");
180 end 185 end