Software /
code /
prosody
Diff
util/pubsub.lua @ 9840:ec353524b739 0.11
util.pubsub: Validate node configuration on node creation (fixes #1328)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 03 Mar 2019 19:31:56 +0100 |
parent | 9816:7f84d7f77a00 |
child | 10356:0a2d7efca039 |
child | 10518:9f50489c2033 |
line wrap: on
line diff
--- a/util/pubsub.lua Sat Mar 02 22:26:01 2019 +0100 +++ b/util/pubsub.lua Sun Mar 03 19:31:56 2019 +0100 @@ -436,10 +436,19 @@ return false, "conflict"; end + local config = setmetatable(options or {}, {__index=self.node_defaults}); + + if self.config.check_node_config then + local ok = self.config.check_node_config(node, actor, config); + if not ok then + return false, "not-acceptable"; + end + end + self.nodes[node] = { name = node; subscribers = {}; - config = setmetatable(options or {}, {__index=self.node_defaults}); + config = config; affiliations = {}; };