Track shared-password logins in RAM, tighten eviction and passwords
Mark guest and read-only logins with a RAM-only flag instead of an ACL permission bit, so saved permission bytes keep their meaning. Inserts evict unsaved entries before saved ones. Sensors refuse GPS movement deltas from shared-password subscribers and give promoted admins the default alert flags. The admin, guest and read-only passwords must all differ, and set ro.password with no value clears it.
This commit is contained in:
1 parent
c9322f5759
commit
3513ddfc01
7 files changed
+45
-27
No files matched your search
@@ -115,7 +115,7 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
|
||||
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 | PERM_ACL_TRANSIENT;
|
||||
perms = PERM_ACL_READ_ONLY;
|
||||
} else if (strcmp((char *)data, _prefs.guest_password) == 0) { // check guest password
|
||||
perms = PERM_ACL_GUEST;
|
||||
} else {
|
||||
@@ -135,9 +135,10 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
|
||||
|
||||
MESH_DEBUG_PRINTLN("Login success!");
|
||||
client->last_timestamp = sender_timestamp;
|
||||
if (!shared_pw || client->permissions == 0 || (client->permissions & PERM_ACL_TRANSIENT)) { // shared passwords don't change saved entries
|
||||
client->permissions &= ~(PERM_ACL_ROLE_MASK | PERM_ACL_TRANSIENT);
|
||||
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;
|
||||
}
|
||||
memcpy(client->shared_secret, secret, PUB_KEY_SIZE);
|
||||
|
||||
|
||||
Reference in new issue
Block a user