From 27054349553f15cb73fbb4a589d822c75e2aa07d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 3 Jun 2016 17:43:42 +0100 Subject: [PATCH] NetworkAgent: Handle VPN service aliases A VPN plugin can support multiple services, indicated by an 'aliases' key. We need to be able to spawn the appropriate auth-dialog for these aliases, as well as the base service. Covered as an afterthought (from comment 57) in https://bugzilla.gnome.org/show_bug.cgi?id=658484 See also https://bugzilla.gnome.org/show_bug.cgi?id=746664 and https://bugzilla.gnome.org/show_bug.cgi?id=767197 --- js/ui/components/networkAgent.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index b5f141db4..9308ac04f 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -796,10 +796,18 @@ const NetworkAgent = new Lang.Class({ path = GLib.build_filenamev([Config.LIBEXECDIR, path]); } - if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE)) + if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE)) { this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode, supportsHints: hints }; - else + try { + let aliases = keyfile.get_string_list('VPN Connection', 'aliases'); + + for (let alias of aliases) { + this._vpnBinaries[alias] = { fileName: path, externalUIMode: externalUIMode, supportsHints: hints }; + } + } catch(e) { } // ignore errors if key does not exist + } else { throw new Error('VPN plugin at %s is not executable'.format(path)); + } } catch(e) { log('Error \'%s\' while processing VPN keyfile \'%s\''. format(e.message, dir.get_child(name).get_path()));