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
@@ -270,8 +270,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
|
||||
// change admin password
|
||||
char pw[sizeof(_prefs->password)];
|
||||
StrHelper::strncpy(pw, &command[9], sizeof(pw));
|
||||
if (_prefs->ro_password[0] && strcmp(pw, _prefs->ro_password) == 0) {
|
||||
strcpy(reply, "Error, same as ro.password");
|
||||
if (strcmp(pw, _prefs->guest_password) == 0 || (_prefs->ro_password[0] && strcmp(pw, _prefs->ro_password) == 0)) {
|
||||
strcpy(reply, "Error, must differ from guest and ro passwords");
|
||||
} else {
|
||||
strcpy(_prefs->password, pw);
|
||||
savePrefs();
|
||||
@@ -492,16 +492,16 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
||||
} else if (memcmp(config, "guest.password ", 15) == 0) {
|
||||
char pw[sizeof(_prefs->guest_password)];
|
||||
StrHelper::strncpy(pw, &config[15], sizeof(pw));
|
||||
if (pw[0] && strcmp(pw, _prefs->ro_password) == 0) {
|
||||
strcpy(reply, "Error, same as ro.password");
|
||||
if (pw[0] && (strcmp(pw, _prefs->password) == 0 || strcmp(pw, _prefs->ro_password) == 0)) {
|
||||
strcpy(reply, "Error, must differ from admin and ro passwords");
|
||||
} else {
|
||||
strcpy(_prefs->guest_password, pw);
|
||||
savePrefs();
|
||||
strcpy(reply, "OK");
|
||||
}
|
||||
} else if (memcmp(config, "ro.password ", 12) == 0) {
|
||||
} else if (memcmp(config, "ro.password", 11) == 0 && (config[11] == 0 || config[11] == ' ')) {
|
||||
char pw[sizeof(_prefs->ro_password)];
|
||||
StrHelper::strncpy(pw, &config[12], sizeof(pw));
|
||||
StrHelper::strncpy(pw, config[11] ? &config[12] : "", sizeof(pw)); // no value clears it
|
||||
if (pw[0] && (strcmp(pw, _prefs->password) == 0 || strcmp(pw, _prefs->guest_password) == 0)) {
|
||||
strcpy(reply, "Error, must differ from admin and guest passwords");
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user