X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=src%2Fprotocol_key.c;fp=src%2Fprotocol_key.c;h=f912c0fb44431c6f33ee625fda372eb5fa3187e0;hb=9ece2f9ded8c65c7f20826f2ec9ae1f0527bdd7c;hp=1d708e4a3bb2fc3b70a6468f446c5a6f04aac307;hpb=9919d6688b2c79a0da93e3f39eeea2b58e923a1e;p=meshlink diff --git a/src/protocol_key.c b/src/protocol_key.c index 1d708e4a..f912c0fb 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -338,22 +338,24 @@ bool ans_key_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { return send_request(mesh, to->nexthop->connection, NULL, "%s", request); } - /* Don't use key material until every check has passed. */ - from->status.validkey = false; + /* Process SPTPS data if present */ - /* Compression is not supported. */ - if(compression != 0) { - logger(mesh, MESHLINK_ERROR, "Node %s uses bogus compression level!", from->name); - return true; - } + if(*key != '.') { + /* Don't use key material until every check has passed. */ + from->status.validkey = false; - /* SPTPS or old-style key exchange? */ + /* Compression is not supported. */ + if(compression != 0) { + logger(mesh, MESHLINK_ERROR, "Node %s uses bogus compression level!", from->name); + return true; + } - char buf[strlen(key)]; - int len = b64decode(key, buf, strlen(key)); + char buf[strlen(key)]; + int len = b64decode(key, buf, strlen(key)); - if(!len || !sptps_receive_data(&from->sptps, buf, len)) { - logger(mesh, MESHLINK_ERROR, "Error processing SPTPS data from %s", from->name); + if(!len || !sptps_receive_data(&from->sptps, buf, len)) { + logger(mesh, MESHLINK_ERROR, "Error processing SPTPS data from %s", from->name); + } } if(from->status.validkey) {