networkAgent: Ask for wifi secrets in the hints paremeter

The `hints` and `settingName` parameters to the agent call may define
the specific list of secrets NM actually needs from the user.  This
seems to have been the intended use of these two parameters but only
recently did NM with the IWD backend start to use this to request 802.1x
secrets.  So if `hints` is provided, ask user for the specific secrets
listed there and don't even look at what type of EAP method is in use.
Only the three types of secrets actually in use by NM's IWD backend are
supported for now -- they happen to be the same three that
_get8021xSecrets() had already supported.
This commit is contained in:
Andrew Zaborowski 2018-09-18 05:47:43 +02:00 committed by Florian Müllner
parent 44b871da92
commit 4609cf1912

View File

@ -198,6 +198,12 @@ var NetworkSecretDialog = new Lang.Class({
_getWirelessSecrets(secrets, wirelessSetting) {
let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
if (this._settingName == '802-1x') {
this._get8021xSecrets(secrets);
return;
}
switch (wirelessSecuritySetting.key_mgmt) {
// First the easy ones
case 'wpa-none':
@ -231,6 +237,20 @@ var NetworkSecretDialog = new Lang.Class({
let ieee8021xSetting = this._connection.get_setting_802_1x();
let phase2method;
/* If hints were given we know exactly what we need to ask */
if (this._settingName == "802-1x" && this._hints.length) {
if (this._hints.includes('identity'))
secrets.push({ label: _("Username: "), key: 'identity',
value: ieee8021xSetting.identity || '', password: false });
if (this._hints.includes('password'))
secrets.push({ label: _("Password: "), key: 'password',
value: ieee8021xSetting.password || '', password: true });
if (this._hints.includes('private-key-password'))
secrets.push({ label: _("Private key password: "), key: 'private-key-password',
value: ieee8021xSetting.private_key_password || '', password: true });
return;
}
switch (ieee8021xSetting.get_eap_method(0)) {
case 'md5':
case 'leap':