[network-manager-fortisslvpn] service: add --bus-name argument
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-fortisslvpn] service: add --bus-name argument
- Date: Fri, 23 Oct 2015 13:04:58 +0000 (UTC)
commit 75bbf0983c52f9f3b9ae1b171c234ed1717f1e43
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Oct 14 19:54:56 2015 +0200
service: add --bus-name argument
Make it possible to specify a different bus name to acquire.
nm-fortisslvpn-service.conf | 6 ++++--
nm-fortisslvpn-service.name.in | 1 +
src/nm-fortisslvpn-service.c | 12 ++++++++----
src/nm-fortisslvpn-service.h | 2 +-
4 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/nm-fortisslvpn-service.conf b/nm-fortisslvpn-service.conf
index 5c0c312..d15940a 100644
--- a/nm-fortisslvpn-service.conf
+++ b/nm-fortisslvpn-service.conf
@@ -3,12 +3,14 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
- <allow own="org.freedesktop.NetworkManager.fortisslvpn"/>
+ <allow own_prefix="org.freedesktop.NetworkManager.fortisslvpn"/>
<allow send_destination="org.freedesktop.NetworkManager.fortisslvpn"/>
+ <allow send_interface="org.freedesktop.NetworkManager.fortisslvpn.ppp"/>
</policy>
<policy context="default">
- <deny own="org.freedesktop.NetworkManager.fortisslvpn"/>
+ <deny own_prefix="org.freedesktop.NetworkManager.fortisslvpn"/>
<deny send_destination="org.freedesktop.NetworkManager.fortisslvpn"/>
+ <deny send_interface="org.freedesktop.NetworkManager.fortisslvpn.ppp"/>
</policy>
</busconfig>
diff --git a/nm-fortisslvpn-service.name.in b/nm-fortisslvpn-service.name.in
index b0f7a63..72b6ee8 100644
--- a/nm-fortisslvpn-service.name.in
+++ b/nm-fortisslvpn-service.name.in
@@ -2,6 +2,7 @@
name=fortisslvpn
service=org.freedesktop.NetworkManager.fortisslvpn
program= LIBEXECDIR@/nm-fortisslvpn-service
+supports-multiple-connections=true
[libnm]
plugin= PLUGINDIR@/libnm-vpn-plugin-fortisslvpn.so
diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c
index 5b59a3a..4672ca6 100644
--- a/src/nm-fortisslvpn-service.c
+++ b/src/nm-fortisslvpn-service.c
@@ -672,7 +672,7 @@ nm_fortisslvpn_plugin_class_init (NMFortisslvpnPluginClass *fortisslvpn_class)
}
NMFortisslvpnPlugin *
-nm_fortisslvpn_plugin_new (void)
+nm_fortisslvpn_plugin_new (const char *bus_name)
{
NMFortisslvpnPlugin *plugin;
NMFortisslvpnPluginPrivate *priv;
@@ -680,8 +680,7 @@ nm_fortisslvpn_plugin_new (void)
GError *error = NULL;
plugin = (NMFortisslvpnPlugin *) g_initable_new (NM_TYPE_FORTISSLVPN_PLUGIN, NULL, &error,
- NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
- NM_DBUS_SERVICE_FORTISSLVPN,
+ NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, bus_name,
NULL);
if (plugin) {
g_signal_connect (G_OBJECT (plugin), "state-changed", G_CALLBACK (state_changed_cb), NULL);
@@ -728,10 +727,12 @@ main (int argc, char *argv[])
GMainLoop *main_loop;
gboolean persist = FALSE;
GOptionContext *opt_ctx = NULL;
+ gchar *bus_name = NM_DBUS_SERVICE_FORTISSLVPN;
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}
};
@@ -765,7 +766,10 @@ main (int argc, char *argv[])
if (debug)
g_message ("nm-fortisslvpn-service (version " DIST_VERSION ") starting...");
- plugin = nm_fortisslvpn_plugin_new ();
+ if (bus_name)
+ setenv ("NM_DBUS_SERVICE_FORTISSLVPN", bus_name, 0);
+
+ plugin = nm_fortisslvpn_plugin_new (bus_name);
if (!plugin)
exit (EXIT_FAILURE);
diff --git a/src/nm-fortisslvpn-service.h b/src/nm-fortisslvpn-service.h
index 0d9c22b..a442282 100644
--- a/src/nm-fortisslvpn-service.h
+++ b/src/nm-fortisslvpn-service.h
@@ -55,6 +55,6 @@ typedef struct {
GType nm_fortisslvpn_plugin_get_type (void);
-NMFortisslvpnPlugin *nm_fortisslvpn_plugin_new (void);
+NMFortisslvpnPlugin *nm_fortisslvpn_plugin_new (const char *bus_name);
#endif /* NM_FORTISSLVPN_SERVICE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]