summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2018-06-13 01:04:55 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-06-13 15:59:48 +0200
commit140ada3aadba87946db4e11d1622ba050f12487a (patch)
tree4e2e0f7f820dd9dd8812dd7382df3616a354ba8c
parent2a7a36494a6dd6d3c3347a4f94fcc7dc0b40e2e6 (diff)
downloadNetworkManager-140ada3aadba87946db4e11d1622ba050f12487a.tar.gz
cli: Actually add passwords to the AddAndActivateConnection arguments
Check the wpa_flags and rsn_flags values to see if the network needs the password added to the 802-11-wireless-security settings. The current ap_flags check alone would only trigger the password to be sent for WEP networks. Also remove unneeded initialization of the three variables.
-rw-r--r--clients/cli/devices.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/clients/cli/devices.c b/clients/cli/devices.c
index 0cd5f603e8..d92978f5a6 100644
--- a/clients/cli/devices.c
+++ b/clients/cli/devices.c
@@ -2952,9 +2952,9 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
{
NMDevice *device = NULL;
NMAccessPoint *ap = NULL;
- NM80211ApFlags ap_flags = NM_802_11_AP_FLAGS_NONE;
- NM80211ApSecurityFlags ap_wpa_flags = NM_802_11_AP_SEC_NONE;
- NM80211ApSecurityFlags ap_rsn_flags = NM_802_11_AP_SEC_NONE;
+ NM80211ApFlags ap_flags;
+ NM80211ApSecurityFlags ap_wpa_flags;
+ NM80211ApSecurityFlags ap_rsn_flags;
NMConnection *connection = NULL;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
@@ -3251,7 +3251,9 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
ap_rsn_flags = nm_access_point_get_rsn_flags (ap);
/* Set password for WEP or WPA-PSK. */
- if (ap_flags & NM_802_11_AP_FLAGS_PRIVACY) {
+ if ( (ap_flags & NM_802_11_AP_FLAGS_PRIVACY)
+ || ap_wpa_flags != NM_802_11_AP_SEC_NONE
+ || ap_rsn_flags != NM_802_11_AP_SEC_NONE) {
/* Ask for missing password when one is expected and '--ask' is used */
if (!password && nmc->ask)
password = passwd_ask = nmc_readline_echo (nmc->nmc_config.show_secrets, _("Password: "));