]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.c
Make sure the SPTSP connection get set up properly during a join.
[meshlink] / src / meshlink.c
index ca5fa3bbe3026a3c98e41f2effc6afe335ecc38c..718b07a183d2d0449cdadfbef6c8881c9956d46b 100644 (file)
@@ -1120,23 +1120,7 @@ bool meshlink_join(meshlink_handle_t *mesh, const char *invitation) {
        char copy[strlen(invitation) + 1];
        strcpy(copy, invitation);
 
-       // Make sure confbase exists and is accessible.
-       if(mkdir(mesh->confbase, 0777) && errno != EEXIST) {
-               fprintf(stderr, "Could not create directory %s: %s\n", mesh->confbase, strerror(errno));
-               return false;
-       }
-
-       if(access(mesh->confbase, R_OK | W_OK | X_OK)) {
-               fprintf(stderr, "No permission to write in directory %s: %s\n", mesh->confbase, strerror(errno));
-               return false;
-       }
-
-       // TODO: Either remove or reintroduce netname in meshlink
-       // If a netname or explicit configuration directory is specified, check for an existing meshlink.conf.
-       //if((mesh->netname || confbasegiven) && !access(meshlink_conf, F_OK)) {
-       //      fprintf(stderr, "Configuration file %s already exists!\n", meshlink_conf);
-       //      return 1;
-       //}
+       // Split the invitation URL into hostname, port, key hash and cookie.
 
        char *slash = strchr(copy, '/');
        if(!slash)
@@ -1197,6 +1181,8 @@ bool meshlink_join(meshlink_handle_t *mesh, const char *invitation) {
 
        // Tell him we have an invitation, and give him our throw-away key.
 
+       mesh->blen = 0;
+
        if(!sendline(mesh->sock, "0 ?%s %d.%d", b64key, PROT_MAJOR, 1)) {
                fprintf(stderr, "Error sending request to %s port %s: %s\n", address, port, strerror(errno));
                closesocket(mesh->sock);