]> git.meshlink.io Git - meshlink/commitdiff
Add missing config file update on receiving a proactive REQ_KEY request.
authorGuus Sliepen <guus@meshlink.io>
Mon, 8 Feb 2021 17:14:38 +0000 (18:14 +0100)
committerGuus Sliepen <guus@meshlink.io>
Mon, 8 Feb 2021 17:14:38 +0000 (18:14 +0100)
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.

src/protocol_key.c

index 693b96db5e11f09d12bc77814dd801a1e07da6c8..6a2946eb8d6ca22be39d3cbcea42fcb0a9c181d3 100644 (file)
@@ -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
+                               }
                        }
                }