net: lwm2m: Don't allow operations on security object

In spec:
The LwM2M Client MUST reject any LwM2M Server operation on
the Security Object (ID: 0) with an "4.01 Unauthorized" response
 code.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit is contained in:
Seppo Takalo 2023-09-20 13:26:41 +03:00 committed by Carles Cufí
commit b0303f5bd3

View file

@ -2330,6 +2330,11 @@ int handle_request(struct coap_packet *request, struct lwm2m_message *msg)
goto error;
}
#endif
if (msg->path.obj_id == LWM2M_OBJECT_SECURITY_ID && !msg->ctx->bootstrap_mode) {
r = -EACCES;
goto error;
}
switch (msg->operation) {
case LWM2M_OP_READ: