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
This commit is contained in:
David Woodhouse 2016-06-03 17:43:42 +01:00
parent a7e030d0f9
commit 2705434955

View File

@ -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()));