Make tinc --batch --force join enable the tinc-up script.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 20 Jul 2021 20:23:52 +0000 (22:23 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 20 Jul 2021 20:23:52 +0000 (22:23 +0200)
The expected behavior of --batch --force is that all parameters in the
invitation are accepted, whether unsafe or not. Unsafe variables were
already accepted with --force in commit 061362d2f, this commit ensures
the generated tinc-up script is enabled as well.

Fixes #196 on GitHub.

src/invitation.c

index 30d100d..2f28aef 100644 (file)
@@ -1054,7 +1054,13 @@ ask_netname:
                                }
                        }
                } else {
-                       fprintf(stderr, "A tinc-up script was generated, but has been left disabled.\n");
+                       if(force) {
+                               rename(filename, filename2);
+                               chmod(filename2, 0755);
+                               fprintf(stderr, "tinc-up enabled.\n");
+                       } else {
+                               fprintf(stderr, "A tinc-up script was generated, but has been left disabled.\n");
+                       }
                }
        } else {
                // A placeholder was generated.