Hello community, here is the log from the commit of package NetworkManager checked in at Fri Nov 30 00:35:08 CET 2007. -------- --- NetworkManager/NetworkManager.changes 2007-11-29 01:41:18.000000000 +0100 +++ /mounts/work_src_done/STABLE/NetworkManager/NetworkManager.changes 2007-09-14 09:12:08.000000000 +0200 @@ -2,9 +1,0 @@ -Wed Nov 28 11:32:12 CET 2007 - tambet@suse.de - -- Upgrade to the unstable branch (0.7). - - many changes and bugfixes - - integrate all previous patches - - switch to using dhcp-client instead of dhcdbd - - gnome applet split off to own source - -------------------------------------------------------------------- Old: ---- NetworkManager-0.7.0.tar.bz2 New: ---- NetworkManager-0.6.5.tar.bz2 network-manager-applet-0.6.5.tar.bz2 nm-0.6.5-killswitch-fix.patch nm-191251.patch nm-222902.patch nm-243959.patch nm-271757.patch nm-applet-0.6.5-build.patch nm-applet-disconnect-on-exit.patch nm-applet-editor.patch nm-applet-fallback.patch nm-configure-networking-rml.patch nm-disconnect-wireless-on-exit.sh nm-editor.tgz nm-fallback.patch nm-fix-adhoc-icon-rml.patch nm-icons.tar.gz nm-make-wireless-menu-item-inactive-rml.patch nm-never-restart-nm-applet-rml.patch nm-resolv-conf-header-rml.patch nm-save-passwds-in-keyring.patch nm-wireless-driver-workarounds-rml.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ NetworkManager.spec ++++++ --- /var/tmp/diff_new_pack.sZ3470/_old 2007-11-30 00:34:54.000000000 +0100 +++ /var/tmp/diff_new_pack.sZ3470/_new 2007-11-30 00:34:54.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package NetworkManager (Version 0.7.0) +# spec file for package NetworkManager (Version 0.6.5) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -8,29 +8,70 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +# norootforbuild Name: NetworkManager -Url: http://www.gnome.org/projects/NetworkManager/ -Version: 0.7.0 -Release: 1 -License: GPL v2 or later -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: dbus-1-devel dbus-1-glib hal-devel intltool iproute2 libgcrypt-devel libnl-devel libtool ppp-devel wireless-tools -Group: Productivity/Networking/System -Summary: Network Link Manager and User Applications -Source0: NetworkManager-%{version}.tar.bz2 -Source1: nfs -Requires: wpa_supplicant >= 0.5.8-54 -Requires: dhcp-client -Obsoletes: dhcdbd -%define dbus_version 1.1.2 -%define dbus_glib_version 0.74 +BuildRequires: dhcdbd fdupes gconf2-devel gnome-keyring-devel gnome-patch-translation hal-devel intltool iproute2 libgcrypt-devel libglade2-devel libgnomeui-devel libgpg-error-devel libnl-devel libnotify-devel libtool wireless-tools wpa_supplicant +%if %suse_version > 1010 +BuildRequires: dbus-1-glib-devel +%else +BuildRequires: dbus-1-devel dbus-1-glib +%endif +%define dbus_version 0.60-22 %define hal_version 0.5.0 %define wireless_version 28pre13-6 +%define wpa_supplicant_version 0.4.8-14 +%define resmgr_version 0.9.8 +%define dhcp_version 3.0.3-22 %define gtk_version 2.6.0 %define keyring_version 0.4.4 %define libnl_version 1.0-6 +%define dhcdbd_version 1.12-19 %define sysconfig_version 0.50.9-13.3 +License: GPL v2 or later +Group: Productivity/Networking/System +Url: http://www.gnome.org/projects/NetworkManager/ +AutoReqProv: on +Version: 0.6.5 +Release: 69 +Summary: Network Link Manager and User Applications +Source0: NetworkManager-%{version}.tar.bz2 +Source1: network-manager-applet-%{version}.tar.bz2 +Source2: nm-editor.tgz +Source3: nm-icons.tar.gz +Source4: nfs +Source5: nm-disconnect-wireless-on-exit.sh +Patch0: nm-wireless-driver-workarounds-rml.patch +Patch1: nm-resolv-conf-header-rml.patch +Patch2: nm-fallback.patch +Patch3: nm-222902.patch +Patch4: nm-191251.patch +Patch5: nm-0.6.5-killswitch-fix.patch +Patch6: nm-271757.patch +Patch7: nm-applet-0.6.5-build.patch +Patch8: nm-make-wireless-menu-item-inactive-rml.patch +Patch9: nm-configure-networking-rml.patch +Patch10: nm-never-restart-nm-applet-rml.patch +Patch11: nm-fix-adhoc-icon-rml.patch +Patch12: nm-applet-disconnect-on-exit.patch +Patch13: nm-243959.patch +Patch14: nm-applet-fallback.patch +Patch15: nm-save-passwds-in-keyring.patch +Patch16: nm-applet-editor.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-build +PreReq: sysconfig >= %{sysconfig_version} /usr/bin/sed +Recommends: %{name}-client +Requires: wireless-tools >= %{wireless_version} +Requires: dbus-1 >= %{dbus_version} +Requires: dbus-1-glib >= %{dbus_version} +Requires: hal >= %{hal_version} +Requires: resmgr >= %{resmgr_version} +Requires: dhcp-client >= %{dhcp_version} +Requires: wpa_supplicant >= %{wpa_supplicant_version} +Requires: dhcdbd >= %{dhcdbd_version} +Requires: libnl >= %{libnl_version} +Requires: iproute2 openssl nscd +Conflicts: netapplet %description NetworkManager attempts to keep an active network connection available @@ -47,13 +88,35 @@ Dan Williams <dcbw@redhat.com> Robert Love <rml@novell.com> +%package gnome +Summary: GNOME applications for use with NetworkManager +Group: System/GUI/GNOME +Provides: %{name}-client +Requires: %{name} = %{version}-%{release} +Requires: dbus-1 >= %{dbus_version} +Requires: dbus-1-glib >= %{dbus_version} +Requires: hal >= %{hal_version} +Requires: gnome-keyring >= %{keyring_version} +Requires: gtk2 >= %{gtk_version} + +%description gnome +This package contains GNOME utilities and applications for use with +NetworkManager, including a panel applet for wireless networks. + + + +Authors: +-------- + Dan Williams <dcbw@redhat.com> + Robert Love <rml@novell.com> + %package devel Summary: Libraries and headers for adding NetworkManager support to applications Group: Development/Libraries/Other Requires: %{name} = %{version}-%{release} Requires: %{name}-glib = %{version}-%{release} Requires: dbus-1 >= %{dbus_version} -Requires: dbus-1-glib >= %{dbus_glib_version} +Requires: dbus-1-glib >= %{dbus_version} Requires: dbus-1-devel Requires: glib2-devel Requires: dbus-1-glib-devel @@ -76,7 +139,7 @@ Group: Development/Libraries/GNOME Requires: %{name} = %{version}-%{release} Requires: dbus-1 >= %{dbus_version} -Requires: dbus-1-glib >= %{dbus_glib_version} +Requires: dbus-1-glib >= %{dbus_version} Requires: glib2 %description glib @@ -91,31 +154,84 @@ Robert Love <rml@novell.com> %prep -%setup +%setup -a 1 -a 2 -a 3 +cd nm-applet-0.6.5 +gnome-patch-translation-prepare +cd .. +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +mv editor nm-applet-0.6.5/ +# applet +%patch7 -p1 +%patch8 -p0 +%patch9 -p0 +%patch10 -p0 +%patch11 -p0 +%patch12 -p0 +%patch13 -p0 +%patch14 -p0 +%patch15 -p0 +%patch16 -p1 +cd nm-applet-0.6.5 +gnome-patch-translation-update +# Prepare directory for gnome-patch-translation-collect: +mv gnome-patch-translation .. +cd .. %build +intltoolize --force +autoreconf %configure\ --libexecdir=%{_prefix}/lib/NetworkManager\ --disable-static\ --with-gcrypt=yes\ --with-distro=suse make %{?jobs:-j%jobs} +# applet +pushd nm-applet-0.6.5 + sed -i s/" --sm-disable"// nm-applet.desktop + autoreconf -i + intltoolize --force + %configure\ + --disable-static\ + --with-notify + make +popd %install +%fdupes -s $RPM_BUILD_ROOT %makeinstall -%find_lang %{name} -mkdir -p $RPM_BUILD_ROOT%{_bindir} -install -m 755 test/nm-tool $RPM_BUILD_ROOT%{_bindir}/ -install -m 755 test/nm-online $RPM_BUILD_ROOT%{_bindir}/ mkdir -p $RPM_BUILD_ROOT/var/log/ touch $RPM_BUILD_ROOT/var/log/NetworkManager -cp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/ +# applet +pushd nm-applet-0.6.5 + make install DESTDIR=$RPM_BUILD_ROOT +popd +%find_lang %{name} +%find_lang nm-applet +cat nm-applet.lang >> %{name}.lang +cp -r nm-icons/* $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/ +cp test/nm-tool $RPM_BUILD_ROOT%{_bindir}/ +cp test/nm-online $RPM_BUILD_ROOT%{_bindir}/ +install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/ +cp %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/NetworkManager/ %clean -rm -rf "$RPM_BUILD_ROOT" +rm -rf $RPM_BUILD_ROOT %post /sbin/ldconfig +if [ "$1" = 1 ]; then + if grep "network_manager.*always" etc/YaST2/ProductFeatures &> /dev/null; then + sed -i '/^NETWORKMANAGER=.*no/s/no/yes/' etc/sysconfig/network/config + sed -i '/^NM_DISPATCHER=.*no/s/no/yes/' etc/sysconfig/network/config + fi +fi %postun -p /sbin/ldconfig @@ -126,43 +242,42 @@ %files -f %{name}.lang %defattr(-,root,root) %doc COPYING ChangeLog NEWS AUTHORS README CONTRIBUTING TODO -%{_bindir}/nm-tool -%{_bindir}/nm-online +%{_bindir}/nm-[ot]* %{_libdir}/libnm-util.so.* -%{_libdir}/nm-pppd-plugin.* %{_datadir}/NetworkManager %dir %attr(0700,root,root) %{_localstatedir}/run/NetworkManager %doc %{_mandir}/man1/*.* -%doc %{_mandir}/man8/*.* %{_prefix}/lib/NetworkManager %{_sbindir}/* %{_sysconfdir}/dbus-1/system.d/NetworkManager.conf -%{_sysconfdir}/dbus-1/system.d/nm-dhcp-client.conf -%dir %{_sysconfdir}/NetworkManager -%dir %{_sysconfdir}/NetworkManager/dispatcher.d -%attr(0755,root,root) %{_sysconfdir}/NetworkManager/dispatcher.d/nfs +%{_sysconfdir}/NetworkManager %ghost %config(noreplace) /var/log/NetworkManager +%files gnome +%defattr(-,root,root) +%{_bindir}/nm-applet +%{_bindir}/nm-vpn-properties +%{_bindir}/nm-editor +%{_datadir}/gnome/autostart/nm-applet.desktop +%{_datadir}/nm-applet +%{_datadir}/nm-editor +%{_datadir}/applications/nm-editor.desktop +%{_datadir}/icons/hicolor/*/apps/*.png +%{_datadir}/gnome-vpn-properties +%{_sysconfdir}/dbus-1/system.d/nm-applet.conf + %files devel %defattr(-,root,root) %{_includedir}/NetworkManager -%{_includedir}/libnm-glib -%{_libdir}/libnm-util* -%{_libdir}/pkgconfig/NetworkManager.pc -%{_libdir}/pkgconfig/libnm-util.pc -%{_libdir}/pkgconfig/libnm_glib.pc +%{_libdir}/*.so +%{_libdir}/*.*a +%{_libdir}/pkgconfig/*.pc %files glib %defattr(-,root,root) -%{_libdir}/libnm_glib* +%{_libdir}/libnm_glib.so.* %changelog -* Wed Nov 28 2007 - tambet@suse.de -- Upgrade to the unstable branch (0.7). - - many changes and bugfixes - - integrate all previous patches - - switch to using dhcp-client instead of dhcdbd - - gnome applet split off to own source * Fri Sep 14 2007 - tambet@suse.de - Make sure gnome-keyring does not return empty result. (Novell #307910). * Wed Aug 15 2007 - tambet@suse.de ++++++ NetworkManager-0.7.0.tar.bz2 -> NetworkManager-0.6.5.tar.bz2 ++++++ ++++ 148301 lines of diff (skipped) ++++++ nm-0.6.5-killswitch-fix.patch ++++++ Index: NetworkManager-0.6.5/src/NetworkManager.c =================================================================== --- NetworkManager-0.6.5.orig/src/NetworkManager.c +++ NetworkManager-0.6.5/src/NetworkManager.c @@ -826,6 +826,10 @@ void nm_hal_init (NMData *data) nm_add_initial_killswitch_devices (data); nm_add_initial_devices (data); } + + /* If there weren't any killswitches, mark hardware RF to on */ + if (g_slist_length (data->killswitch_list) == 0) + data->hw_rf_enabled = TRUE; } ++++++ nm-191251.patch ++++++ Index: NetworkManager-0.6.5/src/vpn-manager/nm-dbus-vpn.c =================================================================== --- NetworkManager-0.6.5.orig/src/vpn-manager/nm-dbus-vpn.c +++ NetworkManager-0.6.5/src/vpn-manager/nm-dbus-vpn.c @@ -410,8 +410,6 @@ static void nm_dbus_vpn_connections_upda NMData * data = (NMData *) user_data; DBusMessage * reply; DBusMessageIter iter, array_iter; - GSList * remove_list = NULL; - GSList * elt; g_return_if_fail (pcall); g_return_if_fail (data != NULL); @@ -427,22 +425,15 @@ static void nm_dbus_vpn_connections_upda nm_info ("Updating VPN Connections..."); - remove_list = nm_vpn_manager_vpn_connection_list_copy (data->vpn_manager); - dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &array_iter); while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRING) { DBusMessage * message; const char * con_name; - NMVPNConnection * vpn; dbus_message_iter_get_basic (&array_iter, &con_name); - /* If the connection already exists, remove it from the remove list */ - if ((vpn = nm_vpn_manager_find_connection_by_name (data->vpn_manager, con_name))) - remove_list = g_slist_remove (remove_list, vpn); - if ((message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "getVPNConnectionProperties"))) { DBusPendingCall * vpn_pcall = NULL; @@ -463,15 +454,6 @@ static void nm_dbus_vpn_connections_upda } dbus_message_unref (reply); - /* VPN connections left in the remove list aren't known by NMI, therefore we delete them */ - for (elt = remove_list; elt; elt = g_slist_next (elt)) - { - nm_vpn_manager_remove_connection (data->vpn_manager, elt->data); - nm_vpn_connection_unref (elt->data); - } - - g_slist_free (remove_list); - out: dbus_pending_call_unref (pcall); } @@ -527,6 +509,8 @@ static gboolean nm_dbus_vpn_connections_ g_return_val_if_fail (data->dbus_connection != NULL, FALSE); g_return_val_if_fail (data->vpn_manager != NULL, FALSE); + nm_vpn_manager_clear_connections (data->vpn_manager); + if (!(message = dbus_message_new_method_call (NMI_DBUS_SERVICE, NMI_DBUS_PATH, NMI_DBUS_INTERFACE, "getVPNConnections"))) { nm_warning ("nm_dbus_vpn_connections_update (): Couldn't allocate the dbus message"); Index: NetworkManager-0.6.5/src/vpn-manager/nm-vpn-manager.c =================================================================== --- NetworkManager-0.6.5.orig/src/vpn-manager/nm-vpn-manager.c +++ NetworkManager-0.6.5/src/vpn-manager/nm-vpn-manager.c @@ -130,28 +130,6 @@ NMVPNService *nm_vpn_manager_find_servic /* - * nm_vpn_manager_vpn_connection_list_copy - * - * Make a shallow copy of the VPN connection list, should - * only be used by nm-dbus-vpn.c - * - */ -GSList *nm_vpn_manager_vpn_connection_list_copy (NMVPNManager *manager) -{ - GSList * list; - GSList * elt; - - g_return_val_if_fail (manager != NULL, NULL); - - list = g_slist_copy (manager->connections); - for (elt = list; elt; elt = g_slist_next (elt)) - nm_vpn_connection_ref (elt->data); - - return list; -} - - -/* * nm_vpn_manager_add_connection * * Add a new VPN connection if none already exits, otherwise update the existing one. @@ -227,6 +205,29 @@ void nm_vpn_manager_remove_connection (N /* + * nm_vpn_manager_clear_connections + * + * Remove all VPN connections. + * + */ +void +nm_vpn_manager_clear_connections (NMVPNManager *manager) +{ + GSList *connections; + GSList *iter; + + g_return_if_fail (manager != NULL); + + connections = g_slist_copy (manager->connections); + + for (iter = connections; iter; iter = iter->next) + nm_vpn_manager_remove_connection (manager, (NMVPNConnection *) iter->data); + + g_slist_free (connections); +} + + +/* * nm_vpn_manager_get_connection_names * * Return an array of strings of all the VPN Connection names Index: NetworkManager-0.6.5/src/vpn-manager/nm-vpn-manager.h =================================================================== --- NetworkManager-0.6.5.orig/src/vpn-manager/nm-vpn-manager.h +++ NetworkManager-0.6.5/src/vpn-manager/nm-vpn-manager.h @@ -29,13 +29,12 @@ NMVPNManager * nm_vpn_manager_new (NMData *app_data); NMVPNConnection * nm_vpn_manager_add_connection (NMVPNManager *manager, const char *name, const char *service_name, const char *user_name); void nm_vpn_manager_remove_connection (NMVPNManager *manager, NMVPNConnection *vpn); +void nm_vpn_manager_clear_connections (NMVPNManager *manager); char ** nm_vpn_manager_get_connection_names (NMVPNManager *manager); void nm_vpn_manager_dispose (NMVPNManager *manager); NMVPNActRequest * nm_vpn_manager_get_vpn_act_request (NMVPNManager *manager); -GSList * nm_vpn_manager_vpn_connection_list_copy (NMVPNManager *manager); - void nm_vpn_manager_activate_vpn_connection (NMVPNManager *manager, NMVPNConnection *vpn, char **password_items, int password_count, char **data_items, int data_count, char **user_routes, int user_routes_count ); ++++++ nm-222902.patch ++++++ Index: NetworkManager-0.6.5/src/nm-device-802-11-wireless.c =================================================================== --- NetworkManager-0.6.5.orig/src/nm-device-802-11-wireless.c +++ NetworkManager-0.6.5/src/nm-device-802-11-wireless.c @@ -2637,7 +2637,7 @@ supplicant_status_cb (GIOChannel *source if ((self->priv->link_timeout == NULL) && !self->priv->scanning) { GMainContext * context = nm_device_get_main_context (dev); - self->priv->link_timeout = g_timeout_source_new (8000); + self->priv->link_timeout = g_timeout_source_new (16000); g_source_set_callback (self->priv->link_timeout, link_timeout_cb, self, ++++++ nm-243959.patch ++++++ Index: nm-applet-0.6.5/src/applet-dbus-info.c =================================================================== --- nm-applet-0.6.5/src/applet-dbus-info.c.orig +++ nm-applet-0.6.5/src/applet-dbus-info.c @@ -841,6 +841,16 @@ nmi_dbus_get_vpn_connection_routes (DBus } +static void +save_network_info_keyring_cb (GnomeKeyringResult result, + guint32 val, + gpointer user_data) +{ + if (result != GNOME_KEYRING_RESULT_OK) + nm_warning ("Error saving secret for wireless network '%s' in keyring: %d", (char *) user_data, result); +} + + /* * nmi_save_network_info * @@ -942,8 +952,6 @@ nmi_save_network_info (NMApplet *applet, GnomeKeyringAttributeList * attributes; GnomeKeyringAttribute attr; char * display_name; - GnomeKeyringResult ret; - guint32 item_id; display_name = g_strdup_printf (_("Passphrase for wireless network %s"), essid); @@ -953,16 +961,15 @@ nmi_save_network_info (NMApplet *applet, attr.value.string = g_strdup (essid); g_array_append_val (attributes, attr); - ret = gnome_keyring_item_create_sync (NULL, - GNOME_KEYRING_ITEM_GENERIC_SECRET, - display_name, - attributes, - nm_gconf_wso_get_key (gconf_wso), - TRUE, - &item_id); - if (ret != GNOME_KEYRING_RESULT_OK) - nm_warning ("Error saving secret for wireless network '%s' in keyring: %d", essid, ret); - + gnome_keyring_item_create (NULL, + GNOME_KEYRING_ITEM_GENERIC_SECRET, + display_name, + attributes, + nm_gconf_wso_get_key (gconf_wso), + TRUE, + save_network_info_keyring_cb, + g_strdup (essid), + (GDestroyNotify) g_free); g_free (display_name); gnome_keyring_attribute_list_free (attributes); } ++++++ nm-271757.patch ++++++ Index: NetworkManager-0.6.5/src/backends/NetworkManagerSuSE.c =================================================================== --- NetworkManager-0.6.5.orig/src/backends/NetworkManagerSuSE.c +++ NetworkManager-0.6.5/src/backends/NetworkManagerSuSE.c @@ -32,6 +32,9 @@ #include <signal.h> #include <sys/stat.h> #include <arpa/inet.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <string.h> #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" @@ -425,6 +428,38 @@ out: } +static gboolean +parse_netmask (const char *buf, guint32 *netmask) +{ + gboolean success = FALSE; + + if (strstr (buf, ".")) { + struct in_addr addr; + + if (inet_aton (buf, &addr)) { + *netmask = addr.s_addr; + success = TRUE; + } + } else { + int maskval; + + maskval = atoi (buf); + if (maskval >= 0 && maskval <= 32) { + guint32 mask = 0; + + while (maskval > 0) { + mask = (mask >> 1) + 0x80000000; + maskval--; + } + + *netmask = htonl (mask); + success = TRUE; + } + } + + return success; +} + /* * nm_system_device_get_system_config * @@ -674,14 +709,38 @@ found: buf = svGetValue (file, "IPADDR"); if (buf) { - struct in_addr ip; - int ret; - - ret = inet_aton (buf, &ip); - if (ret) - nm_ip4_config_set_address (sys_data->config, ip.s_addr); - else + char **pieces; + char *ip_str = NULL; + char *netmask_str = NULL; + + pieces = g_strsplit (buf, "/", 0); + if (g_strv_length (pieces) == 1) { + ip_str = buf; + } else if (g_strv_length (pieces) == 2) { + ip_str = pieces[0]; + netmask_str = pieces[1]; + } else error = TRUE; + + if (!error && ip_str) { + struct in_addr ip; + + if (inet_aton (ip_str, &ip)) + nm_ip4_config_set_address (sys_data->config, ip.s_addr); + else + error = TRUE; + } + + if (!error && netmask_str) { + guint32 netmask; + + if (parse_netmask (netmask_str, &netmask)) + nm_ip4_config_set_netmask (sys_data->config, netmask); + else + error = TRUE; + } + + g_strfreev (pieces); free (buf); } else @@ -696,7 +755,8 @@ found: if ((buf = svGetValue (file, "NETMASK"))) { - nm_ip4_config_set_netmask (sys_data->config, inet_addr (buf)); + if (nm_ip4_config_get_netmask (sys_data->config) == 0) + nm_ip4_config_set_netmask (sys_data->config, inet_addr (buf)); free (buf); } else Index: NetworkManager-0.6.5/gnome/vpn-properties/nm-vpn-properties.c =================================================================== --- NetworkManager-0.6.5.orig/gnome/vpn-properties/nm-vpn-properties.c +++ NetworkManager-0.6.5/gnome/vpn-properties/nm-vpn-properties.c @@ -39,6 +39,7 @@ #include <gtk/gtkwindow.h> #include <glade/glade.h> #include <gconf/gconf-client.h> +#include <libgnomeui/libgnomeui.h> #include <glib/gi18n.h> #define NM_VPN_API_SUBJECT_TO_CHANGE Index: NetworkManager-0.6.5/gnome/vpn-properties/Makefile.am =================================================================== --- NetworkManager-0.6.5.orig/gnome/vpn-properties/Makefile.am +++ NetworkManager-0.6.5/gnome/vpn-properties/Makefile.am @@ -26,7 +26,6 @@ nm_vpn_properties_CFLAGS = -DGLADEDIR=""$(gladedir)"" \ -DG_DISABLE_DEPRECATED \ -DGDK_DISABLE_DEPRECATED \ - -DGNOME_DISABLE_DEPRECATED \ -DGNOMELOCALEDIR="$(datadir)/locale" \ -DVERSION="$(VERSION)" \ $(NULL) ++++++ nm-applet-0.6.5-build.patch ++++++ --- NetworkManager-0.6.5/nm-applet-0.6.5/src/Makefile.am.buildfix 2007-02-02 10:53:26.000000000 -0500 +++ NetworkManager-0.6.5/nm-applet-0.6.5/src/Makefile.am 2007-03-15 14:20:32.000000000 -0400 @@ -2,6 +2,9 @@ bin_PROGRAMS = nm-applet +INCLUDES = -I${top_srcdir}/../include \ + -I${top_srcdir}/../libnm-util + nm_applet_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GTHREAD_CFLAGS) \ @@ -12,7 +15,6 @@ $(GCONF_CFLAGS) \ $(LIBGNOMEUI_CFLAGS) \ $(GNOME_KEYRING_CFLAGS) \ - $(NM_CFLAGS) \ -DICONDIR=""$(datadir)/icons"" \ -DGLADEDIR=""$(gladedir)"" \ -DBINDIR=""$(bindir)"" \ @@ -112,7 +114,7 @@ $(GCONF_LIBS) \ $(LIBGNOMEUI_LIBS) \ $(GNOME_KEYRING_LIBS) \ - $(NM_LIBS) \ + -L${top_srcdir}/../libnm-util $(top_builddir)/../libnm-util/libnm-util.la \ $(NULL) if WITH_NOTIFY --- NetworkManager-0.6.5/nm-applet-0.6.5/configure.ac.buildfix 2007-03-15 11:51:49.000000000 -0400 +++ NetworkManager-0.6.5/nm-applet-0.6.5/configure.ac 2007-03-15 16:33:34.000000000 -0400 @@ -18,10 +18,10 @@ dnl This doesn't depend on gnome support, only on gnome-common, autogen already dnl uses gnome-autogen dnl -GNOME_COMMON_INIT -GNOME_DEBUG_CHECK -GNOME_COMPILE_WARNINGS([maximum]) -GNOME_MAINTAINER_MODE_DEFINES +dnl GNOME_COMMON_INIT +dnl GNOME_DEBUG_CHECK +dnl GNOME_COMPILE_WARNINGS([maximum]) +dnl GNOME_MAINTAINER_MODE_DEFINES dnl dnl Required headers @@ -112,10 +112,6 @@ AC_SUBST(GOBJECT_CFLAGS) AC_SUBST(GOBJECT_LIBS) -PKG_CHECK_MODULES(NM, NetworkManager) -AC_SUBST(NM_CFLAGS) -AC_SUBST(NM_LIBS) - AC_ARG_WITH(notify, AC_HELP_STRING([--with-notify], [Use libnotify]), enable_notify=$withval, enable_notify=auto) PKG_CHECK_MODULES(GTK, gtk+-2.0) ++++++ nm-applet-disconnect-on-exit.patch ++++++ Index: nm-applet-0.6.5/src/applet.c =================================================================== --- nm-applet-0.6.5/src/applet.c.orig +++ nm-applet-0.6.5/src/applet.c @@ -1195,6 +1195,48 @@ done: } +gboolean nma_get_disconnect_wireless_on_exit (NMApplet *applet) +{ + GConfValue *value; + gboolean ret = FALSE; + + g_return_val_if_fail (applet != NULL, FALSE); + g_return_val_if_fail (applet->gconf_client != NULL, FALSE); + + value = gconf_client_get (applet->gconf_client, + GCONF_PATH_PREFS "/disconnect_wireless_on_exit", + NULL); + + if (value) + { + if (value->type == GCONF_VALUE_BOOL) + ret = gconf_value_get_bool (value); + + gconf_value_free (value); + } + + return ret; +} + + +void nma_set_disconnect_wireless_on_exit (NMApplet *applet, gboolean disconnect) +{ + gboolean current; + + g_return_if_fail (applet != NULL); + g_return_if_fail (applet->gconf_client != NULL); + + current = nma_get_disconnect_wireless_on_exit (applet); + if (current != disconnect) + { + gconf_client_set_bool (applet->gconf_client, + GCONF_PATH_PREFS "/disconnect_wireless_on_exit", + disconnect, + NULL); + } +} + + /* * nma_redraw_timeout * @@ -1984,7 +2026,13 @@ static void nma_set_wireless_enabled_cb state = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)); if (applet->wireless_enabled != state) + { + gconf_client_set_bool (applet->gconf_client, + GCONF_PATH_PREFS "/wireless_enabled", + state, + NULL); nma_dbus_enable_wireless (applet, state); + } } @@ -1996,7 +2044,13 @@ static void nma_set_networking_enabled_c state = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)); if ((applet->nm_state == NM_STATE_ASLEEP && state) || (applet->nm_state != NM_STATE_ASLEEP && !state)) + { + gconf_client_set_bool (applet->gconf_client, + GCONF_PATH_PREFS "/networking_enabled", + state, + NULL); nma_dbus_enable_networking (applet, state); + } } @@ -2577,6 +2631,36 @@ static void G_GNUC_NORETURN nma_destroy } +static gboolean +update_network_state (gpointer data) +{ + NMApplet *applet = data; + GConfValue *value; + + value = gconf_client_get (applet->gconf_client, + GCONF_PATH_PREFS "/networking_enabled", + NULL); + if (value) + { + if (value->type == GCONF_VALUE_BOOL) + nma_dbus_enable_networking (applet, gconf_value_get_bool (value)); + gconf_value_free (value); + } + + value = gconf_client_get (applet->gconf_client, + GCONF_PATH_PREFS "/wireless_enabled", + NULL); + if (value) + { + if (value->type == GCONF_VALUE_BOOL) + nma_dbus_enable_wireless (applet, gconf_value_get_bool (value)); + gconf_value_free (value); + } + + return FALSE; +} + + /* * nma_get_instance * @@ -2656,6 +2740,11 @@ static GtkWidget * nma_get_instance (NMA g_signal_connect (applet, "destroy", G_CALLBACK (nma_destroy), NULL); g_signal_connect (applet, "style-set", G_CALLBACK (nma_theme_change_cb), NULL); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, + update_network_state, + g_object_ref (applet), + (GDestroyNotify) g_object_unref); + return GTK_WIDGET (applet); } Index: nm-applet-0.6.5/src/applet.h =================================================================== --- nm-applet-0.6.5/src/applet.h.orig +++ nm-applet-0.6.5/src/applet.h @@ -157,6 +157,9 @@ void nma_set_state (NMApplet *ap void nma_set_running (NMApplet *applet, gboolean running); void nma_update_state (NMApplet *applet); +gboolean nma_get_disconnect_wireless_on_exit (NMApplet *applet); +void nma_set_disconnect_wireless_on_exit (NMApplet *applet, gboolean disconnect); + int nm_null_safe_strcmp (const char *s1, const char *s2); #endif Index: nm-applet-0.6.5/src/main.c =================================================================== --- nm-applet-0.6.5/src/main.c.orig +++ nm-applet-0.6.5/src/main.c @@ -36,7 +36,14 @@ static void session_die (GnomeClient *client, gpointer client_data) { NMApplet *applet = client_data; + + /* Deactivate VPN */ nma_dbus_vpn_deactivate_connection (applet->connection); + + /* Deactivate wireless devices if required */ + if (nma_get_disconnect_wireless_on_exit (applet)) + nma_dbus_enable_wireless (applet, FALSE); + gtk_main_quit (); } ++++++ nm-applet-editor.patch ++++++ Index: NetworkManager-0.6.5/nm-applet-0.6.5/configure.ac =================================================================== --- NetworkManager-0.6.5.orig/nm-applet-0.6.5/configure.ac +++ NetworkManager-0.6.5/nm-applet-0.6.5/configure.ac @@ -249,6 +249,7 @@ fi AC_OUTPUT([ Makefile src/Makefile +editor/Makefile icons/Makefile po/Makefile.in ]) Index: NetworkManager-0.6.5/nm-applet-0.6.5/Makefile.am =================================================================== --- NetworkManager-0.6.5.orig/nm-applet-0.6.5/Makefile.am +++ NetworkManager-0.6.5/nm-applet-0.6.5/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src icons po +SUBDIRS = src editor icons po EXTRA_DIST = \ CONTRIBUTING \ Index: NetworkManager-0.6.5/nm-applet-0.6.5/po/POTFILES.in =================================================================== --- NetworkManager-0.6.5.orig/nm-applet-0.6.5/po/POTFILES.in +++ NetworkManager-0.6.5/nm-applet-0.6.5/po/POTFILES.in @@ -19,3 +19,11 @@ src/wso-wep-hex.c src/wso-wep-passphrase.c src/wso-wpa-eap.c src/wso-wpa-psk.c +editor/bssid-editor-dialog.c +editor/editor-app.c +editor/editor-gconf-helper.c +editor/editor-keyring-helper.c +editor/widget-wso-wep.c +editor/widget-wso-wpa-enterprise.c +editor/widget-wso-wpa-personal.c +editor/editor.glade Index: NetworkManager-0.6.5/nm-applet-0.6.5/src/applet.c =================================================================== --- NetworkManager-0.6.5.orig/nm-applet-0.6.5/src/applet.c +++ NetworkManager-0.6.5/nm-applet-0.6.5/src/applet.c @@ -1614,6 +1614,28 @@ static void nma_menu_add_custom_essid_it } +static void edit_essid_items_selected (GtkWidget *menu_item, NMApplet *applet) +{ + g_spawn_command_line_async ("nm-editor", NULL); +} + + +static void nma_menu_add_edit_essid_item (GtkWidget *menu, NMApplet *applet) +{ + GtkWidget *menu_item; + GtkWidget *label; + + menu_item = gtk_menu_item_new (); + label = gtk_label_new_with_mnemonic (_("_Edit Wireless Networks...")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_container_add (GTK_CONTAINER (menu_item), label); + gtk_widget_show_all (menu_item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + g_signal_connect (menu_item, "activate", G_CALLBACK (edit_essid_items_selected), applet); +} + + + static void new_network_item_selected (GtkWidget *menu_item, NMApplet *applet) { nma_other_network_dialog_run (applet, TRUE); @@ -2014,6 +2036,7 @@ static void nma_menu_add_devices (GtkWid nma_menu_add_separator_item (menu); nma_menu_add_custom_essid_item (menu, applet); nma_menu_add_create_network_item (menu, applet); + nma_menu_add_edit_essid_item (menu, applet); } } Index: NetworkManager-0.6.5/nm-applet-0.6.5/editor/Makefile.am =================================================================== --- NetworkManager-0.6.5.orig/nm-applet-0.6.5/editor/Makefile.am +++ NetworkManager-0.6.5/nm-applet-0.6.5/editor/Makefile.am @@ -1,6 +1,6 @@ NULL= -INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/include -I${top_srcdir}/libnm-util +INCLUDES = -I${top_srcdir}/../include -I${top_srcdir}/../libnm-util bin_PROGRAMS = nm-editor @@ -55,8 +55,8 @@ nm_editor_LDADD = \ $(GCONF_LIBS) \ $(LIBGNOMEUI_LIBS) \ $(GNOME_KEYRING_LIBS) \ - $(top_builddir)/utils/libnmutils.la \ - $(top_builddir)/libnm-util/libnm-util.la \ + $(top_builddir)/../utils/libnmutils.la \ + $(top_builddir)/../libnm-util/libnm-util.la \ $(NULL) Index: NetworkManager-0.6.5/nm-applet-0.6.5/editor/editor-app.c =================================================================== --- NetworkManager-0.6.5.orig/nm-applet-0.6.5/editor/editor-app.c +++ NetworkManager-0.6.5/nm-applet-0.6.5/editor/editor-app.c @@ -197,7 +197,7 @@ gboolean quit_editor(WE_DATA *we_data) if(we_data != NULL) { if(we_data->editor_xml != NULL) - g_free(we_data->editor_xml); + g_object_unref(we_data->editor_xml); if(we_data->gconf_client != NULL) g_object_unref(we_data->gconf_client); if(we_data->glade_file != NULL) @@ -894,7 +894,7 @@ void update_security_widget(gint option, if(we_data->sub_xml != NULL) { - g_free(we_data->sub_xml); + g_object_unref(we_data->sub_xml); we_data->sub_xml = NULL; } ++++++ nm-applet-fallback.patch ++++++ Index: nm-applet-0.6.5/src/applet-dbus-devices.c =================================================================== --- nm-applet-0.6.5/src/applet-dbus-devices.c.orig +++ nm-applet-0.6.5/src/applet-dbus-devices.c @@ -1266,7 +1266,7 @@ void nma_dbus_device_remove_one_device ( * */ void nma_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const char *essid, - WirelessSecurityOption * opt) + gboolean fallback, WirelessSecurityOption * opt) { DBusMessage * message; gboolean success = TRUE; @@ -1285,6 +1285,7 @@ void nma_dbus_set_device (DBusConnection /* Build up the required args */ dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_STRING, &essid, + DBUS_TYPE_BOOLEAN, &fallback, DBUS_TYPE_INVALID); /* If we have specific wireless security options, add them */ Index: nm-applet-0.6.5/src/applet-dbus-devices.h =================================================================== --- nm-applet-0.6.5/src/applet-dbus-devices.h.orig +++ nm-applet-0.6.5/src/applet-dbus-devices.h @@ -49,7 +49,7 @@ void nma_dbus_device_remove_one_device void nma_dbus_device_update_one_network (NMApplet *applet, const char *dev_path, const char *net_path, const char *active_net_path); void nma_dbus_device_remove_one_network (NMApplet *applet, const char *dev_path, const char *net_path); void nma_dbus_update_strength (NMApplet *applet, const char *dev_path, const char *net_path, int strength); -void nma_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const char *essid, WirelessSecurityOption *opt); +void nma_dbus_set_device (DBusConnection *connection, NetworkDevice *dev, const char *essid, gboolean fallback, WirelessSecurityOption *opt); void nma_dbus_create_network (DBusConnection *connection, NetworkDevice *dev, const char *essid, WirelessSecurityOption *opt); void nma_free_data_model (NMApplet *applet); Index: nm-applet-0.6.5/src/applet-dbus-info.c =================================================================== --- nm-applet-0.6.5/src/applet-dbus-info.c.orig +++ nm-applet-0.6.5/src/applet-dbus-info.c @@ -428,7 +428,7 @@ nmi_dbus_get_network_properties (DBusCon char * escaped_network = NULL; char * essid = NULL; gint timestamp = -1; - gboolean trusted = FALSE; + gboolean fallback = FALSE; DBusMessageIter iter, array_iter; GConfClient * client; NMGConfWSO * gconf_wso; @@ -468,9 +468,9 @@ nmi_dbus_get_network_properties (DBusCon if (!nm_gconf_get_int_helper (client, GCONF_PATH_WIRELESS_NETWORKS, "timestamp", escaped_network, ×tamp) || (timestamp < 0)) timestamp = 0; - /* Trusted status */ - if (!nm_gconf_get_bool_helper (client, GCONF_PATH_WIRELESS_NETWORKS, "trusted", escaped_network, &trusted)) - trusted = FALSE; + /* Fallback status */ + if (!nm_gconf_get_bool_helper (client, GCONF_PATH_WIRELESS_NETWORKS, "fallback", escaped_network, &fallback)) + fallback = FALSE; /* Grab the list of stored access point BSSIDs */ gconf_key = g_strdup_printf ("%s/%s/bssids", GCONF_PATH_WIRELESS_NETWORKS, escaped_network); @@ -501,8 +501,8 @@ nmi_dbus_get_network_properties (DBusCon /* Second arg: Timestamp (INT32) */ dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, ×tamp); - /* Third arg: Trusted (BOOLEAN) */ - dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &trusted); + /* Third arg: Fallback? (BOOLEAN) */ + dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &fallback); /* Fourth arg: List of AP BSSIDs (ARRAY, STRING) */ dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array_iter); @@ -861,12 +861,14 @@ static void nmi_save_network_info (NMApplet *applet, const char *essid, gboolean automatic, + gboolean fallback, const char *bssid, NMGConfWSO * gconf_wso) { - char * key; - GConfEntry * gconf_entry; - char * escaped_network; + char * key; + GConfEntry * gconf_entry; + char * escaped_network; + GConfValue * value; g_return_if_fail (applet != NULL); g_return_if_fail (essid != NULL); @@ -897,9 +899,18 @@ nmi_save_network_info (NMApplet *applet, g_free (key); } + /* + * XXX: We don't want to move a network from fallback to non-fallback because the user + * connected via other means. We need a better way to do this. + */ + key = g_strdup_printf ("%s/%s/fallback", GCONF_PATH_WIRELESS_NETWORKS, escaped_network); + value = gconf_client_get (applet->gconf_client, key, NULL); + if (!value || value->type != GCONF_VALUE_BOOL || (!gconf_value_get_bool (value) && fallback)) + gconf_client_set_bool (applet->gconf_client, key, fallback, NULL); + g_free (key); + if (bssid && (strlen (bssid) >= 11)) { - GConfValue * value; GSList * new_bssid_list = NULL; gboolean found = FALSE; @@ -994,6 +1005,7 @@ nmi_dbus_update_network_info (DBusConnec NMApplet * applet = (NMApplet *) user_data; char * essid = NULL; gboolean automatic; + gboolean fallback; NMGConfWSO * gconf_wso = NULL; DBusMessageIter iter; char * bssid; @@ -1024,7 +1036,15 @@ nmi_dbus_update_network_info (DBusConnec } dbus_message_iter_get_basic (&iter, &automatic); - /* Third argument: Access point's BSSID */ + /* Third argument: Fallback? (BOOLEAN) */ + if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_BOOLEAN)) + { + nm_warning ("%s:%d - message argument 'fallback' was invalid.", __FILE__, __LINE__); + goto out; + } + dbus_message_iter_get_basic (&iter, &fallback); + + /* Fourth argument: Access point's BSSID */ if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING)) { nm_warning ("%s:%d - message argument 'bssid' was invalid.", __FILE__, __LINE__); @@ -1042,7 +1062,7 @@ nmi_dbus_update_network_info (DBusConnec goto out; } - nmi_save_network_info (applet, essid, automatic, bssid, gconf_wso); + nmi_save_network_info (applet, essid, automatic, fallback, bssid, gconf_wso); g_object_unref (G_OBJECT (gconf_wso)); out: Index: nm-applet-0.6.5/src/applet.c =================================================================== --- nm-applet-0.6.5/src/applet.c.orig +++ nm-applet-0.6.5/src/applet.c @@ -1352,7 +1352,7 @@ static void nma_menu_item_activate (GtkM if ((tag = g_object_get_data (G_OBJECT (item), "network"))) net = network_device_get_wireless_network_by_essid (dev, tag); - nma_dbus_set_device (applet->connection, dev, net ? wireless_network_get_essid (net) : NULL, NULL); + nma_dbus_set_device (applet->connection, dev, net ? wireless_network_get_essid (net) : NULL, FALSE, NULL); network_device_unref (dev); nmi_dbus_signal_user_interface_activated (applet->connection); Index: nm-applet-0.6.5/src/applet.glade =================================================================== --- nm-applet-0.6.5/src/applet.glade.orig +++ nm-applet-0.6.5/src/applet.glade @@ -426,7 +426,7 @@ You have chosen to log in to the wireles <child> <widget class="GtkTable" id="table1"> <property name="visible">True</property> - <property name="n_rows">4</property> + <property name="n_rows">5</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> @@ -548,8 +548,8 @@ You have chosen to log in to the wireles <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> @@ -569,8 +569,8 @@ WEP 64/128-bit ASCII <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="x_options">fill</property> <property name="y_options">fill</property> </packing> @@ -589,9 +589,31 @@ WEP 64/128-bit ASCII <packing> <property name="left_attach">0</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="x_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="fallback_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Fallback on this Network</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">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> </widget> Index: nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.c =================================================================== --- nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.c.orig +++ nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.c @@ -346,3 +346,80 @@ nm_gconf_wso_wpa_eap_get_type (void) } return type; } + +typedef struct { + GtkComboBox *combo; + gint value; +} ComboSelectInfo; + +static gboolean +combo_select (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) +{ + ComboSelectInfo *info = user_data; + GValue val = { 0, }; + gint i; + + gtk_tree_model_get_value (model, iter, 1, &val); + i = g_value_get_int (&val); + + if (i == info->value) { + gtk_combo_box_set_active_iter (info->combo, iter); + return TRUE; + } + + return FALSE; +} + +/* Ugh. Please avert your eyes. */ +void +nm_gconf_wpa_eap_populate_dialog (NMGConfWSOWPA_EAP *wso, GladeXML *xml) +{ + GtkWidget *widget; + GtkTreeModel *model; + ComboSelectInfo info; + + g_return_if_fail (wso != NULL); + g_return_if_fail (xml != NULL); + + if (wso->priv->identity != NULL) { + widget = glade_xml_get_widget (xml, "wpa_eap_identity_entry"); + gtk_entry_set_text (GTK_ENTRY (widget), wso->priv->identity); + } + + if (wso->priv->passwd != NULL) { + widget = glade_xml_get_widget (xml, "wpa_eap_passwd_entry"); + gtk_entry_set_text (GTK_ENTRY (widget), wso->priv->passwd); + } + + if (wso->priv->anon_identity != NULL) { + widget = glade_xml_get_widget (xml, "wpa_eap_anon_identity_entry"); + gtk_entry_set_text (GTK_ENTRY (widget), wso->priv->anon_identity); + } + + widget = glade_xml_get_widget (xml, "wpa_eap_eap_method_combo"); + info.combo = GTK_COMBO_BOX (widget); + info.value = wso->priv->eap_method; + gtk_tree_model_foreach (gtk_combo_box_get_model (info.combo), + combo_select, &info); + + widget = glade_xml_get_widget (xml, "wpa_eap_key_type_combo"); + info.combo = GTK_COMBO_BOX (widget); + info.value = wso->priv->key_type; + gtk_tree_model_foreach (gtk_combo_box_get_model (info.combo), + combo_select, &info); + + if (wso->priv->client_cert_file != NULL && g_file_test (wso->priv->client_cert_file, G_FILE_TEST_EXISTS)) { + widget = glade_xml_get_widget (xml, "wpa_eap_client_cert_file_chooser_button"); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), wso->priv->client_cert_file); + } + + if (wso->priv->ca_cert_file != NULL && g_file_test (wso->priv->ca_cert_file, G_FILE_TEST_EXISTS)) { + widget = glade_xml_get_widget (xml, "wpa_eap_ca_cert_file_chooser_button"); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), wso->priv->ca_cert_file); + } + + if (wso->priv->private_key_file != NULL && g_file_test (wso->priv->private_key_file, G_FILE_TEST_EXISTS)) { + widget = glade_xml_get_widget (xml, "wpa_eap_private_key_file_chooser_button"); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), wso->priv->private_key_file); + } +} Index: nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.h =================================================================== --- nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.h.orig +++ nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.h @@ -59,4 +59,7 @@ NMGConfWSOWPA_EAP * nm_gconf_wso_wpa_eap NMGConfWSOWPA_EAP * nm_gconf_wso_wpa_eap_new_deserialize_gconf (GConfClient *client, const char *network, int we_cipher); +/* Ugh. Please avert your eyes. */ +void nm_gconf_wpa_eap_populate_dialog (NMGConfWSOWPA_EAP *wso, GladeXML *xml); + #endif /* NM_GCONF_WSO_WPA_EAP_H */ Index: nm-applet-0.6.5/src/other-network-dialog.c =================================================================== --- nm-applet-0.6.5/src/other-network-dialog.c.orig +++ nm-applet-0.6.5/src/other-network-dialog.c @@ -410,19 +410,24 @@ static void nma_ond_response_cb (GtkDial WirelessSecurityOption * opt; GtkComboBox * security_combo; GtkTreeIter iter; + GtkWidget * fallback_button; char * str; NetworkDevice * dev; + gboolean fallback; gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter); gtk_tree_model_get (model, &iter, NAME_COLUMN, &str, DEV_COLUMN, &dev, -1); + fallback_button = glade_xml_get_widget (xml, "fallback_button"); + fallback = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fallback_button)); + security_combo = GTK_COMBO_BOX (glade_xml_get_widget (xml, "security_combo")); opt = wsm_get_option_for_active (wsm, security_combo); if (create_network) nma_dbus_create_network (applet->connection, dev, essid, opt); else - nma_dbus_set_device (applet->connection, dev, essid, opt); + nma_dbus_set_device (applet->connection, dev, essid, fallback, opt); } } Index: nm-applet-0.6.5/src/passphrase-dialog.c =================================================================== --- nm-applet-0.6.5/src/passphrase-dialog.c.orig +++ nm-applet-0.6.5/src/passphrase-dialog.c @@ -37,6 +37,9 @@ #include "NetworkManager.h" #include "wireless-security-manager.h" +#include "nm-gconf-wso-wpa-eap.h" +#include "wso-private.h" + static GladeXML *get_dialog_xml (GtkWidget *dialog) { g_return_val_if_fail (dialog != NULL, NULL); @@ -269,6 +272,24 @@ nmi_passphrase_dialog_new (NMApplet *app g_signal_connect (G_OBJECT (dialog), "response", GTK_SIGNAL_FUNC (nmi_passphrase_dialog_response_received), dialog); + /* Ugh. Avert your eyes, please. */ + { + /* Pre-populate the dialog if we have information about this network. */ + NMGConfWSO *wso; + const char *essid; + char *escaped_network; + + essid = wireless_network_get_essid (net); + escaped_network = gconf_escape_key (essid, strlen (essid)); + wso = nm_gconf_wso_new_deserialize_gconf (applet->gconf_client, escaped_network); + g_free (escaped_network); + + if (wso != NULL && NM_IS_GCONF_WSO_WPA_EAP (wso)) { + WirelessSecurityOption *wso_widget = wsm_get_option_for_active (wsm, GTK_COMBO_BOX (security_combo)); + nm_gconf_wpa_eap_populate_dialog (NM_GCONF_WSO_WPA_EAP (wso), wso_widget->uixml); + } + } + /* Bash focus-stealing prevention in the face */ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); gtk_widget_realize (dialog); ++++++ nm-configure-networking-rml.patch ++++++ Index: nm-applet-0.6.5/src/applet.c =================================================================== --- nm-applet-0.6.5/src/applet.c.orig +++ nm-applet-0.6.5/src/applet.c @@ -273,16 +273,43 @@ static gboolean nma_update_info (NMApple return TRUE; } -static void nma_show_info_cb (GtkMenuItem *mi, NMApplet *applet) + +static gboolean nma_run_yast (GtkWidget *info_dialog) { - GtkWidget *info_dialog; + char *argv[] = { "/usr/bin/gnomesu", "/sbin/yast2", "lan", NULL }; + GError *err = NULL; - info_dialog = glade_xml_get_widget (applet->info_dialog_xml, "info_dialog"); + if (!g_spawn_async ("/", argv, NULL, 0, NULL, NULL, NULL, &err)) + { + GtkWidget *dialog; + char *msg; + + msg = g_strdup_printf ("<span weight="bold" size="larger">%s</span>\n\n%s", + _("Network configuration could not be run"), err->message); + + dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg); + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + g_free (msg); + g_error_free (err); + } + + gtk_widget_hide (info_dialog); + return FALSE; +} + + +static void nma_show_info_cb (GtkMenuItem *mi, NMApplet *applet) +{ if (nma_update_info (applet)) { + GtkWidget * info_dialog; + + info_dialog = glade_xml_get_widget (applet->info_dialog_xml, "info_dialog"); + gtk_window_present (GTK_WINDOW (info_dialog)); - g_signal_connect_swapped (info_dialog, "response", G_CALLBACK (gtk_widget_hide), info_dialog); } } @@ -1742,10 +1769,42 @@ static void nma_menu_add_vpn_menu (GtkWi } +static void nma_config_dialup_cb (GtkMenu *item, gpointer data) +{ + char *modem_argv[] = { "/usr/bin/gnomesu", "/sbin/yast2", "modem", NULL }; + char *isdn_argv[] = { "/usr/bin/gnomesu", "/sbin/yast2", "isdn", NULL }; + char **argv; + gboolean modem = (gboolean) data; + GError *err = NULL; + + if (modem) + argv = modem_argv; + else + argv = isdn_argv; + + if (!g_spawn_async ("/", argv, NULL, 0, NULL, NULL, NULL, &err)) + { + GtkWidget *dialog; + char *msg; + + msg = g_strdup_printf ("<span weight="bold" size="larger">%s</span>\n\n%s", + _("Dialup configuration could not be run"), err->message); + + dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg); + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + g_free (msg); + g_error_free (err); + } +} + + static void nma_menu_add_dialup_menu (GtkWidget *menu, NMApplet *applet) { GtkMenuItem *item; GtkMenu *dialup_menu; + GtkWidget *configure_item; GSList *elt; g_return_if_fail (menu != NULL); @@ -1777,6 +1836,14 @@ static void nma_menu_add_dialup_menu (Gt gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), GTK_WIDGET (disconnect_item)); } + configure_item = gtk_menu_item_new_with_mnemonic (_("Configure _Modem...")); + g_signal_connect (G_OBJECT (configure_item), "activate", G_CALLBACK (nma_config_dialup_cb), (gpointer) 1); + gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), configure_item); + + configure_item = gtk_menu_item_new_with_mnemonic (_("Configure _ISDN...")); + g_signal_connect (G_OBJECT (configure_item), "activate", G_CALLBACK (nma_config_dialup_cb), (gpointer) 0); + gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), configure_item); + gtk_menu_item_set_submenu (item, GTK_WIDGET (dialup_menu)); gtk_menu_shell_append (GTK_MENU_SHELL (menu), GTK_WIDGET (item)); gtk_widget_show_all (GTK_WIDGET (item)); @@ -2518,6 +2585,9 @@ static void G_GNUC_NORETURN nma_destroy */ static GtkWidget * nma_get_instance (NMApplet *applet) { + GtkWidget * widget; + GtkWidget * info_dialog; + gtk_widget_hide (GTK_WIDGET (applet)); applet->nm_running = FALSE; @@ -2545,6 +2615,15 @@ static GtkWidget * nma_get_instance (NMA } applet->info_dialog_xml = glade_xml_new (applet->glade_file, "info_dialog", NULL); + info_dialog = glade_xml_get_widget (applet->info_dialog_xml, "info_dialog"); + + widget = glade_xml_get_widget (applet->info_dialog_xml, "configure_button"); + g_signal_connect_swapped (widget, "clicked", G_CALLBACK (nma_run_yast), info_dialog); + + widget = glade_xml_get_widget (applet->info_dialog_xml, "closebutton1"); + g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_widget_hide), info_dialog); + + g_signal_connect_swapped (info_dialog, "delete_event", G_CALLBACK (gtk_widget_hide_on_delete), info_dialog); applet->gconf_client = gconf_client_get_default (); if (!applet->gconf_client) Index: nm-applet-0.6.5/src/applet.glade =================================================================== --- nm-applet-0.6.5/src/applet.glade.orig +++ nm-applet-0.6.5/src/applet.glade @@ -855,24 +855,9 @@ WEP 64/128-bit ASCII <property name="spacing">6</property> <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> + <widget class="GtkHButtonBox" id="hbuttonbox2"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="closebutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="label">gtk-close</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-7</property> - </widget> - </child> </widget> <packing> <property name="padding">0</property> @@ -927,7 +912,7 @@ WEP 64/128-bit ASCII <widget class="GtkTable" id="table1"> <property name="border_width">1</property> <property name="visible">True</property> - <property name="n_rows">14</property> + <property name="n_rows">16</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> @@ -1696,6 +1681,165 @@ WEP 64/128-bit ASCII <property name="y_options"></property> </packing> </child> + + <child> + <widget class="GtkButton" id="closebutton1"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="label">gtk-close</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</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">15</property> + <property name="bottom_attach">16</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="configure_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox8"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="stock">gtk-properties</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label34"> + <property name="visible">True</property> + <property name="label" translatable="yes">Configure _Networking</property> + <property name="use_underline">True</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.5</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="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">15</property> + <property name="bottom_attach">16</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label35"> + <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">14</property> + <property name="bottom_attach">15</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label36"> + <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">1</property> + <property name="right_attach">2</property> + <property name="top_attach">14</property> + <property name="bottom_attach">15</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> ++++++ nm-fallback.patch ++++++ Index: NetworkManager-0.6.5/src/NetworkManagerAP.c =================================================================== --- NetworkManager-0.6.5.orig/src/NetworkManagerAP.c +++ NetworkManager-0.6.5/src/NetworkManagerAP.c @@ -56,7 +56,7 @@ struct NMAccessPoint GTimeVal last_seen; /* Last time the AP was seen in a scan */ /* Things from user prefs/NetworkManagerInfo */ - gboolean trusted; + gboolean fallback; NMAPSecurity * security; GTimeVal timestamp; GSList * user_addresses; @@ -403,21 +403,21 @@ void nm_ap_set_invalid (NMAccessPoint *a /* * Get/Set functions to indicate that an access point is - * 'trusted' + * 'fallback' * */ -gboolean nm_ap_get_trusted (const NMAccessPoint *ap) +gboolean nm_ap_get_fallback (const NMAccessPoint *ap) { g_return_val_if_fail (ap != NULL, FALSE); - return (ap->trusted); + return (ap->fallback); } -void nm_ap_set_trusted (NMAccessPoint *ap, gboolean trusted) +void nm_ap_set_fallback (NMAccessPoint *ap, gboolean fallback) { g_return_if_fail (ap != NULL); - ap->trusted = trusted; + ap->fallback = fallback; } Index: NetworkManager-0.6.5/src/NetworkManagerAP.h =================================================================== --- NetworkManager-0.6.5.orig/src/NetworkManagerAP.h +++ NetworkManager-0.6.5/src/NetworkManagerAP.h @@ -72,8 +72,8 @@ void nm_ap_set_rate (NMAccessPoint gboolean nm_ap_get_invalid (const NMAccessPoint *ap); void nm_ap_set_invalid (NMAccessPoint *ap, gboolean invalid); -gboolean nm_ap_get_trusted (const NMAccessPoint *ap); -void nm_ap_set_trusted (NMAccessPoint *ap, gboolean trusted); +gboolean nm_ap_get_fallback (const NMAccessPoint *ap); +void nm_ap_set_fallback (NMAccessPoint *ap, gboolean fallback); gboolean nm_ap_get_artificial (const NMAccessPoint *ap); void nm_ap_set_artificial (NMAccessPoint *ap, gboolean artificial); Index: NetworkManager-0.6.5/src/NetworkManagerAPList.c =================================================================== --- NetworkManager-0.6.5.orig/src/NetworkManagerAPList.c +++ NetworkManager-0.6.5/src/NetworkManagerAPList.c @@ -422,6 +422,63 @@ NMAccessPoint *nm_ap_list_get_ap_by_addr return (found_ap); } +/* + * nm_ap_list_merge_fallback + * + * Merges the user's fallback networks, if any, into the scan list. We "fall back" + * on these networks and attempt a brute-force connection, given no better options. + */ +void nm_ap_list_merge_fallback (NMDevice80211Wireless *dev) +{ + NMAccessPointList * allowed_list; + NMAccessPointList * scan_list; + NMAPListIter * iter; + NMData * app_data; + + app_data = nm_device_get_app_data (NM_DEVICE (dev)); + allowed_list = app_data->allowed_ap_list; + scan_list = nm_device_802_11_wireless_ap_list_get (dev); + + iter = nm_ap_list_iter_new (allowed_list); + if (iter) + { + NMAccessPoint * allowed_ap; + + while ((allowed_ap = nm_ap_list_iter_next (iter))) + { + if (nm_ap_get_fallback (allowed_ap)) + { + NMAccessPoint * ap; + GTimeVal cur_time; + NMAPSecurity * allowed_security; + + ap = nm_ap_new (); + nm_ap_set_essid (ap, nm_ap_get_essid (allowed_ap)); + nm_ap_set_timestamp_via_timestamp (ap, nm_ap_get_timestamp (allowed_ap)); + nm_ap_set_fallback (ap, TRUE); + + allowed_security = nm_ap_get_security (allowed_ap); + nm_ap_set_security (ap, allowed_security); + nm_ap_set_capabilities (ap, nm_ap_security_get_default_capabilities (allowed_security)); + nm_ap_add_capabilities_from_security (ap, allowed_security); + + /* + * Fake it as if we see the AP right now. We process the scan results _after_ this, thus + * if the AP is seen in a scan we will favor that AP when we merge. + * XXX: Temporarily doing this _after_ the scan results. + */ + g_get_current_time (&cur_time); + nm_ap_set_last_seen (ap, &cur_time); + nm_ap_set_artificial (ap, TRUE); + nm_ap_set_broadcast (ap, FALSE); + + nm_ap_list_merge_scanned_ap (dev, scan_list, ap); + nm_ap_unref (ap); + } + } + nm_ap_list_iter_free (iter); + } +} /* * nm_ap_list_merge_scanned_ap Index: NetworkManager-0.6.5/src/NetworkManagerAPList.h =================================================================== --- NetworkManager-0.6.5.orig/src/NetworkManagerAPList.h +++ NetworkManager-0.6.5/src/NetworkManagerAPList.h @@ -51,6 +51,8 @@ void nm_ap_list_copy_properties (NMA void nm_ap_list_copy_essids_by_address (NMData *app_data, NMDevice80211Wireless *dev, NMAccessPointList *dest, NMAccessPointList *source); void nm_ap_list_copy_one_essid_by_address (NMData *app_data, NMDevice80211Wireless *dev, NMAccessPoint *ap, NMAccessPointList *search_list); +void nm_ap_list_merge_fallback (NMDevice80211Wireless *dev); + gboolean nm_ap_list_merge_scanned_ap (NMDevice80211Wireless *dev, NMAccessPointList *list, NMAccessPoint *merge_ap); NMNetworkType nm_ap_list_get_type (NMAccessPointList *list); Index: NetworkManager-0.6.5/src/backends/NetworkManagerSuSE.c =================================================================== --- NetworkManager-0.6.5.orig/src/backends/NetworkManagerSuSE.c +++ NetworkManager-0.6.5/src/backends/NetworkManagerSuSE.c @@ -527,11 +527,10 @@ found: NMAccessPoint * list_ap; char * key; char * mode; + gboolean success = FALSE; 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")) { @@ -549,11 +548,16 @@ found: { nm_ap_security_set_key (NM_AP_SECURITY (security), hash, strlen (hash)); nm_ap_set_security (ap, NM_AP_SECURITY (security)); + success = TRUE; } + else + nm_warning ("Ignoring ESSID '%s' (invalid PSK key).", nm_ap_get_orig_essid (ap)); ieee_802_11_cipher_unref (cipher); g_object_unref (G_OBJECT (security)); } + else + nm_warning ("Ignoring ESSID '%s' (PSK mode but no key provided).", nm_ap_get_orig_essid (ap)); } else if ((key = svGetValue (file, "WIRELESS_KEY_0")) && strlen (key) > 3) { @@ -612,7 +616,10 @@ found: { nm_ap_security_set_key (NM_AP_SECURITY (security), hash, strlen (hash)); nm_ap_set_security (ap, NM_AP_SECURITY (security)); + success = TRUE; } + else + nm_warning ("Ignoring ESSID '%s' (invalid WEP key).", nm_ap_get_orig_essid (ap)); ieee_802_11_cipher_unref (cipher); g_object_unref (G_OBJECT (security)); @@ -626,26 +633,32 @@ found: security = nm_ap_security_new (IW_AUTH_CIPHER_NONE); nm_ap_set_security (ap, security); g_object_unref (G_OBJECT (security)); + success = TRUE; } - 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 + if (success) { - /* New AP, just add it to the list */ - nm_ap_list_append_ap (app_data->allowed_ap_list, ap); - } - nm_ap_unref (ap); + 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_security (list_ap, nm_ap_get_security (ap)); + } + else + { + nm_ap_set_timestamp (ap, time (NULL), 0); + + /* New AP, just add it to the list */ + nm_ap_list_append_ap (app_data->allowed_ap_list, ap); + } + + nm_debug ("Adding '%s' to the list of trusted networks", buf); - 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); + } - /* Ensure all devices get new information copied into their device lists */ - nm_policy_schedule_device_ap_lists_update_from_allowed (app_data); + nm_ap_unref (ap); free (key); free (mode); Index: NetworkManager-0.6.5/src/nm-dbus-nm.c =================================================================== --- NetworkManager-0.6.5.orig/src/nm-dbus-nm.c +++ NetworkManager-0.6.5/src/nm-dbus-nm.c @@ -262,6 +262,7 @@ static DBusMessage *nm_dbus_nm_set_activ { NMAPSecurity * security = NULL; char * essid = NULL; + gboolean fallback = FALSE; if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING)) { @@ -277,6 +278,15 @@ static DBusMessage *nm_dbus_nm_set_activ goto out; } + if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_BOOLEAN)) + { + nm_warning ("Invalid argument type (fallback"); + goto out; + } + + /* grab the fallback bit */ + dbus_message_iter_get_basic (&iter, &fallback); + /* If there's security information, we use that. If not, we * make some up from the scan list. */ @@ -293,6 +303,7 @@ static DBusMessage *nm_dbus_nm_set_activ /* Set up the wireless-specific activation request properties */ ap = nm_device_802_11_wireless_get_activation_ap (NM_DEVICE_802_11_WIRELESS (dev), essid, security); + nm_ap_set_fallback (ap, fallback); if (security) g_object_unref (G_OBJECT (security)); Index: NetworkManager-0.6.5/src/nm-dbus-nmi.c =================================================================== --- NetworkManager-0.6.5.orig/src/nm-dbus-nmi.c +++ NetworkManager-0.6.5/src/nm-dbus-nmi.c @@ -229,6 +229,7 @@ gboolean nm_dbus_update_network_info (DB { DBusMessage * message; gboolean success = FALSE; + gboolean fallback; const char * essid; gchar * char_bssid; NMAPSecurity * security; @@ -251,10 +252,14 @@ gboolean nm_dbus_update_network_info (DB /* First argument: ESSID (STRING) */ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &essid); - /* Second argument: Automatic (BOOLEAN) */ + /* Second argument: Automatic or user-driven connection? (BOOLEAN) */ dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &automatic); - /* Third argument: Access point's BSSID */ + /* Third argument: Fallback? (BOOLEAN) */ + fallback = nm_ap_get_fallback (ap); + dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &fallback); + + /* Fourth argument: Access point's BSSID */ addr = nm_ap_get_address (ap); if ((nm_ap_get_mode (ap) == IW_MODE_INFRA) && nm_ethernet_address_is_valid (addr)) { @@ -345,7 +350,7 @@ static void nm_dbus_get_network_data_cb DBusMessageIter subiter; const char * essid = NULL; gint timestamp_secs = -1; - gboolean trusted = FALSE; + gboolean fallback = FALSE; GSList * addr_list = NULL; NMAPSecurity * security; NMAccessPoint * ap; @@ -396,14 +401,14 @@ static void nm_dbus_get_network_data_cb } dbus_message_iter_get_basic (&iter, ×tamp_secs); - /* Third arg: Trusted (BOOLEAN) */ + /* Third arg: Fallback? (BOOLEAN) */ if (!dbus_message_iter_next (&iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_BOOLEAN)) { - nm_warning ("a message argument (trusted) was invalid."); + nm_warning ("a message argument (fallback) was invalid."); goto out; } - dbus_message_iter_get_basic (&iter, &trusted); + dbus_message_iter_get_basic (&iter, &fallback); /* Fourth arg: BSSID addresses (ARRAY, STRING) */ if (!dbus_message_iter_next (&iter) @@ -442,11 +447,12 @@ static void nm_dbus_get_network_data_cb ap = nm_ap_new (); nm_ap_set_essid (ap, essid); nm_ap_set_security (ap, security); + nm_ap_add_capabilities_from_security (ap, security); g_object_unref (G_OBJECT (security)); /* set_security copies the object */ nm_ap_set_timestamp (ap, timestamp_secs, 0); - nm_ap_set_trusted (ap, trusted); + nm_ap_set_fallback (ap, fallback); nm_ap_set_user_addresses (ap, addr_list); if ((list_ap = nm_ap_list_get_ap_by_essid (cb_data->list, essid))) @@ -455,8 +461,9 @@ static void nm_dbus_get_network_data_cb 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_fallback (list_ap, nm_ap_get_fallback (ap)); nm_ap_set_security (list_ap, nm_ap_get_security (ap)); + nm_ap_add_capabilities_from_security (list_ap, nm_ap_get_security (ap)); user_addresses = nm_ap_get_user_addresses (ap); nm_ap_set_user_addresses (list_ap, user_addresses); Index: NetworkManager-0.6.5/src/nm-device-802-11-wireless.c =================================================================== --- NetworkManager-0.6.5.orig/src/nm-device-802-11-wireless.c +++ NetworkManager-0.6.5/src/nm-device-802-11-wireless.c @@ -242,12 +242,13 @@ nm_device_802_11_wireless_update_bssid ( return; /* Get the current BSSID. If it is valid but does not match the stored value, - * and the ESSID is the same as what we think its suposed to be, update it. */ + * and the ESSID is the same as what we think its supposed to be, update it. */ nm_device_802_11_wireless_get_bssid (self, &new_bssid); old_bssid = nm_ap_get_address (ap); new_essid = nm_device_802_11_wireless_get_essid(self); old_essid = nm_ap_get_essid(ap); if ( nm_ethernet_address_is_valid (&new_bssid) + && nm_ethernet_address_is_valid (old_bssid) && !nm_ethernet_addresses_are_equal (&new_bssid, old_bssid) && !nm_null_safe_strcmp (old_essid, new_essid)) { @@ -742,12 +743,11 @@ nm_device_802_11_wireless_get_best_ap (N NMAPListIter * iter; NMAccessPoint * scan_ap = NULL; NMAccessPoint * best_ap = NULL; + NMAccessPoint * fallback_ap = NULL; NMAccessPoint * cur_ap = NULL; NMActRequest * req = NULL; - NMAccessPoint * trusted_best_ap = NULL; - NMAccessPoint * untrusted_best_ap = NULL; - GTimeVal trusted_latest_timestamp = {0, 0}; - GTimeVal untrusted_latest_timestamp = {0, 0}; + GTimeVal best_timestamp = {0, 0}; + GTimeVal fallback_timestamp = {0, 0}; NMData * app_data; g_return_val_if_fail (self != NULL, NULL); @@ -833,27 +833,50 @@ nm_device_802_11_wireless_get_best_ap (N } } - g_slist_foreach (user_addrs, (GFunc)g_free, NULL); + g_slist_foreach (user_addrs, (GFunc) g_free, NULL); g_slist_free (user_addrs); } - if (!blacklisted && nm_ap_get_trusted (tmp_ap) && (curtime->tv_sec > trusted_latest_timestamp.tv_sec)) + if (!blacklisted) { - trusted_latest_timestamp = *nm_ap_get_timestamp (tmp_ap); - trusted_best_ap = scan_ap; - nm_ap_set_security (trusted_best_ap, nm_ap_get_security (tmp_ap)); - } - else if (!blacklisted && !nm_ap_get_trusted (tmp_ap) && (curtime->tv_sec > untrusted_latest_timestamp.tv_sec)) - { - untrusted_latest_timestamp = *nm_ap_get_timestamp (tmp_ap); - untrusted_best_ap = scan_ap; - nm_ap_set_security (untrusted_best_ap, nm_ap_get_security (tmp_ap)); + if (!nm_ap_get_artificial (scan_ap)) + { + /* + * Allowed, non-blacklist, non-invalid, really-seen-in-scan network. We + * prefer these, and we will return the most-recently-used. + */ + if (curtime->tv_sec > best_timestamp.tv_sec) + { + best_timestamp = *nm_ap_get_timestamp (tmp_ap); + best_ap = scan_ap; + nm_ap_set_security (best_ap, nm_ap_get_security (tmp_ap)); + } + } + else + { + /* + * Allowed, non-blacklist, non-invalid, fallback, but not-seen-in-scan network. + * If we don't find any of the above networks, we will brute-force one of these + */ + if (nm_ap_get_fallback (tmp_ap) && (curtime->tv_sec > fallback_timestamp.tv_sec)) + { + fallback_timestamp = *nm_ap_get_timestamp (tmp_ap); + fallback_ap = scan_ap; + nm_ap_set_security (fallback_ap, nm_ap_get_security (tmp_ap)); + } + } } } } - best_ap = trusted_best_ap ? trusted_best_ap : untrusted_best_ap; nm_ap_list_iter_free (iter); + if (!best_ap && fallback_ap) + { + nm_ap_set_broadcast (fallback_ap, FALSE); + nm_info ("Attempting to fallback to wireless network '%s'", nm_ap_get_essid (fallback_ap)); + best_ap = fallback_ap; + } + if (best_ap) nm_ap_ref (best_ap); @@ -1787,7 +1810,6 @@ convert_scan_results (gpointer user_data NMDevice80211Wireless * self; GTimeVal cur_time; NMAPListIter * iter = NULL; - const char * iface; NMData * app_data; NMAccessPointList * ap_list; @@ -1797,17 +1819,22 @@ convert_scan_results (gpointer user_data if (!self || !cb_data->results) return FALSE; - iface = nm_device_get_iface (NM_DEVICE (self)); app_data = nm_device_get_app_data (NM_DEVICE (self)); if (cb_data->results_len > 0) { if (!process_scan_results (self, cb_data->results, cb_data->results_len)) + { + const char * iface; + iface = nm_device_get_iface (NM_DEVICE (self)); nm_warning ("process_scan_results() on device %s returned an error.", iface); + } /* Once we have the list, copy in any relevant information from our Allowed list. */ nm_ap_list_copy_properties (nm_device_802_11_wireless_ap_list_get (self), app_data->allowed_ap_list); } + nm_ap_list_merge_fallback (self); + /* Walk the access point list and remove any access points older than thrice the inactive scan interval */ g_get_current_time (&cur_time); ap_list = nm_device_802_11_wireless_ap_list_get (self); @@ -2906,9 +2933,10 @@ supplicant_send_network_config (NMDevice goto out; /* For non-broadcast networks, we need to set "scan_ssid 1" to scan with probe request frames. + * FIXME: Unfortunately, we sometimes think a hidden network is broadcast, so we always do this. * However, don't try to probe Ad-Hoc networks. */ - if (!nm_ap_get_broadcast (ap) && !is_adhoc) + if (!is_adhoc) { if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i scan_ssid 1", nwid)) @@ -3219,24 +3247,27 @@ real_activation_failure_handler (NMDevic if ((ap = nm_act_request_get_ap (req))) { - if (nm_ap_get_artificial (ap)) + if (!nm_ap_get_fallback (ap)) { - NMAccessPointList * dev_list; - - /* Artificial APs are ones that don't show up in scans, - * but which the user explicitly attempted to connect to. - * However, if we fail on one of these, remove it from the - * list because we don't have any scan or capability info - * for it, and they are pretty much useless. - */ - dev_list = nm_device_802_11_wireless_ap_list_get (self); - nm_ap_list_remove_ap (dev_list, ap); - } - else - { - /* Add the AP to the invalid list */ - nm_ap_set_invalid (ap, TRUE); - nm_ap_list_append_ap (app_data->invalid_ap_list, ap); + if (nm_ap_get_artificial (ap)) + { + NMAccessPointList * dev_list; + + /* Artificial APs are ones that don't show up in scans, + * but which the user explicitly attempted to connect to. + * However, if we fail on one of these, remove it from the + * list because we don't have any scan or capability info + * for it, and they are pretty much useless. + */ + dev_list = nm_device_802_11_wireless_ap_list_get (self); + nm_ap_list_remove_ap (dev_list, ap); + } + else + { + /* Add the AP to the invalid list */ + nm_ap_set_invalid (ap, TRUE); + nm_ap_list_append_ap (app_data->invalid_ap_list, ap); + } } } Index: NetworkManager-0.6.5/test/nm-set-fallback =================================================================== --- /dev/null +++ NetworkManager-0.6.5/test/nm-set-fallback @@ -0,0 +1,28 @@ +#! /bin/sh +# +# nm-set-fallback - mark a network as fallback +# +# Robert Love + +BIN=`which gconftool-2` + +if [ "x$1" == "x" ]; then + echo "usage: $0 <network> <true|false>" + exit 1 +fi + +if [ "x$2" != "xtrue" -a "x$2" != "xfalse" ]; then + echo "usage: $0 <network> <true|false>" + exit 2 +fi + +KEY="/system/networking/wireless/networks/${1}/fallback" +CURRENT=`$BIN --get $KEY 2>/dev/null` + +if [ "x$CURRENT" != "xtrue" -a "x$CURRENT" != "xfalse" ]; then + echo "Network '$1' is not valid" + exit 3 +fi + +$BIN --set --type=bool $KEY ${2} + ++++++ nm-fix-adhoc-icon-rml.patch ++++++ Index: nm-applet-0.6.5/src/applet.c =================================================================== --- nm-applet-0.6.5/src/applet.c.orig +++ nm-applet-0.6.5/src/applet.c @@ -2741,7 +2741,7 @@ nma_icons_load_from_disk (NMApplet *appl ICON_LOAD(applet->no_connection_icon, "nm-no-connection"); ICON_LOAD(applet->wired_icon, "nm-device-wired"); - ICON_LOAD(applet->adhoc_icon, "nm-adhoc"); + ICON_LOAD(applet->adhoc_icon, "nm-adhoc-nd"); ICON_LOAD(applet->vpn_lock_icon, "nm-vpn-lock"); ICON_LOAD(applet->wireless_00_icon, "nm-signal-00"); ++++++ nm-make-wireless-menu-item-inactive-rml.patch ++++++ Index: nm-applet-0.6.5/src/menu-items.c =================================================================== --- nm-applet-0.6.5.orig/src/menu-items.c +++ nm-applet-0.6.5/src/menu-items.c @@ -112,14 +112,6 @@ struct NMWirelessMenuItem }; -static gboolean label_expose (GtkWidget *widget) -{ - /* Bad hack to make the label draw normally, instead of insensitive. */ - widget->state = GTK_STATE_NORMAL; - - return FALSE; -} - NMWirelessMenuItem *wireless_menu_item_new (void) { NMWirelessMenuItem *item = g_malloc0 (sizeof (NMWirelessMenuItem)); @@ -129,7 +121,6 @@ NMWirelessMenuItem *wireless_menu_item_n /* Make sure it looks slightly different if the label determines the width of the widget */ item->label = GTK_LABEL (gtk_label_new (NULL)); gtk_misc_set_padding (GTK_MISC (item->label), 6, 0); - g_signal_connect (G_OBJECT (item->label), "expose-event", G_CALLBACK (label_expose), NULL); gtk_container_add (GTK_CONTAINER (item->menu_item), GTK_WIDGET (item->label)); gtk_widget_show (GTK_WIDGET (item->label)); ++++++ nm-never-restart-nm-applet-rml.patch ++++++ Index: nm-applet-0.6.5/src/main.c =================================================================== --- nm-applet-0.6.5.orig/src/main.c +++ nm-applet-0.6.5/src/main.c @@ -50,7 +50,7 @@ int main (int argc, char *argv[]) GNOME_PARAM_NONE, GNOME_PARAM_NONE); client = gnome_master_client (); - gnome_client_set_restart_style (client, GNOME_RESTART_ANYWAY); + gnome_client_set_restart_style (client, GNOME_RESTART_NEVER); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); ++++++ nm-resolv-conf-header-rml.patch ++++++ Index: NetworkManager-0.6.5/src/named-manager/nm-named-manager.c =================================================================== --- NetworkManager-0.6.5.orig/src/named-manager/nm-named-manager.c +++ NetworkManager-0.6.5/src/named-manager/nm-named-manager.c @@ -367,7 +367,15 @@ rewrite_resolv_conf (NMNamedManager *mgr if ((f = fopen (tmp_resolv_conf, "w")) == NULL) goto lose; - if (fprintf (f, "%s","# generated by NetworkManager, do not edit!\n\n") < 0) + if (fprintf (f, "### BEGIN INFO\n#\n") < 0) + goto lose; + if (fprintf (f, "# Modified_by: NetworkManager\n") < 0) + goto lose; + if (fprintf (f, "# Process: /usr/bin/NetworkManager\n") < 0) + goto lose; + if (fprintf (f, "# Process_id: %d\n", getpid ()) < 0) + goto lose; + if (fprintf (f, "#\n### END INFO\n\n") < 0) goto lose; searches = compute_searches (mgr, config); ++++++ nm-save-passwds-in-keyring.patch ++++++ Index: nm-applet-0.6.5/src/applet-dbus-info.c =================================================================== --- nm-applet-0.6.5/src/applet-dbus-info.c.orig +++ nm-applet-0.6.5/src/applet-dbus-info.c @@ -39,6 +39,7 @@ #include "passphrase-dialog.h" #include "nm-utils.h" #include "nm-gconf-wso.h" +#include "nm-gconf-wso-wpa-eap.h" #include "gconf-helpers.h" #include "dbus-method-dispatcher.h" #include "dbus-helpers.h" @@ -73,6 +74,7 @@ typedef struct NMGetNetworkKeyCBData { NMApplet *applet; DBusMessage *message; + NMGConfWSO *gconf_wso; NetworkDevice *dev; char *net_path; char *essid; @@ -83,6 +85,7 @@ static void free_network_key_cb_data (NM if (cb_data) { dbus_message_unref (cb_data->message); + g_object_unref (cb_data->gconf_wso); network_device_unref (cb_data->dev); g_free (cb_data->net_path); g_free (cb_data->essid); @@ -92,6 +95,37 @@ static void free_network_key_cb_data (NM } +static void +nmi_dbus_get_eap_key_callback (GnomeKeyringResult result, + GList *found_list, + gpointer data) +{ + NMGetNetworkKeyCBData * cb_data = (NMGetNetworkKeyCBData*) data; + NMApplet * applet = cb_data->applet; + DBusMessage * message = cb_data->message; + NMGConfWSO * gconf_wso = cb_data->gconf_wso; + NetworkDevice * dev = cb_data->dev; + char * net_path = cb_data->net_path; + + if (result == GNOME_KEYRING_RESULT_OK && found_list) { + GnomeKeyringFound * found; + + found = found_list->data; + nm_gconf_wso_wpa_eap_set_password (NM_GCONF_WSO_WPA_EAP (gconf_wso), + found->secret, + strlen (found->secret)); + nmi_dbus_return_user_key (applet->connection, message, gconf_wso); + } else { + WirelessNetwork *net; + + nmi_passphrase_dialog_destroy (applet); + if ((net = network_device_get_wireless_network_by_nm_path (dev, net_path))) + applet->passphrase_dialog = nmi_passphrase_dialog_new (applet, 0, dev, net, message); + } + + free_network_key_cb_data (cb_data); +} + static void nmi_dbus_get_network_key_callback (GnomeKeyringResult result, GList *found_list, gpointer data) @@ -99,26 +133,30 @@ static void nmi_dbus_get_network_key_cal NMGetNetworkKeyCBData * cb_data = (NMGetNetworkKeyCBData*) data; NMApplet * applet = cb_data->applet; DBusMessage * message = cb_data->message; + NMGConfWSO * gconf_wso = cb_data->gconf_wso; NetworkDevice * dev = cb_data->dev; char * net_path = cb_data->net_path; char * essid = cb_data->essid; - if (result == GNOME_KEYRING_RESULT_OK) - { - gchar * escaped_network; - GnomeKeyringFound * found; - NMGConfWSO * gconf_wso; + if (result == GNOME_KEYRING_RESULT_OK && found_list) { + GnomeKeyringFound *found = (GnomeKeyringFound *) found_list->data; + nm_gconf_wso_set_key (gconf_wso, found->secret, strlen (found->secret)); - escaped_network = gconf_escape_key (essid, strlen (essid)); - gconf_wso = nm_gconf_wso_new_deserialize_gconf (applet->gconf_client, escaped_network); - g_free (escaped_network); + if (nm_gconf_wso_get_we_cipher (gconf_wso) == NM_AUTH_TYPE_WPA_EAP && + nm_gconf_wso_wpa_eap_have_passwd (NM_GCONF_WSO_WPA_EAP (gconf_wso))) { - found = found_list->data; - nm_gconf_wso_set_key (gconf_wso, found->secret, strlen (found->secret)); - nmi_dbus_return_user_key (applet->connection, message, gconf_wso); - } - else - { + gnome_keyring_find_itemsv (GNOME_KEYRING_ITEM_GENERIC_SECRET, + nmi_dbus_get_eap_key_callback, + cb_data, + NULL, + "eap-essid", + GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, + essid, + NULL); + return; /* Don't free cb_data */ + } else + nmi_dbus_return_user_key (applet->connection, message, gconf_wso); + } else { WirelessNetwork *net; nmi_passphrase_dialog_destroy (applet); @@ -210,7 +248,6 @@ nmi_dbus_get_key_for_network (DBusConnec else new_key = TRUE; } - g_free (escaped_network); /* It's not a new key, so try to get the key from the keyring. */ if (!new_key) @@ -222,6 +259,7 @@ nmi_dbus_get_key_for_network (DBusConnec cb_data->essid = g_strdup (essid); cb_data->message = message; dbus_message_ref (message); + cb_data->gconf_wso = nm_gconf_wso_new_deserialize_gconf (applet->gconf_client, escaped_network); cb_data->dev = dev; network_device_ref (dev); cb_data->net_path = g_strdup (net_path); @@ -234,16 +272,38 @@ nmi_dbus_get_key_for_network (DBusConnec gtk_menu_shell_deactivate (GTK_MENU_SHELL (applet->dropdown_menu)); /* Get the essid key, if any, from the keyring */ - gnome_keyring_find_itemsv (GNOME_KEYRING_ITEM_GENERIC_SECRET, - (GnomeKeyringOperationGetListCallback) nmi_dbus_get_network_key_callback, - cb_data, - NULL, - "essid", - GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - essid, - NULL); + if (!NM_IS_GCONF_WSO_WPA_EAP (cb_data->gconf_wso) || + (NM_IS_GCONF_WSO_WPA_EAP (cb_data->gconf_wso) && + nm_gconf_wso_wpa_eap_have_private_key_passwd (NM_GCONF_WSO_WPA_EAP (cb_data->gconf_wso)))) { + + /* Not WPA-EAP or WPA-EAP and have private key password */ + gnome_keyring_find_itemsv (GNOME_KEYRING_ITEM_GENERIC_SECRET, + nmi_dbus_get_network_key_callback, + cb_data, + NULL, + "essid", + GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, + essid, + NULL); + } else if (NM_IS_GCONF_WSO_WPA_EAP (cb_data->gconf_wso) && + nm_gconf_wso_wpa_eap_have_passwd (NM_GCONF_WSO_WPA_EAP (cb_data->gconf_wso))) { + + /* WPA-EAP, no private key password, user password */ + gnome_keyring_find_itemsv (GNOME_KEYRING_ITEM_GENERIC_SECRET, + nmi_dbus_get_eap_key_callback, + cb_data, + NULL, + "eap-essid", + GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, + essid, + NULL); + } else { + free_network_key_cb_data (cb_data); + new_key = TRUE; + } } - else + + if (new_key) { /* We only ask the user for a new key when we know about the network from NM, * since throwing up a dialog with a random essid from somewhere is a security issue. @@ -255,6 +315,8 @@ nmi_dbus_get_key_for_network (DBusConnec } } + g_free (escaped_network); + return NULL; } @@ -850,6 +912,62 @@ save_network_info_keyring_cb (GnomeKeyri nm_warning ("Error saving secret for wireless network '%s' in keyring: %d", (char *) user_data, result); } + +static void +save_one_secret (const char *description, const char *essid, const char *name, const char *key) +{ + GnomeKeyringAttributeList *attributes; + GnomeKeyringAttribute attr; + GnomeKeyringResult ret; + guint32 item_id; + + attributes = gnome_keyring_attribute_list_new (); + attr.name = g_strdup (name); + attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING; + attr.value.string = g_strdup (essid); + g_array_append_val (attributes, attr); + + ret = gnome_keyring_item_create_sync (NULL, + GNOME_KEYRING_ITEM_GENERIC_SECRET, + description, + attributes, + key, + TRUE, + &item_id); + if (ret != GNOME_KEYRING_RESULT_OK) + nm_warning ("Error saving secret for wireless network '%s' in keyring: %d", essid, ret); + + gnome_keyring_attribute_list_free (attributes); +} + +static void +save_secrets (NMGConfWSO *gconf_wso, const char *essid) +{ + int we_cipher; + const char *key; + char *description; + + we_cipher = nm_gconf_wso_get_we_cipher (gconf_wso); + if (we_cipher == IW_AUTH_CIPHER_NONE) + /* That was easy */ + return; + + key = nm_gconf_wso_get_key (gconf_wso); + if (key) { + description = g_strdup_printf (_("Passphrase for wireless network %s"), essid); + save_one_secret (description, essid, "essid", key); + g_free (description); + } + + if (we_cipher == NM_AUTH_TYPE_WPA_EAP) { + key = nm_gconf_wso_wpa_eap_get_password (NM_GCONF_WSO_WPA_EAP (gconf_wso)); + if (key) { + description = g_strdup_printf (_("EAP password for wireless network %s"), essid); + save_one_secret (description, essid, "eap-essid", key); + g_free (description); + } + } +} /* * nmi_save_network_info @@ -958,32 +1076,7 @@ nmi_save_network_info (NMApplet *applet, } /* Stuff the encryption key into the keyring */ - if (nm_gconf_wso_get_we_cipher (gconf_wso) != IW_AUTH_CIPHER_NONE) - { - GnomeKeyringAttributeList * attributes; - GnomeKeyringAttribute attr; - char * display_name; - - display_name = g_strdup_printf (_("Passphrase for wireless network %s"), essid); - - attributes = gnome_keyring_attribute_list_new (); - attr.name = g_strdup ("essid"); - attr.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING; - attr.value.string = g_strdup (essid); - g_array_append_val (attributes, attr); - - gnome_keyring_item_create (NULL, - GNOME_KEYRING_ITEM_GENERIC_SECRET, - display_name, - attributes, - nm_gconf_wso_get_key (gconf_wso), - TRUE, - save_network_info_keyring_cb, - g_strdup (essid), - (GDestroyNotify) g_free); - g_free (display_name); - gnome_keyring_attribute_list_free (attributes); - } + save_secrets (gconf_wso, essid); out: g_free (escaped_network); Index: nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.c =================================================================== --- nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.c.orig +++ nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.c @@ -49,6 +49,9 @@ struct _NMGConfWSOWPA_EAPPrivate const char * private_key_file; const char * client_cert_file; const char * ca_cert_file; + + gboolean have_passwd; + gboolean have_private_key_passwd; }; @@ -78,14 +81,21 @@ nm_gconf_wso_wpa_eap_new_deserialize_dbu /* 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); - if (private_key_passwd && strlen (private_key_passwd) > 0) + if (private_key_passwd && strlen (private_key_passwd) > 0) { + security->priv->have_private_key_passwd = TRUE; nm_gconf_wso_set_key (NM_GCONF_WSO (security), private_key_passwd, strlen (private_key_passwd)); + } security->priv->wpa_version = wpa_version; security->priv->key_type = key_type; security->priv->eap_method = NM_EAP_TO_EAP_METHOD (eap_method); security->priv->phase2_type = NM_EAP_TO_PHASE2_METHOD (eap_method); security->priv->key_mgmt = IW_AUTH_KEY_MGMT_802_1X; - security->priv->identity = g_strdup (identity); + + if (passwd) { + security->priv->have_passwd = TRUE; + security->priv->passwd = g_strdup (passwd); + } + security->priv->passwd = g_strdup (passwd); security->priv->anon_identity = g_strdup (anon_identity); security->priv->private_key_file = g_strdup (private_key_file); @@ -102,7 +112,6 @@ nm_gconf_wso_wpa_eap_new_deserialize_gco { NMGConfWSOWPA_EAP * security = NULL; char * identity = NULL; - char * passwd = NULL; char * anon_identity = NULL; char * private_key_file = NULL; char * client_cert_file = NULL; @@ -112,6 +121,8 @@ nm_gconf_wso_wpa_eap_new_deserialize_gco int key_type = 0; int phase2_type = 0; int key_mgmt = 0; + gboolean have_passwd = FALSE; + gboolean have_private_key_passwd = FALSE; g_return_val_if_fail (client != NULL, NULL); g_return_val_if_fail (network != NULL, NULL); @@ -155,12 +166,6 @@ nm_gconf_wso_wpa_eap_new_deserialize_gco nm_gconf_get_string_helper (client, GCONF_PATH_WIRELESS_NETWORKS, - WPA_EAP_PREFIX"passwd", - network, - &passwd); - - nm_gconf_get_string_helper (client, - GCONF_PATH_WIRELESS_NETWORKS, WPA_EAP_PREFIX"anon_identity", network, &anon_identity); @@ -183,6 +188,18 @@ nm_gconf_wso_wpa_eap_new_deserialize_gco network, &ca_cert_file); + nm_gconf_get_bool_helper (client, + GCONF_PATH_WIRELESS_NETWORKS, + WPA_EAP_PREFIX"passwd", + network, + &have_passwd); + + nm_gconf_get_bool_helper (client, + GCONF_PATH_WIRELESS_NETWORKS, + WPA_EAP_PREFIX"private_key_passwd", + network, + &have_private_key_passwd); + /* 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); @@ -192,14 +209,14 @@ nm_gconf_wso_wpa_eap_new_deserialize_gco security->priv->phase2_type = phase2_type; security->priv->key_mgmt = IW_AUTH_KEY_MGMT_802_1X; security->priv->identity = g_strdup (identity); - security->priv->passwd = g_strdup (passwd); security->priv->anon_identity = g_strdup (anon_identity); security->priv->private_key_file = g_strdup (private_key_file); security->priv->client_cert_file = g_strdup (client_cert_file); security->priv->ca_cert_file = g_strdup (ca_cert_file); + security->priv->have_passwd = have_passwd; + security->priv->have_private_key_passwd = have_private_key_passwd; g_free (identity); - g_free (passwd); g_free (anon_identity); g_free (private_key_file); g_free (client_cert_file); @@ -262,13 +279,6 @@ real_serialize_gconf (NMGConfWSO *instan g_free (key); } - if (self->priv->passwd && strlen (self->priv->passwd) > 0) - { - key = g_strdup_printf ("%s/%s/%spasswd", GCONF_PATH_WIRELESS_NETWORKS, network, WPA_EAP_PREFIX); - gconf_client_set_string (client, key, self->priv->passwd, NULL); - g_free (key); - } - if (self->priv->anon_identity && strlen (self->priv->anon_identity) > 0) { key = g_strdup_printf ("%s/%s/%sanon_identity", GCONF_PATH_WIRELESS_NETWORKS, network, WPA_EAP_PREFIX); @@ -297,6 +307,18 @@ real_serialize_gconf (NMGConfWSO *instan g_free (key); } + /* Only update these if we have any security information. NM happens to send blank + security every now and then */ + if (self->priv->passwd || nm_gconf_wso_get_key (instance)) { + key = g_strdup_printf ("%s/%s/%spasswd", GCONF_PATH_WIRELESS_NETWORKS, network, WPA_EAP_PREFIX); + gconf_client_set_bool (client, key, self->priv->have_passwd, NULL); + g_free (key); + + key = g_strdup_printf ("%s/%s/%sprivate_key_passwd", GCONF_PATH_WIRELESS_NETWORKS, network, WPA_EAP_PREFIX); + gconf_client_set_bool (client, key, self->priv->have_private_key_passwd, NULL); + g_free (key); + } + return TRUE; } @@ -423,3 +445,42 @@ nm_gconf_wpa_eap_populate_dialog (NMGCon gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), wso->priv->private_key_file); } } + +void +nm_gconf_wso_wpa_eap_set_password (NMGConfWSOWPA_EAP *wso, const char *passwd, int passwd_len) +{ + g_return_if_fail (NM_IS_GCONF_WSO_WPA_EAP (wso)); + g_return_if_fail (passwd != NULL); + g_return_if_fail (passwd_len > 0); + + if (wso->priv->passwd) + g_free (wso->priv->passwd); + + wso->priv->passwd = g_malloc0 (passwd_len + 1); + memcpy (wso->priv->passwd, passwd, passwd_len); + wso->priv->have_passwd = TRUE; +} + +const char * +nm_gconf_wso_wpa_eap_get_password (NMGConfWSOWPA_EAP *wso) +{ + g_return_val_if_fail (NM_IS_GCONF_WSO_WPA_EAP (wso), NULL); + + return wso->priv->passwd; +} + +gboolean +nm_gconf_wso_wpa_eap_have_private_key_passwd (NMGConfWSOWPA_EAP *wso) +{ + g_return_val_if_fail (NM_IS_GCONF_WSO_WPA_EAP (wso), FALSE); + + return wso->priv->have_private_key_passwd; +} + +gboolean +nm_gconf_wso_wpa_eap_have_passwd (NMGConfWSOWPA_EAP *wso) +{ + g_return_val_if_fail (NM_IS_GCONF_WSO_WPA_EAP (wso), FALSE); + + return wso->priv->have_passwd; +} Index: nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.h =================================================================== --- nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.h.orig +++ nm-applet-0.6.5/src/nm-gconf-wso-wpa-eap.h @@ -61,5 +61,9 @@ NMGConfWSOWPA_EAP * nm_gconf_wso_wpa_eap /* Ugh. Please avert your eyes. */ void nm_gconf_wpa_eap_populate_dialog (NMGConfWSOWPA_EAP *wso, GladeXML *xml); +void nm_gconf_wso_wpa_eap_set_password (NMGConfWSOWPA_EAP *wso, const char *passwd, int passwd_len); +const char *nm_gconf_wso_wpa_eap_get_password (NMGConfWSOWPA_EAP *wso); +gboolean nm_gconf_wso_wpa_eap_have_private_key_passwd (NMGConfWSOWPA_EAP *wso); +gboolean nm_gconf_wso_wpa_eap_have_passwd (NMGConfWSOWPA_EAP *wso); #endif /* NM_GCONF_WSO_WPA_EAP_H */ ++++++ nm-wireless-driver-workarounds-rml.patch ++++++ Index: NetworkManager-0.6.5/src/nm-device-802-11-wireless.c =================================================================== --- NetworkManager-0.6.5.orig/src/nm-device-802-11-wireless.c +++ NetworkManager-0.6.5/src/nm-device-802-11-wireless.c @@ -116,9 +116,10 @@ static gboolean process_scan_results (NM guint32 res_buf_len); static void schedule_scan (NMDevice80211Wireless *self); -static int wireless_qual_to_percent (const struct iw_quality *qual, - const struct iw_quality *max_qual, - const struct iw_quality *avg_qual); +static int wireless_qual_to_percent (NMDevice *dev, + const struct iw_quality *qual, + const struct iw_quality *max_qual, + const struct iw_quality *avg_qual); static gboolean is_associated (NMDevice80211Wireless *self); @@ -190,8 +191,9 @@ nm_device_802_11_wireless_update_signal_ #endif if (iw_get_stats (nm_dev_sock_get_fd (sk), iface, &stats, &range, has_range) == 0) { - percent = wireless_qual_to_percent (&stats.qual, (const iwqual *)(&self->priv->max_qual), - (const iwqual *)(&self->priv->avg_qual)); + percent = wireless_qual_to_percent (NM_DEVICE (self), &stats.qual, + (const iwqual *)(&self->priv->max_qual), + (const iwqual *)(&self->priv->avg_qual)); } nm_dev_sock_close (sk); } @@ -350,23 +352,15 @@ get_wireless_capabilities (NMDevice80211 if ((data_len >= minlen) && range->we_version_compiled >= 18) { - if (range->enc_capa & IW_ENC_CAPA_WPA) - { - caps |= (NM_802_11_CAP_PROTO_WPA - | NM_802_11_CAP_KEY_MGMT_PSK - | NM_802_11_CAP_KEY_MGMT_802_1X); - } - if (range->enc_capa & IW_ENC_CAPA_WPA2) - { - caps |= (NM_802_11_CAP_PROTO_WPA2 - | NM_802_11_CAP_KEY_MGMT_PSK - | NM_802_11_CAP_KEY_MGMT_802_1X); - } - - if (range->enc_capa & IW_ENC_CAPA_CIPHER_TKIP) - caps |= NM_802_11_CAP_CIPHER_TKIP; - if (range->enc_capa & IW_ENC_CAPA_CIPHER_CCMP) - caps |= NM_802_11_CAP_CIPHER_CCMP; + /* FIXME: Until all drivers support enc_capa ... */ + caps |= (NM_802_11_CAP_PROTO_WPA + | NM_802_11_CAP_KEY_MGMT_PSK + | NM_802_11_CAP_KEY_MGMT_802_1X); + caps |= (NM_802_11_CAP_PROTO_WPA2 + | NM_802_11_CAP_KEY_MGMT_PSK + | NM_802_11_CAP_KEY_MGMT_802_1X); + caps |= NM_802_11_CAP_CIPHER_TKIP; + caps |= NM_802_11_CAP_CIPHER_CCMP; } return caps; @@ -1234,7 +1228,8 @@ nm_device_802_11_wireless_get_signal_str * */ static int -wireless_qual_to_percent (const struct iw_quality *qual, +wireless_qual_to_percent (NMDevice *dev, + const struct iw_quality *qual, const struct iw_quality *max_qual, const struct iw_quality *avg_qual) { @@ -1263,7 +1258,7 @@ max_qual->updated); * are free to use whatever they want to calculate "Link Quality". */ if ((max_qual->qual != 0) && !(max_qual->updated & IW_QUAL_QUAL_INVALID) && !(qual->updated & IW_QUAL_QUAL_INVALID)) - percent = (int)(100 * ((double)qual->qual / (double)max_qual->qual)); + percent = (int) (100 * ((double) qual->qual / (double) max_qual->qual)); /* If the driver doesn't specify a complete and valid quality, we have two options: * @@ -1329,7 +1324,7 @@ max_qual->updated); } /* If the quality percent was 0 or doesn't exist, then try to use signal levels instead */ - if ((percent < 1) && (level_percent >= 0)) + if ((percent < 1 || !strcmp (nm_device_get_driver (dev), "ath_pci")) && (level_percent >= 0)) percent = level_percent; #ifdef IW_QUAL_DEBUG @@ -2636,13 +2631,11 @@ supplicant_status_cb (GIOChannel *source } -#define NM_SUPPLICANT_TIMEOUT 20 /* how long we wait for wpa_supplicant to associate (in seconds) */ +#define NM_SUPPLICANT_TIMEOUT 60 /* how long we wait for wpa_supplicant to associate (in seconds) */ static unsigned int get_supplicant_timeout (NMDevice80211Wireless *self) { - if (self->priv->num_freqs > 14) - return NM_SUPPLICANT_TIMEOUT * 2; return NM_SUPPLICANT_TIMEOUT; } @@ -2762,6 +2755,8 @@ supplicant_interface_init (NMDevice80211 struct wpa_ctrl * ctrl = NULL; char * socket_path; const char * iface = nm_device_get_iface (NM_DEVICE (self)); + const char * wpa_driver; + const char * kernel_driver; gboolean success = FALSE; int tries = 0; @@ -2778,9 +2773,19 @@ supplicant_interface_init (NMDevice80211 goto exit; } + /* + * We want to work with the generic "wext" wpa_supplicant driver, but some kernel drivers + * are just utter junk. For those losers, we use a specific wpa_supplicant driver. + */ + kernel_driver = nm_device_get_driver (NM_DEVICE (self)); + if (!strcmp (kernel_driver, "ath_pci")) + wpa_driver = "madwifi"; + else + wpa_driver = "wext"; + /* wpa_cli -g/var/run/wpa_supplicant-global interface_add eth1 "" wext /var/run/wpa_supplicant */ if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, - "INTERFACE_ADD %s\t\twext\t" WPA_SUPPLICANT_CONTROL_SOCKET "\t", iface)) + "INTERFACE_ADD %s\t\t%s\t" WPA_SUPPLICANT_CONTROL_SOCKET "\t", iface, wpa_driver)) goto exit; wpa_ctrl_close (ctrl); @@ -2816,7 +2821,8 @@ supplicant_send_network_config (NMDevice struct wpa_ctrl * ctrl; gboolean is_adhoc; char * hex_essid = NULL; - const char * ap_scan = "AP_SCAN 1"; + char * ap_scan; + const char * kernel_driver; guint32 caps; gboolean supports_wpa; @@ -2838,12 +2844,39 @@ supplicant_send_network_config (NMDevice || (caps & NM_802_11_CAP_PROTO_WPA2); /* Use "AP_SCAN 2" if: + * + * - The wireless driver does not support "AP_SCAN 1" + * (orinoco, prism54, airo, and airo_cs) + * - The wireless network is hidden and the driver does not support + * "AP_SCAN 1" with hidden networks (ipw2100, ipw2200, and ndiswrapper) * - The wireless network is non-broadcast or Ad-Hoc * - The wireless driver does not support WPA (stupid drivers...) + * + * Otherwise, we prefer "AP_SCAN 1". */ is_adhoc = (nm_ap_get_mode(ap) == IW_MODE_ADHOC); - if (!nm_ap_get_broadcast (ap) || is_adhoc || !supports_wpa) + kernel_driver = nm_device_get_driver (NM_DEVICE (self)); + if (!strcmp (kernel_driver, "orinoco_cs")) + ap_scan = "AP_SCAN 2"; + else if (!strcmp (kernel_driver, "prism54")) + ap_scan = "AP_SCAN 2"; + else if (!strncmp (kernel_driver, "airo", 4)) + ap_scan = "AP_SCAN 2"; + else if (!strcmp (kernel_driver, "ndiswrapper") && !nm_ap_get_broadcast (ap)) + ap_scan = "AP_SCAN 2"; + else if (!strcmp (kernel_driver, "ipw2100") || !strcmp (kernel_driver, "ipw2200")) + { + if (nm_ap_get_broadcast (ap)) + ap_scan = "AP_SCAN 1"; + else + ap_scan = "AP_SCAN 2"; + } + else if (is_adhoc) ap_scan = "AP_SCAN 2"; + else if (!supports_wpa) + ap_scan = "AP_SCAN 2"; + else + ap_scan = "AP_SCAN 1"; /* Tell wpa_supplicant that we'll do the scanning */ if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, ap_scan)) @@ -3522,7 +3555,8 @@ process_scan_results (NMDevice80211Wirel nm_ap_set_freq (ap, iw_freq2float(&(iwe->u.freq))); break; case IWEVQUAL: - nm_ap_set_strength (ap, wireless_qual_to_percent (&(iwe->u.qual), + nm_ap_set_strength (ap, wireless_qual_to_percent (&dev->parent, + &(iwe->u.qual), (const iwqual *)(&dev->priv->max_qual), (const iwqual *)(&dev->priv->avg_qual))); break; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org