X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprocess.c;h=b76e81cd3430d66161b66e2a6432d1407ace0b3d;hp=c65923711244fe15d3dc04da236daa498c49dd4d;hb=2a3e343c7228d5f07176e4b404d895c7adc5bdf9;hpb=6d08eb1614b59d5f86a43edda9db06fca72b76cd diff --git a/src/process.c b/src/process.c index c6592371..b76e81cd 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 *interpreter = NULL; #ifndef HAVE_MINGW len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name); @@ -369,14 +370,22 @@ bool execute_script(const char *name, char **envp) { scriptname[len - 1] = '\0'; -#ifndef HAVE_TUNEMU /* First check if there is a script */ if(access(scriptname + 1, F_OK)) { free(scriptname); return true; } -#endif + + // Custom scripts interpreter + if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &interpreter)) { + // 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\"", interpreter, confbase, name); + free(interpreter); + if(len < 0) + return false; + } ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name); @@ -511,7 +520,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();