From 5d4504e51b8d1e77b20fffaf60cd7f2bdb80785a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 3 Mar 2019 19:31:56 +0100 Subject: util.pubsub: Validate node configuration on node creation (fixes #1328) --- util/pubsub.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'util') 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 = {}; }; -- cgit v1.2.3