X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprocess.c;h=a682226808725729c88f49796d00bb1d4902480b;hp=41a1468d952d8c08b31ec3fd360741aa6e5d0302;hb=f2570c1b7f5813e087c867cf002f36f0c09b5cfa;hpb=8a6f278fd2606c0a8f133f05df83b2649eacf6c3 diff --git a/src/process.c b/src/process.c index 41a1468d..a6822268 100644 --- a/src/process.c +++ b/src/process.c @@ -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); @@ -376,17 +377,21 @@ bool execute_script(const char *name, char **envp) { free(scriptname); return true; } - else +#endif + + // Custom scripts interpreter + if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &aInterpreter)) { - // Ugly hard-code allowing execution of scripts on android without execution flag (such as on /sdcard) + // Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard) free(scriptname); - len = xasprintf(&scriptname, "/system/bin/sh \"%s/%s\"", confbase, name); + len = xasprintf(&scriptname, "%s \"%s/%s\"", aInterpreter, confbase, name); if(len < 0) { + free(aInterpreter); return false; } } -#endif + free(aInterpreter); ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name);