diff --git a/ChangeLog b/ChangeLog index d057d89f85..445ec3775a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-06-07 Robert Love + + * gnome/applet/gconf-helpers.c: Bug fix: nm_gconf_helper_get_bool() + checked that the return type was GCONF_VALUE_STRING, not the correct + GCONF_VALUE_BOOL, and thus it never worked. + * src/NetworkManagerAPList.c: Before concluding that two networks are + identical based on their BSSID, make sure that the BSSID in question + is actually valid. Specifically, an empty or all zero BSSID does not + cut it. + * gnome/applet/applet-dbus-info.c, gnome/applet/other-network-dialog.c, + src/nm-dbus-nmi.c, src/nm-device-802-11-wireless.c: White space and + similar invariant clean up. + 2006-06-02 Robert Love * gnome/applet/applet.c: Update copyright years. Add Novell. diff --git a/gnome/applet/applet-dbus-info.c b/gnome/applet/applet-dbus-info.c index 57c3e31c1c..5789047366 100644 --- a/gnome/applet/applet-dbus-info.c +++ b/gnome/applet/applet-dbus-info.c @@ -97,7 +97,7 @@ static void nmi_dbus_get_network_key_callback (GnomeKeyringResult result, gpointer data) { NMGetNetworkKeyCBData * cb_data = (NMGetNetworkKeyCBData*) data; - NMApplet * applet = cb_data->applet; + NMApplet * applet = cb_data->applet; DBusMessage * message = cb_data->message; NetworkDevice * dev = cb_data->dev; char * net_path = cb_data->net_path; @@ -141,7 +141,7 @@ nmi_dbus_get_key_for_network (DBusConnection *connection, DBusMessage *message, void *user_data) { - NMApplet * applet = (NMApplet *) user_data; + NMApplet * applet = (NMApplet *) user_data; char * dev_path = NULL; char * net_path = NULL; char * essid = NULL; @@ -307,9 +307,9 @@ nmi_dbus_get_networks (DBusConnection *connection, DBusMessage *message, void *user_data) { - const char * NO_NET_ERROR = "NoNetworks"; - const char * NO_NET_ERROR_MSG = "There are no wireless networks stored."; - NMApplet * applet = (NMApplet *) user_data; + const char * NO_NET_ERROR = "NoNetworks"; + const char * NO_NET_ERROR_MSG = "There are no wireless networks stored."; + NMApplet * applet = (NMApplet *) user_data; GSList * dir_list = NULL; GSList * elt; DBusMessage * reply = NULL; @@ -474,11 +474,7 @@ nmi_dbus_get_network_properties (DBusConnection *connection, /* Fourth arg: List of AP BSSIDs (ARRAY, STRING) */ dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array_iter); if (bssids_value && (g_slist_length (gconf_value_get_list (bssids_value)) > 0)) - { - g_slist_foreach (gconf_value_get_list (bssids_value), - (GFunc) addr_list_append_helper, - &array_iter); - } + g_slist_foreach (gconf_value_get_list (bssids_value), (GFunc) addr_list_append_helper, &array_iter); else { const char *fake = ""; @@ -841,7 +837,7 @@ nmi_save_network_info (NMApplet *applet, g_free (key); if (!gconf_entry) { - nm_warning ("%s:%d - GConf entry for '%s' doesn't exist.", __FILE__, __LINE__, essid); + nm_warning ("Failed to create or obtain GConf entry for '%s'.", essid); goto out; } gconf_entry_unref (gconf_entry); @@ -1023,8 +1019,8 @@ out: DBusHandlerResult nmi_dbus_info_message_handler (DBusConnection *connection, DBusMessage *message, void *user_data) { NMApplet * applet = (NMApplet *)user_data; - DBusMessage * reply = NULL; - gboolean handled; + DBusMessage * reply = NULL; + gboolean handled; g_return_val_if_fail (applet != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED); diff --git a/gnome/applet/gconf-helpers.c b/gnome/applet/gconf-helpers.c index 017133cc9b..6d2b4b3166 100644 --- a/gnome/applet/gconf-helpers.c +++ b/gnome/applet/gconf-helpers.c @@ -107,7 +107,7 @@ nm_gconf_get_bool_helper (GConfClient *client, gc_key = g_strdup_printf ("%s/%s/%s", path, network, key); if ((gc_value = gconf_client_get (client, gc_key, NULL))) { - if (gc_value->type == GCONF_VALUE_STRING) + if (gc_value->type == GCONF_VALUE_BOOL) { *value = gconf_value_get_bool (gc_value); success = TRUE; diff --git a/gnome/applet/other-network-dialog.c b/gnome/applet/other-network-dialog.c index bc36504b52..4669cf168c 100644 --- a/gnome/applet/other-network-dialog.c +++ b/gnome/applet/other-network-dialog.c @@ -381,7 +381,7 @@ static GtkDialog *nma_ond_init (GladeXML *xml, NMApplet *applet, gboolean create static void nma_ond_response_cb (GtkDialog *dialog, gint response, gpointer data) { GladeXML * xml; - NMApplet * applet; + NMApplet * applet; gboolean create_network; GtkTreeModel * model; GtkComboBox * combo; diff --git a/src/NetworkManagerAPList.c b/src/NetworkManagerAPList.c index 37d9a1a89f..05a45024b1 100644 --- a/src/NetworkManagerAPList.c +++ b/src/NetworkManagerAPList.c @@ -437,10 +437,11 @@ NMAccessPoint *nm_ap_list_get_ap_by_address (NMAccessPointList *list, const stru */ gboolean nm_ap_list_merge_scanned_ap (NMDevice80211Wireless *dev, NMAccessPointList *list, NMAccessPoint *merge_ap) { - NMAccessPoint * list_ap = NULL; - gboolean strength_changed = FALSE; - gboolean new = FALSE; - NMData * app_data; + NMAccessPoint * list_ap = NULL; + gboolean strength_changed = FALSE; + gboolean new = FALSE; + NMData * app_data; + const struct ether_addr * merge_bssid; g_return_val_if_fail (dev != NULL, FALSE); g_return_val_if_fail (list != NULL, FALSE); @@ -449,18 +450,17 @@ gboolean nm_ap_list_merge_scanned_ap (NMDevice80211Wireless *dev, NMAccessPointL app_data = nm_device_get_app_data (NM_DEVICE (dev)); g_return_val_if_fail (app_data != NULL, FALSE); - if ((list_ap = nm_ap_list_get_ap_by_address (list, nm_ap_get_address (merge_ap)))) + merge_bssid = nm_ap_get_address (merge_ap); + if (nm_ethernet_address_is_valid (merge_bssid) && (list_ap = nm_ap_list_get_ap_by_address (list, merge_bssid))) { + /* First, we check for an address match. If the merge AP has a valid + * BSSID and the same address as a list AP, then the merge AP and + * the list AP must be the same physical AP. The list AP properties must + * be from a previous scan so the time_last_seen's are not equal. Update + * encryption, authentication method, strength, and the time_last_seen. */ + const char * devlist_essid = nm_ap_get_essid (list_ap); const char * merge_essid = nm_ap_get_essid (merge_ap); - - /* First, we check for an address match. If the merge AP has the - * same address as a list AP, the merge AP and the list AP - * must be the same physical AP. The list AP properties must be from - * a previous scan so the time_last_seen's are not equal. - * Update encryption, authentication method, - * strength, and the time_last_seen. */ - const GTimeVal *merge_ap_seen = nm_ap_get_last_seen (merge_ap); /* Did the AP's name change? */ @@ -492,7 +492,6 @@ gboolean nm_ap_list_merge_scanned_ap (NMDevice80211Wireless *dev, NMAccessPointL } else if ((list_ap = nm_ap_list_get_ap_by_essid (list, nm_ap_get_essid (merge_ap)))) { - /* Second, we check for an ESSID match. In this case, * a list AP has the same non-NULL ESSID as the merge AP. Update the * encryption and authentication method. Update the strength and address diff --git a/src/nm-dbus-nmi.c b/src/nm-dbus-nmi.c index 4c56ad084a..6be71ecc8d 100644 --- a/src/nm-dbus-nmi.c +++ b/src/nm-dbus-nmi.c @@ -379,8 +379,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data /* First arg: ESSID (STRING) */ if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING) { - nm_warning ("%s:%d (%s): a message argument (essid) was invalid.", - __FILE__, __LINE__, __func__); + nm_warning ("a message argument (essid) was invalid."); goto out; } dbus_message_iter_get_basic (&iter, &essid); @@ -389,18 +388,16 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_INT32)) { - nm_warning ("%s:%d (%s): a message argument (timestamp) was invalid.", - __FILE__, __LINE__, __func__); + nm_warning ("a message argument (timestamp) was invalid."); goto out; } dbus_message_iter_get_basic (&iter, ×tamp_secs); - - /* Third arg: trusted (BOOLEAN) */ + + /* Third arg: Trusted (BOOLEAN) */ if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_BOOLEAN)) { - nm_warning ("%s:%d (%s): a message argument (trusted) was invalid.", - __FILE__, __LINE__, __func__); + nm_warning ("a message argument (trusted) was invalid."); goto out; } dbus_message_iter_get_basic (&iter, &trusted); @@ -410,8 +407,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY) || (dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_STRING)) { - nm_warning ("%s:%d (%s): a message argument (addresses) was invalid.", - __FILE__, __LINE__, __func__); + nm_warning ("a message argument (addresses) was invalid."); goto out; } dbus_message_iter_recurse (&iter, &subiter); @@ -427,16 +423,15 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data /* Unserialize access point security info */ if (!dbus_message_iter_has_next (&iter)) { - nm_warning ("%s:%d (%s): a message argument (security info) was invalid.", - __FILE__, __LINE__, __func__); + nm_warning ("a message argument (security info) was invalid."); goto out; } dbus_message_iter_next (&iter); if (!(security = nm_ap_security_new_deserialize (&iter))) { - nm_warning ("%s:%d (%s): message arguments were invalid (could not deserialize " - "wireless network security information.", __FILE__, __LINE__, __func__); + nm_warning ("message arguments were invalid (could not deserialize " + "wireless network security information."); goto out; } @@ -499,15 +494,13 @@ static void nm_dbus_get_networks_cb (DBusPendingCall *pcall, void *user_data) if (!dbus_pending_call_get_completed (pcall)) { - nm_warning ("%s:%d (%s): pending call was not completed.", - __FILE__, __LINE__, __func__); + nm_warning ("pending call was not completed."); goto out; } if (!(reply = dbus_pending_call_steal_reply (pcall))) { - nm_warning ("%s:%d (%s): could not retrieve the reply.", - __FILE__, __LINE__, __func__); + nm_warning ("could not retrieve the reply."); goto out; } @@ -517,8 +510,7 @@ static void nm_dbus_get_networks_cb (DBusPendingCall *pcall, void *user_data) dbus_error_init (&err); dbus_set_error_from_message (&err, reply); - nm_warning ("%s:%d (%s): error received: %s - %s.", - __FILE__, __LINE__, __func__, err.name, err.message); + nm_warning ("error received: %s - %s.", err.name, err.message); goto out; } diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index c9a4153fb5..628a302dca 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -3265,7 +3265,6 @@ add_new_ap_to_device_list (NMDevice80211Wireless *dev, NMAccessPoint *ap) { GTimeVal cur_time; - NMData * app_data; NMAccessPointList * ap_list; g_return_if_fail (dev != NULL); @@ -3277,10 +3276,12 @@ add_new_ap_to_device_list (NMDevice80211Wireless *dev, /* If the AP is not broadcasting its ESSID, try to fill it in here from our * allowed list where we cache known MAC->ESSID associations. */ - app_data = nm_device_get_app_data (NM_DEVICE (dev)); if (!nm_ap_get_essid (ap)) { + NMData * app_data; + nm_ap_set_broadcast (ap, FALSE); + app_data = nm_device_get_app_data (NM_DEVICE (dev)); nm_ap_list_copy_one_essid_by_address (app_data, dev, ap, app_data->allowed_ap_list); }