Mercurial > prosody-hg
comparison core/moduleapi.lua @ 12652:30e2a0107217
moduleapi: Stricter type check for actor in permission check
Non-table but truthy values would trigger "attempt to index a foo value"
on the next line otherwise
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 20 Jul 2022 13:08:07 +0200 |
| parents | 1ce98f27eabe |
| children | 07424992d7fc |
comparison
equal
deleted
inserted
replaced
| 12651:1ce98f27eabe | 12652:30e2a0107217 |
|---|---|
| 643 end | 643 end |
| 644 return permit; | 644 return permit; |
| 645 end | 645 end |
| 646 | 646 |
| 647 local session = context.origin or context.session; | 647 local session = context.origin or context.session; |
| 648 if not session then | 648 if type(session) ~= "table" then |
| 649 error("Unable to identify actor session from context"); | 649 error("Unable to identify actor session from context"); |
| 650 end | 650 end |
| 651 if session.type == "s2sin" or (session.type == "c2s" and session.host ~= self.host) then | 651 if session.type == "s2sin" or (session.type == "c2s" and session.host ~= self.host) then |
| 652 local actor_jid = context.stanza.attr.from; | 652 local actor_jid = context.stanza.attr.from; |
| 653 local role = hosts[self.host].authz.get_jid_role(actor_jid); | 653 local role = hosts[self.host].authz.get_jid_role(actor_jid); |
