Repeater, room server, sensor: passwords can no longer be guessed over the air at full speed, and a replayed login no longer floods a reply

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-18 13:03:59 +01:00
1 parent de92ca9ba2
commit dbdae14566
8 files changed
+123

No files matched your search

+10
View File
@@ -359,10 +359,19 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
#if MESH_DEBUG
MESH_DEBUG_PRINTLN("Login, sender not in ACL");
#endif
} else {
// CUSTOM (TeTeHacko): a blank login has a replay floor too -- replayed, it
// gained nothing, but each copy made us flood a reply over the mesh.
if (sender_timestamp <= client->last_timestamp) return 0;
acl.persistTimestamp(client, sender_timestamp, getRTCClock()->getCurrentTime());
client->last_timestamp = sender_timestamp;
}
}
if (client == NULL) {
uint8_t perms;
// CUSTOM (TeTeHacko): capped wrong passwords (LoginGuard.h); a known admin is never locked out
ClientInfo* known = acl.getClient(sender.pub_key, PUB_KEY_SIZE);
if (login_guard.locked(millis()) && !(known && known->isAdmin())) return 0;
if (strcmp((char *)data, _prefs.password) == 0) { // check for valid admin password
perms = PERM_ACL_ADMIN;
} else if (strcmp((char *)data, _prefs.guest_password) == 0) { // check guest password
@@ -371,6 +380,7 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
#if MESH_DEBUG
MESH_DEBUG_PRINTLN("Invalid password: %s", data);
#endif
login_guard.failed(millis()); // CUSTOM (TeTeHacko)
return 0;
}