summaryrefslogtreecommitdiff
path: root/callouts
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-03-31 13:15:19 -0400
committerDan Winship <danw@gnome.org>2014-04-18 11:32:13 -0400
commit45ed459ae32976a120f607046021b48bf728c1d6 (patch)
tree58da92a18fa21ac79f021423f80a3d970b48cc94 /callouts
parentd53357f4202f46dbbbd8c67c73a5d50bd11aba38 (diff)
dispatcher: Leave PATH set in the dispatcher script environment
https://bugzilla.gnome.org/show_bug.cgi?id=724657
Diffstat (limited to 'callouts')
-rw-r--r--callouts/nm-dispatcher-utils.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
index 4b333d2638..1f99a0b6c1 100644
--- a/callouts/nm-dispatcher-utils.c
+++ b/callouts/nm-dispatcher-utils.c
@@ -345,10 +345,10 @@ nm_dispatcher_utils_construct_envp (const char *action,
char **out_iface)
{
const char *iface = NULL, *ip_iface = NULL;
- const char *uuid = NULL, *id = NULL;
+ const char *uuid = NULL, *id = NULL, *path;
NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN;
GValue *value;
- char **envp = NULL;
+ char **envp = NULL, *path_item;
GSList *items = NULL, *iter;
guint i;
GHashTable *con_setting_hash;
@@ -359,7 +359,7 @@ nm_dispatcher_utils_construct_envp (const char *action,
/* Hostname changes don't require a device nor contain a connection */
if (!strcmp (action, "hostname"))
- return g_new0 (char *, 1);
+ goto done;
/* Canonicalize the VPN interface name; "" is used when passing it through
* D-Bus so make sure that's fixed up here.
@@ -445,12 +445,6 @@ nm_dispatcher_utils_construct_envp (const char *action,
items = construct_ip6_items (items, vpn_ip6_props, "VPN_");
}
- /* Convert the list to an environment pointer */
- envp = g_new0 (char *, g_slist_length (items) + 1);
- for (iter = items, i = 0; iter; iter = g_slist_next (iter), i++)
- envp[i] = (char *) iter->data;
- g_slist_free (items);
-
/* Backwards compat: 'iface' is set in this order:
* 1) VPN interface name
* 2) Device IP interface name
@@ -463,6 +457,19 @@ nm_dispatcher_utils_construct_envp (const char *action,
else
*out_iface = g_strdup (iface);
+ done:
+ path = g_getenv ("PATH");
+ if (path) {
+ path_item = g_strdup_printf ("PATH=%s", path);
+ items = g_slist_prepend (items, path_item);
+ }
+
+ /* Convert the list to an environment pointer */
+ envp = g_new0 (char *, g_slist_length (items) + 1);
+ for (iter = items, i = 0; iter; iter = g_slist_next (iter), i++)
+ envp[i] = (char *) iter->data;
+ g_slist_free (items);
+
return envp;
}