validity of GConf data-connection to hidden APs



Here are three short patches which change the way NM writes network data to GConf and Keyring. I noticed that a colleague had some garbage in his GConf data and also in his Keyring from aborted attempts to connect with NM. At the same time I had been trying to get the other-network-dialog to work with hidden ESSIDs and to write valid data to GConf and Keyring. All of which got me to thinking about how GConf and Keyring data gets written.

Data entered into the passphrase-dialog or the other-network-dialog should not be written to GConf or Keyring until validated on the NM side; that is, the functions nmi_save_network_info and nmi_dbus_add_network_address should only be called as a result of a dbus signal from the NM side.

These patches have been tested with a new user account containing no GConf or Keyring data and with hidden and broadcast ESSIDs. The other-dialog will only signal NMI to update GConf and Keyring at the end of stage 5 of activation, after a successful connection has been made. The passphrase dialog will send a passphrase to NM and NM will in turn signal NMI to update GConf and Keyring BUT ONLY IF the access point is allowed.

Here are the patches.
_____________________________________________
passphrase.patch: remove the call to nmi_save_network_info
--- passphrase-dialog.c_orig    2005-08-05 11:53:41.000000000 -0400
+++ passphrase-dialog.c 2005-08-05 11:58:42.000000000 -0400
@@ -217,7 +217,6 @@

               /* Tell NetworkManager about the key the user typed in */
nmi_dbus_return_user_key (applet->connection, message, passphrase, key_type_return); - nmi_save_network_info (applet, wireless_network_get_essid(net), passphrase, key_type_return, NM_DEVICE_AUTH_METHOD_UNKNOWN);
               nmi_passphrase_dialog_clear (dialog);
       }
}
______________________________________________________
nmdevice.patch: update the requested ap not the allowed_ap. In the current code, no passphrase is attached to the allowed_ap. This is the main bug.
--- NetworkManagerDevice.c_orig 2005-08-05 14:04:17.000000000 -0400
+++ NetworkManagerDevice.c      2005-08-05 14:00:36.000000000 -0400
@@ -3281,8 +3281,8 @@
               nm_ap_set_enc_key_source (ap, key, enc_type);

               /* Be sure to update NMI with the new auth mode */
- nm_ap_set_auth_method (allowed_ap, NM_DEVICE_AUTH_METHOD_OPEN_SYSTEM); - nm_dbus_update_network_info (data->dbus_connection, allowed_ap);
+               if (allowed_ap)
+ nm_dbus_update_network_info (data->dbus_connection, ap);

               nm_device_activate_schedule_stage1_device_prepare (req);
       }
_________________________________________________________

applet-dbus-info.patch: add timestamps to nmi_save_network_info and nmi_dbus_add_network_address so that timestamps are always written when GConf data is written.
--- applet-dbus-info.c_orig     2005-08-04 20:35:15.000000000 -0400
+++ applet-dbus-info.c  2005-08-05 01:25:35.000000000 -0400
@@ -866,6 +866,10 @@
gconf_client_set_int (applet->gconf_client, key, (int)enc_key_type, NULL);
               g_free (key);

+ key = g_strdup_printf ("%s/%s/timestamp", GCONF_PATH_WIRELESS_NETWORKS, escaped_network); + gconf_client_set_int (applet->gconf_client, key, time (NULL), NULL);
+               g_free (key);
+
               if (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN)
               {
key = g_strdup_printf ("%s/%s/auth_method", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
@@ -970,7 +974,6 @@
/* Get current list of access point MAC addresses for this AP from GConf */ key = g_strdup_printf ("%s/%s/addresses", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
       value = gconf_client_get (applet->gconf_client, key, NULL);
-       g_free (escaped_network);

if (value && (value->type == GCONF_VALUE_LIST) && (gconf_value_get_list_type (value) == GCONF_VALUE_STRING))
       {
@@ -997,13 +1000,17 @@
       {
new_mac_list = g_slist_append (new_mac_list, g_strdup (addr)); gconf_client_set_list (applet->gconf_client, key, GCONF_VALUE_STRING, new_mac_list, NULL);
+               g_free (key);
+ key = g_strdup_printf ("%s/%s/timestamp", GCONF_PATH_WIRELESS_NETWORKS, escaped_network); + gconf_client_set_int (applet->gconf_client, key, time (NULL), NULL);
       }
+       g_free (key);

       /* Free the list, since gconf_client_set_list deep-copies it */
       g_slist_foreach (new_mac_list, (GFunc)g_free, NULL);
       g_slist_free (new_mac_list);

-       g_free (key);
+       g_free (escaped_network);

       return (NULL);
}







--
Bill Moss
Professor, Mathematical Sciences
Clemson University




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]