mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 06:10:14 +01:00
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.
This commit is contained in:
parent
2a7a36494a
commit
140ada3aad
1 changed files with 6 additions and 4 deletions
|
|
@ -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: "));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue