diff options
author | (no author) <(no author)> | 2006-03-13 16:54:49 +0000 |
---|---|---|
committer | (no author) <(no author)@4912f4e0-d625-0410-9fb7-b9a5a253dbdc> | 2006-03-13 16:54:49 +0000 |
commit | 5eacbd27ac87e9c7e04b1656a0f07279c124e97e (patch) | |
tree | 3e76043611ec84add1cc03e4b03a8107c0c4f7ec | |
parent | f5876bbd07ed0b344260b76882bbb8de5a07702d (diff) |
This commit was manufactured by cvs2svn to create tagNETWORKMANAGER_0_6_1_RELEASE
'NETWORKMANAGER_0_6_1_RELEASE'.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/tags/NETWORKMANAGER_0_6_1_RELEASE@1592 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
43 files changed, 1042 insertions, 267 deletions
@@ -1,3 +1,169 @@ +2006-03-13 Robert Love <rml@novell.com> + + * configure.in: Bump version to 0.6.1. + * NEWS: Update. + +2006-03-13 Robert Love <rml@novell.com> + + Patch by Timo Hoenig <thoenig@suse.de>: + * dispatcher-daemon/NetworkManagerDispatcher.c: Let the dispatcher + daemon survive DBUS restarts, too. + +2006-03-10 Robert Love <rml@novell.com> + + * gnome/applet/applet-dbus-devices.c: When building the device + description, do not bail out if one property is nonexistant. Keep + building the rest of the string, in case the others exist. The user + cannot do anything about the errors, anyhow. Some devices do not + have all of the properties. + +2006-03-10 Robert Love <rml@novell.com> + + * gnome/applet/applet.glade: Add toggles to show/obfuscate the + passphrase or key. + * gnome/applet/wso-wep-ascii.c, gnome/applet/wso-wep-hex.c, + gnome/applet/wso-wep-passphrase.c, gnome/applet/wso-wpa-eap.c, + gnome/applet/wso-wpa-psk.c: Show and obfuscate passphrases and keys + in response to "toggled" signal on new toggle. + +2006-03-10 Robert Love <rml@novell.com> + + * src/nm-ap-security-wpa-eap.c: Pass fake empty strings for + serialization if strings are NULL, lest DBUS get angry. + +2006-03-10 Robert Love <rml@novell.com> + + * src/nm-ap-security-wpa-eap.c: Don't log the password. + +2006-03-09 Robert Love <rml@novell.com> + + * src/backends/NetworkManagerSuSE.c: Read in WEP and WPA static + configurations. + +2006-03-09 Robert Love <rml@novell.com> + + * src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function + nm_ap_set_timestamp() take the second and micro-second parameters as + direct arguments, which avoids both a dynamic memory allocation and a + structure-to-structure copy! Add a new interface, the aptly named + nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an + existing GTimeVal, as nm_ap_set_timestamp() once did, for use with + the return from nm_ap_get_timestamp(). New users should use the new + nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for + the extreme benefit to performance. + * src/NetworkManagerAPList.c, src/nm-dbus-nmi.c, + src/backends/NetworkManagerSuSE.c: Use the new functions as needed. + +2006-03-08 Robert Love <rml@novell.com> + + * gnome/applet/applet.glade: Hide the password entry text with + asterisks. + +2006-03-08 Robert Love <rml@novell.com> + + * src/NetworkManagerSystem.h, src/nm-device.c, NetworkManagerDebian.c, + NetworkManagerRedHat.c, NetworkManagerGentoo.c, + NetworkManagerSlackware.c: Pass nm_system_device_get_system_config() + a second argument, NMData. + * src/nm-ap-security.h, src/nm-ap-security.c: Export nm_ap_security_new. + * src/backends/NetworkManagerSuSE.c: Add wireless networks from ifcfg-* + config files as trusted. + +2006-03-06 Robert Love <rml@novell.com> + + * gnome/applet/Makefile.am: Define AUTOSTARTDIR. + * gnome/applet/applet.c: Add 'Remove' option to the right click menu, + to exit the applet. As a sweet side-effect, idea courtesy of Chris + Rivera, detect if the applet was auto-started. If so, ask the user + if he or she would like to stop automatically running the applet on + login. If so, disable autostart. + +2006-03-06 Robert Love <rml@novell.com> + + * NetworkManager.pc.in: Provide an -I to the NetworkManager include + directory in CFLAGS so developers can actually use NetworkManager.h. + +2006-03-06 Robert Love <rml@novell.com> + + * src/dhcp-manager/nm-dhcp-manager.c: Use preprocessor defines and not + open-coded integer constants. Add state_to_string() to map a given + state to a textual description, and provide that when notifying of + state change. + * src/dhcp-manager/nm-dhcp-manager.h: Provide defines for the dhcdbd + states, copied and cleaned up from dhcdbd.d. Ideally, we would use + this header directly, but it is currently not installed on most + systems. + +2006-03-05 Dan Williams <dcbw@redhat.com> + + * gnome/applet/applet-notifications.h + - Protect prototype of nma_send_event_notification() because it + includes libnotify-specific types + - Include libnotify/libnotify.h too, since we technically need it + + * gnome/applet/applet.c + - (nma_show_vpn_failure_dialog): fix usage of g_return_if_fail + - (nma_show_vpn_login_banner_dialog): add some error checking + +2006-03-04 Dan Williams <dcbw@redhat.com> + + Clean up activation cancellation. Should be a lot faster now. Observed + an issue with wireless devices between stage 2 and 3 of activation, where + activation would be cancelled, but the device thread wouldn't notice until + the supplicant association timed out. Reorganize activation such that + a cancellation handler gets immediately scheduled in the device's thread, + and devices have a chance to perform any custom cleanup too. + + * src/nm-device.[ch] + - (activation_cancel_handler): new device-type-specific function + for cleaning up device-type-specific stuff on cancellation + - (cancel_activation): removed + - (nm_device_activation_cancel): subsume functionality of + real_cancel_activation, but instead of doing anything, punt + operation to a handler that's run in device-thread context + - (nm_device_schedule_activation_handle_cancel): fix spelling of + a warning message + - (activation_handle_cancel_helper): cancellation handler run in + device-thread context, calls device-type-specific cancelation, + then tears down the activation request + - (real_activation_cancel_handler): generic cancellation handler, + deals with cancelling any in-process DHCP request + - (nm_device_activate_stage1_device_prepare, + nm_device_activate_stage2_device_config, + nm_device_activate_stage3_ip_config_start, + nm_device_activate_stage4_ip_config_get, + nm_device_activate_stage4_ip_config_timeout, + nm_device_activate_stage5_ip_commit): don't call + nm_device_schedule_activation_handle_cancel() any more, since + cancellation will have been already scheduled for us by + nm_device_activation_cancel(). Just exit the function and + assume that the cancel handler will be called next. + + * src/nm-device-802-3-ethernet.c + - (real_act_stage2_config): remove; didn't do anything anyway + + * src/nm-device-802-11-wireless.c + - (supplicant_status_cb): ensure we don't do anything if the activation + got cancelled + - (real_activation_cancel_handler): implement; cancel user key request + on activation cancellation + +2006-03-04 Dan Williams <dcbw@redhat.com> + + * src/nm-device-802-11-wireless.c + - (supplicant_send_network_config): assume that drivers that don't + support WPA pretty much suck, and can't handle NM scanning + along with wpa_supplicant. + +2006-03-03 Robert Love <rml@novell.com> + + * configure.in: Bump version to 0.6.0. + * NEWS: Update. + +2006-03-03 Robert Love <rml@novell.com> + + * configure.in: Require DBUS 0.60 or later. + 2006-03-03 Dan Williams <dcbw@redhat.com> Fix a crash if an "Other wireless network" was chosen, failed, then @@ -1,4 +1,54 @@ ============================================== +NetworkManager-0.6.1 +Overview of changes since NetworkManager-0.6.0 +============================================== + +0.6.1 is a minor bug fix release. + +* NetworkManager + * Improved activation cancelation (Dan Williams) + * Workarounds for non-WPA drivers (Dan Williams) + * Fix WPA Enterprise crasher (Robert Love) + +* nm-applet + * Hide password entry fields by default (Robert Love) + * Add toggle to show/hide password field (Robert Love) + * Add 'Remove' option to right-click menu (Robert Love) + +============================================== +NetworkManager-0.6.0 +Overview of changes since NetworkManager-0.5.1 +============================================== + +This releases ushers in WPA support, as well as many other features, bug fixes, +and clean ups. + +We now require libnl, a netlink library (http://people.suug.ch/~tgr/libnl/) and +wpa_supplicant, a WPA supplicant (http://hostap.epitest.fi/wpa_supplicant/). + +Two new VPN modules are part of the distribution: openvpn and pptp. + +* NetworkManager + * WPA and WPA2 support (Dan Williams) + * WPA Enterprise support (Robert Love) + * Rearchitecting, refactoring (Dan Williams) + * wpa_supplicant support (Dan Williams, Kay Sievers) + * NIS support (Robert Love) + * DHCP hostname support (Timo Hoenig) + * ISDN support, improve dial up support (Robert Love) + * Man pages (Robert Love) + * Survive DBUS and HAL restarts (Timo Hoening) + * Generate PID files (Dan Willians) + * Bug fixes and clean ups (the whole gang) + +* nm-applet + * New tray icon look and behavior (Robert Love, Dan Williams) + * New wireless security layer (Dan Williams) + * New "Enable Networking" toggle (Robert Love) + * Display speed of current connection (Robert Love) + * Bug fixes and clean ups (the whole gang) + +============================================== NetworkManager-0.5.1 Overview of changes since NetworkManager-0.5.0 ============================================== diff --git a/NetworkManager.pc.in b/NetworkManager.pc.in index 3ffcc5389c..33694613d4 100644 --- a/NetworkManager.pc.in +++ b/NetworkManager.pc.in @@ -8,3 +8,4 @@ Name: NetworkManager Description: System for maintaining active network connection Requires: dbus-1 Version: @VERSION@ +Cflags: -I${includedir}/NetworkManager diff --git a/configure.in b/configure.in index 47cfa56ff0..9ac7ad58d3 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ AC_PREREQ(2.52) -AC_INIT(NetworkManager, 0.5.1, dcbw@redhat.com, NetworkManager) +AC_INIT(NetworkManager, 0.6.1, dcbw@redhat.com, NetworkManager) AM_INIT_AUTOMAKE([subdir-objects]) AM_MAINTAINER_MODE @@ -87,7 +87,7 @@ fi IWLIB=-liw AC_SUBST(IWLIB) -PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.22) +PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60) ##### Find out the version of DBUS we're using dbus_version=`pkg-config --modversion dbus-1` diff --git a/dispatcher-daemon/NetworkManagerDispatcher.c b/dispatcher-daemon/NetworkManagerDispatcher.c index c61b25cbaf..8f1d366398 100644 --- a/dispatcher-daemon/NetworkManagerDispatcher.c +++ b/dispatcher-daemon/NetworkManagerDispatcher.c @@ -52,6 +52,7 @@ typedef enum NMDAction NMDAction; #define NMD_DEFAULT_PID_FILE LOCALSTATEDIR"/run/NetworkManagerDispatcher.pid" +static DBusConnection *nmd_dbus_init (void); /* * nmd_permission_check @@ -174,6 +175,22 @@ static char * nmd_get_device_name (DBusConnection *connection, char *path) return dev_name; } +/* + * nmd reinit_dbus + * + * Reconnect to the system message bus if the connection was dropped. + * + */ +static gboolean nmd_reinit_dbus (gpointer user_data) +{ + if (nmd_dbus_init ()) + { + nm_info ("Successfully reconnected to the system bus."); + return FALSE; + } + else + return TRUE; +} /* * nmd_dbus_filter @@ -191,6 +208,14 @@ static DBusHandlerResult nmd_dbus_filter (DBusConnection *connection, DBusMessag dbus_error_init (&error); object_path = dbus_message_get_path (message); + if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected")) + { + dbus_connection_unref (connection); + connection = NULL; + g_timeout_add (3000, nmd_reinit_dbus, NULL); + handled = TRUE; + } + if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive")) action = NMD_DEVICE_NOW_INACTIVE; else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")) @@ -225,7 +250,6 @@ static DBusHandlerResult nmd_dbus_filter (DBusConnection *connection, DBusMessag return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED); } - /* * nmd_dbus_init * @@ -246,6 +270,7 @@ static DBusConnection *nmd_dbus_init (void) return (NULL); } + dbus_connection_set_exit_on_disconnect (connection, FALSE); dbus_connection_setup_with_g_main (connection, NULL); if (!dbus_connection_add_filter (connection, nmd_dbus_filter, NULL, NULL)) diff --git a/gnome/applet/Makefile.am b/gnome/applet/Makefile.am index 542bed9ab5..c53ac218f1 100644 --- a/gnome/applet/Makefile.am +++ b/gnome/applet/Makefile.am @@ -6,28 +6,29 @@ INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/include -I${top bin_PROGRAMS = nm-applet -nm_applet_CPPFLAGS = \ - $(DBUS_CFLAGS) \ - $(GTHREAD_CFLAGS) \ - $(HAL_CFLAGS) \ - $(DBUS_GLIB_CFLAGS) \ - $(GLADE_CFLAGS) \ - $(GTK_CFLAGS) \ - $(GCONF_CFLAGS) \ - $(LIBGNOMEUI_CFLAGS) \ - $(PANEL_APPLET_CFLAGS) \ - $(GNOME_KEYRING_CFLAGS) \ - -DICONDIR=\""$(datadir)/pixmaps"\" \ - -DGLADEDIR=\""$(gladedir)"\" \ - -DBINDIR=\""$(bindir)"\" \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ +nm_applet_CPPFLAGS = \ + $(DBUS_CFLAGS) \ + $(GTHREAD_CFLAGS) \ + $(HAL_CFLAGS) \ + $(DBUS_GLIB_CFLAGS) \ + $(GLADE_CFLAGS) \ + $(GTK_CFLAGS) \ + $(GCONF_CFLAGS) \ + $(LIBGNOMEUI_CFLAGS) \ + $(PANEL_APPLET_CFLAGS) \ + $(GNOME_KEYRING_CFLAGS) \ + -DICONDIR=\""$(datadir)/pixmaps"\" \ + -DGLADEDIR=\""$(gladedir)"\" \ + -DBINDIR=\""$(bindir)"\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DAUTOSTARTDIR=\""$(datadir)/gnome/autostart"\" \ -DVPN_NAME_FILES_DIR=\""$(sysconfdir)/NetworkManager/VPN"\" \ - -DDBUS_API_SUBJECT_TO_CHANGE \ - -DG_DISABLE_DEPRECATED \ - -DGDK_DISABLE_DEPRECATED \ - -DGNOME_DISABLE_DEPRECATED \ + -DDBUS_API_SUBJECT_TO_CHANGE \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGNOME_DISABLE_DEPRECATED \ -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ - -DVERSION=\"$(VERSION)\" \ + -DVERSION=\"$(VERSION)\" \ $(NULL) if WITH_NOTIFY diff --git a/gnome/applet/applet-dbus-devices.c b/gnome/applet/applet-dbus-devices.c index 6f6dda9b22..bfed7955ad 100644 --- a/gnome/applet/applet-dbus-devices.c +++ b/gnome/applet/applet-dbus-devices.c @@ -291,7 +291,8 @@ static void hal_info_product_cb (DBusPendingCall *pcall, void *user_data) { DBusMessage * reply; HalInfoCBData * cb_data = (HalInfoCBData *) user_data; - char * info_product; + char * info_product = "Unknown"; + char * desc; g_return_if_fail (pcall != NULL); g_return_if_fail (cb_data != NULL); @@ -303,24 +304,13 @@ static void hal_info_product_cb (DBusPendingCall *pcall, void *user_data) if (!(reply = dbus_pending_call_steal_reply (pcall))) goto out; - if (message_is_error (reply)) - { - DBusError err; + if (!message_is_error (reply)) + dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &info_product, DBUS_TYPE_INVALID); - dbus_error_init (&err); - dbus_set_error_from_message (&err, reply); - nm_warning ("dbus returned an error.\n (%s) %s\n", err.name, err.message); - dbus_error_free (&err); - dbus_message_unref (reply); - goto out; - } + desc = g_strdup_printf ("%s %s", cb_data->vendor, info_product); + network_device_set_desc (cb_data->dev, desc); + g_free (desc); - if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &info_product, DBUS_TYPE_INVALID)) - { - char *desc = g_strdup_printf ("%s %s", cb_data->vendor, info_product); - - network_device_set_desc (cb_data->dev, desc); - } dbus_message_unref (reply); out: @@ -338,7 +328,10 @@ static void hal_info_vendor_cb (DBusPendingCall *pcall, void *user_data) { DBusMessage * reply; HalInfoCBData * cb_data = (HalInfoCBData *) user_data; - char * info_vendor; + char * info_vendor = "Unknown"; + DBusMessage * message; + DBusPendingCall * product_pcall = NULL; + g_return_if_fail (pcall != NULL); g_return_if_fail (cb_data != NULL); @@ -349,44 +342,30 @@ static void hal_info_vendor_cb (DBusPendingCall *pcall, void *user_data) if (!(reply = dbus_pending_call_steal_reply (pcall))) goto out; - if (message_is_error (reply)) - { - DBusError err; + if (!message_is_error (reply)) + dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &info_vendor, DBUS_TYPE_INVALID); - dbus_error_init (&err); - dbus_set_error_from_message (&err, reply); - nm_warning ("dbus returned an error.\n (%s) %s\n", err.name, err.message); - dbus_error_free (&err); - dbus_message_unref (reply); - goto out; - } - - if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &info_vendor, DBUS_TYPE_INVALID)) + if ((message = dbus_message_new_method_call ("org.freedesktop.Hal", cb_data->parent_op, + "org.freedesktop.Hal.Device", "GetPropertyString"))) { - DBusMessage * message; - DBusPendingCall * product_pcall = NULL; + const char * prop = "info.product"; - if ((message = dbus_message_new_method_call ("org.freedesktop.Hal", cb_data->parent_op, - "org.freedesktop.Hal.Device", "GetPropertyString"))) + dbus_message_append_args (message, DBUS_TYPE_STRING, &prop, DBUS_TYPE_INVALID); + dbus_connection_send_with_reply (cb_data->applet->connection, message, &product_pcall, -1); + if (product_pcall) { - const char * prop = "info.product"; - - dbus_message_append_args (message, DBUS_TYPE_STRING, &prop, DBUS_TYPE_INVALID); - dbus_connection_send_with_reply (cb_data->applet->connection, message, &product_pcall, -1); - if (product_pcall) - { - HalInfoCBData * product_cb_data = g_malloc0 (sizeof (HalInfoCBData)); - - product_cb_data->applet = cb_data->applet; - network_device_ref (cb_data->dev); - product_cb_data->dev = cb_data->dev; - product_cb_data->parent_op = g_strdup (cb_data->parent_op); - product_cb_data->vendor = g_strdup (info_vendor); - dbus_pending_call_set_notify (product_pcall, hal_info_product_cb, product_cb_data, (DBusFreeFunction) free_hal_info_cb_data); - } - dbus_message_unref (message); + HalInfoCBData * product_cb_data = g_malloc0 (sizeof (HalInfoCBData)); + + product_cb_data->applet = cb_data->applet; + network_device_ref (cb_data->dev); + product_cb_data->dev = cb_data->dev; + product_cb_data->parent_op = g_strdup (cb_data->parent_op); + product_cb_data->vendor = g_strdup (info_vendor); + dbus_pending_call_set_notify (product_pcall, hal_info_product_cb, product_cb_data, (DBusFreeFunction) free_hal_info_cb_data); } + dbus_message_unref (message); } + dbus_message_unref (reply); out: @@ -895,11 +874,13 @@ static void free_device_activated_cb_data (DeviceActivatedCBData *obj) static void nma_dbus_device_activated_cb (DBusPendingCall *pcall, void *user_data) { DeviceActivatedCBData * cb_data = (DeviceActivatedCBData*) user_data; - NMApplet * applet = cb_data->applet; + NMApplet * applet = cb_data->applet; +#ifdef ENABLE_NOTIFY char * essid = cb_data->essid; NetworkDevice * active_device; char * message = NULL; char * icon = NULL; +#endif nma_dbus_device_properties_cb (pcall, applet); diff --git a/gnome/applet/applet-notifications.c b/gnome/applet/applet-notifications.c index 86dcc4a69d..4a13a6ca90 100644 --- a/gnome/applet/applet-notifications.c +++ b/gnome/applet/applet-notifications.c @@ -20,6 +20,7 @@ */ #include <libnotify/notify.h> +#include "applet.h" #include "applet-notifications.h" void diff --git a/gnome/applet/applet-notifications.h b/gnome/applet/applet-notifications.h index e95d0b965e..a4050310b9 100644 --- a/gnome/applet/applet-notifications.h +++ b/gnome/applet/applet-notifications.h @@ -22,6 +22,11 @@ #ifndef NM_NOTIFICATION_H__ #define NM_NOTIFICATION_H__ +#include "config.h" + +#ifdef ENABLE_NOTIFY + +#include <libnotify/notify.h> #include "applet.h" void @@ -31,4 +36,6 @@ nma_send_event_notification (NMApplet *applet, const char *message, const char *icon); +#endif /* ENABLE_NOTIFY */ + #endif /* NM_NOTIFICATION_H__ */ diff --git a/gnome/applet/applet.c b/gnome/applet/applet.c index 9602ec0871..58805b7e58 100644 --- a/gnome/applet/applet.c +++ b/gnome/applet/applet.c @@ -75,15 +75,15 @@ #define GTK_STOCK_INFO GTK_STOCK_DIALOG_INFO #endif -static GObject * nma_constructor (GType type, guint n_props, GObjectConstructParam *construct_props); -static gboolean nma_icons_init (NMApplet *applet); -static void nma_icons_free (NMApplet *applet); -static void nma_about_cb (NMApplet *applet); -static void nma_context_menu_update (NMApplet *applet); -static GtkWidget * nma_get_instance (NMApplet *applet); -static void nma_update_state (NMApplet *applet); -static void nma_dropdown_menu_deactivate_cb (GtkWidget *menu, NMApplet *applet); -static GType nma_get_type (void); /* for G_DEFINE_TYPE */ +static GObject * nma_constructor (GType type, guint n_props, GObjectConstructParam *construct_props); +static gboolean nma_icons_init (NMApplet *applet); +static void nma_icons_free (NMApplet *applet); +static void nma_context_menu_update (NMApplet *applet); +static GtkWidget * nma_get_instance (NMApplet *applet); +static void nma_update_state (NMApplet *applet); +static void nma_dropdown_menu_deactivate_cb (GtkWidget *menu, NMApplet *applet); +static G_GNUC_NORETURN void nma_destroy (NMApplet *applet); +static GType nma_get_type (void); /* for G_DEFINE_TYPE */ G_DEFINE_TYPE(NMApplet, nma, EGG_TYPE_TRAY_ICON) @@ -291,7 +291,7 @@ static void about_dialog_activate_link_cb (GtkAboutDialog *about, gnome_url_show (url, NULL); } -static void nma_about_cb (NMApplet *applet) +static void nma_about_cb (GtkMenuItem *mi, NMApplet *applet) { static const gchar *authors[] = { @@ -373,6 +373,87 @@ static void nma_about_cb (NMApplet *applet) #endif } + +#define AUTOSTART_ENABLE_STR "X-GNOME-Autostart-enabled=true" +#define AUTOSTART_ENABLE_STR_LEN 30 +#define AUTOSTART_DISABLE_STR "X-GNOME-Autostart-enabled=false" +#define AUTOSTART_DISABLE_STR_LEN 31 +static void G_GNUC_NORETURN nma_remove_cb (GtkMenuItem *mi, NMApplet *applet) +{ + char *src; + char *dir; + char *file; + const char *sub; + gsize src_len; + GtkWidget *dialog; + + /* + * Give the user the option of disabling autostart, if it is enabled. Autostart is in + * use if there is an nm-applet.desktop in either the system wide or the per-user + * autostart directory and it has "X-GNOME-Autostart-enabled" set to "true". To disable + * autostart, we (re)write the autostart file to the per-user location, with the + * autostart option set to "false". + */ + + dir = g_strdup_printf ("%s/.config/autostart", g_get_home_dir ()); + file = g_strdup_printf ("%s/nm-applet.desktop", dir); + + /* + * Figure out what our source file is. Try to use the user's nm-applet.desktop, first. + * If it does not exist, we use the system-wide autostart file. + */ + if (!g_file_get_contents (file, &src, &src_len, NULL)) + if (!g_file_get_contents (AUTOSTARTDIR"/nm-applet.desktop", &src, &src_len, NULL)) + goto out_free_file; + + /* If autostart is explicitly disabled or not explicitly enabled, we are done. */ + if (strstr (src, AUTOSTART_DISABLE_STR)) + goto out_free_src; + sub = strstr (src, AUTOSTART_ENABLE_STR); + if (!sub) + goto out_free_src; + + dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", + _("Stop automatically running the networking applet?"), + _("The networking applet will now terminate, but will automatically launch the next time you login. Would you like to stop automatically running the networking applet on login?")); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) + { + char *dst; + gsize dst_len; + gsize sub_len; + + src_len += 1; + dst_len = src_len + 1; + dst = g_malloc (dst_len); + sub_len = sub - src; + + /* memcpy the first chunk, write in our updated string, and memcpy the remaining bytes */ + memcpy (dst, src, sub_len); + g_strlcpy (dst + sub_len, AUTOSTART_DISABLE_STR, dst_len - sub_len); + memcpy (dst + sub_len + AUTOSTART_DISABLE_STR_LEN, + sub + AUTOSTART_ENABLE_STR_LEN, + src_len - sub_len - AUTOSTART_ENABLE_STR_LEN); + dst[dst_len-1] = '\0'; + + g_mkdir_with_parents (dir, 0750); + g_file_set_contents (file, dst, dst_len, NULL); + + g_free (dst); + } + + gtk_widget_destroy (dialog); + +out_free_src: + g_free (src); +out_free_file: + g_free (file); + g_free (dir); + + nma_destroy (applet); +} + + #ifndef ENABLE_NOTIFY /* * nma_show_vpn_failure_dialog @@ -386,8 +467,8 @@ nma_show_vpn_failure_dialog (const char *title, { GtkWidget *dialog; - g_return_if_fail (title != NULL, FALSE); - g_return_if_fail (msg != NULL, FALSE); + g_return_if_fail (title != NULL); + g_return_if_fail (msg != NULL); dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg, NULL); @@ -480,6 +561,9 @@ nma_show_vpn_login_banner_dialog (const char *title, { GtkWidget *dialog; + g_return_if_fail (title != NULL); + g_return_if_fail (msg != NULL); + dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, msg, NULL); gtk_window_set_title (GTK_WINDOW (dialog), title); @@ -2199,6 +2283,13 @@ static GtkWidget *nma_context_menu_create (NMApplet *applet) gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + /* Quit */ + menu_item = gtk_image_menu_item_new_with_mnemonic (_("_Remove")); + g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (nma_remove_cb), applet); + image = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + gtk_widget_show_all (menu); return menu; @@ -2437,8 +2528,7 @@ static void nma_gconf_vpn_connections_notify_callback (GConfClient *client, guin * Destroy the applet and clean up its data * */ -static void G_GNUC_NORETURN -nma_destroy (NMApplet *applet, gpointer user_data) +static void G_GNUC_NORETURN nma_destroy (NMApplet *applet) { if (applet->dropdown_menu) nma_dropdown_menu_clear (applet->dropdown_menu); diff --git a/gnome/applet/applet.glade b/gnome/applet/applet.glade index fd8a852ff8..606a20f5cb 100644 --- a/gnome/applet/applet.glade +++ b/gnome/applet/applet.glade @@ -1749,7 +1749,7 @@ WEP 40/128-bit ASCII <widget class="GtkTable" id="table6"> <property name="border_width">8</property> <property name="visible">True</property> - <property name="n_rows">2</property> + <property name="n_rows">3</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> @@ -1788,7 +1788,7 @@ WEP 40/128-bit ASCII <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> - <property name="visibility">True</property> + <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> @@ -1825,8 +1825,8 @@ WEP 40/128-bit ASCII <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -1843,10 +1843,60 @@ Shared Key</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label31"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="show_checkbutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Show key</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> </widget> @@ -1970,7 +2020,7 @@ Shared Key</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> - <property name="visibility">True</property> + <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> @@ -2130,7 +2180,7 @@ Shared Key</property> <widget class="GtkTable" id="wpa_psk_table"> <property name="border_width">8</property> <property name="visible">True</property> - <property name="n_rows">2</property> + <property name="n_rows">3</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">4</property> @@ -2169,7 +2219,7 @@ Shared Key</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> - <property name="visibility">True</property> + <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> @@ -2206,8 +2256,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2223,10 +2273,60 @@ Shared Key</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label32"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="show_checkbutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Show password</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> </widget> @@ -2318,7 +2418,7 @@ Shared Key</property> <widget class="GtkTable" id="wpa_eap_table"> <property name="border_width">8</property> <property name="visible">True</property> - <property name="n_rows">8</property> + <property name="n_rows">9</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">4</property> @@ -2453,7 +2553,7 @@ Shared Key</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> - <property name="visibility">True</property> + <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> @@ -2627,7 +2727,7 @@ Shared Key</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> - <property name="visibility">True</property> + <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> @@ -2707,6 +2807,56 @@ Shared Key</property> <property name="y_options">fill</property> </packing> </child> + + <child> + <widget class="GtkLabel" id="label33"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="show_checkbutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Show passwords</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> <property name="tab_expand">False</property> @@ -2796,7 +2946,7 @@ Shared Key</property> <widget class="GtkTable" id="table7"> <property name="border_width">8</property> <property name="visible">True</property> - <property name="n_rows">2</property> + <property name="n_rows">3</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> @@ -2835,7 +2985,7 @@ Shared Key</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> - <property name="visibility">True</property> + <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> @@ -2872,8 +3022,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2890,10 +3040,60 @@ Shared Key</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="show_checkbutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Show passphrase</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label30"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> </widget> diff --git a/gnome/applet/wso-wep-ascii.c b/gnome/applet/wso-wep-ascii.c index e11980b470..20c08d23f1 100644 --- a/gnome/applet/wso-wep-ascii.c +++ b/gnome/applet/wso-wep-ascii.c @@ -37,6 +37,7 @@ struct OptData { const char * entry_name; const char * auth_combo_name; + const char * show_checkbutton_name; }; static void data_free_func (WirelessSecurityOption *opt) @@ -53,9 +54,16 @@ static void data_free_func (WirelessSecurityOption *opt) } +static void show_key_cb (GtkToggleButton *button, GtkEntry *entry) +{ + gtk_entry_set_visibility (entry, gtk_toggle_button_get_active (button)); +} + + static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFunc validate_cb, gpointer user_data) { GtkWidget * entry; + GtkWidget * checkbutton; GtkWidget * combo; GtkWidget * widget; @@ -69,6 +77,9 @@ static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFun entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); g_signal_connect (G_OBJECT (entry), "changed", validate_cb, user_data); + checkbutton = glade_xml_get_widget (opt->uixml, opt->data->show_checkbutton_name); + g_signal_connect (G_OBJECT (checkbutton), "toggled", GTK_SIGNAL_FUNC (show_key_cb), GTK_ENTRY (entry)); + combo = glade_xml_get_widget (opt->uixml, opt->data->auth_combo_name); wso_wep_auth_combo_setup (opt, GTK_COMBO_BOX (combo)); @@ -143,6 +154,7 @@ WirelessSecurityOption * wso_wep_ascii_new (const char *glade_file) opt->data = data = g_malloc0 (sizeof (OptData)); data->entry_name = "wep_key_entry"; data->auth_combo_name = "auth_method_combo"; + data->show_checkbutton_name = "show_checkbutton"; return opt; } diff --git a/gnome/applet/wso-wep-hex.c b/gnome/applet/wso-wep-hex.c index 2809edd23b..102b616630 100644 --- a/gnome/applet/wso-wep-hex.c +++ b/gnome/applet/wso-wep-hex.c @@ -37,6 +37,7 @@ struct OptData { const char * entry_name; const char * auth_combo_name; + const char * show_checkbutton_name; }; static void data_free_func (WirelessSecurityOption *opt) @@ -53,9 +54,16 @@ static void data_free_func (WirelessSecurityOption *opt) } +static void show_key_cb (GtkToggleButton *button, GtkEntry *entry) +{ + gtk_entry_set_visibility (entry, gtk_toggle_button_get_active (button)); +} + + static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFunc validate_cb, gpointer user_data) { GtkWidget * entry; + GtkWidget * checkbutton; GtkWidget * combo; GtkWidget * widget; @@ -67,6 +75,9 @@ static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFun entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); g_signal_connect (G_OBJECT (entry), "changed", validate_cb, user_data); + checkbutton = glade_xml_get_widget (opt->uixml, opt->data->show_checkbutton_name); + g_signal_connect (G_OBJECT (checkbutton), "toggled", GTK_SIGNAL_FUNC (show_key_cb), GTK_ENTRY (entry)); + combo = glade_xml_get_widget (opt->uixml, opt->data->auth_combo_name); wso_wep_auth_combo_setup (opt, GTK_COMBO_BOX (combo)); @@ -140,6 +151,7 @@ WirelessSecurityOption * wso_wep_hex_new (const char *glade_file) opt->data = data = g_malloc0 (sizeof (OptData)); data->entry_name = "wep_key_entry"; data->auth_combo_name = "auth_method_combo"; + data->show_checkbutton_name = "show_checkbutton"; return opt; } diff --git a/gnome/applet/wso-wep-passphrase.c b/gnome/applet/wso-wep-passphrase.c index 7034b3e855..29cc373d66 100644 --- a/gnome/applet/wso-wep-passphrase.c +++ b/gnome/applet/wso-wep-passphrase.c @@ -37,6 +37,7 @@ struct OptData { const char * entry_name; const char * auth_combo_name; + const char * show_checkbutton_name; }; static void data_free_func (WirelessSecurityOption *opt) @@ -53,9 +54,15 @@ static void data_free_func (WirelessSecurityOption *opt) } +static void show_passphrase_cb (GtkToggleButton *button, GtkEntry *entry) +{ + gtk_entry_set_visibility (entry, gtk_toggle_button_get_active (button)); +} + static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFunc validate_cb, gpointer user_data) { GtkWidget * entry; + GtkWidget * checkbutton; GtkWidget * combo; GtkWidget * widget; @@ -67,6 +74,9 @@ static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFun entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); g_signal_connect (G_OBJECT (entry), "changed", validate_cb, user_data); + checkbutton = glade_xml_get_widget (opt->uixml, opt->data->show_checkbutton_name); + g_signal_connect (G_OBJECT (checkbutton), "toggled", GTK_SIGNAL_FUNC (show_passphrase_cb), GTK_ENTRY (entry)); + combo = glade_xml_get_widget (opt->uixml, opt->data->auth_combo_name); wso_wep_auth_combo_setup (opt, GTK_COMBO_BOX (combo)); @@ -83,6 +93,7 @@ static gboolean validate_input_func (WirelessSecurityOption *opt, const char *ss entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); input = gtk_entry_get_text (GTK_ENTRY (entry)); + return wso_validate_helper (opt, ssid, input, out_cipher); } @@ -139,6 +150,7 @@ WirelessSecurityOption * wso_wep_passphrase_new (const char *glade_file) opt->data = data = g_malloc0 (sizeof (OptData)); data->entry_name = "wep_passphrase_entry"; data->auth_combo_name = "auth_method_combo"; + data->show_checkbutton_name = "show_checkbutton"; return opt; } diff --git a/gnome/applet/wso-wpa-eap.c b/gnome/applet/wso-wpa-eap.c index f7ae4c7467..44342d422b 100644 --- a/gnome/applet/wso-wpa-eap.c +++ b/gnome/applet/wso-wpa-eap.c @@ -62,6 +62,21 @@ data_free_func (WirelessSecurityOption *opt) } +static void show_passwords_cb (GtkToggleButton *button, WirelessSecurityOption *opt) +{ + GtkWidget * entry; + gboolean visible; + + visible = gtk_toggle_button_get_active (button); + + entry = glade_xml_get_widget (opt->uixml, "wpa_eap_passwd_entry"); + gtk_entry_set_visibility (GTK_ENTRY (entry), visible); + + entry = glade_xml_get_widget (opt->uixml, "wpa_eap_private_key_passwd_entry"); + gtk_entry_set_visibility (GTK_ENTRY (entry), visible); +} + + static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFunc validate_cb, @@ -69,6 +84,7 @@ widget_create_func (WirelessSecurityOption *opt, { GtkWidget * entry; GtkWidget * widget; + GtkWidget * checkbutton; g_return_val_if_fail (opt != NULL, NULL); g_return_val_if_fail (opt->data != NULL, NULL); @@ -97,6 +113,9 @@ widget_create_func (WirelessSecurityOption *opt, entry = glade_xml_get_widget (opt->uixml, "wpa_eap_private_key_passwd_entry"); g_signal_connect (G_OBJECT (entry), "changed", validate_cb, user_data); + checkbutton = glade_xml_get_widget (opt->uixml, "show_checkbutton"); + g_signal_connect (G_OBJECT (checkbutton), "toggled", GTK_SIGNAL_FUNC (show_passwords_cb), opt); + return widget; } diff --git a/gnome/applet/wso-wpa-psk.c b/gnome/applet/wso-wpa-psk.c index ded3e16ca5..e6fcbf5ee3 100644 --- a/gnome/applet/wso-wpa-psk.c +++ b/gnome/applet/wso-wpa-psk.c @@ -41,6 +41,7 @@ struct OptData gboolean wpa2; const char * entry_name; const char * key_type_combo_name; + const char * show_checkbutton_name; IEEE_802_11_Cipher * hex_cipher; IEEE_802_11_Cipher * passphrase_cipher; }; @@ -58,12 +59,19 @@ data_free_func (WirelessSecurityOption *opt) } +static void show_passphrase_cb (GtkToggleButton *button, GtkEntry *entry) +{ + gtk_entry_set_visibility (entry, gtk_toggle_button_get_active (button)); +} + + static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFunc validate_cb, gpointer user_data) { GtkWidget * entry; + GtkWidget * checkbutton; GtkWidget * widget; g_return_val_if_fail (opt != NULL, NULL); @@ -73,6 +81,10 @@ widget_create_func (WirelessSecurityOption *opt, widget = wso_widget_helper (opt); entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); g_signal_connect (G_OBJECT (entry), "changed", validate_cb, user_data); + + checkbutton = glade_xml_get_widget (opt->uixml, opt->data->show_checkbutton_name); + g_signal_connect (G_OBJECT (checkbutton), "toggled", GTK_SIGNAL_FUNC (show_passphrase_cb), GTK_ENTRY (entry)); + return widget; } @@ -183,6 +195,7 @@ wso_wpa_psk_new (const char *glade_file, data->wpa2 = wpa2; data->entry_name = "wpa_psk_entry"; data->key_type_combo_name = "wpa_psk_type_combo"; + data->show_checkbutton_name = "show_checkbutton"; /* Set up our ciphers */ data->passphrase_cipher = cipher_wpa_psk_passphrase_new (); diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c index d616cb8f4b..6d3c749c19 100644 --- a/src/NetworkManagerAP.c +++ b/src/NetworkManagerAP.c @@ -171,13 +171,20 @@ const GTimeVal *nm_ap_get_timestamp (const NMAccessPoint *ap) return (&ap->timestamp); } -void nm_ap_set_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp) +void nm_ap_set_timestamp (NMAccessPoint *ap, glong sec, glong usec) { g_return_if_fail (ap != NULL); - ap->timestamp = *timestamp; + ap->timestamp.tv_sec = sec; + ap->timestamp.tv_usec = usec; } +void nm_ap_set_timestamp_via_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp) +{ + g_return_if_fail (ap != NULL); + + ap->timestamp = *timestamp; +} /* * Get/set functions for essid diff --git a/src/NetworkManagerAP.h b/src/NetworkManagerAP.h index 66f9188fa1..fc376ba3e6 100644 --- a/src/NetworkManagerAP.h +++ b/src/NetworkManagerAP.h @@ -37,8 +37,9 @@ NMAccessPoint * nm_ap_new_from_ap (NMAccessPoint *ap); void nm_ap_unref (NMAccessPoint *ap); void nm_ap_ref (NMAccessPoint *ap); -const GTimeVal * nm_ap_get_timestamp (const NMAccessPoint *ap); -void nm_ap_set_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp); +const GTimeVal * nm_ap_get_timestamp (const NMAccessPoint *ap); +void nm_ap_set_timestamp (NMAccessPoint *ap, glong sec, glong usec); +void nm_ap_set_timestamp_via_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp); const char * nm_ap_get_essid (const NMAccessPoint *ap); void nm_ap_set_essid (NMAccessPoint *ap, const char *essid); diff --git a/src/NetworkManagerAPList.c b/src/NetworkManagerAPList.c index 32e5964933..6fb99431da 100644 --- a/src/NetworkManagerAPList.c +++ b/src/NetworkManagerAPList.c @@ -573,7 +573,7 @@ void nm_ap_list_copy_properties (NMAccessPointList *dest, NMAccessPointList *sou { nm_ap_set_invalid (dest_ap, nm_ap_get_invalid (src_ap)); nm_ap_set_security (dest_ap, nm_ap_get_security (src_ap)); - nm_ap_set_timestamp (dest_ap, nm_ap_get_timestamp (src_ap)); + nm_ap_set_timestamp_via_timestamp (dest_ap, nm_ap_get_timestamp (src_ap)); } } nm_ap_list_iter_free (iter); diff --git a/src/NetworkManagerSystem.h b/src/NetworkManagerSystem.h index e6f3f80ddd..4a173d6632 100644 --- a/src/NetworkManagerSystem.h +++ b/src/NetworkManagerSystem.h @@ -27,6 +27,7 @@ #include "nm-ip4-config.h" #include "nm-named-manager.h" +struct NMData; /* Prototypes for system/distribution dependent functions, * implemented in the backend files in backends/ directory @@ -55,7 +56,7 @@ void nm_system_update_dns (void); void nm_system_restart_mdns_responder (void); void nm_system_device_add_ip6_link_address (NMDevice *dev); -void * nm_system_device_get_system_config (NMDevice *dev); +void * nm_system_device_get_system_config (NMDevice *dev, struct NMData *data); void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data); NMIP4Config * nm_system_device_new_ip4_system_config (NMDevice *dev); diff --git a/src/backends/Makefile.am b/src/backends/Makefile.am index 3e1ad3b038..583acef01e 100644 --- a/src/backends/Makefile.am +++ b/src/backends/Makefile.am @@ -1,9 +1,10 @@ -INCLUDES = -I${top_srcdir} \ - -I${top_srcdir}/include \ - -I${top_srcdir}/utils \ - -I${top_srcdir}/src \ - -I${top_srcdir}/src/vpn-manager \ - -I${top_srcdir}/src/named-manager +INCLUDES = -I${top_srcdir} \ + -I${top_srcdir}/include \ + -I${top_srcdir}/utils \ + -I${top_srcdir}/src \ + -I${top_srcdir}/src/vpn-manager \ + -I${top_srcdir}/src/named-manager \ + -I${top_srcdir}/libnm-util noinst_LTLIBRARIES = libnmbackend.la diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c index db90fad3d8..63cfafb630 100644 --- a/src/backends/NetworkManagerDebian.c +++ b/src/backends/NetworkManagerDebian.c @@ -384,7 +384,7 @@ out: * info before setting stuff too. * */ -void* nm_system_device_get_system_config (NMDevice *dev) +void* nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) { DebSystemConfigData * sys_data = NULL; if_block *curr_device; diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index c77855b56b..338a8e50f7 100644 --- a/src/backends/NetworkManagerGentoo.c +++ b/src/backends/NetworkManagerGentoo.c @@ -300,7 +300,7 @@ typedef struct GentooSystemConfigData * info before setting stuff too. * */ -void *nm_system_device_get_system_config (NMDevice *dev) +void *nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) { char *cfg_file_path = NULL; FILE *file = NULL; diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index 2676ca51f3..c6cba7d8ad 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -454,7 +454,7 @@ out: * Read in the config file for a device. * */ -void *nm_system_device_get_system_config (NMDevice *dev) +void *nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) { char * cfg_file_path = NULL; shvarFile * file; diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index 91dbb0aa87..ae7816a0cd 100644 --- a/src/backends/NetworkManagerSlackware.c +++ b/src/backends/NetworkManagerSlackware.c @@ -139,7 +139,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev) * info before setting stuff too. * */ -void *nm_system_device_get_system_config (NMDevice *dev) +void *nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) { return NULL; } diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index 43cc79e630..d7d3889bed 100644 --- a/src/backends/NetworkManagerSuSE.c +++ b/src/backends/NetworkManagerSuSE.c @@ -31,7 +31,19 @@ #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" +#include "NetworkManagerMain.h" #include "nm-device.h" +#include "nm-ap-security.h" +#include "nm-ap-security-private.h" +#include "nm-ap-security-wep.h" +#include "nm-ap-security-wpa-psk.h" +#include "NetworkManagerAPList.h" +#include "NetworkManagerPolicy.h" +#include "cipher.h" +#include "cipher-wep-ascii.h" +#include "cipher-wep-hex.h" +#include "cipher-wep-passphrase.h" +#include "cipher-wpa-psk-passphrase.h" #include "nm-device-802-3-ethernet.h" #include "nm-device-802-11-wireless.h" #include "NetworkManagerDialup.h" @@ -428,7 +440,7 @@ out: * SuSE stores this information in /etc/sysconfig/network/ifcfg-*-<MAC address> * */ -void *nm_system_device_get_system_config (NMDevice *dev) +void *nm_system_device_get_system_config (NMDevice *dev, NMData *app_data) { char *cfg_file_path = NULL; char mac[18]; @@ -482,7 +494,7 @@ void *nm_system_device_get_system_config (NMDevice *dev) return sys_data; found: - nm_debug ("found config %s for if %s", cfg_file_path, nm_device_get_iface (dev)); + nm_debug ("found config '%s' for interface '%s'", cfg_file_path, nm_device_get_iface (dev)); if (!(file = svNewFile (cfg_file_path))) { g_free (cfg_file_path); @@ -507,7 +519,127 @@ found: sys_data->system_disabled = TRUE; } free (buf); - } + } + + if ((buf = svGetValue (file, "WIRELESS_ESSID"))) + { + NMAccessPoint * ap; + NMAccessPoint * list_ap; + char * key; + char * mode; + + ap = nm_ap_new (); + nm_ap_set_essid (ap, buf); + nm_ap_set_timestamp (ap, time (NULL), 0); + nm_ap_set_trusted (ap, TRUE); + + if ((mode = svGetValue (file, "WIRELESS_AUTH_MODE")) && !strcmp (mode, "psk")) + { + if ((key = svGetValue (file, "WIRELESS_WPA_PSK"))) + { + IEEE_802_11_Cipher * cipher; + NMAPSecurityWPA_PSK * security; + char * hash; + + cipher = cipher_wpa_psk_passphrase_new (); + nm_ap_set_capabilities (ap, NM_802_11_CAP_PROTO_WPA); + security = nm_ap_security_wpa_psk_new_from_ap (ap, NM_AUTH_TYPE_WPA_PSK_AUTO); + hash = ieee_802_11_cipher_hash (cipher, buf, key); + nm_ap_security_set_key (NM_AP_SECURITY (security), hash, strlen (hash)); + nm_ap_set_security (ap, NM_AP_SECURITY (security)); + + ieee_802_11_cipher_unref (cipher); + g_object_unref (G_OBJECT (security)); + } + } + else if ((key = svGetValue (file, "WIRELESS_KEY_0")) && strlen (key) > 3) + { + IEEE_802_11_Cipher * cipher; + NMAPSecurityWEP * security; + char * key_type; + char * hash; + char * real_key; + + key_type = svGetValue (file, "WIRELESS_KEY_LENGTH"); + if (key_type && strcmp (key_type, "128") != 0) + { + if (key[0] == 'h' && key[1] == ':') + { + cipher = cipher_wep64_passphrase_new (); + real_key = key + 2; + } + else if (key[0] == 's' && key[1] == ':') + { + cipher = cipher_wep64_ascii_new (); + real_key = key + 2; + } + else + { + cipher = cipher_wep64_hex_new (); + real_key = key; + } + security = nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP40); + } + else + { + if (key[0] == 'h' && key[1] == ':') + { + cipher = cipher_wep128_passphrase_new (); + real_key = key + 2; + } + else if (key[0] == 's' && key[1] == ':') + { + cipher = cipher_wep128_ascii_new (); + real_key = key + 2; + } + else + { + cipher = cipher_wep128_hex_new (); + real_key = key; + } + security = nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP104); + } + hash = ieee_802_11_cipher_hash (cipher, buf, real_key); + nm_ap_security_set_key (NM_AP_SECURITY (security), hash, strlen (hash)); + nm_ap_set_security (ap, NM_AP_SECURITY (security)); + + ieee_802_11_cipher_unref (cipher); + g_object_unref (G_OBJECT (security)); + + free (key_type); + } + else + { + NMAPSecurity * security; + + security = nm_ap_security_new (IW_AUTH_CIPHER_NONE); + nm_ap_set_security (ap, security); + g_object_unref (G_OBJECT (security)); + } + + if ((list_ap = nm_ap_list_get_ap_by_essid (app_data->allowed_ap_list, buf))) + { + nm_ap_set_essid (list_ap, nm_ap_get_essid (ap)); + nm_ap_set_timestamp_via_timestamp (list_ap, nm_ap_get_timestamp (ap)); + nm_ap_set_trusted (list_ap, nm_ap_get_trusted (ap)); + nm_ap_set_security (list_ap, nm_ap_get_security (ap)); + } + else + { + /* New AP, just add it to the list */ + nm_ap_list_append_ap (app_data->allowed_ap_list, ap); + } + nm_ap_unref (ap); + + nm_debug ("Adding '%s' to the list of trusted networks", buf); + + /* Ensure all devices get new information copied into their device lists */ + nm_policy_schedule_device_ap_lists_update_from_allowed (app_data); + + free (key); + free (mode); + free (buf); + } sys_data->config = nm_ip4_config_new (); diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index acf7eb2880..9c60a24b40 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -614,6 +614,34 @@ out: return ip4_config; } +static inline const char * state_to_string (guint state) +{ + switch (state) + { + case DHCDBD_PREINIT: + return "starting"; + case DHCDBD_BOUND: + return "bound"; + case DHCDBD_RENEW: + return "renew"; + case DHCDBD_REBOOT: + return "reboot"; + case DHCDBD_REBIND: + return "rebind"; + case DHCDBD_TIMEOUT: + return "timeout"; + case DHCDBD_FAIL: + return "fail"; + case DHCDBD_START: + return "successfully started"; + case DHCDBD_ABEND: + return "abnormal exit"; + case DHCDBD_END: + return "normal exit"; + default: + return "unknown"; + } +} /* * nm_dhcp_manager_process_signal @@ -654,19 +682,23 @@ gboolean nm_dhcp_manager_process_signal (NMDHCPManager *manager, DBusMessage *me dev = nm_get_device_by_iface (manager->data, member); if (dev && (req = nm_device_get_act_request (dev))) { - if (dbus_message_is_signal (message, DHCP_SERVICE_NAME".state", nm_device_get_iface (dev))) + const char *iface = nm_device_get_iface (dev); + + if (dbus_message_is_signal (message, DHCP_SERVICE_NAME".state", iface)) { guint8 state; if (dbus_message_get_args (message, NULL, DBUS_TYPE_BYTE, &state, DBUS_TYPE_INVALID)) { - nm_info ("DHCP daemon state now %d for interface %s", state, nm_device_get_iface (dev)); + const char *desc = state_to_string (state); + + nm_info ("DHCP daemon state is now %d (%s) for interface %s", state, desc, iface); switch (state) { - case 2: /* BOUND */ - case 3: /* RENEW */ - case 4: /* REBOOT */ - case 5: /* REBIND */ + case DHCDBD_BOUND: /* lease obtained */ + case DHCDBD_RENEW: /* lease renewed */ + case DHCDBD_REBOOT: /* have valid lease, but now obtained a different one */ + case DHCDBD_REBIND: /* new, different lease */ if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START) { nm_device_activate_schedule_stage4_ip_config_get (req); @@ -674,7 +706,7 @@ gboolean nm_dhcp_manager_process_signal (NMDHCPManager *manager, DBusMessage *me } break; - case 8: /* TIMEOUT - timed out trying to contact server */ + case DHCDBD_TIMEOUT: /* timed out contacting DHCP server */ if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START) { nm_device_activate_schedule_stage4_ip_config_timeout (req); @@ -682,9 +714,9 @@ gboolean nm_dhcp_manager_process_signal (NMDHCPManager *manager, DBusMessage *me } break; - case 9: /* FAIL */ - case 13: /* ABEND */ -// case 14: /* END */ + case DHCDBD_FAIL: /* all attempts to contact server timed out, sleeping */ + case DHCDBD_ABEND: /* dhclient exited abnormally */ +// case DHCDBD_END: /* dhclient exited normally */ if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START) { nm_policy_schedule_activation_failed (req); diff --git a/src/dhcp-manager/nm-dhcp-manager.h b/src/dhcp-manager/nm-dhcp-manager.h index 7cf4a19db3..2746713bed 100644 --- a/src/dhcp-manager/nm-dhcp-manager.h +++ b/src/dhcp-manager/nm-dhcp-manager.h @@ -24,6 +24,31 @@ #include "NetworkManagerMain.h" #include "nm-device.h" +/* + * FIXME: These should go in a header shared by NetworkManager and dhcdbd, + * but right now NetworkManager and dhcdbd do not share any header. The + * following is copied (and cleaned up) from dhcdbd.h. + */ +enum dhcdbd_state +{ + DHCDBD_NBI=0, /* no broadcast interfaces found */ + DHCDBD_PREINIT, /* configuration started */ + DHCDBD_BOUND, /* lease obtained */ + DHCDBD_RENEW, /* lease renewed */ + DHCDBD_REBOOT, /* have valid lease, but now obtained a different one */ + DHCDBD_REBIND, /* new, different lease */ + DHCDBD_STOP, /* remove old lease */ + DHCDBD_MEDIUM, /* media selection begun */ + DHCDBD_TIMEOUT, /* timed out contacting DHCP server */ + DHCDBD_FAIL, /* all attempts to contact server timed out, sleeping */ + DHCDBD_EXPIRE, /* lease has expired, renewing */ + DHCDBD_RELEASE, /* releasing lease */ + DHCDBD_START, /* sent when dhclient started OK */ + DHCDBD_ABEND, /* dhclient exited abnormally */ + DHCDBD_END, /* dhclient exited normally */ + DHCDBD_END_OPTIONS, /* last option in subscription sent */ +}; + char * get_dhcp_match_string (const char *owner); NMDHCPManager * nm_dhcp_manager_new (NMData *data); diff --git a/src/nm-ap-security-wpa-eap.c b/src/nm-ap-security-wpa-eap.c index 4ad74053b2..0cd107da34 100644 --- a/src/nm-ap-security-wpa-eap.c +++ b/src/nm-ap-security-wpa-eap.c @@ -128,15 +128,15 @@ real_serialize (NMAPSecurity *instance, DBusMessageIter *iter) NMAPSecurityWPA_EAP * self = NM_AP_SECURITY_WPA_EAP (instance); if (!nmu_security_serialize_wpa_eap (iter, - self->priv->eap_method, - self->priv->identity, - self->priv->passwd, - self->priv->anon_identity, - self->priv->private_key_passwd, - self->priv->private_key_file, - self->priv->client_cert_file, - self->priv->ca_cert_file, - self->priv->wpa_version)) + self->priv->eap_method, + self->priv->identity ? : "", + self->priv->passwd ? : "", + self->priv->anon_identity ? : "", + self->priv->private_key_passwd ? : "", + self->priv->private_key_file ? : "", + self->priv->client_cert_file ? : "", + self->priv->ca_cert_file ? : "", + self->priv->wpa_version)) return -1; return 0; } @@ -217,8 +217,15 @@ real_write_supplicant_config (NMAPSecurity *instance, goto out; if (passwd && strlen (passwd) > 0) - if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i password \"%s\"", nwid, passwd)) + { + msg = g_strdup_printf ("SET_NETWORK %i password <password>", nwid); + if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, msg, "SET_NETWORK %i password \"%s\"", nwid, passwd)) + { + g_free (msg); goto out; + } + g_free (msg); + } if (anon_identity && strlen (anon_identity) > 0) if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i anonymous_identity \"%s\"", nwid, anon_identity)) diff --git a/src/nm-ap-security.c b/src/nm-ap-security.c index ffeabe14ea..c9161b3da3 100644 --- a/src/nm-ap-security.c +++ b/src/nm-ap-security.c @@ -45,7 +45,7 @@ struct _NMAPSecurityPrivate gboolean dispose_has_run; }; -static NMAPSecurity * +NMAPSecurity * nm_ap_security_new (int we_cipher) { NMAPSecurity * security; diff --git a/src/nm-ap-security.h b/src/nm-ap-security.h index a2344b74ee..7d5f0f9c07 100644 --- a/src/nm-ap-security.h +++ b/src/nm-ap-security.h @@ -77,6 +77,8 @@ GType nm_ap_security_get_type (void); NMAPSecurity * nm_ap_security_new_copy (NMAPSecurity *self); +NMAPSecurity * nm_ap_security_new (int we_cipher); + NMAPSecurity * nm_ap_security_new_deserialize (DBusMessageIter *iter); NMAPSecurity * nm_ap_security_new_from_ap (struct NMAccessPoint *ap); diff --git a/src/nm-dbus-nmi.c b/src/nm-dbus-nmi.c index 38bc71ed91..c1e2c51600 100644 --- a/src/nm-dbus-nmi.c +++ b/src/nm-dbus-nmi.c @@ -346,7 +346,6 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data NMAPSecurity * security; NMAccessPoint * ap; NMAccessPoint * list_ap; - GTimeVal * timestamp; g_return_if_fail (pcall != NULL); g_return_if_fail (cb_data != NULL); @@ -448,11 +447,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data nm_ap_set_security (ap, security); g_object_unref (G_OBJECT (security)); /* set_security copies the object */ - timestamp = g_malloc0 (sizeof (GTimeVal)); - timestamp->tv_sec = timestamp_secs; - timestamp->tv_usec = 0; - nm_ap_set_timestamp (ap, timestamp); - g_free (timestamp); + nm_ap_set_timestamp (ap, timestamp_secs, 0); nm_ap_set_trusted (ap, trusted); nm_ap_set_user_addresses (ap, addr_list); @@ -460,7 +455,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data if ((list_ap = nm_ap_list_get_ap_by_essid (cb_data->list, essid))) { nm_ap_set_essid (list_ap, nm_ap_get_essid (ap)); - nm_ap_set_timestamp (list_ap, nm_ap_get_timestamp (ap)); + nm_ap_set_timestamp_via_timestamp (list_ap, nm_ap_get_timestamp (ap)); nm_ap_set_trusted (list_ap, nm_ap_get_trusted (ap)); nm_ap_set_security (list_ap, nm_ap_get_security (ap)); nm_ap_set_user_addresses (list_ap, nm_ap_get_user_addresses (ap)); diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index 228a139efc..68b541e29e 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -1872,7 +1872,7 @@ nm_device_802_11_wireless_scan (gpointer user_data) scan_results->results_len = results_len; } else - nm_warning ("get_scan_results() on device %s returned an error.", iface); + nm_warning ("device %s returned an error.", iface); } nm_device_802_11_wireless_set_mode (self, orig_mode); @@ -2192,6 +2192,12 @@ supplicant_status_cb (GIOChannel *source, g_assert (self); + /* Do nothing if we're supposed to be canceling activation. + * We'll get cleaned up by the cancellation handlers later. + */ + if (nm_device_activation_should_cancel (dev)) + return TRUE; + ctrl = self->priv->supplicant.ctrl; g_return_val_if_fail (ctrl != NULL, FALSE); @@ -2394,7 +2400,7 @@ supplicant_exec (NMDevice80211Wireless *self) g_source_attach (self->priv->supplicant.stdout, nm_device_get_main_context (NM_DEVICE (self))); g_io_channel_unref (channel); - /* Crackrock delay so we don't try to talk to wpa_supplicant to early */ + /* Crackrock delay so we don't try to talk to wpa_supplicant too early */ /* FIXME: poll the global control socket instead of just sleeping */ g_usleep (G_USEC_PER_SEC); @@ -2460,8 +2466,10 @@ supplicant_send_network_config (NMDevice80211Wireless *self, const char * essid; struct wpa_ctrl * ctrl; gboolean user_created; - char * hex_essid; - char * ap_scan = "AP_SCAN 1"; + const char * hex_essid; + const char * ap_scan = "AP_SCAN 1"; + guint32 caps; + gboolean supports_wpa; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (req != NULL, FALSE); @@ -2472,14 +2480,24 @@ supplicant_send_network_config (NMDevice80211Wireless *self, ctrl = self->priv->supplicant.ctrl; g_assert (ctrl); - /* Ad-Hoc and non-broadcasting networks need AP_SCAN 2 */ + /* Assume that drivers that don't support WPA pretty much suck, + * and can't handle NM scanning along with wpa_supplicant. Which + * is the case for most of them, airo in particular. + */ + caps = nm_device_get_type_capabilities (NM_DEVICE (self)); + supports_wpa = (caps & NM_802_11_CAP_PROTO_WPA) + || (caps & NM_802_11_CAP_PROTO_WPA2); + + /* Use "AP_SCAN 2" if: + * - The wireless network is non-broadcast or user created + * - The wireless driver does not support WPA + */ user_created = nm_ap_get_user_created (ap); - if (!nm_ap_get_broadcast (ap) || user_created) + if (!nm_ap_get_broadcast (ap) || user_created || !supports_wpa) ap_scan = "AP_SCAN 2"; /* Tell wpa_supplicant that we'll do the scanning */ - if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, - ap_scan)) + if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, ap_scan)) goto out; /* Standard network setup info */ @@ -2820,6 +2838,27 @@ real_activation_failure_handler (NMDevice *dev, ap ? nm_ap_get_essid (ap) : "(none)"); } +static void +real_activation_cancel_handler (NMDevice *dev, + NMActRequest *req) +{ + NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev); + NMDevice80211WirelessClass * klass; + NMDeviceClass * parent_class; + + /* Chain up to parent first */ + klass = NM_DEVICE_802_11_WIRELESS_GET_CLASS (self); + parent_class = NM_DEVICE_CLASS (g_type_class_peek_parent (klass)); + parent_class->activation_cancel_handler (dev, req); + + if (nm_act_request_get_stage (req) == NM_ACT_STAGE_NEED_USER_KEY) + { + NMData *data = nm_device_get_app_data (dev); + nm_dbus_cancel_get_user_key_for_network (data->dbus_connection, req); + } +} + + static gboolean real_can_interrupt_activation (NMDevice *dev) { @@ -2912,6 +2951,7 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass) parent_class->activation_failure_handler = real_activation_failure_handler; parent_class->activation_success_handler = real_activation_success_handler; + parent_class->activation_cancel_handler = real_activation_cancel_handler; g_type_class_add_private (object_class, sizeof (NMDevice80211WirelessPrivate)); } @@ -3046,7 +3086,7 @@ get_scan_results (NMDevice80211Wireless *dev, { if (tries > 20 * SCAN_SLEEP_CENTISECONDS) { - nm_warning ("get_scan_results(): card took too much time scanning. Get a better one."); + nm_warning ("card took too much time scanning. Get a better one."); break; } @@ -3060,7 +3100,7 @@ get_scan_results (NMDevice80211Wireless *dev, } else /* Random errors */ { - nm_warning ("get_scan_results(): unknown error, or the card returned too much scan info: %s", + nm_warning ("unknown error, or the card returned too much scan info: %s", strerror (errno)); break; } diff --git a/src/nm-device-802-11-wireless.h b/src/nm-device-802-11-wireless.h index d5d32f5f18..1397889055 100644 --- a/src/nm-device-802-11-wireless.h +++ b/src/nm-device-802-11-wireless.h @@ -65,8 +65,6 @@ struct _NMDevice80211WirelessClass GType nm_device_802_11_wireless_get_type (void); -NMDevice80211Wireless * nm_device_802_11_wireless_new (void); - static inline gboolean nm_device_is_802_11_wireless (NMDevice *dev); static inline gboolean nm_device_is_802_11_wireless (NMDevice *dev) diff --git a/src/nm-device-802-3-ethernet.c b/src/nm-device-802-3-ethernet.c index 3355646584..e57c481a04 100644 --- a/src/nm-device-802-3-ethernet.c +++ b/src/nm-device-802-3-ethernet.c @@ -213,19 +213,6 @@ real_get_generic_capabilities (NMDevice *dev) return caps; } -static NMActStageReturn -real_act_stage2_config (NMDevice *dev, NMActRequest *req) -{ - NMData * data; - - g_assert (req); - data = nm_act_request_get_data (req); - g_assert (data); - - return TRUE; -} - - static void nm_device_802_3_ethernet_dispose (GObject *object) { @@ -280,8 +267,6 @@ nm_device_802_3_ethernet_class_init (NMDevice8023EthernetClass *klass) parent_class->start = real_start; parent_class->update_link = real_update_link; - parent_class->act_stage2_config = real_act_stage2_config; - g_type_class_add_private (object_class, sizeof (NMDevice8023EthernetPrivate)); } diff --git a/src/nm-device-802-3-ethernet.h b/src/nm-device-802-3-ethernet.h index f976ab4cc1..5d5a70b08e 100644 --- a/src/nm-device-802-3-ethernet.h +++ b/src/nm-device-802-3-ethernet.h @@ -57,8 +57,6 @@ struct _NMDevice8023EthernetClass GType nm_device_802_3_ethernet_get_type (void); -NMDevice8023Ethernet * nm_device_802_3_ethernet_new (void); - static inline gboolean nm_device_is_802_3_ethernet (NMDevice *dev); static inline gboolean nm_device_is_802_3_ethernet (NMDevice *dev) diff --git a/src/nm-device.c b/src/nm-device.c index d2f9152921..586e7d9dc9 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -75,9 +75,6 @@ static gpointer nm_device_worker (gpointer user_data); static void nm_device_activate_schedule_stage5_ip_config_commit (NMActRequest *req); -static void nm_device_schedule_activation_handle_cancel (NMActRequest *req); - - /* * nm_device_test_wireless_extensions * @@ -199,7 +196,7 @@ nm_device_new (const char *iface, nm_device_802_11_wireless_set_address (NM_DEVICE_802_11_WIRELESS (dev)); /* Grab IP config data for this device from the system configuration files */ - dev->priv->system_config_data = nm_system_device_get_system_config (dev); + dev->priv->system_config_data = nm_system_device_get_system_config (dev, app_data); dev->priv->use_dhcp = nm_system_device_get_use_dhcp (dev); /* Allow distributions to flag devices as disabled */ @@ -678,10 +675,7 @@ nm_device_activate_stage1_device_prepare (NMActRequest *req) g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } nm_device_activate_schedule_stage2_device_config (req); @@ -762,10 +756,7 @@ nm_device_activate_stage2_device_config (NMActRequest *req) nm_device_bring_up (self); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } ret = NM_DEVICE_GET_CLASS (self)->act_stage2_config (self, req); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) @@ -780,10 +771,7 @@ nm_device_activate_stage2_device_config (NMActRequest *req) nm_info ("Activation (%s) Stage 2 of 5 (Device Configure) successful.", iface); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } nm_device_activate_schedule_stage3_ip_config_start (req); @@ -873,10 +861,7 @@ nm_device_activate_stage3_ip_config_start (NMActRequest *req) nm_info ("Activation (%s) Stage 3 of 5 (IP Configure Start) started...", iface); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip_config_start (self, req); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) @@ -889,10 +874,7 @@ nm_device_activate_stage3_ip_config_start (NMActRequest *req) g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } nm_device_activate_schedule_stage4_ip_config_get (req); @@ -1019,18 +1001,12 @@ nm_device_activate_stage4_ip_config_get (NMActRequest *req) nm_info ("Activation (%s) Stage 4 of 5 (IP Configure Get) started...", nm_device_get_iface (self)); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } ret = NM_DEVICE_GET_CLASS (self)->act_stage4_get_ip4_config (self, req, &ip4_config); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } if (ret == NM_ACT_STAGE_RETURN_POSTPONE) goto out; @@ -1042,10 +1018,7 @@ nm_device_activate_stage4_ip_config_get (NMActRequest *req) g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } nm_act_request_set_ip4_config (req, ip4_config); nm_device_activate_schedule_stage5_ip_config_commit (req); @@ -1129,10 +1102,7 @@ nm_device_activate_stage4_ip_config_timeout (NMActRequest *req) nm_info ("Activation (%s) Stage 4 of 5 (IP Configure Timeout) started...", iface); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip_config_timeout (self, req, &ip4_config); if (ret == NM_ACT_STAGE_RETURN_POSTPONE) @@ -1209,10 +1179,7 @@ nm_device_activate_stage5_ip_config_commit (NMActRequest *req) nm_device_get_iface (self)); if (nm_device_activation_should_cancel (self)) - { - nm_device_schedule_activation_handle_cancel (req); goto out; - } nm_device_set_ip4_config (self, ip4_config); if (nm_system_device_set_from_ip4_config (self)) @@ -1262,27 +1229,39 @@ nm_device_activate_schedule_stage5_ip_config_commit (NMActRequest *req) } +static void +real_activation_cancel_handler (NMDevice *self, + NMActRequest *req) +{ + g_return_if_fail (self != NULL); + g_return_if_fail (req != NULL); + + if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START) + nm_dhcp_manager_cancel_transaction (self->priv->app_data->dhcp_manager, req); +} + /* - * nm_device_activation_handle_cancel + * activation_handle_cancel_helper * - * Cancel activation on a device and clean up. + * Allow specific device types to clean up their own cancellation * */ static gboolean -nm_device_activation_handle_cancel (NMActRequest *req) +activation_handle_cancel_helper (NMActRequest *req) { - NMDevice * self; - NMData * data; + NMDevice * self; + NMDeviceClass *klass; - g_return_val_if_fail (req != NULL, FALSE); - - data = nm_act_request_get_data (req); - g_assert (data); + g_assert (req); self = nm_act_request_get_dev (req); g_assert (self); - if ((req = nm_device_get_act_request (self)) && nm_device_is_activating (self)) + klass = NM_DEVICE_CLASS (g_type_class_peek (NM_TYPE_DEVICE)); + if (klass->activation_cancel_handler) + klass->activation_cancel_handler (self, req); + + if ((req = nm_device_get_act_request (self))) { self->priv->act_request = NULL; nm_act_request_unref (req); @@ -1317,29 +1296,13 @@ nm_device_schedule_activation_handle_cancel (NMActRequest *req) nm_info ("Activation (%s) cancellation handler scheduled...", nm_device_get_iface (self)); source = g_idle_source_new (); - g_source_set_callback (source, (GSourceFunc) nm_device_activation_handle_cancel, req, NULL); + g_source_set_callback (source, (GSourceFunc) activation_handle_cancel_helper, req, NULL); + g_source_set_priority (source, G_PRIORITY_HIGH_IDLE); g_source_attach (source, self->priv->context); g_source_unref (source); } -/* - * nm_device_activation_cancel - * - * Signal activation worker that it should stop and die. - * - */ -void -nm_device_activation_cancel (NMDevice *self) -{ - NMDeviceClass * klass; - - g_return_if_fail (self != NULL); - - klass = NM_DEVICE_CLASS (g_type_class_peek (NM_TYPE_DEVICE)); - klass->cancel_activation (self); -} - static gboolean nm_ac_test (int tries, nm_completion_args args) @@ -1358,8 +1321,14 @@ gboolean nm_ac_test (int tries, return TRUE; } -static void -real_cancel_activation (NMDevice *self) +/* + * nm_device_activation_cancel + * + * Signal activation worker that it should stop and die. + * + */ +void +nm_device_activation_cancel (NMDevice *self) { nm_completion_args args; NMData * app_data; @@ -1372,28 +1341,11 @@ real_cancel_activation (NMDevice *self) if (nm_device_is_activating (self)) { NMActRequest * req = nm_device_get_act_request (self); - gboolean clear_act_request = FALSE; nm_info ("Activation (%s): cancelling...", nm_device_get_iface (self)); self->priv->quit_activation = TRUE; - /* If the device is waiting for DHCP or a user key, force its current request to stop. */ - if (nm_act_request_get_stage (req) == NM_ACT_STAGE_NEED_USER_KEY) - { - nm_dbus_cancel_get_user_key_for_network (app_data->dbus_connection, req); - clear_act_request = TRUE; - } - else if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START) - { - nm_dhcp_manager_cancel_transaction (app_data->dhcp_manager, req); - clear_act_request = TRUE; - } - - if (clear_act_request) - { - self->priv->act_request = NULL; - nm_act_request_unref (req); - } + nm_device_schedule_activation_handle_cancel (req); /* Spin until cancelled. Possible race conditions or deadlocks here. * The other problem with waiting here is that we hold up dbus traffic @@ -1972,7 +1924,7 @@ nm_device_class_init (NMDeviceClass *klass) object_class->finalize = nm_device_finalize; klass->is_test_device = real_is_test_device; - klass->cancel_activation = real_cancel_activation; + klass->activation_cancel_handler = real_activation_cancel_handler; klass->get_type_capabilities = real_get_type_capabilities; klass->get_generic_capabilities = real_get_generic_capabilities; klass->start = real_start; diff --git a/src/nm-device.h b/src/nm-device.h index 1689fe19b5..f413c8800c 100644 --- a/src/nm-device.h +++ b/src/nm-device.h @@ -102,12 +102,13 @@ struct _NMDeviceClass NMIP4Config **config); void (* deactivate) (NMDevice *self); void (* deactivate_quickly) (NMDevice *self); - void (* cancel_activation) (NMDevice *self); void (* activation_failure_handler) (NMDevice *self, struct NMActRequest *req); void (* activation_success_handler) (NMDevice *self, struct NMActRequest *req); + void (* activation_cancel_handler) (NMDevice *self, + struct NMActRequest *req); gboolean (* can_interrupt_activation) (NMDevice *self); }; diff --git a/vpn-daemons/openvpn/po/.cvsignore b/vpn-daemons/openvpn/po/.cvsignore index 68336a4624..b4f445d021 100644 --- a/vpn-daemons/openvpn/po/.cvsignore +++ b/vpn-daemons/openvpn/po/.cvsignore @@ -5,3 +5,4 @@ POTFILES da.gmo sv.gmo *.pot +stamp-it diff --git a/vpn-daemons/pptp/po/.cvsignore b/vpn-daemons/pptp/po/.cvsignore index 68336a4624..b4f445d021 100644 --- a/vpn-daemons/pptp/po/.cvsignore +++ b/vpn-daemons/pptp/po/.cvsignore @@ -5,3 +5,4 @@ POTFILES da.gmo sv.gmo *.pot +stamp-it diff --git a/vpn-daemons/vpnc/ChangeLog b/vpn-daemons/vpnc/ChangeLog index 26d04843e4..ad51063325 100644 --- a/vpn-daemons/vpnc/ChangeLog +++ b/vpn-daemons/vpnc/ChangeLog @@ -1,3 +1,7 @@ +2006-03-08 Christopher Aillon <caillon@redhat.com> + + * nm-vpnc.desktop.in: Use NoDisplay=true (fixes 333854) + 2006-01-23 Robert Love <rml@novell.com> * properties/nm-vpnc-dialog.glade: Add (back) 'Optional Information' diff --git a/vpn-daemons/vpnc/nm-vpnc.desktop.in b/vpn-daemons/vpnc/nm-vpnc.desktop.in index d06f706dc7..b9a6e5cbc7 100644 --- a/vpn-daemons/vpnc/nm-vpnc.desktop.in +++ b/vpn-daemons/vpnc/nm-vpnc.desktop.in @@ -10,3 +10,4 @@ Type=Application DocPath= Categories=GNOME;Application;Network; MimeType=application/x-cisco-vpn-settings +NoDisplay=true diff --git a/vpn-daemons/vpnc/po/.cvsignore b/vpn-daemons/vpnc/po/.cvsignore index 68336a4624..b4f445d021 100644 --- a/vpn-daemons/vpnc/po/.cvsignore +++ b/vpn-daemons/vpnc/po/.cvsignore @@ -5,3 +5,4 @@ POTFILES da.gmo sv.gmo *.pot +stamp-it |