summaryrefslogtreecommitdiff
path: root/mesh
diff options
context:
space:
mode:
authorIsak Westin <isak.westin@hotmail.com>2022-09-21 13:16:29 +0200
committerBrian Gix <brian.gix@intel.com>2022-09-22 14:02:38 -0700
commitb72edcc5ca6fd0b3728a37cfa2bfbf483953ebba (patch)
treeb64934a461b3c12734ca8237365143467f83c297 /mesh
parenta76ff5879b755b97043a30682c97788d162bb229 (diff)
downloadbluez-b72edcc5ca6fd0b3728a37cfa2bfbf483953ebba.tar.gz
mesh: Do not accept publication for unbound appkey
If a user tries to configure publication of a model with an appkey that is not bound to that model, an error should be returned.
Diffstat (limited to 'mesh')
-rw-r--r--mesh/model.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mesh/model.c b/mesh/model.c
index 82078ed85..d48e6ef12 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -1063,7 +1063,8 @@ int mesh_model_pub_set(struct mesh_node *node, uint16_t addr, uint32_t id,
if (!mod->pub_enabled || (mod->cbs && !(mod->cbs->pub)))
return MESH_STATUS_INVALID_PUB_PARAM;
- if (!appkey_have_key(node_get_net(node), idx))
+ if (!appkey_have_key(node_get_net(node), idx) ||
+ !has_binding(mod->bindings, idx))
return MESH_STATUS_INVALID_APPKEY;
/*