2008-10-20 Dan Williams <dcbw@redhat.com>
authorDan Williams <dcbw@redhat.com>
Mon, 20 Oct 2008 21:39:56 +0000 (21:39 +0000)
committerDan Williams <dcbw@redhat.com>
Mon, 20 Oct 2008 21:39:56 +0000 (21:39 +0000)
* libnm-util/nm-setting-wireless-security.c
- (verify): accept 'none' as a pairwise cipher with Ad-Hoc WPA connections

git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4198 4912f4e0-d625-0410-9fb7-b9a5a253dbdc

ChangeLog
libnm-util/nm-setting-wireless-security.c

index 0d13faf..568d197 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-20  Dan Williams  <dcbw@redhat.com>
+
+       * libnm-util/nm-setting-wireless-security.c
+               - (verify): accept 'none' as a pairwise cipher with Ad-Hoc WPA connections
+
 2008-10-20  Dan Williams  <dcbw@redhat.com>
 
        * src/supplicant-manager/nm-supplicant-config.c
index a2bc65a..9c18518 100644 (file)
@@ -339,12 +339,38 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
                return FALSE;
        }
 
-       if (self->pairwise && !nm_utils_string_slist_validate (self->pairwise, valid_pairwise)) {
-               g_set_error (error,
-                            NM_SETTING_WIRELESS_SECURITY_ERROR,
-                            NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
-                            NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
-               return FALSE;
+       if (self->pairwise) {
+               const char *wpa_none[] = { "wpa-none", NULL };
+
+               /* For ad-hoc connections, pairwise must be "none" */
+               if (nm_utils_string_in_list (self->key_mgmt, wpa_none)) {
+                       GSList *iter;
+                       gboolean found = FALSE;
+
+                       for (iter = self->pairwise; iter; iter = g_slist_next (iter)) {
+                               if (!strcmp ((char *) iter->data, "none")) {
+                                       found = TRUE;
+                                       break;
+                               }
+                       }
+
+                       /* pairwise cipher list didn't contain "none", which is invalid
+                        * for WPA adhoc connections.
+                        */
+                       if (!found) {
+                               g_set_error (error,
+                                            NM_SETTING_WIRELESS_SECURITY_ERROR,
+                                            NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
+                                            NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
+                               return FALSE;
+                       }
+               } else if (!nm_utils_string_slist_validate (self->pairwise, valid_pairwise)) {
+                       g_set_error (error,
+                                    NM_SETTING_WIRELESS_SECURITY_ERROR,
+                                    NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
+                                    NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
+                       return FALSE;
+               }
        }
 
        if (self->group && !nm_utils_string_slist_validate (self->group, valid_groups)) {