summaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorGrant Limberg <[email protected]>2023-11-20 08:16:10 -0800
committerGitHub <[email protected]>2023-11-20 08:16:10 -0800
commit663ed73768a895a8681b6ec57059109073adf8f9 (patch)
tree041d277be72e51228e91c660ddb0ae9384156eaa /controller
parenta477688e5147ee534efb27f02f21f5db75cd47e1 (diff)
parentd37dce508ac3e430099d3ba36f7e755b17f3bb82 (diff)
Merge pull request #2165 from zerotier/network-checkHEADdev
check hooks are enabled before firing
Diffstat (limited to 'controller')
-rw-r--r--controller/PostgreSQL.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp
index fd99e0ff..0ab721dc 100644
--- a/controller/PostgreSQL.cpp
+++ b/controller/PostgreSQL.cpp
@@ -1436,7 +1436,21 @@ void PostgreSQL::commitThread()
w.commit();
if (_smee != NULL && isNewMember) {
- notifyNewMember(networkId, memberId);
+ pqxx::row row = w.exec_params1(
+ "SELECT "
+ " count(h.hook_id) "
+ "FROM "
+ " ztc_hook h "
+ " INNER JOIN ztc_org o ON o.org_id = h.org_id "
+ " INNER JOIN ztc_network n ON n.owner_id = o.owner_id "
+ " WHERE "
+ "n.id = $1 ",
+ networkId
+ );
+ int64_t hookCount = row[0].as<int64_t>();
+ if (hookCount > 0) {
+ notifyNewMember(networkId, memberId);
+ }
}
const uint64_t nwidInt = OSUtils::jsonIntHex(config["nwid"], 0ULL);