diff options
| author | Michael Biebl <biebl@debian.org> | 2017-05-11 14:55:55 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-05-11 14:55:55 +0200 |
| commit | c333f062ddcba9b35330647bf6cbd0a07f2d786e (patch) | |
| tree | 257c3a0c74c09f4ad2328eab5b932806405f0c1c /libnm/nm-access-point.c | |
| parent | a222e56e103f949b148a6942e385ccca2c26d9f3 (diff) | |
New upstream version 1.8.0 upstream/1.8.0
Diffstat (limited to 'libnm/nm-access-point.c')
| -rw-r--r-- | libnm/nm-access-point.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/libnm/nm-access-point.c b/libnm/nm-access-point.c index 60b8e33d..ed0135ba 100644 --- a/libnm/nm-access-point.c +++ b/libnm/nm-access-point.c @@ -271,9 +271,11 @@ nm_access_point_connection_valid (NMAccessPoint *ap, NMConnection *connection) guint32 ap_freq, setting_chan, ap_chan; s_con = nm_connection_get_setting_connection (connection); - g_assert (s_con); + if (!s_con) + return FALSE; + ctype = nm_setting_connection_get_connection_type (s_con); - if (strcmp (ctype, NM_SETTING_WIRELESS_SETTING_NAME) != 0) + if (!ctype || !nm_streq (ctype, NM_SETTING_WIRELESS_SETTING_NAME)) return FALSE; s_wifi = nm_connection_get_setting_wireless (connection); @@ -282,25 +284,30 @@ nm_access_point_connection_valid (NMAccessPoint *ap, NMConnection *connection) /* SSID checks */ ap_ssid = nm_access_point_get_ssid (ap); - g_warn_if_fail (ap_ssid != NULL); - setting_ssid = nm_setting_wireless_get_ssid (s_wifi); - if (!setting_ssid || !ap_ssid) + if (!ap_ssid) return FALSE; - if (!g_bytes_equal (ap_ssid, setting_ssid)) + setting_ssid = nm_setting_wireless_get_ssid (s_wifi); + if ( !setting_ssid + || !g_bytes_equal (ap_ssid, setting_ssid)) return FALSE; /* BSSID checks */ ap_bssid = nm_access_point_get_bssid (ap); - g_warn_if_fail (ap_bssid); + if (!ap_bssid) + return FALSE; setting_bssid = nm_setting_wireless_get_bssid (s_wifi); - if (setting_bssid && ap_bssid) { - if (!nm_utils_hwaddr_matches (ap_bssid, -1, setting_bssid, -1)) + if (setting_bssid) { + guint8 c[ETH_ALEN]; + + if ( !nm_utils_hwaddr_aton (ap_bssid, c, ETH_ALEN) + || !nm_utils_hwaddr_matches (c, ETH_ALEN, setting_bssid, -1)) return FALSE; } /* Mode */ ap_mode = nm_access_point_get_mode (ap); - g_warn_if_fail (ap_mode != NM_802_11_MODE_UNKNOWN); + if (ap_mode == NM_802_11_MODE_UNKNOWN) + return FALSE; setting_mode = nm_setting_wireless_get_mode (s_wifi); if (setting_mode && ap_mode) { if (!strcmp (setting_mode, "infrastructure") && (ap_mode != NM_802_11_MODE_INFRA)) |