]> git.meshlink.io Git - meshlink/commitdiff
Handle host config files without a public key.
authorGuus Sliepen <guus@meshlink.io>
Tue, 5 Nov 2019 18:27:11 +0000 (19:27 +0100)
committerGuus Sliepen <guus@meshlink.io>
Tue, 5 Nov 2019 18:27:11 +0000 (19:27 +0100)
Commit fa05f996c5500c056a36c1d43e33a407f876643c broke reading config
files for hosts for which no public key is known.

src/net_setup.c

index 1a123cf5415665e9ead4390fde87742dc9d8ff80..e1db743a3c3f3acc484b5c975c0f00599c4dd806 100644 (file)
@@ -170,12 +170,14 @@ bool node_read_from_config(meshlink_handle_t *mesh, node_t *n, const config_t *c
        const void *key;
        uint32_t len = packmsg_get_bin_raw(&in, &key);
 
-       if(len != 32) {
-               return false;
-       }
+       if(len) {
+               if(len != 32) {
+                       return false;
+               }
 
-       if(!ecdsa_active(n->ecdsa)) {
-               n->ecdsa = ecdsa_set_public_key(key);
+               if(!ecdsa_active(n->ecdsa)) {
+                       n->ecdsa = ecdsa_set_public_key(key);
+               }
        }
 
        n->canonical_address = packmsg_get_str_dup(&in);