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

+9
View File
@@ -374,11 +374,20 @@ uint8_t SensorMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t*
#endif
return 0;
}
// CUSTOM (TeTeHacko): a blank login has a replay floor too -- replayed, it
// gained nothing, but each copy made us send a reply.
if (sender_timestamp <= client->last_timestamp) return 0;
acl.persistTimestamp(client, sender_timestamp, getRTCClock()->getCurrentTime());
client->last_timestamp = sender_timestamp;
} else {
// 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
#if MESH_DEBUG
MESH_DEBUG_PRINTLN("Invalid password: %s", &data[0]);
#endif
login_guard.failed(millis()); // CUSTOM (TeTeHacko)
return 0;
}