Software / code / prosody
Comparison
plugins/muc/register.lib.lua @ 10342:dab2a7a82170
MUC: Validate registration dataform more carefully
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 20 Oct 2019 14:54:57 +0200 |
| parent | 10225:9bdd9b6bf362 |
| child | 10343:7651b80aaec3 |
comparison
equal
deleted
inserted
replaced
| 10340:5c6912289ce3 | 10342:dab2a7a82170 |
|---|---|
| 134 end | 134 end |
| 135 origin.send(reply); | 135 origin.send(reply); |
| 136 return true; | 136 return true; |
| 137 end | 137 end |
| 138 local form_tag = query:get_child("x", "jabber:x:data"); | 138 local form_tag = query:get_child("x", "jabber:x:data"); |
| 139 local reg_data = form_tag and registration_form:data(form_tag); | 139 if not form_tag then |
| 140 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform")); | |
| 141 return true; | |
| 142 end | |
| 143 local form_type, err = dataforms.get_type(form_tag); | |
| 144 if not form_type then | |
| 145 origin.send(st.error_reply(stanza, "modify", "bad-request", "Error with form: "..err)); | |
| 146 return true; | |
| 147 elseif form_type ~= "http://jabber.org/protocol/muc#register" then | |
| 148 origin.send(st.error_reply(stanza, "modify", "bad-request", "Error in form")); | |
| 149 return true; | |
| 150 end | |
| 151 local reg_data = registration_form:data(form_tag); | |
| 140 if not reg_data then | 152 if not reg_data then |
| 141 origin.send(st.error_reply(stanza, "modify", "bad-request", "Error in form")); | 153 origin.send(st.error_reply(stanza, "modify", "bad-request", "Error in form")); |
| 142 return true; | 154 return true; |
| 143 end | 155 end |
| 144 -- Is the nickname valid? | 156 -- Is the nickname valid? |