Skip to content

Commit 95e533d

Browse files
author
Scott Powell
committed
* repeater & room server fix for blank guest password
1 parent 7bcf1f1 commit 95e533d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/simple_repeater/MyMesh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ void MyMesh::putNeighbour(const mesh::Identity &id, uint32_t timestamp, float sn
8383
}
8484

8585
uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data) {
86-
ClientInfo* client;
86+
ClientInfo* client = NULL;
8787
if (data[0] == 0) { // blank password, just check if sender is in ACL
8888
client = acl.getClient(sender.pub_key, PUB_KEY_SIZE);
8989
if (client == NULL) {
9090
#if MESH_DEBUG
9191
MESH_DEBUG_PRINTLN("Login, sender not in ACL");
9292
#endif
93-
return 0;
9493
}
95-
} else {
94+
}
95+
if (client == NULL) {
9696
uint8_t perms;
9797
if (strcmp((char *)data, _prefs.password) == 0) { // check for valid admin password
9898
perms = PERM_ACL_ADMIN;

examples/simple_room_server/MyMesh.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,16 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
289289

290290
data[len] = 0; // ensure null terminator
291291

292-
ClientInfo* client;
292+
ClientInfo* client = NULL;
293293
if (data[8] == 0 && !_prefs.allow_read_only) { // blank password, just check if sender is in ACL
294294
client = acl.getClient(sender.pub_key, PUB_KEY_SIZE);
295295
if (client == NULL) {
296296
#if MESH_DEBUG
297297
MESH_DEBUG_PRINTLN("Login, sender not in ACL");
298298
#endif
299-
return;
300299
}
301-
} else {
300+
}
301+
if (client == NULL) {
302302
uint8_t perm;
303303
if (strcmp((char *)&data[8], _prefs.password) == 0) { // check for valid admin password
304304
perm = PERM_ACL_ADMIN;

0 commit comments

Comments
 (0)