#include "names.h"
#include "script.h"
#include "xalloc.h"
+#include "sandbox.h"
#ifdef HAVE_PUTENV
static void unputenv(const char *p) {
ptrdiff_t len = e - p;
#ifndef HAVE_UNSETENV
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
// Windows requires putenv("FOO=") to unset %FOO%
len++;
#endif
void environment_exit(environment_t *env) {
for(int i = 0; i < env->n; i++) {
- free(env->entries[i]);
+ free_string(env->entries[i]);
}
free(env->entries);
}
bool execute_script(const char *name, environment_t *env) {
+ if(!sandbox_can(START_PROCESSES, RIGHT_NOW)) {
+ return false;
+ }
+
char scriptname[PATH_MAX];
char *command;
/* First check if there is a script */
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
if(!*scriptextension) {
const char *pathext = getenv("PATHEXT");