Merge remote-tracking branch 'dechamps/ipip' into 1.1
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 5 Jan 2018 18:58:28 +0000 (19:58 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 5 Jan 2018 18:58:28 +0000 (19:58 +0100)
doc/tinc.texi
src/invitation.c
src/tincctl.c

index 6dcc349..c0508fa 100644 (file)
@@ -2709,6 +2709,8 @@ Address = server.example.com
 The file is basically a concatenation of several host config blocks. Each host
 config block starts with @code{Name = ...}.  Lines that look like @code{#---#}
 are not important, it just makes it easier for humans to read the file.
+However, the first line of an invitation file @emph{must} always start with
+@code{Name = ...}.
 
 The first host config block is always the one representing the invitee. So the
 first Name statement determines the name that the invitee will get. From the
index d6f00a5..5dc8c63 100644 (file)
@@ -769,13 +769,19 @@ make_names:
 
                l[len] = 0;
 
+               // Ignore lines with empty variable names
+               if(!*l) {
+                       continue;
+               }
+
                // Is it a Name?
-               if(!strcasecmp(l, "Name"))
+               if(!strcasecmp(l, "Name")) {
                        if(strcmp(value, name)) {
                                break;
                        } else {
                                continue;
-                       } else if(!strcasecmp(l, "NetName")) {
+                       }
+               } else if(!strcasecmp(l, "NetName")) {
                        continue;
                }
 
index 4803d6c..cd2d3d8 100644 (file)
@@ -842,7 +842,7 @@ bool connect_tincd(bool verbose) {
 
        if(getaddrinfo(host, port, &hints, &res) || !res) {
                if(verbose) {
-                       fprintf(stderr, "Cannot resolve %s port %s: %s", host, port, sockstrerror(sockerrno));
+                       fprintf(stderr, "Cannot resolve %s port %s: %s\n", host, port, sockstrerror(sockerrno));
                }
 
                return false;
@@ -863,7 +863,7 @@ bool connect_tincd(bool verbose) {
 
        if(ioctlsocket(fd, FIONBIO, &arg) != 0) {
                if(verbose) {
-                       fprintf(stderr, "ioctlsocket failed: %s", sockstrerror(sockerrno));
+                       fprintf(stderr, "System call `%s' failed: %s\n", "ioctlsocket", sockstrerror(sockerrno));
                }
        }
 
@@ -1157,7 +1157,7 @@ static int dump_invitations(void) {
                buf[0] = 0;
 
                if(!fgets(buf, sizeof(buf), f)) {
-                       fprintf(stderr, "Invalid invitation file %s", fname);
+                       fprintf(stderr, "Invalid invitation file %s\n", fname);
                        fclose(f);
                        continue;
                }
@@ -1171,7 +1171,7 @@ static int dump_invitations(void) {
                }
 
                if(strncmp(buf, "Name = ", 7) || !check_id(buf + 7)) {
-                       fprintf(stderr, "Invalid invitation file %s", fname);
+                       fprintf(stderr, "Invalid invitation file %s\n", fname);
                        continue;
                }