From c6b4a584498ea375e6227d405b65fe4c67735017 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Tue, 14 Oct 2025 12:31:43 +1100 Subject: [PATCH] * repeater and room server: enable downgrading permissions on guest login --- examples/simple_repeater/MyMesh.cpp | 1 + examples/simple_room_server/MyMesh.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 6c85b7e0..4bb9a2bb 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -114,6 +114,7 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr MESH_DEBUG_PRINTLN("Login success!"); client->last_timestamp = sender_timestamp; client->last_activity = getRTCClock()->getCurrentTime(); + client->permissions &= ~0x03; client->permissions |= perms; memcpy(client->shared_secret, secret, PUB_KEY_SIZE); diff --git a/examples/simple_room_server/MyMesh.cpp b/examples/simple_room_server/MyMesh.cpp index e4b57f98..c1a39a11 100644 --- a/examples/simple_room_server/MyMesh.cpp +++ b/examples/simple_room_server/MyMesh.cpp @@ -286,7 +286,7 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m data[len] = 0; // ensure null terminator ClientInfo* client = NULL; - if (data[8] == 0 && !_prefs.allow_read_only) { // blank password, just check if sender is in ACL + if (data[8] == 0) { // blank password, just check if sender is in ACL client = acl.getClient(sender.pub_key, PUB_KEY_SIZE); if (client == NULL) { #if MESH_DEBUG @@ -322,6 +322,7 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m client->extra.room.push_failures = 0; client->last_activity = getRTCClock()->getCurrentTime(); + client->permissions &= ~0x03; client->permissions |= perm; memcpy(client->shared_secret, secret, PUB_KEY_SIZE);