[network-manager-libreswan/lr/multiple-vpn: 3/5] service: add --bus-name argument
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-libreswan/lr/multiple-vpn: 3/5] service: add --bus-name argument
- Date: Tue, 3 Nov 2015 16:13:21 +0000 (UTC)
commit d0b6ce1d4000779dc0a2a72ac3f694d97ad49ffa
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Oct 29 09:47:08 2015 +0100
service: add --bus-name argument
nm-libreswan-service.conf | 4 ++--
nm-libreswan-service.name.in | 1 +
src/nm-libreswan-service.c | 10 ++++++++--
3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/nm-libreswan-service.conf b/nm-libreswan-service.conf
index 49e421e..bbe2bab 100644
--- a/nm-libreswan-service.conf
+++ b/nm-libreswan-service.conf
@@ -3,12 +3,12 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
- <allow own="org.freedesktop.NetworkManager.libreswan"/>
+ <allow own_prefix="org.freedesktop.NetworkManager.libreswan"/>
<allow send_destination="org.freedesktop.NetworkManager.libreswan"/>
<allow send_interface="org.freedesktop.NetworkManager.libreswan.helper"/>
</policy>
<policy context="default">
- <deny own="org.freedesktop.NetworkManager.libreswan"/>
+ <deny own_prefix="org.freedesktop.NetworkManager.libreswan"/>
<deny send_destination="org.freedesktop.NetworkManager.libreswan"/>
</policy>
</busconfig>
diff --git a/nm-libreswan-service.name.in b/nm-libreswan-service.name.in
index cb221d1..c723842 100644
--- a/nm-libreswan-service.name.in
+++ b/nm-libreswan-service.name.in
@@ -3,6 +3,7 @@ name=libreswan
service=org.freedesktop.NetworkManager.libreswan
aliases=org.freedesktop.NetworkManager.openswan
program= LIBEXECDIR@/nm-libreswan-service
+supports-multiple-connections=true
[libnm]
plugin= PLUGINDIR@/libnm-vpn-plugin-libreswan.so
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index f25d8e4..520c8aa 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -674,6 +674,7 @@ nm_libreswan_config_write (NMLibreswanPlugin *self,
const char *default_username;
const char *phase1_alg_str;
const char *phase2_alg_str;
+ char *bus_name;
g_assert (fd >= 0);
g_assert (s_vpn);
@@ -686,7 +687,10 @@ nm_libreswan_config_write (NMLibreswanPlugin *self,
write_config_option (fd, " leftid= %s\n", nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_LEFTID));
write_config_option (fd, " leftxauthclient=yes\n");
write_config_option (fd, " leftmodecfgclient=yes\n");
- write_config_option (fd, " leftupdown=\"" NM_LIBRESWAN_HELPER_PATH "\"\n");
+
+ g_object_get (self, NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, &bus_name, NULL);
+ write_config_option (fd, " leftupdown=\"" NM_LIBRESWAN_HELPER_PATH " --bus-name %s\"\n", bus_name);
+ g_free (bus_name);
default_username = nm_setting_vpn_get_user_name (s_vpn);
props_username = nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_LEFTXAUTHUSER);
@@ -1830,10 +1834,12 @@ main (int argc, char *argv[])
GOptionContext *opt_ctx = NULL;
GDBusConnection *connection;
GError *error = NULL;
+ const gchar *bus_name = NM_DBUS_SERVICE_LIBRESWAN;
GOptionEntry options[] = {
{ "persist", 0, 0, G_OPTION_ARG_NONE, &persist, N_("Don't quit when VPN connection
terminates"), NULL },
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable verbose debug logging (may expose
passwords)"), NULL },
+ { "bus-name", 0, 0, G_OPTION_ARG_STRING, &bus_name, N_("DBus name to use for this instance"),
NULL },
{NULL}
};
@@ -1868,7 +1874,7 @@ main (int argc, char *argv[])
g_message ("%s (version " DIST_VERSION ") starting...", argv[0]);
plugin = g_initable_new (NM_TYPE_LIBRESWAN_PLUGIN, NULL, &error,
- NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, NM_DBUS_SERVICE_LIBRESWAN,
+ NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, bus_name,
NULL);
if (!plugin) {
g_warning ("Failed to initialize a plugin instance: %s", error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]