From 773c82f9d1e569fbcc5793ea5756e02d08eab031 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 27 Dec 2007 07:17:50 +0000 Subject: [PATCH] 2007-12-27 Dan Williams * libnm-util/nm-utils.c libnm-util/nm-utils.h - (nm_utils_security_valid): add 'adhoc' argument and handle security for adhoc networks git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3195 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 +++++++ libnm-util/nm-utils.c | 14 ++++++++++++-- libnm-util/nm-utils.h | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc8f5b9a23..997ba46215 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-12-27 Dan Williams + + * libnm-util/nm-utils.c + libnm-util/nm-utils.h + - (nm_utils_security_valid): add 'adhoc' argument and handle security + for adhoc networks + 2007-12-24 Dan Williams * libnm-util/nm-setting-wireless.c diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 4eb3cf399b..fc28fb9def 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -667,6 +667,7 @@ gboolean nm_utils_security_valid (NMUtilsSecurityType type, guint32 dev_caps, gboolean have_ap, + gboolean adhoc, guint32 ap_flags, guint32 ap_wpa, guint32 ap_rsn) @@ -677,8 +678,8 @@ nm_utils_security_valid (NMUtilsSecurityType type, if (type == NMU_SEC_NONE) return TRUE; if ( (type == NMU_SEC_STATIC_WEP) - || (type == NMU_SEC_DYNAMIC_WEP) - || (type == NMU_SEC_LEAP)) { + || ((type == NMU_SEC_DYNAMIC_WEP) && !adhoc) + || ((type == NMU_SEC_LEAP) && !adhoc)) { if (dev_caps & (NM_802_11_DEVICE_CAP_CIPHER_WEP40 | NM_802_11_DEVICE_CAP_CIPHER_WEP104)) return TRUE; } @@ -693,6 +694,9 @@ nm_utils_security_valid (NMUtilsSecurityType type, return FALSE; break; case NMU_SEC_LEAP: /* require PRIVACY bit for LEAP? */ + if (adhoc) + return FALSE; + /* Fall through */ case NMU_SEC_STATIC_WEP: g_assert (have_ap); if (!(ap_flags & NM_802_11_AP_FLAGS_PRIVACY)) @@ -704,6 +708,8 @@ nm_utils_security_valid (NMUtilsSecurityType type, } break; case NMU_SEC_DYNAMIC_WEP: + if (adhoc) + return FALSE; g_assert (have_ap); if (ap_rsn || !(ap_flags & NM_802_11_AP_FLAGS_PRIVACY)) return FALSE; @@ -752,6 +758,8 @@ nm_utils_security_valid (NMUtilsSecurityType type, } break; case NMU_SEC_WPA_ENTERPRISE: + if (adhoc) + return FALSE; if (!(dev_caps & NM_802_11_DEVICE_CAP_WPA)) return FALSE; if (have_ap) { @@ -765,6 +773,8 @@ nm_utils_security_valid (NMUtilsSecurityType type, } break; case NMU_SEC_WPA2_ENTERPRISE: + if (adhoc) + return FALSE; if (!(dev_caps & NM_802_11_DEVICE_CAP_RSN)) return FALSE; if (have_ap) { diff --git a/libnm-util/nm-utils.h b/libnm-util/nm-utils.h index a96a0981aa..bd2e25db77 100644 --- a/libnm-util/nm-utils.h +++ b/libnm-util/nm-utils.h @@ -169,6 +169,7 @@ typedef enum { gboolean nm_utils_security_valid (NMUtilsSecurityType type, guint32 dev_caps, gboolean have_ap, + gboolean adhoc, guint32 ap_flags, guint32 ap_wpa, guint32 ap_rsn);