From: Guus Sliepen Date: Mon, 8 Feb 2021 17:14:38 +0000 (+0100) Subject: Add missing config file update on receiving a proactive REQ_KEY request. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=42c2dd52c43dceb72127e3a02103ea8338c8dae2;p=meshlink Add missing config file update on receiving a proactive REQ_KEY request. A REQ_KEY request from a node that wants our key can contain their key as well. The node status was not set to dirty in this case, which could prevent their key from being written to disk with the default settings, but this actually always forgot to write the key to disk with storage policy set to KEYS_ONLY. --- diff --git a/src/protocol_key.c b/src/protocol_key.c index 693b96db..6a2946eb 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -146,6 +146,13 @@ static bool req_key_ext_h(meshlink_handle_t *mesh, connection_t *c, const char * logger(mesh, MESHLINK_ERROR, "Got bad %s from %s: %s", "REQ_PUBKEY", from->name, "invalid pubkey"); return true; } + + logger(mesh, MESHLINK_INFO, "Learned ECDSA public key from %s", from->name); + from->status.dirty = true; + + if(!node_write_config(mesh, from, true)) { + // ignore + } } }