]> tinc-vpn.org Git - tinc/blobdiff - src/process.c
Replace hard-code with new ScriptsInterpreter configuration property.
[tinc] / src / process.c
index c65923711244fe15d3dc04da236daa498c49dd4d..a682226808725729c88f49796d00bb1d4902480b 100644 (file)
@@ -358,6 +358,7 @@ bool execute_script(const char *name, char **envp) {
        int status, len;
        char *scriptname;
        int i;
+    char *aInterpreter = NULL;
 
 #ifndef HAVE_MINGW
        len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name);
@@ -378,6 +379,20 @@ bool execute_script(const char *name, char **envp) {
        }
 #endif
 
+    // Custom scripts interpreter
+    if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &aInterpreter))
+    {
+        // Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard)
+        free(scriptname);
+        len = xasprintf(&scriptname, "%s \"%s/%s\"", aInterpreter, confbase, name);
+        if(len < 0)
+        {
+            free(aInterpreter);
+            return false;
+        }
+    }
+    free(aInterpreter);
+
        ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name);
 
 #ifdef HAVE_PUTENV
@@ -511,7 +526,7 @@ static RETSIGTYPE sigusr1_handler(int a) {
 }
 
 static RETSIGTYPE sigusr2_handler(int a) {
-       dump_device_stats();
+       devops.dump_stats();
        dump_nodes();
        dump_edges();
        dump_subnets();