2007-12-27 Dan Williams <dcbw@redhat.com>

* 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
This commit is contained in:
Dan Williams 2007-12-27 07:17:50 +00:00
parent 62049fea24
commit 773c82f9d1
3 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2007-12-27 Dan Williams <dcbw@redhat.com>
* 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 <dcbw@redhat.com>
* libnm-util/nm-setting-wireless.c

View file

@ -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) {

View file

@ -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);