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)
// 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);