X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/92db0e2617cec9b118708c722c1a9f273001f87d..935445b29ab2952f928f347e0446bc81ab5f6229:/garden.c diff --git a/garden.c b/garden.c index 994ecb5..0e6880c 100644 --- a/garden.c +++ b/garden.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include "dhcp6.h" #include "l2tpns.h" #include "plugin.h" #include "control.h" @@ -157,7 +159,7 @@ int plugin_become_master(void) for (i = 0; up_commands[i] && *up_commands[i]; i++) { f->log(3, 0, 0, "Running %s\n", up_commands[i]); - system(up_commands[i]); + if (-1 == system(up_commands[i])) f->log(0, 0, 0, "error command %s\n", up_commands[i]); } return PLUGIN_RET_OK; @@ -176,6 +178,7 @@ int garden_session(sessiont *s, int flag, char *newuser) { char cmd[2048]; sessionidt sess; + int status; if (!s) return 0; if (!s->opened) return 0; @@ -191,7 +194,7 @@ int garden_session(sessiont *s, int flag, char *newuser) f->fmtaddr(htonl(s->ip), 0)); f->log(3, sess, s->tunnel, "%s\n", cmd); - system(cmd); + status = system(cmd); s->walled_garden = 1; } else @@ -229,7 +232,7 @@ int garden_session(sessiont *s, int flag, char *newuser) f->log(3, sess, s->tunnel, "%s\n", cmd); while (--count) { - int status = system(cmd); + status = system(cmd); if (WEXITSTATUS(status) != 0) break; } @@ -272,7 +275,7 @@ int plugin_init(struct pluginfuncs *funcs) for (i = 0; down_commands[i] && *down_commands[i]; i++) { f->log(3, 0, 0, "Running %s\n", down_commands[i]); - system(down_commands[i]); + if (-1 == system(down_commands[i])) f->log(0, 0, 0, "error command %s\n", down_commands[i]); } } @@ -289,7 +292,7 @@ void plugin_done() for (i = 0; down_commands[i] && *down_commands[i]; i++) { f->log(3, 0, 0, "Running %s\n", down_commands[i]); - system(down_commands[i]); + if (-1 == system(down_commands[i])) f->log(0, 0, 0, "error command %s\n", down_commands[i]); } }