diff options
author | (no author) <(no author)> | 2006-03-27 16:11:53 +0000 |
---|---|---|
committer | (no author) <(no author)@4912f4e0-d625-0410-9fb7-b9a5a253dbdc> | 2006-03-27 16:11:53 +0000 |
commit | 21df0516ae794172c75d740caaf1b4d751169e8f (patch) | |
tree | 4dab9fab5b1a463a3b0614ac1fb87e22a953629e | |
parent | f5876bbd07ed0b344260b76882bbb8de5a07702d (diff) |
This commit was manufactured by cvs2svn to create tagNETWORKMANAGER_0_6_2_RELEASE
'NETWORKMANAGER_0_6_2_RELEASE'.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/tags/NETWORKMANAGER_0_6_2_RELEASE@1645 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
59 files changed, 1704 insertions, 475 deletions
@@ -1,3 +1,331 @@ +2006-03-27 Robert Love <rml@novell.com> + + * configure.in: Bump version to 0.6.2. + * NEWS: Update. + +2006-03-27 Robert Love <rml@novell.com> + + * gnome/applet/other-network-dialog.c: Do not allow the user to try to + create WPA-EAP Ad-Hoc networks because such an action makes no sense. + +2006-03-27 Robert Love <rml@novell.com> + + Patch by Jürg Billeter <j@bitron.ch>: + * src/nm-logging.c: Add printf modifier to fix warning on 64-bit + systems. + * src/nm-netlink-monitor.c: Include <net/if.h> instead of <linux/if.h> + as we prefer glibc over kernel headers, if possible. + +2006-03-27 Robert Love <rml@novell.com> + + Patch by Jon Escombe <list@dresco.co.uk>: + * gnome/applet/nm-gconf-wso.c: Add missing NM_AUTH_TYPE_WPA_EAP case. + * gnome/applet/nm-gconf-wso-wpa-eap.c: If retrieving the gconf values + fail, don't bail out. We don't expect all of the various WPA-EAP + values to be present. + * src/nm-ap-security.c: We need to match all capabilities for each + encryption type, not any one of them. + +2006-03-27 Robert Love <rml@novell.com> + + * src/backends/NetworkManagerSuSE.c: Revert 2006-03-17 commit and again + restart, not reload, ypbind. Unfortunately there is no superior + solution. + +2006-03-24 Robert Love <rml@novell.com> + + Patch by Christopher Aillon <caillon@redhat.com> on HEAD: + * gnome/applet/applet-notifications.c: When displaying a notification, + make sure to get rid of the previous notification so as to not have + competing bubbles, and stop leaking the old one. + * gnome/applet/applet.c, gnome/applet/applet.h: Add a new + 'notification' member to the applet, and zero it out and free it + appropriately. + +2006-03-23 Robert Love <rml@novell.com> + + Patch by j <j@bootlab.org>: + * gnome/applet/applet.glade: Don't set the invisible_char property, + which simply overrides the GTK default. By and by, this behavior + ought to be fixed in Glade. + +2006-03-22 Robert Love <rml@novell.com> + + * src/dhcp-manager/nm-dhcp-manager.c: Bump timeout to 45 seconds. + +2006-03-22 Robert Love <rml@novell.com> + + Bug fix by Timo Hoenig <thoenig@suse.de>: + * gnome/applet/applet-dbus.c: Let the applet reconnect to DBUS on + disconnect. Otherwise, we have the daemon surviving DBUS restarts + and the applet going AWOL. + +2006-03-22 Robert Love <rml@novell.com> + + * src/dhcp-manager/nm-dhcp-manager.c: Create NM_DHCP_TIMEOUT + preprocessor define and use it instead of open-coded the DHCP + timeout, which is currently 25 seconds, everywhere. + +2006-03-22 Robert Love <rml@novell.com> + + Implement "Dynamic WEP", which is basically WPA authentication and WEP + key exchange via WPA, ostensibly providing good security without + requiring hardware that supports full WPA. Also, add UI elements to + allow the user to select the pairwise & group cipher for WPA Enterprise + networks, too: + * gnome/applet/applet.glade: Update glade file. + * gnome/applet/nm-gconf-wso-wpa-eap.c: Serialize and deserialize the + key type, too, to and from gconf. + * gnome/applet/wireless-security-option.c: Add "wpa_eap" parameter to + wso_wpa_create_key_type_model(), noting whether we are handling PSK + or EAP configuration, and in the latter case add in "Dynamic WEP" if + the capabilities match. + * gnome/applet/wso-private.h: Update wso_wpa_create_key_type_model()'s + prototype. + * gnome/applet/wso-wpa-eap.c: Manage UI elements for the key type and + serialize from UI to DBUS. + * gnome/applet/wso-wpa-psk.c: Cannot fail and always returns at least + one element. + * libnm-util/dbus-helpers.c: Update nmu_security_serialize_wpa_eap(), + nmu_security_serialize_wpa_eap_with_cipher(), and + nmu_security_deserialize_wpa_eap() to take a "key_type" parameter and + serialize/deserialize the key type via DBUS as the new third DBUS + parameter. + * libnm-util/dbus-helpers.h: Update prototypes. + * src/nm-ap-security-wpa-eap.c: Deserialize the key type from DBUS, + too. If the key type is WEP104, do Dynamic WEP, which means + "IEEE8021X" for "key_mgmt". Also add support for user-specified + pairwise and group ciphers (fixes a FIXME). + +2006-03-21 Robert Love <rml@novell.com> + + * src/NetworkManagerSystem.c, src/NetworkManagerSystem.h: Add + nm_system_get_mtu(), which returns a user-provided or system-mandated + MTU value for a given device, if any, or zero if no such value + exists. Add nm_system_set_mtu() to set the MTU for a given device + if we have a provided value. + * src/nm-device.c: Set the MTU of devices. + * src/backends/NetworkManagerSuSE.c: Read MTU, if any, from sysconfig. + * src/backends/NetworkManagerDebian.c, + src/backends/NetworkManagerGentoo.c, + src/backends/NetworkManagerRedHat.c, + src/backends/NetworkManagerSlackware.c: Implement stub functions. + +2006-03-21 Robert Love <rml@novell.com> + + * src/backends/NetworkManagerSuSE.c: Strip hypens from hex key in + configuration file. + +2006-03-17 Robert Love <rml@novell.com> + + * src/backends/NetworkManagerSuSE.c: Do "rcypbind reload" to send the + signal SIGHUP to ypbind, not "rcypbind restart" to physically restart + it, in case it is not running in the first place. We just want its + configuration reloaded. Also, do not "rcypbind stop" on device down. + +2006-03-15 Robert Love <rml@novell.com> + + * gnome/applet/applet.glade, gnome/applet/wso-wep-ascii.c, + gnome/applet/wso-wep-hex.c, gnome/applet/wso-wep-passphrase.c: The + label "WEP 40/128-bit" is inconsistent because the physical key size + is 40 or 104-bits, to which a 24-bit initialisation vector is + appended, forming a 64 or 128-bit traffic key. Thus, the label ought + to read "40/104" or "64/128". I do not care much which, but most + users think of "silver" and "gold" encryption as 64 and 128-bits, so + let's stick with that. Thus, s/"40/128"/"64/128"/g. Also, since our + WEP passphrase support only handles 128-bit keys, and any future + 64-bit passphrase support will require a new option (no way to auto- + detect the target key size), explicitly label our passphrase support + "WEP 128-bit Passphrase". + +2006-03-15 Robert Love <rml@novell.com> + + * src/dhcp-manager/nm-dhcp-manager.c: Do not start dhcdbd, but rely on + the system init scripts (or some other mechanism) starting it (or a + compatible DBUS service) before NetworkManager runs. This means that + distributions might need to update their init scripts. This fixes + possible races and is quite a bit cleaner. + * initscript/SUSE/networkmanager.in: Update to start dhcdbd before + starting the NetworkManager daemon. + +2006-03-14 Robert Love <rml@novell.com> + + * src/backends/NetworkManagerSuSE.c: Check that we have a valid AP + before adding anything. + +2006-03-13 Robert Love <rml@novell.com> + + * gnome/vpn-properties/nm-vpn-properties.c: Hide the next page's + widgets, too, if they exist, in case the user hit the back button. + Fixes a bug where the details page contains the widgets of multiple + VPN modules (Novell bug #157048). + +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,69 @@ ============================================== +NetworkManager-0.6.2 +Overview of changes since NetworkManager-0.6.2 +============================================== + +0.6.2 is a bug fix release. + +* NetworkManager + * Many, many bug fixes (Everyone) + * Dynamic WEP Support (Robert Love) + +* nm-applet + * Many bug fixes (Everyone) + + +============================================== +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..35475c2338 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.2, 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-dbus.c b/gnome/applet/applet-dbus.c index cf1de23b0c..ca91979f8c 100644 --- a/gnome/applet/applet-dbus.c +++ b/gnome/applet/applet-dbus.c @@ -68,7 +68,13 @@ static DBusHandlerResult nma_dbus_filter (DBusConnection *connection, DBusMessag /* nm_info ("signal(): got signal op='%s' member='%s' interface='%s'", object_path, member, interface); */ - if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) + if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected")) + { + dbus_connection_unref (applet->connection); + applet->connection = NULL; + applet->nm_running = FALSE; + } + else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { char *service; char *old_owner; @@ -398,11 +404,14 @@ static gboolean nma_dbus_connection_watcher (gpointer user_data) if ((applet->connection = nma_dbus_init (applet))) { applet->nm_running = nma_dbus_nm_is_running (applet->connection); - nma_set_state (applet, NM_STATE_DISCONNECTED); - nma_dbus_update_nm_state (applet); - nma_dbus_update_devices (applet); - nma_dbus_update_dialup (applet); - nma_dbus_vpn_update_vpn_connections (applet); + if (applet->nm_running) + { + nma_set_state (applet, NM_STATE_DISCONNECTED); + nma_dbus_update_nm_state (applet); + nma_dbus_update_devices (applet); + nma_dbus_update_dialup (applet); + nma_dbus_vpn_update_vpn_connections (applet); + } } } diff --git a/gnome/applet/applet-notifications.c b/gnome/applet/applet-notifications.c index 86dcc4a69d..b7f7a5811e 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 @@ -29,7 +30,7 @@ nma_send_event_notification (NMApplet *applet, const char *message, const char *icon) { - NotifyNotification *notification; + const char *notify_icon; g_return_if_fail (applet != NULL); g_return_if_fail (summary != NULL); @@ -38,9 +39,16 @@ nma_send_event_notification (NMApplet *applet, if (!notify_is_initted ()) notify_init ("NetworkManager"); - notification = notify_notification_new (summary, message, - icon ? icon : GTK_STOCK_NETWORK, GTK_WIDGET (applet)); - notify_notification_set_urgency (notification, urgency); - notify_notification_show (notification, NULL); + if (applet->notification != NULL) { + notify_notification_close (applet->notification, NULL); + g_object_unref (applet->notification); + } + + notify_icon = icon ? icon : GTK_STOCK_NETWORK; + + applet->notification = notify_notification_new (summary, message, notify_icon, GTK_WIDGET (applet)); + + notify_notification_set_urgency (applet->notification, urgency); + notify_notification_show (applet->notification, NULL); } 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..f35c60c128 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); @@ -2448,6 +2538,10 @@ nma_destroy (NMApplet *applet, gpointer user_data) nma_icons_free (applet); nmi_passphrase_dialog_destroy (applet); +#ifdef ENABLE_NOTIFY + notify_notification_close (applet->notification, NULL); + g_object_unref (applet->notification); +#endif if (applet->redraw_timeout_id > 0) { @@ -2489,6 +2583,10 @@ static GtkWidget * nma_get_instance (NMApplet *applet) applet->nm_state = NM_STATE_DISCONNECTED; applet->tooltips = NULL; applet->passphrase_dialog = NULL; +#ifdef ENABLE_NOTIFY + applet->notification = NULL; +#endif + applet->glade_file = g_build_filename (GLADEDIR, "applet.glade", NULL); if (!applet->glade_file || !g_file_test (applet->glade_file, G_FILE_TEST_IS_REGULAR)) { diff --git a/gnome/applet/applet.glade b/gnome/applet/applet.glade index fd8a852ff8..9d2d89166a 100644 --- a/gnome/applet/applet.glade +++ b/gnome/applet/applet.glade @@ -514,7 +514,6 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> - <property name="invisible_char">*</property> <property name="activates_default">True</property> </widget> <packing> @@ -558,9 +557,9 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th <widget class="GtkComboBox" id="security_combo"> <property name="visible">True</property> <property name="items" translatable="yes">None -WEP Passphrase -WEP 40/128-bit hex -WEP 40/128-bit ASCII +WEP 128-bit Passphrase +WEP 64/128-bit Hex +WEP 64/128-bit ASCII </property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> @@ -773,9 +772,9 @@ A passphrase or encryption key is required to access the wireless network '%s'.< <widget class="GtkComboBox" id="security_combo"> <property name="visible">True</property> <property name="items" translatable="yes">None -WEP Passphrase -WEP 40/128-bit hex -WEP 40/128-bit ASCII +WEP 128-bit Passphrase +WEP 64/128-bit Hex +WEP 64/128-bit ASCII </property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> @@ -1749,7 +1748,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,11 +1787,10 @@ 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> - <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> @@ -1825,8 +1823,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 +1841,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> @@ -1953,7 +2001,6 @@ Shared Key</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> - <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> @@ -1970,11 +2017,10 @@ 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> - <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> @@ -2130,7 +2176,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,11 +2215,10 @@ 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> - <property name="invisible_char">*</property> <property name="activates_default">True</property> </widget> <packing> @@ -2206,8 +2251,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 +2268,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"></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">fill</property> + <property name="y_options"></property> </packing> </child> </widget> @@ -2318,7 +2413,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">10</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">4</property> @@ -2345,8 +2440,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2373,8 +2468,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2393,8 +2488,8 @@ Shared Key</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> @@ -2413,8 +2508,8 @@ Shared Key</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">7</property> + <property name="bottom_attach">8</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> @@ -2441,8 +2536,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</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> @@ -2453,18 +2548,17 @@ 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> - <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> <property name="y_options"></property> </packing> </child> @@ -2490,8 +2584,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2510,8 +2604,8 @@ Shared Key</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> @@ -2538,8 +2632,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> @@ -2566,8 +2660,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2594,8 +2688,8 @@ Shared Key</property> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -2610,14 +2704,13 @@ Shared Key</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> - <property name="invisible_char">*</property> <property name="activates_default">False</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="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options"></property> </packing> </child> @@ -2627,18 +2720,17 @@ 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> - <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <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="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="y_options"></property> </packing> </child> @@ -2652,14 +2744,13 @@ Shared Key</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> - <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> <property name="y_options"></property> </packing> </child> @@ -2707,6 +2798,100 @@ 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">9</property> + <property name="bottom_attach">10</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">9</property> + <property name="bottom_attach">10</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="wpa-key-type-label"> + <property name="visible">True</property> + <property name="label" translatable="yes">Key Type:</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> + + <child> + <widget class="GtkComboBox" id="wpa_eap_key_type_combo"> + <property name="visible">True</property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">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> + </packing> + </child> </widget> <packing> <property name="tab_expand">False</property> @@ -2796,7 +2981,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,11 +3020,10 @@ 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> - <property name="invisible_char">*</property> <property name="activates_default">True</property> </widget> <packing> @@ -2872,8 +3056,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 +3074,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/applet.h b/gnome/applet/applet.h index 16334c2672..9661653b13 100644 --- a/gnome/applet/applet.h +++ b/gnome/applet/applet.h @@ -21,6 +21,11 @@ #ifndef APPLET_H #define APPLET_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <gtk/gtk.h> #include <gconf/gconf-client.h> #include <glade/glade.h> @@ -33,6 +38,9 @@ #include "wireless-network.h" #include "dbus-method-dispatcher.h" +#ifdef ENABLE_NOTIFY +#include <libnotify/notify.h> +#endif /* * Preference locations @@ -119,6 +127,9 @@ typedef struct GtkWidget * passphrase_dialog; GladeXML * info_dialog_xml; +#ifdef ENABLE_NOTIFY + NotifyNotification* notification; +#endif } NMApplet; typedef struct diff --git a/gnome/applet/nm-gconf-wso-wpa-eap.c b/gnome/applet/nm-gconf-wso-wpa-eap.c index 66c3ead0b0..91a6ddb4a1 100644 --- a/gnome/applet/nm-gconf-wso-wpa-eap.c +++ b/gnome/applet/nm-gconf-wso-wpa-eap.c @@ -39,6 +39,7 @@ struct _NMGConfWSOWPA_EAPPrivate { int eap_method; + int key_type; int wpa_version; int key_mgmt; const char * identity; @@ -64,11 +65,12 @@ nm_gconf_wso_wpa_eap_new_deserialize_dbus (DBusMessageIter *iter, int we_cipher) char * ca_cert_file = NULL; int wpa_version; int eap_method; + int key_type; g_return_val_if_fail (we_cipher == NM_AUTH_TYPE_WPA_EAP, NULL); g_return_val_if_fail (iter != NULL, NULL); - if (!nmu_security_deserialize_wpa_eap (iter, &eap_method, &identity, &passwd, &anon_identity, &private_key_passwd, + if (!nmu_security_deserialize_wpa_eap (iter, &eap_method, &key_type, &identity, &passwd, &anon_identity, &private_key_passwd, &private_key_file, &client_cert_file, &ca_cert_file, &wpa_version)) goto out; @@ -78,6 +80,7 @@ nm_gconf_wso_wpa_eap_new_deserialize_dbus (DBusMessageIter *iter, int we_cipher) nm_gconf_wso_set_key (NM_GCONF_WSO (security), "FIXME", 5); /* FIXME: What to do about Enterprise keys? */ security->priv->wpa_version = wpa_version; security->priv->eap_method = eap_method; + security->priv->key_type = key_type; security->priv->key_mgmt = IW_AUTH_KEY_MGMT_802_1X; security->priv->identity = g_strdup (identity); security->priv->passwd = g_strdup (passwd); @@ -103,88 +106,87 @@ nm_gconf_wso_wpa_eap_new_deserialize_gconf (GConfClient *client, const char *net char * private_key_file = NULL; char * client_cert_file = NULL; char * ca_cert_file = NULL; - int wpa_version; - int eap_method; - int key_mgmt; + int wpa_version = 0; + int eap_method = 0; + int key_type = 0; + int key_mgmt = 0; g_return_val_if_fail (client != NULL, NULL); g_return_val_if_fail (network != NULL, NULL); g_return_val_if_fail ((we_cipher == NM_AUTH_TYPE_WPA_EAP), NULL); - if (!nm_gconf_get_int_helper (client, + nm_gconf_get_int_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"eap_method", network, - &eap_method)) - goto out; + &eap_method); - if (!nm_gconf_get_int_helper (client, + nm_gconf_get_int_helper (client, + GCONF_PATH_WIRELESS_NETWORKS, + WPA_EAP_PREFIX"key_type", + network, + &key_type); + + nm_gconf_get_int_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"wpa_version", network, - &wpa_version)) - goto out; + &wpa_version); - if (!nm_gconf_get_int_helper (client, + nm_gconf_get_int_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"key_mgt", network, - &key_mgmt)) + &key_mgmt); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"identity", network, - &identity)) - goto out; + &identity); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"passwd", network, - &passwd)) - goto out; + &passwd); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"anon_identity", network, - &anon_identity)) - goto out; + &anon_identity); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"private_key_passwd", network, - &private_key_passwd)) - goto out; + &private_key_passwd); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"private_key_file", network, - &private_key_file)) - goto out; + &private_key_file); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"client_cert_file", network, - &client_cert_file)) - goto out; + &client_cert_file); - if (!nm_gconf_get_string_helper (client, + nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"ca_cert_file", network, - &ca_cert_file)) - goto out; + &ca_cert_file); /* Success, build up our security object */ security = g_object_new (NM_TYPE_GCONF_WSO_WPA_EAP, NULL); nm_gconf_wso_set_we_cipher (NM_GCONF_WSO (security), we_cipher); security->priv->wpa_version = wpa_version; security->priv->eap_method = eap_method; + security->priv->key_type = key_type; security->priv->key_mgmt = IW_AUTH_KEY_MGMT_802_1X; security->priv->identity = g_strdup (identity); security->priv->passwd = g_strdup (passwd); @@ -202,7 +204,6 @@ nm_gconf_wso_wpa_eap_new_deserialize_gconf (GConfClient *client, const char *net g_free (client_cert_file); g_free (ca_cert_file); -out: return security; } @@ -214,6 +215,7 @@ real_serialize_dbus (NMGConfWSO *instance, DBusMessageIter *iter) if (!nmu_security_serialize_wpa_eap (iter, self->priv->eap_method, + self->priv->key_type, self->priv->identity ? : "", self->priv->passwd ? : "", self->priv->anon_identity ? : "", @@ -236,6 +238,10 @@ real_serialize_gconf (NMGConfWSO *instance, GConfClient *client, const char *net gconf_client_set_int (client, key, self->priv->eap_method, NULL); g_free (key); + key = g_strdup_printf ("%s/%s/%skey_type", GCONF_PATH_WIRELESS_NETWORKS, network, WPA_EAP_PREFIX); + gconf_client_set_int (client, key, self->priv->key_type, NULL); + g_free (key); + key = g_strdup_printf ("%s/%s/%swpa_version", GCONF_PATH_WIRELESS_NETWORKS, network, WPA_EAP_PREFIX); gconf_client_set_int (client, key, self->priv->wpa_version, NULL); g_free (key); diff --git a/gnome/applet/nm-gconf-wso.c b/gnome/applet/nm-gconf-wso.c index 0aecef361b..23b6069fe1 100644 --- a/gnome/applet/nm-gconf-wso.c +++ b/gnome/applet/nm-gconf-wso.c @@ -137,6 +137,10 @@ nm_gconf_wso_new_deserialize_gconf (GConfClient *client, security = NM_GCONF_WSO (nm_gconf_wso_wpa_psk_new_deserialize_gconf (client, network, we_cipher)); break; + case NM_AUTH_TYPE_WPA_EAP: + security = NM_GCONF_WSO (nm_gconf_wso_wpa_eap_new_deserialize_gconf (client, network, we_cipher)); + break; + default: break; } diff --git a/gnome/applet/other-network-dialog.c b/gnome/applet/other-network-dialog.c index e66cf49bd7..bc36504b52 100644 --- a/gnome/applet/other-network-dialog.c +++ b/gnome/applet/other-network-dialog.c @@ -329,11 +329,11 @@ static GtkDialog *nma_ond_init (GladeXML *xml, NMApplet *applet, gboolean create gtk_tree_model_get (model, &iter, NAME_COLUMN, &str, DEV_COLUMN, &dev, -1); g_assert (dev); dev_caps = network_device_get_type_capabilities (dev); - /* Can't do WPA2/CCMP Ad-Hoc networks because wpa_supplicant - * doesn't support them. + /* Can't do WPA2/CCMP or WPA-EAP Ad-Hoc networks because wpa_supplicant + * doesn't support the former and the latter does not make sense. */ if (create_network) - dev_caps &= ~NM_802_11_CAP_PROTO_WPA2; + dev_caps &= ~(NM_802_11_CAP_PROTO_WPA2 | NM_802_11_CAP_KEY_MGMT_802_1X); wsm_set_capabilities (wsm, dev_caps); security_combo = GTK_COMBO_BOX (glade_xml_get_widget (xml, "security_combo")); diff --git a/gnome/applet/wireless-security-option.c b/gnome/applet/wireless-security-option.c index fed6381a3f..3383b640e9 100644 --- a/gnome/applet/wireless-security-option.c +++ b/gnome/applet/wireless-security-option.c @@ -194,8 +194,7 @@ void wso_wep_auth_combo_cleanup (WirelessSecurityOption *opt, GtkComboBox * comb GtkTreeModel * -wso_wpa_create_key_type_model (int capabilities, - int *num_added) +wso_wpa_create_key_type_model (int capabilities, gboolean wpa_eap, int *num_added) { GtkListStore * model; GtkTreeIter iter; @@ -209,8 +208,16 @@ wso_wpa_create_key_type_model (int capabilities, name = _("Automatic (Default)"); gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, WPA_KEY_TYPE_NAME_COL, name, - WPA_KEY_TYPE_CIPHER_COL, 0, -1); + WPA_KEY_TYPE_CIPHER_COL, NM_AUTH_TYPE_WPA_PSK_AUTO, -1); + if (capabilities & NM_802_11_CAP_CIPHER_CCMP) + { + name = _("AES-CCMP"); + gtk_list_store_append (model, &iter); + gtk_list_store_set (model, &iter, WPA_KEY_TYPE_NAME_COL, name, + WPA_KEY_TYPE_CIPHER_COL, IW_AUTH_CIPHER_CCMP, -1); + num++; + } if (capabilities & NM_802_11_CAP_CIPHER_TKIP) { name = _("TKIP"); @@ -219,12 +226,12 @@ wso_wpa_create_key_type_model (int capabilities, WPA_KEY_TYPE_CIPHER_COL, IW_AUTH_CIPHER_TKIP, -1); num++; } - if (capabilities & NM_802_11_CAP_CIPHER_CCMP) + if (wpa_eap && capabilities & NM_802_11_CAP_KEY_MGMT_802_1X) { - name = _("AES-CCMP"); + name = _("Dynamic WEP"); gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, WPA_KEY_TYPE_NAME_COL, name, - WPA_KEY_TYPE_CIPHER_COL, IW_AUTH_CIPHER_CCMP, -1); + WPA_KEY_TYPE_CIPHER_COL, IW_AUTH_CIPHER_WEP104, -1); num++; } diff --git a/gnome/applet/wso-private.h b/gnome/applet/wso-private.h index d3e248f7fb..796d370e99 100644 --- a/gnome/applet/wso-private.h +++ b/gnome/applet/wso-private.h @@ -79,7 +79,7 @@ void wso_wep_auth_combo_cleanup (WirelessSecurityOption *opt, GtkComboBox * co #define WPA_KEY_TYPE_NAME_COL 0 #define WPA_KEY_TYPE_CIPHER_COL 1 -GtkTreeModel * wso_wpa_create_key_type_model (int capabilities, int *num_added); +GtkTreeModel * wso_wpa_create_key_type_model (int capabilities, gboolean wpa_eap, int *num_added); #endif /* WIRELESS_SECURITY_OPTION_PRIVATE_H */ diff --git a/gnome/applet/wso-wep-ascii.c b/gnome/applet/wso-wep-ascii.c index e11980b470..1c51734b32 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)); @@ -124,7 +135,7 @@ WirelessSecurityOption * wso_wep_ascii_new (const char *glade_file) g_return_val_if_fail (glade_file != NULL, NULL); opt = g_malloc0 (sizeof (WirelessSecurityOption)); - opt->name = g_strdup (_("WEP 40/128-bit ASCII")); + opt->name = g_strdup (_("WEP 64/128-bit ASCII")); opt->widget_name = "wep_key_notebook"; opt->data_free_func = data_free_func; opt->validate_input_func = validate_input_func; @@ -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..0bd00de3ae 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)); @@ -121,7 +132,7 @@ WirelessSecurityOption * wso_wep_hex_new (const char *glade_file) g_return_val_if_fail (glade_file != NULL, NULL); opt = g_malloc0 (sizeof (WirelessSecurityOption)); - opt->name = g_strdup (_("WEP 40/128-bit hex")); + opt->name = g_strdup (_("WEP 64/128-bit Hex")); opt->widget_name = "wep_key_notebook"; opt->data_free_func = data_free_func; opt->validate_input_func = validate_input_func; @@ -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..4253d45bba 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); } @@ -121,7 +132,7 @@ WirelessSecurityOption * wso_wep_passphrase_new (const char *glade_file) g_return_val_if_fail (glade_file != NULL, NULL); opt = g_malloc0 (sizeof (WirelessSecurityOption)); - opt->name = g_strdup (_("WEP Passphrase")); + opt->name = g_strdup (_("WEP 128-bit Passphrase")); opt->widget_name = "wep_passphrase_notebook"; opt->data_free_func = data_free_func; opt->validate_input_func = validate_input_func; @@ -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..bcc52c269d 100644 --- a/gnome/applet/wso-wpa-eap.c +++ b/gnome/applet/wso-wpa-eap.c @@ -40,6 +40,7 @@ struct OptData { int eap_method; + int key_type; const char * identity; const char * passwd; const char * anon_identity; @@ -62,6 +63,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 +85,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 +114,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; } @@ -151,6 +171,11 @@ append_dbus_params_func (WirelessSecurityOption *opt, gtk_combo_box_get_active_iter (GTK_COMBO_BOX (entry), &tree_iter); gtk_tree_model_get (model, &tree_iter, WPA_EAP_VALUE_COL, &opt->data->eap_method, -1); + entry = glade_xml_get_widget (opt->uixml, "wpa_eap_key_type_combo"); + model = gtk_combo_box_get_model (GTK_COMBO_BOX (entry)); + gtk_combo_box_get_active_iter (GTK_COMBO_BOX (entry), &tree_iter); + gtk_tree_model_get (model, &tree_iter, WPA_KEY_TYPE_CIPHER_COL, &opt->data->key_type, -1); + entry = glade_xml_get_widget (opt->uixml, "wpa_eap_identity_entry"); opt->data->identity = gtk_entry_get_text (GTK_ENTRY (entry)) ? : ""; @@ -176,6 +201,7 @@ append_dbus_params_func (WirelessSecurityOption *opt, nmu_security_serialize_wpa_eap_with_cipher (&dbus_iter, opt->data->eap_method, + opt->data->key_type, opt->data->identity, opt->data->passwd, opt->data->anon_identity, @@ -197,9 +223,12 @@ wso_wpa_eap_new (const char *glade_file, WirelessSecurityOption * opt = NULL; OptData * data = NULL; GtkWidget * eap_method_combo; + GtkWidget * key_type_combo; GtkListStore * model; + GtkTreeModel * tree_model; GtkTreeIter iter; GtkCellRenderer * renderer; + int num_added; struct { const char * name; @@ -242,12 +271,25 @@ wso_wpa_eap_new (const char *glade_file, gtk_combo_box_set_model (GTK_COMBO_BOX (eap_method_combo), GTK_TREE_MODEL (model)); gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter); gtk_combo_box_set_active_iter (GTK_COMBO_BOX (eap_method_combo), &iter); - renderer = gtk_cell_renderer_text_new (); /* FIXME: Why do we need this here but not in the same place in wso-wpa-psk.c ? */ + renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (eap_method_combo), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (eap_method_combo), renderer, "text", 0, NULL); + key_type_combo = glade_xml_get_widget (opt->uixml, "wpa_eap_key_type_combo"); + tree_model = wso_wpa_create_key_type_model (capabilities, TRUE, &num_added); + gtk_combo_box_set_model (GTK_COMBO_BOX (key_type_combo), tree_model); + gtk_tree_model_get_iter_first (tree_model, &iter); + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (key_type_combo), &iter); + if (num_added == 1) + gtk_widget_set_sensitive (key_type_combo, FALSE); + + /* FIXME: Why do we need this here but not in the same place in wso-wpa-psk.c ? */ + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (key_type_combo), renderer, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (key_type_combo), renderer, "text", 0, NULL); + /* Option-specific data */ opt->data = data = g_malloc0 (sizeof (OptData)); data->wpa2 = wpa2; diff --git a/gnome/applet/wso-wpa-psk.c b/gnome/applet/wso-wpa-psk.c index ded3e16ca5..3625a381ce 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 (); @@ -194,12 +207,7 @@ wso_wpa_psk_new (const char *glade_file, key_type_combo = glade_xml_get_widget (opt->uixml, data->key_type_combo_name); g_signal_connect (G_OBJECT (key_type_combo), "changed", (GCallback) key_type_combo_changed_cb, opt); - model = wso_wpa_create_key_type_model (capabilities, &num_added); - if (!model || !num_added) - { - wso_free (opt); - return NULL; - } + model = wso_wpa_create_key_type_model (capabilities, FALSE, &num_added); gtk_combo_box_set_model (GTK_COMBO_BOX (key_type_combo), model); gtk_tree_model_get_iter_first (model, &iter); gtk_combo_box_set_active_iter (GTK_COMBO_BOX (key_type_combo), &iter); diff --git a/gnome/vpn-properties/nm-vpn-properties.c b/gnome/vpn-properties/nm-vpn-properties.c index 4cbfadadb7..3e5b01d5e8 100644 --- a/gnome/vpn-properties/nm-vpn-properties.c +++ b/gnome/vpn-properties/nm-vpn-properties.c @@ -236,9 +236,12 @@ static gboolean vpn_druid_vpn_type_page_next (GnomeDruidPage *druidpage, /* first hide existing child */ w = g_list_nth_data (gtk_container_children (GTK_CONTAINER (vpn_type_details)), 0); - if (w != NULL) { + if (w) + gtk_widget_hide (w); + /* hide the previous widget from the next page, in case the user hit 'back' */ + w = g_list_nth_data (gtk_container_children (GTK_CONTAINER (vpn_type_details)), 1); + if (w) gtk_widget_hide (w); - } /* show appropriate child */ vpn_ui = (NetworkManagerVpnUI *) g_slist_nth_data (vpn_types, gtk_combo_box_get_active (vpn_type_combo_box)); @@ -380,6 +383,7 @@ add_cb (GtkButton *button, gpointer user_data) gtk_window_set_policy (druid_window, FALSE, FALSE, TRUE); gtk_widget_show_all (GTK_WIDGET (druid_window)); + out: ; } diff --git a/initscript/SUSE/networkmanager.in b/initscript/SUSE/networkmanager.in index df2cd24a2b..ada215c675 100644 --- a/initscript/SUSE/networkmanager.in +++ b/initscript/SUSE/networkmanager.in @@ -10,6 +10,9 @@ sbindir=@sbindir@ +DHCDBD_BIN=${sinbidr}/dhcdbd +test -x $DHCDBD_BIN || exit 5 + NETWORKMANAGER_BIN=${sbindir}/NetworkManager test -x $NETWORKMANAGER_BIN || exit 5 @@ -18,6 +21,12 @@ rc_reset case "$1" in start) + checkproc $DHCDBD_BIN + if [ $? != 0 ]; then + echo -n "Starting the DHCP DBUS Daemon" + startproc $DHCDBD_BIN --system + rc_status -v + fi checkproc $NETWORKMANAGER_BIN if [ $? = 0 ]; then echo -n "NetworkManager already running" @@ -32,6 +41,8 @@ case "$1" in echo -n "Shutting down the NetworkManager" killproc -TERM $NETWORKMANAGER_BIN rc_status -v + echo -n "Shutting down the DHCP DBUS Daemon" + killproc -TERM $DHCDBD_BIN ;; restart) $0 stop @@ -39,6 +50,9 @@ case "$1" in rc_status ;; status) + echo -n "Checking for the DHCP DBUS Daemon: " + checkproc $DHCDBD_BIN + rc_status -v echo -n "Checking for the NetworkManager: " checkproc $NETWORKMANAGER_BIN rc_status -v diff --git a/libnm-util/dbus-helpers.c b/libnm-util/dbus-helpers.c index 990c4ea83a..0307331aca 100644 --- a/libnm-util/dbus-helpers.c +++ b/libnm-util/dbus-helpers.c @@ -249,6 +249,7 @@ nmu_security_serialize_wpa_psk_with_cipher (DBusMessage *message, dbus_bool_t nmu_security_serialize_wpa_eap (DBusMessageIter *iter, int eap_method, + int key_type, const char *identity, const char *passwd, const char *anon_identity, @@ -267,32 +268,39 @@ nmu_security_serialize_wpa_eap (DBusMessageIter *iter, || (eap_method == NM_EAP_METHOD_PEAP) || (eap_method == NM_EAP_METHOD_TLS) || (eap_method == NM_EAP_METHOD_TTLS), FALSE); + g_return_val_if_fail ((key_type == NM_AUTH_TYPE_WPA_PSK_AUTO) + || (key_type == IW_AUTH_CIPHER_CCMP) + || (key_type == IW_AUTH_CIPHER_TKIP) + || (key_type == IW_AUTH_CIPHER_WEP104), FALSE); /* Second arg: EAP method (INT32) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_INT32, &eap_method); - /* Third arg: Identity (STRING) */ + /* Third arg: Key type (INT32) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_INT32, &key_type); + + /* Fourth arg: Identity (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &identity); - /* Fourth arg: Password (STRING) */ + /* Fifth arg: Password (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &passwd); - /* Fifth arg: Anonymous Identity (STRING) */ + /* Sixth arg: Anonymous Identity (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &anon_identity); - /* Sixth arg: Private key password (STRING) */ + /* Seventh arg: Private key password (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &private_key_passwd); - /* Seventh arg: Private key file (STRING) */ + /* Eighth arg: Private key file (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &private_key_file); - /* Eighth arg: Client certificate file (STRING) */ + /* Ninth arg: Client certificate file (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &client_cert_file); - /* Ninth arg: CA certificate file (STRING) */ + /* Tenth arg: CA certificate file (STRING) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &ca_cert_file); - /* Tenth and final arg: WPA version (INT32) */ + /* Eleventh and final arg: WPA version (INT32) */ dbus_message_iter_append_basic (iter, DBUS_TYPE_INT32, &wpa_version); return TRUE; @@ -302,6 +310,7 @@ nmu_security_serialize_wpa_eap (DBusMessageIter *iter, dbus_bool_t nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, int eap_method, + int key_type, const char *identity, const char *passwd, const char *anon_identity, @@ -322,11 +331,15 @@ nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, || (eap_method == NM_EAP_METHOD_PEAP) || (eap_method == NM_EAP_METHOD_TLS) || (eap_method == NM_EAP_METHOD_TTLS), FALSE); + g_return_val_if_fail ((key_type == NM_AUTH_TYPE_WPA_PSK_AUTO) + || (key_type == IW_AUTH_CIPHER_CCMP) + || (key_type == IW_AUTH_CIPHER_TKIP) + || (key_type == IW_AUTH_CIPHER_WEP104), FALSE); /* First arg: WE Cipher (INT32) */ we_cipher_append_helper (iter, NM_AUTH_TYPE_WPA_EAP); - result = nmu_security_serialize_wpa_eap (iter, eap_method, identity, passwd, anon_identity, private_key_passwd, + result = nmu_security_serialize_wpa_eap (iter, eap_method, key_type, identity, passwd, anon_identity, private_key_passwd, private_key_file, client_cert_file, ca_cert_file, wpa_version); return result; @@ -338,6 +351,7 @@ nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, dbus_bool_t nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, int *eap_method, + int *key_type, char **identity, char **passwd, char **anon_identity, @@ -356,8 +370,11 @@ nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, char * dbus_ca_cert_file; dbus_int32_t dbus_wpa_version; dbus_int32_t dbus_eap_method; + dbus_int32_t dbus_key_type; g_return_val_if_fail (iter != NULL, FALSE); + g_return_val_if_fail (eap_method != NULL, FALSE); + g_return_val_if_fail (key_type != NULL, FALSE); g_return_val_if_fail (identity != NULL, FALSE); g_return_val_if_fail (*identity == NULL, FALSE); g_return_val_if_fail (passwd != NULL, FALSE); @@ -385,49 +402,58 @@ nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, || (dbus_eap_method == NM_EAP_METHOD_TLS) || (dbus_eap_method == NM_EAP_METHOD_TTLS), FALSE); - /* Third arg: Identity (STRING) */ + /* Third arg: Key type (INT32) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_INT32, FALSE); + dbus_message_iter_get_basic (iter, &dbus_key_type); + g_return_val_if_fail ((dbus_key_type == NM_AUTH_TYPE_WPA_PSK_AUTO) + || (dbus_key_type == IW_AUTH_CIPHER_CCMP) + || (dbus_key_type == IW_AUTH_CIPHER_TKIP) + || (dbus_key_type == IW_AUTH_CIPHER_WEP104), FALSE); + + /* Fourth arg: Identity (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_identity); g_return_val_if_fail (dbus_identity != NULL, FALSE); - /* Fourth arg: Password (STRING) */ + /* Fifth arg: Password (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_password); g_return_val_if_fail (dbus_password != NULL, FALSE); - /* Fifth arg: Anonymous Identity (STRING) */ + /* Sixth arg: Anonymous Identity (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_anon_identity); g_return_val_if_fail (dbus_anon_identity != NULL, FALSE); - /* Sixth arg: Private key password (STRING) */ + /* Seventh arg: Private key password (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_private_key_passwd); g_return_val_if_fail (dbus_private_key_passwd != NULL, FALSE); - /* Seventh arg: Private key file (STRING) */ + /* Eighth arg: Private key file (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_private_key_file); g_return_val_if_fail (dbus_private_key_file != NULL, FALSE); - /* Eighth arg: Client certificate file (STRING) */ + /* Ninth arg: Client certificate file (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_client_cert_file); g_return_val_if_fail (dbus_client_cert_file != NULL, FALSE); - /* Ninth arg: CA certificate file (STRING) */ + /* Tenth arg: CA certificate file (STRING) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); dbus_message_iter_get_basic (iter, &dbus_ca_cert_file); g_return_val_if_fail (dbus_ca_cert_file != NULL, FALSE); - /* Tenth and final arg: WPA version (INT32) */ + /* Eleventh and final arg: WPA version (INT32) */ g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_INT32, FALSE); dbus_message_iter_get_basic (iter, &dbus_wpa_version); @@ -435,6 +461,7 @@ nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, || (dbus_wpa_version == IW_AUTH_WPA_VERSION_WPA2), FALSE); *eap_method = dbus_eap_method; + *key_type = dbus_key_type; *identity = strlen (dbus_identity) > 0 ? dbus_identity : NULL; *passwd = strlen (dbus_password) > 0 ? dbus_password : NULL; *anon_identity = strlen (dbus_anon_identity) > 0 ? dbus_anon_identity : NULL; diff --git a/libnm-util/dbus-helpers.h b/libnm-util/dbus-helpers.h index 713f425eb0..8bc56c6b17 100644 --- a/libnm-util/dbus-helpers.h +++ b/libnm-util/dbus-helpers.h @@ -67,6 +67,7 @@ dbus_bool_t nmu_security_serialize_wpa_psk_with_cipher (DBusMessage *message, dbus_bool_t nmu_security_serialize_wpa_eap (DBusMessageIter *iter, int eap_method, + int key_type, const char *identity, const char *passwd, const char *anon_identity, @@ -78,6 +79,7 @@ dbus_bool_t nmu_security_serialize_wpa_eap (DBusMessageIter *iter, dbus_bool_t nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, int eap_method, + int key_type, const char *identity, const char *passwd, const char *anon_identity, @@ -89,6 +91,7 @@ dbus_bool_t nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, dbus_bool_t nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, int *eap_method, + int *key_type, char **identity, char **passwd, char **anon_identity, 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.c b/src/NetworkManagerSystem.c index fc93a9d22f..68faff85a4 100644 --- a/src/NetworkManagerSystem.c +++ b/src/NetworkManagerSystem.c @@ -255,6 +255,49 @@ out: /* + * nm_system_set_mtu + * + * Set the MTU for a given device. + */ +void nm_system_set_mtu (NMDevice *dev) +{ + struct rtnl_link * request; + struct rtnl_link * old; + unsigned long mtu; + struct nl_handle * nlh; + const char * iface; + + mtu = nm_system_get_mtu (dev); + if (!mtu) + return; + + nlh = new_nl_handle (); + if (!nlh) + return; + + request = rtnl_link_alloc (); + if (!request) + goto out_nl_close; + + iface = nm_device_get_iface (dev); + old = iface_to_rtnl_link (iface, nlh); + if (!old) + goto out_request; + + nm_info ("Setting MTU of interface '%s' to %ld", iface, mtu); + rtnl_link_set_mtu (request, mtu); + rtnl_link_change (nlh, old, request, 0); + + rtnl_link_put (old); +out_request: + rtnl_link_put (request); +out_nl_close: + nl_close (nlh); + nl_handle_destroy (nlh); +} + + +/* * nm_system_vpn_device_set_from_ip4_config * * Set IPv4 configuration of a VPN device from an NMIP4Config object. diff --git a/src/NetworkManagerSystem.h b/src/NetworkManagerSystem.h index e6f3f80ddd..6ec68c5041 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); @@ -81,6 +82,9 @@ void nm_system_set_hostname (NMIP4Config *config); void nm_system_activate_nis (NMIP4Config *config); void nm_system_shutdown_nis (void); +void nm_system_set_mtu (NMDevice *dev); +unsigned int nm_system_get_mtu (NMDevice *dev); + gboolean nm_system_should_modify_resolv_conf (void); #endif 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..ea79d3c470 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; @@ -681,3 +681,15 @@ gboolean nm_system_should_modify_resolv_conf (void) { return TRUE; } + + +/* + * nm_system_get_mtu + * + * Return a user-provided or system-mandated MTU for this device or zero if + * no such MTU is provided. + */ +unsigned int nm_system_get_mtu (NMDevice *dev) +{ + return 0; +} diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index c77855b56b..43f0b1e7de 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; @@ -583,3 +583,14 @@ gboolean nm_system_should_modify_resolv_conf (void) { return TRUE; } + +/* + * nm_system_get_mtu + * + * Return a user-provided or system-mandated MTU for this device or zero if + * no such MTU is provided. + */ +unsigned int nm_system_get_mtu (NMDevice *dev) +{ + return 0; +} diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index 2676ca51f3..443a027a17 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; @@ -930,3 +930,15 @@ gboolean nm_system_should_modify_resolv_conf (void) { return TRUE; } + + +/* + * nm_system_get_mtu + * + * Return a user-provided or system-mandated MTU for this device or zero if + * no such MTU is provided. + */ +unsigned int nm_system_get_mtu (NMDevice *dev) +{ + return 0; +} diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index 91dbb0aa87..fb711d98d2 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; } @@ -423,3 +423,15 @@ gboolean nm_system_should_modify_resolv_conf (void) { return TRUE; } + + +/* + * nm_system_get_mtu + * + * Return a user-provided or system-mandated MTU for this device or zero if + * no such MTU is provided. + */ +unsigned int nm_system_get_mtu (NMDevice *dev) +{ + return 0; +} diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index 43cc79e630..a186559801 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" @@ -342,6 +354,7 @@ typedef struct SuSEDeviceConfigData NMIP4Config * config; gboolean use_dhcp; gboolean system_disabled; + unsigned int mtu; } SuSEDeviceConfigData; /* @@ -428,7 +441,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 +495,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 +520,150 @@ found: sys_data->system_disabled = TRUE; } free (buf); - } + } + + if ((buf = svGetValue (file, "MTU"))) + { + unsigned long mtu; + + errno = 0; + mtu = strtoul (buf, NULL, 10); + if (!errno && mtu > 500 && mtu < INT_MAX) + sys_data->mtu = (unsigned int) mtu; + free (buf); + } + + if ((buf = svGetValue (file, "WIRELESS_ESSID")) && strlen (buf) > 1) + { + 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); + if (hash) + { + 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 + { + char **keyv; + + cipher = cipher_wep128_hex_new (); + + keyv = g_strsplit (key, "-", 0); + real_key = g_strjoinv (NULL, keyv); + g_strfreev (keyv); + free (key); + } + security = nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP104); + } + hash = ieee_802_11_cipher_hash (cipher, buf, real_key); + if (hash) + { + 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 (); @@ -619,6 +775,9 @@ out: nm_debug ("mask=%s", ip_str); g_free (ip_str); + if (sys_data->mtu) + nm_debug ("mtu=%u", sys_data->mtu); + len = nm_ip4_config_get_num_nameservers (sys_data->config); for (i = 0; i < len; i++) { @@ -1113,3 +1272,20 @@ out_gfree: return ret; } + +/* + * nm_system_get_mtu + * + * Return a user-provided or system-mandated MTU for this device or zero if + * no such MTU is provided. + */ +unsigned int nm_system_get_mtu (NMDevice *dev) +{ + SuSEDeviceConfigData * sys_data; + + sys_data = nm_device_get_system_config_data (dev); + if (!sys_data) + return 0; + + return sys_data->mtu; +} diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index acf7eb2880..7c4e23bcd3 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -33,6 +33,8 @@ #include "nm-utils.h" +#define NM_DHCP_TIMEOUT 45 /* DHCP timeout, in seconds */ + struct NMDHCPManager { NMData * data; @@ -73,39 +75,6 @@ static gboolean state_is_down (guint8 state) } -/* - * nm_dhcp_manager_exec_daemon - * - * Launch the DHCP daemon. - * - */ -static gboolean nm_dhcp_manager_exec_daemon (NMDHCPManager *manager) -{ - GPtrArray *dhcp_argv; - GError *error = NULL; - GPid pid; - - g_return_val_if_fail (manager != NULL, FALSE); - - dhcp_argv = g_ptr_array_new (); - g_ptr_array_add (dhcp_argv, (gpointer) DHCDBD_BINARY_PATH); - g_ptr_array_add (dhcp_argv, (gpointer) "--system"); - g_ptr_array_add (dhcp_argv, NULL); - - if (!g_spawn_async ("/", (char **) dhcp_argv->pdata, NULL, 0, NULL, NULL, &pid, &error)) - { - g_ptr_array_free (dhcp_argv, TRUE); - nm_warning ("Could not activate the DHCP daemon " DHCDBD_BINARY_PATH ". error: '%s'.", error->message); - g_error_free (error); - return FALSE; - } - g_ptr_array_free (dhcp_argv, TRUE); - nm_info ("Activated the DHCP daemon " DHCDBD_BINARY_PATH " with PID %d.", pid); - - return TRUE; -} - - NMDHCPManager * nm_dhcp_manager_new (NMData *data) { NMDHCPManager * manager; @@ -153,9 +122,8 @@ guint32 nm_dhcp_manager_get_state_for_device (NMDHCPManager *manager, NMDevice * if (!manager->running) { - if (nm_dhcp_manager_exec_daemon (manager) == FALSE) - return 0; - sleep (1); + nm_warning ("dhcdbd not running!"); + return 0; } path = g_strdup_printf (DHCP_OBJECT_PATH"/%s", nm_device_get_iface (dev)); @@ -206,7 +174,8 @@ static gboolean nm_dhcp_manager_handle_timeout (NMActRequest *req) dev = nm_act_request_get_dev (req); g_assert (dev); - nm_info ("Device '%s' DHCP transaction took too long (>25s), stopping it.", nm_device_get_iface (dev)); + nm_info ("Device '%s' DHCP transaction took too long (>%ds), stopping it.", + nm_device_get_iface (dev), NM_DHCP_TIMEOUT); if (nm_act_request_get_stage (req) == NM_ACT_STAGE_IP_CONFIG_START) { @@ -235,9 +204,8 @@ gboolean nm_dhcp_manager_begin_transaction (NMDHCPManager *manager, NMActRequest if (!manager->running) { - if (nm_dhcp_manager_exec_daemon (manager) == FALSE) - return FALSE; - sleep (1); + nm_warning ("dhcdbd not running!"); + return FALSE; } else { @@ -273,8 +241,8 @@ gboolean nm_dhcp_manager_begin_transaction (NMDHCPManager *manager, NMActRequest return FALSE; } - /* Set up a timeout on the transaction to kill it after 25s */ - source = g_timeout_source_new (25000); + /* Set up a timeout on the transaction to kill it after NM_DHCP_TIMEOUT seconds */ + source = g_timeout_source_new (NM_DHCP_TIMEOUT * 1000); g_source_set_callback (source, (GSourceFunc) nm_dhcp_manager_handle_timeout, req, NULL); nm_act_request_set_dhcp_timeout (req, g_source_attach (source, manager->data->main_context)); g_source_unref (source); @@ -614,6 +582,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 +650,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 +674,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 +682,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..0d9603aeca 100644 --- a/src/nm-ap-security-wpa-eap.c +++ b/src/nm-ap-security-wpa-eap.c @@ -37,6 +37,7 @@ struct _NMAPSecurityWPA_EAPPrivate { int eap_method; + int key_type; int wpa_version; int key_mgmt; char * identity; @@ -54,6 +55,7 @@ nm_ap_security_wpa_eap_new_deserialize (DBusMessageIter *iter) { NMAPSecurityWPA_EAP * security = NULL; int eap_method; + int key_type; int wpa_version; char * identity = NULL; char * passwd = NULL; @@ -65,9 +67,9 @@ nm_ap_security_wpa_eap_new_deserialize (DBusMessageIter *iter) g_return_val_if_fail (iter != NULL, NULL); - if (!nmu_security_deserialize_wpa_eap (iter, &eap_method, &identity, &passwd, &anon_identity, - &private_key_passwd, &private_key_file, &client_cert_file, - &ca_cert_file, &wpa_version)) + if (!nmu_security_deserialize_wpa_eap (iter, &eap_method, &key_type, &identity, &passwd, + &anon_identity, &private_key_passwd, &private_key_file, + &client_cert_file, &ca_cert_file, &wpa_version)) goto out; /* Success, build up our security object */ @@ -75,6 +77,7 @@ nm_ap_security_wpa_eap_new_deserialize (DBusMessageIter *iter) nm_ap_security_set_we_cipher (NM_AP_SECURITY (security), NM_AUTH_TYPE_WPA_EAP); nm_ap_security_set_key (NM_AP_SECURITY (security), "FIXME", 5); /* FIXME: what do we do for Enterprise? */ security->priv->eap_method = eap_method; + security->priv->key_type = key_type; security->priv->wpa_version = wpa_version; security->priv->key_mgmt = IW_AUTH_KEY_MGMT_802_1X; security->priv->identity = g_strdup (identity); @@ -128,15 +131,16 @@ 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->key_type, + 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; } @@ -177,11 +181,11 @@ real_write_supplicant_config (NMAPSecurity *instance, const char * ca_cert_file = self->priv->ca_cert_file; const char * client_cert_file = self->priv->client_cert_file; int wpa_version = self->priv->wpa_version; - int cipher = nm_ap_security_get_we_cipher (instance); int key_mgmt = self->priv->key_mgmt; int eap_method = self->priv->eap_method; + int key_type = self->priv->key_type; - g_return_val_if_fail (cipher == NM_AUTH_TYPE_WPA_EAP, FALSE); + g_return_val_if_fail (nm_ap_security_get_we_cipher (instance) == NM_AUTH_TYPE_WPA_EAP, FALSE); g_return_val_if_fail (key_mgmt == IW_AUTH_KEY_MGMT_802_1X, FALSE); g_return_val_if_fail (wpa_version == IW_AUTH_WPA_VERSION_WPA || wpa_version == IW_AUTH_WPA_VERSION_WPA2, FALSE); @@ -192,6 +196,10 @@ real_write_supplicant_config (NMAPSecurity *instance, || eap_method == NM_EAP_METHOD_PEAP || eap_method == NM_EAP_METHOD_TLS || eap_method == NM_EAP_METHOD_TTLS, FALSE); + g_return_val_if_fail ((key_type == NM_AUTH_TYPE_WPA_PSK_AUTO) + || (key_type == IW_AUTH_CIPHER_CCMP) + || (key_type == IW_AUTH_CIPHER_TKIP) + || (key_type == IW_AUTH_CIPHER_WEP104), FALSE); /* WPA-EAP network setup */ @@ -206,8 +214,17 @@ real_write_supplicant_config (NMAPSecurity *instance, goto out; } - if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i key_mgmt WPA-EAP", nwid)) - goto out; + if (key_type != IW_AUTH_CIPHER_WEP104) + { + if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i key_mgmt WPA-EAP", nwid)) + goto out; + } + else + { + /* So-called Dynamic WEP */ + if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i key_mgmt IEEE8021X", nwid)) + goto out; + } if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i eap %s", nwid, get_eap_method (eap_method))) goto out; @@ -217,8 +234,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)) @@ -246,34 +270,31 @@ real_write_supplicant_config (NMAPSecurity *instance, if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i ca_cert \"%s\"", nwid, ca_cert_file)) goto out; -#if 0 /* Right now we always let wpa_supplicant sort out the pairwise and group cipher */ /* - * FIXME: Technically, the pairwise cipher does not need to be the same as - * the group cipher. Fixing this requires changes in the UI. + * Set the pairwise and group cipher, if the user provided one. If user selected "Automatic", we + * let wpa_supplicant sort it out. Likewise, if the user selected "Dynamic WEP", we do nothing. */ - if (cipher == IW_AUTH_CIPHER_TKIP) - pairwise_cipher = group_cipher = "TKIP"; - else if (cipher == IW_AUTH_CIPHER_CCMP) - pairwise_cipher = group_cipher = "CCMP"; - else if (cipher == IW_AUTH_CIPHER_NONE) - pairwise_cipher = group_cipher = "NONE"; - - /* Ad-Hoc requires pairwise cipher of NONE */ - if (user_created) - pairwise_cipher = "NONE"; - - /* If user selected "Automatic", we let wpa_supplicant sort it out */ - if (cipher != NM_AUTH_TYPE_WPA_PSK_AUTO) + if (key_type != NM_AUTH_TYPE_WPA_PSK_AUTO && key_type != IW_AUTH_CIPHER_WEP104) { + const char *cipher; + + /* + * FIXME: Technically, the pairwise cipher does not need to be the same as + * the group cipher. Fixing this requires changes in the UI. + */ + if (key_type == IW_AUTH_CIPHER_TKIP) + cipher = "TKIP"; + else /* IW_AUTH_CIPHER_CCMP */ + cipher = "CCMP"; + if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, - "SET_NETWORK %i pairwise %s", nwid, pairwise_cipher)) + "SET_NETWORK %i pairwise %s", nwid, cipher)) goto out; if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, - "SET_NETWORK %i group %s", nwid, group_cipher)) + "SET_NETWORK %i group %s", nwid, cipher)) goto out; } -#endif success = TRUE; @@ -305,6 +326,7 @@ real_copy_constructor (NMAPSecurity *instance) NMAPSecurityWPA_EAP * self = NM_AP_SECURITY_WPA_EAP (instance); dst->priv->eap_method = self->priv->eap_method; + dst->priv->key_type = self->priv->key_type; dst->priv->wpa_version = self->priv->wpa_version; dst->priv->key_mgmt = self->priv->key_mgmt; dst->priv->identity = self->priv->identity; diff --git a/src/nm-ap-security.c b/src/nm-ap-security.c index ffeabe14ea..3809d2c897 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; @@ -125,15 +125,15 @@ nm_ap_security_new_from_ap (NMAccessPoint *ap) /* Deteremine best encryption algorithm to use */ caps = nm_ap_get_capabilities (ap); - if ((caps & WPA_CCMP_PSK) || (caps & WPA2_CCMP_PSK)) + if (((caps & WPA_CCMP_PSK) == WPA_CCMP_PSK) || ((caps & WPA2_CCMP_PSK) == WPA2_CCMP_PSK)) security = NM_AP_SECURITY (nm_ap_security_wpa_psk_new_from_ap (ap, IW_AUTH_CIPHER_CCMP)); - else if ((caps & WPA_TKIP_PSK) || (caps & WPA2_TKIP_PSK)) + else if (((caps & WPA_TKIP_PSK) == WPA_TKIP_PSK) || ((caps & WPA2_TKIP_PSK) == WPA2_TKIP_PSK)) security = NM_AP_SECURITY (nm_ap_security_wpa_psk_new_from_ap (ap, IW_AUTH_CIPHER_TKIP)); - else if ((caps & WPA_EAP) || (caps & WPA2_EAP)) + else if (((caps & WPA_EAP) == WPA_EAP) || ((caps & WPA2_EAP) == WPA2_EAP)) security = NM_AP_SECURITY (nm_ap_security_wpa_eap_new_from_ap (ap)); - else if (caps & WEP_WEP104) + else if ((caps & WEP_WEP104) == WEP_WEP104) security = NM_AP_SECURITY (nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP104)); - else if (caps & WEP_WEP40) + else if ((caps & WEP_WEP40) == WEP_WEP40) security = NM_AP_SECURITY (nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP40)); else if (!nm_ap_get_encrypted (ap)) security = nm_ap_security_new (IW_AUTH_CIPHER_NONE); 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..7fb9e45e3d 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 */ @@ -215,9 +212,11 @@ nm_device_new (const char *iface, if (NM_DEVICE_GET_CLASS (dev)->init) NM_DEVICE_GET_CLASS (dev)->init (dev); + /* This ref should logically go in nm_device_worker, but we need the + ref to be taken before the worker thread is scheduled on a cpu. */ + g_object_ref (G_OBJECT (dev)); dev->priv->worker = g_thread_create (nm_device_worker, dev, TRUE, NULL); g_assert (dev->priv->worker); - g_object_ref (G_OBJECT (dev)); /* For the worker thread */ /* Block until our device thread has actually had a chance to start. */ args[0] = &dev->priv->worker_started; @@ -678,10 +677,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 +758,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 +773,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 +863,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 +876,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 +1003,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 +1020,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 +1104,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 +1181,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)) @@ -1222,6 +1191,7 @@ nm_device_activate_stage5_ip_config_commit (NMActRequest *req) nm_system_restart_mdns_responder (); nm_system_set_hostname (self->priv->ip4_config); nm_system_activate_nis (self->priv->ip4_config); + nm_system_set_mtu (self); if (NM_DEVICE_GET_CLASS (self)->update_link) NM_DEVICE_GET_CLASS (self)->update_link (self); nm_policy_schedule_activation_finish (req); @@ -1262,27 +1232,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 +1299,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 +1324,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 +1344,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 @@ -1924,8 +1879,6 @@ nm_device_dispose (GObject *object) * reference. */ - nm_device_stop (self); - nm_system_device_free_system_config (self, self->priv->system_config_data); if (self->priv->ip4_config) { @@ -1972,7 +1925,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/src/nm-ip4-config.c b/src/nm-ip4-config.c index da91e92c9c..6418f2cd65 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -44,7 +44,7 @@ struct NMIP4Config GSList * nameservers; GSList * domains; - gchar * hostname; + gchar * hostname; gchar * nis_domain; GSList * nis_servers; diff --git a/src/nm-logging.c b/src/nm-logging.c index 7d409cd4f0..b2d34ab4c9 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -46,7 +46,7 @@ fallback_get_backtrace (void) { syslog (LOG_CRIT, "******************* START **********************************"); for (i = 0; i < size; i++) - syslog (LOG_CRIT, "Frame %d: %s", i, strings[i]); + syslog (LOG_CRIT, "Frame %zd: %s", i, strings[i]); free (strings); syslog (LOG_CRIT, "******************* END **********************************"); } diff --git a/src/nm-netlink-monitor.c b/src/nm-netlink-monitor.c index 98e9c17967..144d191b0b 100644 --- a/src/nm-netlink-monitor.c +++ b/src/nm-netlink-monitor.c @@ -30,7 +30,7 @@ #include <linux/types.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> -#include <linux/if.h> +#include <net/if.h> #include <linux/unistd.h> #include <unistd.h> 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..ebdd1f901f 100644 --- a/vpn-daemons/vpnc/ChangeLog +++ b/vpn-daemons/vpnc/ChangeLog @@ -1,3 +1,11 @@ +2006-03-20 Dan Williams <dcbw@redhat.com> + + * configure.in: Bump release to 0.6 + +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/configure.in b/vpn-daemons/vpnc/configure.in index 131e9dfff0..1572727630 100644 --- a/vpn-daemons/vpnc/configure.in +++ b/vpn-daemons/vpnc/configure.in @@ -1,6 +1,6 @@ AC_PREREQ(2.52) -AC_INIT(NetworkManager-vpnc, 0.5.0, dcbw@redhat.com, NetworkManager-vpnc) +AC_INIT(NetworkManager-vpnc, 0.6.0, dcbw@redhat.com, NetworkManager-vpnc) AC_CONFIG_AUX_DIR(.) AM_INIT_AUTOMAKE([subdir-objects]) AM_MAINTAINER_MODE 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 |