projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enable more clang-tidy checks
[tinc]
/
src
/
script.c
diff --git
a/src/script.c
b/src/script.c
index
b380931
..
2f2c30b
100644
(file)
--- a/
src/script.c
+++ b/
src/script.c
@@
-26,6
+26,7
@@
#include "names.h"
#include "script.h"
#include "xalloc.h"
#include "names.h"
#include "script.h"
#include "xalloc.h"
+#include "sandbox.h"
#ifdef HAVE_PUTENV
static void unputenv(const char *p) {
#ifdef HAVE_PUTENV
static void unputenv(const char *p) {
@@
-37,7
+38,7
@@
static void unputenv(const char *p) {
ptrdiff_t len = e - p;
#ifndef HAVE_UNSETENV
ptrdiff_t len = e - p;
#ifndef HAVE_UNSETENV
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
// Windows requires putenv("FOO=") to unset %FOO%
len++;
#endif
// Windows requires putenv("FOO=") to unset %FOO%
len++;
#endif
@@
-134,13
+135,17
@@
void environment_init(environment_t *env) {
void environment_exit(environment_t *env) {
for(int i = 0; i < env->n; i++) {
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) {
}
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;
char scriptname[PATH_MAX];
char *command;
@@
-148,7
+153,7
@@
bool execute_script(const char *name, environment_t *env) {
/* First check if there is a script */
/* First check if there is a script */
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(!*scriptextension) {
const char *pathext = getenv("PATHEXT");
if(!*scriptextension) {
const char *pathext = getenv("PATHEXT");