When exporting configuration files, don't copy Name variables.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 16 Jul 2012 16:49:39 +0000 (18:49 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 16 Jul 2012 16:49:39 +0000 (18:49 +0200)
These interfere with tincctl import. Besides, host configuration files should
not contain Name at all.

src/tincctl.c

index 057ff7c..b977d13 100644 (file)
@@ -1383,8 +1383,10 @@ static int export(const char *name, FILE *out) {
 
        fprintf(out, "Name = %s\n", name);
        char buf[4096];
-       while(fgets(buf, sizeof buf, in))
-               fputs(buf, out);
+       while(fgets(buf, sizeof buf, in)) {
+               if(strcspn(buf, "\t =") != 4 || strncasecmp(buf, "Name", 4))
+                       fputs(buf, out);
+       }
 
        if(ferror(in)) {
                fprintf(stderr, "Error while reading configuration file %s: %s\n", filename, strerror(errno));