mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-10 01:10:22 +01:00
libnm-util: fix nm_utils_security_valid() checks for Ad-Hoc APs (rh #632123)
Without the fix fake Ad-Hoc APs created by nm-applet's "Create New Wireless Network..." don't pass the check and nm-applet can crash.
This commit is contained in:
parent
7e5ab41d13
commit
b3800183b4
1 changed files with 28 additions and 10 deletions
|
|
@ -1269,14 +1269,24 @@ nm_utils_security_valid (NMUtilsSecurityType type,
|
|||
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_WPA))
|
||||
return FALSE;
|
||||
if (have_ap) {
|
||||
/* Ad-Hoc WPA APs won't necessarily have the PSK flag set */
|
||||
if ((ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK) || adhoc) {
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_TKIP)
|
||||
/* Ad-Hoc WPA APs won't necessarily have the PSK flag set, and
|
||||
* they don't have any pairwise ciphers. */
|
||||
if (adhoc) {
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_GROUP_TKIP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
|
||||
return TRUE;
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_GROUP_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_TKIP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
|
||||
return TRUE;
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1285,14 +1295,22 @@ nm_utils_security_valid (NMUtilsSecurityType type,
|
|||
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_RSN))
|
||||
return FALSE;
|
||||
if (have_ap) {
|
||||
/* Ad-Hoc WPA APs won't necessarily have the PSK flag set */
|
||||
if ((ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK) || adhoc) {
|
||||
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_TKIP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
|
||||
/* Ad-Hoc WPA APs won't necessarily have the PSK flag set, and
|
||||
* they don't have any pairwise ciphers, nor any RSA flags yet. */
|
||||
if (adhoc) {
|
||||
if (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP)
|
||||
return TRUE;
|
||||
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
if (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP)
|
||||
return TRUE;
|
||||
} else {
|
||||
if (ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
|
||||
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_TKIP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
|
||||
return TRUE;
|
||||
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue