Merge upstream/dev (3 commits) [upstream-sync]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
7e911aa17d
7 files changed
+135
-28
No files matched your search
@@ -384,6 +384,8 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
|
||||
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 (_prefs.ro_password[0] && strcmp((char *)data, _prefs.ro_password) == 0) { // check read-only password
|
||||
perms = PERM_ACL_READ_ONLY;
|
||||
} else if (strcmp((char *)data, _prefs.guest_password) == 0) { // check guest password
|
||||
perms = PERM_ACL_GUEST;
|
||||
} else {
|
||||
@@ -394,7 +396,8 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
|
||||
return 0;
|
||||
}
|
||||
|
||||
client = acl.putClient(sender, 0); // add to contacts (if not already known)
|
||||
bool shared_pw = perms != PERM_ACL_ADMIN;
|
||||
client = acl.putClient(sender, 0, shared_pw); // add to contacts (if not already known)
|
||||
if (client == NULL) return 0;
|
||||
if (sender_timestamp <= client->last_timestamp) {
|
||||
MESH_DEBUG_PRINTLN("Possible login replay attack!");
|
||||
@@ -402,12 +405,15 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
|
||||
}
|
||||
MESH_DEBUG_PRINTLN("Login success!");
|
||||
client->last_timestamp = sender_timestamp;
|
||||
client->permissions &= ~0x03;
|
||||
client->permissions |= perms;
|
||||
if (!shared_pw || client->permissions == 0 || client->shared_login) { // shared passwords don't change saved entries
|
||||
client->permissions &= ~PERM_ACL_ROLE_MASK;
|
||||
client->permissions |= perms;
|
||||
client->shared_login = shared_pw;
|
||||
}
|
||||
acl.persistTimestamp(client, sender_timestamp, getRTCClock()->getCurrentTime()); // CUSTOM (TeTeHacko): admin only, so after the role
|
||||
memcpy(client->shared_secret, secret, PUB_KEY_SIZE);
|
||||
|
||||
if (perms != PERM_ACL_GUEST) { // keep number of FS writes to a minimum
|
||||
if (!shared_pw) { // keep number of FS writes to a minimum
|
||||
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user