aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-03 19:31:56 +0100
committerKim Alvefur <zash@zash.se>2019-03-03 19:31:56 +0100
commit5d4504e51b8d1e77b20fffaf60cd7f2bdb80785a (patch)
tree2f850f6d31956c595e9950ae016378195acadd57 /util/pubsub.lua
parent7241f866687168f1e3f9238ea240af0f4b319ccb (diff)
downloadprosody-5d4504e51b8d1e77b20fffaf60cd7f2bdb80785a.tar.gz
prosody-5d4504e51b8d1e77b20fffaf60cd7f2bdb80785a.zip
util.pubsub: Validate node configuration on node creation (fixes #1328)
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index a53e8b95..e5e0cb7c 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -436,10 +436,19 @@ function service:create(node, actor, options) --> ok, err
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 = {};
};