summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/options.c2
-rw-r--r--src/sysexec.h6
-rw-r--r--src/uanytun.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/src/options.c b/src/options.c
index 2300794..d6428f0 100644
--- a/src/options.c
+++ b/src/options.c
@@ -446,7 +446,7 @@ void options_print_usage()
#endif
printf(" [-K|--key] <master key> master key to use for encryption\n");
printf(" [-A|--salt] <master salt> master salt to use for encryption\n");
- printf(" [-e|--role] <role> left (alice) or right (bob)");
+ printf(" [-e|--role] <role> left (alice) or right (bob)\n");
printf(" [-c|--cipher] <cipher type> payload encryption algorithm\n");
printf(" [-a|--auth-algo] <algo type> message authentication algorithm\n");
printf(" [-b|--auth-tag-length] <length> length of the auth tag\n");
diff --git a/src/sysexec.h b/src/sysexec.h
index b724433..23a84d0 100644
--- a/src/sysexec.h
+++ b/src/sysexec.h
@@ -35,9 +35,9 @@
#ifndef _SYSEXEC_H_
#define _SYSEXEC_H_
-int exec_script(const char* script, const char* ifname)
+int uanytun_exec(const char* script, char* const argv[], char* const evp[])
{
- if(!script || !ifname)
+ if(!script)
return -1;
pid_t pid;
@@ -56,7 +56,7 @@ int exec_script(const char* script, const char* ifname)
if(dup(fd) == -1) // stderr
log_printf(WARNING, "can't open stderr");
}
- execl("/bin/sh", "/bin/sh", script, ifname, NULL);
+ execve(script, argv, evp);
// if execl return, an error occurred
log_printf(ERROR, "error on executing script: %s", strerror(errno));
return -1;
diff --git a/src/uanytun.c b/src/uanytun.c
index c20cbeb..7ce1871 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -401,7 +401,8 @@ int main(int argc, char* argv[])
if(opt.post_up_script_) {
log_printf(NOTICE, "executing post-up script '%s'", opt.post_up_script_);
- int ret = exec_script(opt.post_up_script_, dev.actual_name_);
+ char* const argv[] = { dev.actual_name_, NULL };
+ int ret = uanytun_exec(opt.post_up_script_, argv, NULL);
}