summaryrefslogtreecommitdiff
path: root/src/nm-iodine-service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-iodine-service.c')
-rw-r--r--src/nm-iodine-service.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nm-iodine-service.c b/src/nm-iodine-service.c
index 4c97581..ead8908 100644
--- a/src/nm-iodine-service.c
+++ b/src/nm-iodine-service.c
@@ -45,6 +45,9 @@
#include "nm-iodine-service.h"
#include "nm-utils.h"
+#define NM_IODINE_USER "nm-iodine"
+#define NM_IODINE_RUNDIR LOCALSTATEDIR "/run/" NM_IODINE_USER
+
G_DEFINE_TYPE (NMIODINEPlugin, nm_iodine_plugin, NM_TYPE_VPN_PLUGIN)
typedef struct {
@@ -458,6 +461,9 @@ nm_iodine_start_iodine_binary(NMIODINEPlugin *plugin,
passwd = nm_setting_vpn_get_secret (s_vpn, NM_IODINE_KEY_PASSWORD);
+ if (passwd && strlen(passwd))
+ g_setenv("IODINE_PASS", passwd, TRUE);
+
iodine_argv = g_ptr_array_new ();
g_ptr_array_add (iodine_argv, (gpointer) (*iodine_binary));
/* Run in foreground */
@@ -468,17 +474,18 @@ nm_iodine_start_iodine_binary(NMIODINEPlugin *plugin,
g_ptr_array_add (iodine_argv, (gpointer) props_fragsize);
}
- if (passwd && strlen(passwd)) {
- g_ptr_array_add (iodine_argv, (gpointer) "-P");
- g_ptr_array_add (iodine_argv, (gpointer) passwd);
- }
-
if (has_user(NM_IODINE_USER)) {
g_ptr_array_add (iodine_argv, (gpointer) "-u");
g_ptr_array_add (iodine_argv, (gpointer) NM_IODINE_USER);
} else
g_warning("Running as root user");
+ if (!g_mkdir_with_parents(NM_IODINE_RUNDIR, 700)) {
+ g_ptr_array_add (iodine_argv, (gpointer) "-t");
+ g_ptr_array_add (iodine_argv, (gpointer) NM_IODINE_RUNDIR);
+ } else
+ g_warning("Not running chrooted");
+
if (props_nameserver && strlen(props_nameserver))
g_ptr_array_add (iodine_argv, (gpointer) props_nameserver);