mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 10:42:49 +00:00
Add boolean to only warn a user of a duplicated key once per boot
This commit is contained in:
@@ -1566,7 +1566,8 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
|
|||||||
printBytes("Incoming Pubkey: ", p.public_key.bytes, 32);
|
printBytes("Incoming Pubkey: ", p.public_key.bytes, 32);
|
||||||
|
|
||||||
// Alert the user if a remote node is advertising public key that matches our own
|
// Alert the user if a remote node is advertising public key that matches our own
|
||||||
if (owner.public_key.size == 32 && memcmp(p.public_key.bytes, owner.public_key.bytes, 32) == 0) {
|
if (owner.public_key.size == 32 && memcmp(p.public_key.bytes, owner.public_key.bytes, 32) == 0 && !duplicateWarned) {
|
||||||
|
duplicateWarned = true;
|
||||||
char warning[] = "Remote device %s has advertised your public key. This may indicate a low-entropy key. You may need "
|
char warning[] = "Remote device %s has advertised your public key. This may indicate a low-entropy key. You may need "
|
||||||
"to regenerate your public keys.";
|
"to regenerate your public keys.";
|
||||||
LOG_WARN(warning, p.long_name);
|
LOG_WARN(warning, p.long_name);
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ class NodeDB
|
|||||||
int restoreWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
int restoreWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool duplicateWarned = false;
|
||||||
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash
|
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash
|
||||||
uint32_t lastBackupAttempt = 0; // when we last tried a backup automatically or manually
|
uint32_t lastBackupAttempt = 0; // when we last tried a backup automatically or manually
|
||||||
/// Find a node in our DB, create an empty NodeInfoLite if missing
|
/// Find a node in our DB, create an empty NodeInfoLite if missing
|
||||||
|
|||||||
Reference in New Issue
Block a user