projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge from master
[l2tpns.git]
/
garden.c
diff --git
a/garden.c
b/garden.c
index
30439f1
..
863114e
100644
(file)
--- a/
garden.c
+++ b/
garden.c
@@
-3,14
+3,15
@@
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/types.h>
+#include <sys/socket.h>
+#include <linux/rtnetlink.h>
+
#include "l2tpns.h"
#include "plugin.h"
#include "control.h"
/* walled garden */
#include "l2tpns.h"
#include "plugin.h"
#include "control.h"
/* walled garden */
-char const *cvs_id = "$Id: garden.c,v 1.25 2006-02-23 01:07:23 bodea Exp $";
-
int plugin_api_version = PLUGIN_API_VERSION;
static struct pluginfuncs *f = 0;
int plugin_api_version = PLUGIN_API_VERSION;
static struct pluginfuncs *f = 0;
@@
-159,7
+160,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]);
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;
}
return PLUGIN_RET_OK;
@@
-178,6
+179,7
@@
int garden_session(sessiont *s, int flag, char *newuser)
{
char cmd[2048];
sessionidt sess;
{
char cmd[2048];
sessionidt sess;
+ int status;
if (!s) return 0;
if (!s->opened) return 0;
if (!s) return 0;
if (!s->opened) return 0;
@@
-193,7
+195,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);
f->fmtaddr(htonl(s->ip), 0));
f->log(3, sess, s->tunnel, "%s\n", cmd);
- system(cmd);
+ s
tatus = s
ystem(cmd);
s->walled_garden = 1;
}
else
s->walled_garden = 1;
}
else
@@
-231,7
+233,7
@@
int garden_session(sessiont *s, int flag, char *newuser)
f->log(3, sess, s->tunnel, "%s\n", cmd);
while (--count)
{
f->log(3, sess, s->tunnel, "%s\n", cmd);
while (--count)
{
-
int
status = system(cmd);
+ status = system(cmd);
if (WEXITSTATUS(status) != 0) break;
}
if (WEXITSTATUS(status) != 0) break;
}
@@
-274,7
+276,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]);
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]);
}
}
}
}
@@
-291,7
+293,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]);
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]);
}
}
}
}