Update to 0.8.2

This commit is contained in:
Dan Williams 2010-11-03 14:00:41 -05:00
parent 3029c8db21
commit 8945c4bc19
13 changed files with 66 additions and 1426 deletions

2
.gitignore vendored
View File

@ -214,3 +214,5 @@ NetworkManager-0.8.0.999.tar.bz2
network-manager-applet-0.8.0.999.tar.bz2
NetworkManager-0.8.1.tar.bz2
network-manager-applet-0.8.1.tar.bz2
/NetworkManager-0.8.2.tar.bz2
/network-manager-applet-0.8.2.tar.bz2

View File

@ -7,9 +7,9 @@
%define libnl_version 1.1
%define ppp_version 2.4.5
%define snapshot .git20100831
%define applet_snapshot .git20100831
%define realversion 0.8.1
%define snapshot %{nil}
%define applet_snapshot %{nil}
%define realversion 0.8.2
%define use_systemd 0
%if 0%{?fedora} >= 15
@ -19,8 +19,8 @@
Name: NetworkManager
Summary: Network connection manager and user applications
Epoch: 1
Version: 0.8.1
Release: 10.1%{snapshot}%{?dist}
Version: 0.8.2
Release: 1%{snapshot}%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -31,12 +31,6 @@ Source2: NetworkManager.conf
Patch1: nm-applet-internal-buildfixes.patch
Patch2: explain-dns1-dns2.patch
Patch3: nm-applet-no-notifications.patch
Patch4: nm-remove-stale-hosts-mappings.patch
Patch5: nm-preserve-custom-hostnames.patch
Patch6: nm-prevent-hostname-dup.patch
Patch7: nm-sleep-wake-no-auth.patch
Patch8: nm-libnm-glib-prop-set-delay.patch
Patch9: nm-preserve-wifi-state.patch
Patch10: Port-to-libnotify-070.patch
Patch11: gtk-build.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -169,12 +163,6 @@ tar -xjf %{SOURCE1}
%patch1 -p1 -b .buildfix
%patch2 -p1 -b .explain-dns1-dns2
%patch3 -p1 -b .no-notifications
%patch4 -p1 -b .remove-stale-hosts-mappings
%patch5 -p1 -b .preserve-custom-hostnames
%patch6 -p1 -b .prevent-hostname-dup
%patch7 -p1 -b .sleep-wake
%patch8 -p1 -b .prop-set-delay
%patch9 -p1 -b .wifi-state-preserve
pushd network-manager-applet-%{realversion}
%patch10 -p1 -b .libnotify-070
popd
@ -437,6 +425,9 @@ fi
%{_datadir}/gtk-doc/html/libnm-util/*
%changelog
* Wed Nov 3 2010 Dan Williams <dcbw@redhat.com> - 0.8.2-1
- Update to 0.8.2
* Wed Nov 3 2010 Matthias Clasen <mclasen@redhat.com> - 0.8.1-10.1
- Rebuild against libnotify 0.7
- misc gtk build fixes

View File

@ -1,21 +1,21 @@
diff -up NetworkManager-0.7.0/src/named-manager/nm-named-manager.c.explain-dns1-dns2 NetworkManager-0.7.0/src/named-manager/nm-named-manager.c
--- NetworkManager-0.7.0/src/named-manager/nm-named-manager.c.explain-dns1-dns2 2008-09-15 10:33:29.000000000 -0400
+++ NetworkManager-0.7.0/src/named-manager/nm-named-manager.c 2008-10-12 08:25:48.000000000 -0400
@@ -243,7 +243,7 @@ write_resolv_conf (FILE *f, const char *
g_free (tmp_str);
}
diff -up NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c
--- NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 2010-10-18 18:44:05.000000000 -0500
+++ NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c 2010-11-03 13:51:56.614584001 -0500
@@ -358,7 +358,7 @@ write_resolv_conf (FILE *f, const char *
str = g_string_new ("");
- if (nameservers) {
+ if (nameservers && g_strv_length (nameservers)) {
GString *str;
int num;
int num = g_strv_length (nameservers);
@@ -265,6 +265,14 @@ write_resolv_conf (FILE *f, const char *
for (i = 0; i < num; i++) {
@@ -374,6 +374,14 @@ write_resolv_conf (FILE *f, const char *
g_string_append (str, nameservers[i]);
g_string_append_c (str, '\n');
}
nameservers_str = g_string_free (str, FALSE);
+ } else {
+ nameservers_str = g_strdup_printf ("\n\n%s%s%s%s%s%s",
+ g_string_append_printf (str, "\n\n%s%s%s%s%s%s",
+ "# No nameservers found; try putting DNS servers into your\n",
+ "# ifcfg files in /etc/sysconfig/network-scripts like so:\n",
+ "#\n",
@ -24,4 +24,4 @@ diff -up NetworkManager-0.7.0/src/named-manager/nm-named-manager.c.explain-dns1-
+ "# DOMAIN=lab.foo.com bar.foo.com\n");
}
if (fprintf (f, "%s%s%s",
nameservers_str = g_string_free (str, FALSE);

View File

@ -1,15 +1,5 @@
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/wireless-dialog.c 2010-07-21 19:01:21.000000000 -0400
+++ NetworkManager-0.8.1.hacked/network-manager-applet-0.8.1/src/wireless-dialog.c 2010-11-02 21:19:46.531180001 -0400
@@ -1069,7 +1069,6 @@
gtk_container_set_border_width (GTK_CONTAINER (self), 6);
gtk_window_set_default_size (GTK_WINDOW (self), 488, -1);
gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
- gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
priv->auth_only = auth_only;
if (auth_only)
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/applet.c 2010-11-02 21:28:16.850180001 -0400
+++ NetworkManager-0.8.1.hacked/network-manager-applet-0.8.1/src/applet.c 2010-11-02 20:58:40.797180001 -0400
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/applet.c 2010-11-02 21:28:16.850180001 -0400
+++ NetworkManager-0.8.2.hacked/network-manager-applet-0.8.2/src/applet.c 2010-11-02 20:58:40.797180001 -0400
@@ -2736,7 +2736,7 @@
return *icon;
}

View File

@ -1,14 +1,14 @@
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/configure.ac.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/configure.ac
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/configure.ac.buildfix 2009-07-28 10:01:26.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/configure.ac 2009-07-28 13:11:39.261718877 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/configure.ac.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/configure.ac
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/configure.ac.buildfix 2009-07-28 10:01:26.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/configure.ac 2009-07-28 13:11:39.261718877 -0400
@@ -70,10 +70,6 @@ PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
PKG_CHECK_MODULES(NMA,
[dbus-glib-1 >= 0.74
glib-2.0 >= 2.16
- NetworkManager >= 0.8.1
- libnm-glib >= 0.8.1
- libnm-util >= 0.8.1
- libnm-glib-vpn >= 0.8.1
- NetworkManager >= 0.8.2
- libnm-glib >= 0.8.2
- libnm-util >= 0.8.2
- libnm-glib-vpn >= 0.8.2
gtk+-2.0 >= 2.14
libglade-2.0
gmodule-export-2.0
@ -17,16 +17,16 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/configure.ac.buildfix
PKG_CHECK_MODULES(GNOME_BLUETOOTH,
gconf-2.0
- gnome-bluetooth-1.0 >= 2.27.6
- libnm-util >= 0.8.1
- libnm-glib >= 0.8.1,
- libnm-util >= 0.8.2
- libnm-glib >= 0.8.2,
+ gnome-bluetooth-1.0 >= 2.27.6,
have_gbt=yes, have_gbt=no)
;;
esac
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/connection-editor/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/connection-editor/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/connection-editor/Makefile.am.buildfix 2009-07-23 10:51:39.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/connection-editor/Makefile.am 2009-07-28 11:29:11.685841724 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/connection-editor/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/connection-editor/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/connection-editor/Makefile.am.buildfix 2009-07-23 10:51:39.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/connection-editor/Makefile.am 2009-07-28 11:29:11.685841724 -0400
@@ -1,5 +1,9 @@
bin_PROGRAMS = nm-connection-editor
@ -49,9 +49,9 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/connection-editor
gladedir = $(datadir)/nm-applet
glade_DATA = \
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gconf-helpers/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gconf-helpers/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gconf-helpers/Makefile.am.buildfix 2009-04-20 07:09:10.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gconf-helpers/Makefile.am 2009-07-28 11:29:11.686841642 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gconf-helpers/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gconf-helpers/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gconf-helpers/Makefile.am.buildfix 2009-04-20 07:09:10.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gconf-helpers/Makefile.am 2009-07-28 11:29:11.686841642 -0400
@@ -1,3 +1,7 @@
+INCLUDES = -I${top_srcdir}/../include \
+ -I${top_srcdir}/../libnm-util \
@ -69,9 +69,9 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gconf-helpers/Mak
+ -L${top_builddir}/../libnm-util $(top_builddir)/../libnm-util/libnm-util.la \
+ -L${top_builddir}/../libnm-glib $(top_builddir)/../libnm-glib/libnm-glib.la
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gnome-bluetooth/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gnome-bluetooth/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gnome-bluetooth/Makefile.am.buildfix 2009-07-28 13:23:40.282718683 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gnome-bluetooth/Makefile.am 2009-07-28 13:24:56.316719077 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gnome-bluetooth/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gnome-bluetooth/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gnome-bluetooth/Makefile.am.buildfix 2009-07-28 13:23:40.282718683 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/gnome-bluetooth/Makefile.am 2009-07-28 13:24:56.316719077 -0400
@@ -6,6 +6,9 @@ INCLUDES = \
-I$(top_builddir) \
-I${top_builddir}/src/marshallers \
@ -93,9 +93,9 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/gnome-bluetooth/M
endif
EXTRA_DIST = $(BT_WIDGET_SOURCES)
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/Makefile.am.buildfix 2009-07-27 15:26:53.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/Makefile.am 2009-07-28 11:29:11.686841642 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/Makefile.am.buildfix 2009-07-27 15:26:53.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/Makefile.am 2009-07-28 11:29:11.686841642 -0400
@@ -2,6 +2,10 @@ SUBDIRS = marshallers utils gconf-helper
bin_PROGRAMS = nm-applet
@ -118,9 +118,9 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/Makefile.am.build
gladedir = $(datadir)/nm-applet
glade_DATA = applet.glade keyring.png
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/Makefile.am.buildfix 2009-07-02 16:32:26.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/Makefile.am 2009-07-28 11:29:11.686841642 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/Makefile.am.buildfix 2009-07-02 16:32:26.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/Makefile.am 2009-07-28 11:29:11.686841642 -0400
@@ -1,5 +1,9 @@
SUBDIRS=. tests
@ -140,9 +140,9 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/Makefile.am
+ -L${top_builddir}/../libnm-util $(top_builddir)/../libnm-util/libnm-util.la \
+ -L${top_builddir}/../libnm-glib $(top_builddir)/../libnm-glib/libnm-glib.la
+
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/tests/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/tests/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/tests/Makefile.am.buildfix 2009-07-02 16:32:26.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/tests/Makefile.am 2009-07-28 11:29:11.686841642 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/tests/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/tests/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/tests/Makefile.am.buildfix 2009-07-02 16:32:26.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/utils/tests/Makefile.am 2009-07-28 11:29:11.686841642 -0400
@@ -1,4 +1,7 @@
-INCLUDES = -I$(top_srcdir)/src/utils
+INCLUDES = -I$(top_srcdir)/src/utils \
@ -152,9 +152,9 @@ diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/utils/tests/Makef
noinst_PROGRAMS = test-utils
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/src/wireless-security/Makefile.am.buildfix NetworkManager-0.8.1/network-manager-applet-0.8.1/src/wireless-security/Makefile.am
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/src/wireless-security/Makefile.am.buildfix 2009-07-02 16:32:26.000000000 -0400
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/src/wireless-security/Makefile.am 2009-07-28 11:29:11.687841490 -0400
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/src/wireless-security/Makefile.am.buildfix NetworkManager-0.8.2/network-manager-applet-0.8.2/src/wireless-security/Makefile.am
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/src/wireless-security/Makefile.am.buildfix 2009-07-02 16:32:26.000000000 -0400
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/src/wireless-security/Makefile.am 2009-07-28 11:29:11.687841490 -0400
@@ -1,5 +1,9 @@
noinst_LTLIBRARIES = libwireless-security.la

View File

@ -1,6 +1,6 @@
diff -up NetworkManager-0.8.1/network-manager-applet-0.8.1/nm-applet.schemas.in.foo NetworkManager-0.8.1/network-manager-applet-0.8.1/nm-applet.schemas.in
--- NetworkManager-0.8.1/network-manager-applet-0.8.1/nm-applet.schemas.in.foo 2009-10-21 17:23:29.480267635 -0700
+++ NetworkManager-0.8.1/network-manager-applet-0.8.1/nm-applet.schemas.in 2009-10-21 17:39:42.734142996 -0700
diff -up NetworkManager-0.8.2/network-manager-applet-0.8.2/nm-applet.schemas.in.foo NetworkManager-0.8.2/network-manager-applet-0.8.2/nm-applet.schemas.in
--- NetworkManager-0.8.2/network-manager-applet-0.8.2/nm-applet.schemas.in.foo 2009-10-21 17:23:29.480267635 -0700
+++ NetworkManager-0.8.2/network-manager-applet-0.8.2/nm-applet.schemas.in 2009-10-21 17:39:42.734142996 -0700
@@ -6,7 +6,7 @@
<applyto>/apps/nm-applet/disable-connected-notifications</applyto>
<owner>nm-applet</owner>

View File

@ -1,50 +0,0 @@
commit 8d7b9a4ef56d3ca0c06c8d655e71698bdab04d9f
Author: Jiří Klimeš <jklimes@redhat.com>
Date: Fri Oct 15 09:41:34 2010 +0200
libnm-glib: call D-Bus with a timeout when Set()ting properties
The caller needs to be authenticated, so wait a bit to be sure
it didn't quit too quickly.
diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am
index 008cc6d..ec21a32 100644
--- a/libnm-glib/Makefile.am
+++ b/libnm-glib/Makefile.am
@@ -132,7 +132,7 @@ libnm_glib_la_LIBADD = \
$(GUDEV_LIBS)
libnm_glib_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib.ver \
- -version-info "6:1:4"
+ -version-info "6:2:4"
noinst_PROGRAMS = libnm-glib-test
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index 72ea050..85cb6b7 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -527,12 +527,17 @@ _nm_object_set_property (NMObject *object,
g_return_if_fail (prop_name != NULL);
g_return_if_fail (G_IS_VALUE (value));
- dbus_g_proxy_call_no_reply (NM_OBJECT_GET_PRIVATE (object)->properties_proxy,
- "Set",
- G_TYPE_STRING, interface,
- G_TYPE_STRING, prop_name,
- G_TYPE_VALUE, value,
- G_TYPE_INVALID);
+ if (!dbus_g_proxy_call_with_timeout (NM_OBJECT_GET_PRIVATE (object)->properties_proxy,
+ "Set", 2000, NULL,
+ G_TYPE_STRING, interface,
+ G_TYPE_STRING, prop_name,
+ G_TYPE_VALUE, value,
+ G_TYPE_INVALID)) {
+
+ /* Ignore errors. dbus_g_proxy_call_with_timeout() is called instead of
+ * dbus_g_proxy_call_no_reply() to give NM chance to authenticate the caller.
+ */
+ }
}
char *

View File

@ -1,561 +0,0 @@
commit 052ca428d9c4862112a905cd07fd126bbe7192ee
Author: Dan Williams <dcbw@redhat.com>
Date: Thu Oct 7 18:08:52 2010 -0500
policy: preserve custom hostnames on local-mapping lines (rh #627269)
Try to preserve custom hostnames (ie, anything not a localhost* variant,
the current hostname, or the previous hostname) when rewriting the
127.0.0.1/::1 localhost mapping lines.
diff --git a/src/nm-policy-hostname.c b/src/nm-policy-hostname.c
index 0a49f9e..42a2e0f 100644
--- a/src/nm-policy-hostname.c
+++ b/src/nm-policy-hostname.c
@@ -217,7 +217,7 @@ nm_policy_set_system_hostname (const char *new_hostname,
char old_hostname[HOST_NAME_MAX + 1];
int ret = 0;
const char *name;
- gboolean set_hostname = TRUE, changed = FALSE;
+ gboolean set_hostname = TRUE, changed = FALSE, old_valid = TRUE;
if (new_hostname)
g_warn_if_fail (strlen (new_hostname));
@@ -230,11 +230,15 @@ nm_policy_set_system_hostname (const char *new_hostname,
if (ret != 0) {
nm_log_warn (LOGD_DNS, "couldn't get the system hostname: (%d) %s",
errno, strerror (errno));
+ old_valid = FALSE;
} else {
/* Don't set the hostname if it isn't actually changing */
if ( (new_hostname && !strcmp (old_hostname, new_hostname))
|| (!new_hostname && !strcmp (old_hostname, FALLBACK_HOSTNAME4)))
set_hostname = FALSE;
+
+ if (old_hostname[0] == '\0')
+ old_valid = FALSE;
}
if (set_hostname) {
@@ -255,6 +259,7 @@ nm_policy_set_system_hostname (const char *new_hostname,
* /etc/hosts at all.
*/
if (!nm_policy_hosts_update_etc_hosts (name,
+ old_valid ? old_hostname : NULL,
FALLBACK_HOSTNAME4,
FALLBACK_HOSTNAME6,
ip4_addr,
diff --git a/src/nm-policy-hosts.c b/src/nm-policy-hosts.c
index 1b57d42..ddc828d 100644
--- a/src/nm-policy-hosts.c
+++ b/src/nm-policy-hosts.c
@@ -28,6 +28,9 @@
#include "nm-policy-hosts.h"
#include "nm-logging.h"
+#define IP4_LH "127.0.0.1"
+#define IP6_LH "::1"
+
gboolean
nm_policy_hosts_find_token (const char *line, const char *token)
{
@@ -56,7 +59,7 @@ nm_policy_hosts_find_token (const char *line, const char *token)
static gboolean
is_local_mapping (const char *str, gboolean ip6, const char *hostname)
{
- const char *addr = ip6 ? "::1" : "127.0.0.1";
+ const char *addr = ip6 ? IP6_LH : IP4_LH;
const char *fallback = ip6 ? "localhost6" : "localhost";
return ( !strncmp (str, addr, strlen (addr))
@@ -137,12 +140,71 @@ ip6_addr_matches (const char *str, const char *ip6_addr)
return memcmp (&found, &given, sizeof (found)) == 0;
}
+static char *
+get_custom_hostnames (const char *line,
+ const char *hostname,
+ const char *old_hostname)
+{
+ char **items = NULL, **iter;
+ guint start = 0;
+ GString *str = NULL;
+ char *custom = NULL;
+
+ g_return_val_if_fail (line != NULL, NULL);
+
+ if (!strncmp (line, IP4_LH, strlen (IP4_LH)))
+ start = strlen (IP4_LH);
+ else if (!strncmp (line, IP6_LH, strlen (IP6_LH)))
+ start = strlen (IP6_LH);
+
+ g_return_val_if_fail (start > 0, NULL);
+
+ /* Split the line into tokens */
+ items = g_strsplit_set (line + start, " \t", -1);
+ if (!items)
+ return NULL;
+
+ str = g_string_sized_new (50);
+ /* Ignore current & old hostnames, and localhost-anything */
+ for (iter = items; iter && *iter; iter++) {
+ if (*iter[0] == '\0')
+ continue;
+ if (hostname && !strcmp (*iter, hostname))
+ continue;
+ if (old_hostname && !strcmp (*iter, old_hostname))
+ continue;
+ if (!strcmp (*iter, "localhost"))
+ continue;
+ if (!strcmp (*iter, "localhost6"))
+ continue;
+ if (!strcmp (*iter, "localhost.localdomain"))
+ continue;
+ if (!strcmp (*iter, "localhost4.localdomain4"))
+ continue;
+ if (!strcmp (*iter, "localhost6.localdomain6"))
+ continue;
+
+ /* Found a custom hostname */
+ g_string_append_c (str, '\t');
+ g_string_append (str, *iter);
+ }
+
+ if (str->len)
+ custom = g_string_free (str, FALSE);
+ else
+ g_string_free (str, TRUE);
+
+ g_strfreev (items);
+ return custom;
+}
+
#define ADDED_TAG "# Added by NetworkManager"
GString *
nm_policy_get_etc_hosts (const char **lines,
gsize existing_len,
const char *hostname,
+ const char *old_hostname,
const char *fallback_hostname4,
const char *fallback_hostname6,
const char *ip4_addr,
@@ -163,7 +225,10 @@ nm_policy_get_etc_hosts (const char **lines,
gboolean hostname6_is_fallback;
gboolean host4_before = FALSE;
gboolean host6_before = FALSE;
+ gboolean no_stale = TRUE;
char *short_hostname = NULL;
+ char *custom4 = NULL;
+ char *custom6 = NULL;
g_return_val_if_fail (lines != NULL, FALSE);
g_return_val_if_fail (hostname != NULL, FALSE);
@@ -181,21 +246,20 @@ nm_policy_get_etc_hosts (const char **lines,
* If all these things exist we don't need to bother updating the file.
*/
- if (!ip4_addr) {
- found_host4 = TRUE;
+ if (!ip4_addr)
host4_before = TRUE;
- }
- if (!ip6_addr) {
- found_host6 = TRUE;
+ if (!ip6_addr)
host6_before = TRUE;
- }
/* Look for the four cases from above */
for (line = lines; lines && *line; line++) {
- if (!strlen (*line) || (*line[0] == '#'))
+ gboolean found_hostname = FALSE;
+
+ if ((*line[0] == '\0') || (*line[0] == '#'))
continue;
- if (nm_policy_hosts_find_token (*line, hostname)) {
+ found_hostname = nm_policy_hosts_find_token (*line, hostname);
+ if (found_hostname) {
/* Found the current hostname on this line */
if (ip4_addr && ip4_addr_matches (*line, ip4_addr)) {
found_host4 = TRUE;
@@ -211,7 +275,7 @@ nm_policy_get_etc_hosts (const char **lines,
* so make sure we update /etc/hosts.
*/
if (is_ip4_addr (*line))
- found_host4 = FALSE;
+ no_stale = FALSE;
}
if (ip6_addr && ip6_addr_matches (*line, ip6_addr)) {
@@ -228,26 +292,54 @@ nm_policy_get_etc_hosts (const char **lines,
* so make sure we update /etc/hosts.
*/
if (is_ip6_addr (*line))
- found_host6 = FALSE;
+ no_stale = FALSE;
}
}
if (is_local_mapping (*line, FALSE, "localhost")) {
/* a 127.0.0.1 line containing 'localhost' */
found_localhost4 = TRUE;
+ custom4 = get_custom_hostnames (*line, hostname, old_hostname);
+ if (!ip4_addr) {
+ /* If there's no IP-specific mapping for the current hostname
+ * but that hostname is present on in the local mapping line,
+ * we've found our IPv4 hostname mapping. If the hostname is
+ * the fallback *IPv6* hostname it's not going to show up in
+ * the IPv4 local mapping though, so fake it.
+ */
+ if (hostname6_is_fallback || found_hostname)
+ found_host4 = TRUE;
+ }
} else if (is_local_mapping (*line, TRUE, "localhost6")) {
/* a ::1 line containing 'localhost6' */
found_localhost6 = TRUE;
+ custom6 = get_custom_hostnames (*line, hostname, old_hostname);
+ if (!ip6_addr) {
+ /* If there's no IP-specific mapping for the current hostname
+ * but that hostname is present on in the local mapping line,
+ * we've found our IPv6 hostname mapping. If the hostname is
+ * the fallback *IPv4* hostname it's not going to show up in
+ * the IPv6 local mapping though, so fake it.
+ */
+ if (hostname4_is_fallback || found_hostname)
+ found_host6 = TRUE;
+ }
}
- if (found_localhost4 && found_host4 && found_localhost6 && found_host6 && host4_before && host6_before)
- return NULL; /* No update required */
+ if ( found_localhost4
+ && found_host4
+ && found_localhost6
+ && found_host6
+ && host4_before
+ && host6_before
+ && no_stale)
+ goto out; /* No update required */
}
contents = g_string_sized_new (existing_len ? existing_len + 100 : 200);
if (!contents) {
g_set_error_literal (error, 0, 0, "not enough memory");
- return NULL;
+ goto out;
}
/* Find the short hostname, like 'foo' from 'foo.bar.baz'; we want to
@@ -277,8 +369,6 @@ nm_policy_get_etc_hosts (const char **lines,
* 'localhost6'.
*/
for (line = lines, initial_comments = TRUE; lines && *line; line++) {
- gboolean add_line = TRUE;
-
/* This is the first line after the initial comments */
if (strlen (*line) && initial_comments && (*line[0] != '#')) {
initial_comments = FALSE;
@@ -311,7 +401,10 @@ nm_policy_get_etc_hosts (const char **lines,
if (short_hostname)
g_string_append_printf (contents, "\t%s", short_hostname);
}
- g_string_append_printf (contents, "\t%s\tlocalhost\n", fallback_hostname4);
+ g_string_append_printf (contents, "\t%s\tlocalhost", fallback_hostname4);
+ if (custom4)
+ g_string_append (contents, custom4);
+ g_string_append_c (contents, '\n');
/* IPv6 localhost line */
g_string_append (contents, "::1");
@@ -320,26 +413,23 @@ nm_policy_get_etc_hosts (const char **lines,
if (short_hostname)
g_string_append_printf (contents, "\t%s", short_hostname);
}
- g_string_append_printf (contents, "\t%s\tlocalhost6\n", fallback_hostname6);
+ g_string_append_printf (contents, "\t%s\tlocalhost6", fallback_hostname6);
+ if (custom6)
+ g_string_append (contents, custom6);
+ g_string_append_c (contents, '\n');
added = TRUE;
}
/* Don't add the original line if it is a localhost mapping */
- if (is_local_mapping (*line, FALSE, "localhost"))
- add_line = FALSE;
- else if (is_local_mapping (*line, FALSE, fallback_hostname4))
- add_line = FALSE;
- else if (is_local_mapping (*line, FALSE, hostname))
- add_line = FALSE;
- else if (is_local_mapping (*line, TRUE, "localhost6"))
- add_line = FALSE;
- else if (is_local_mapping (*line, TRUE, fallback_hostname6))
- add_line = FALSE;
- else if (is_local_mapping (*line, TRUE, hostname))
- add_line = FALSE;
-
- if (add_line && !strstr (*line, ADDED_TAG)) {
+ if ( !is_local_mapping (*line, FALSE, "localhost")
+ && !is_local_mapping (*line, FALSE, fallback_hostname4)
+ && !is_local_mapping (*line, FALSE, hostname)
+ && !is_local_mapping (*line, TRUE, "localhost6")
+ && !is_local_mapping (*line, TRUE, fallback_hostname6)
+ && !is_local_mapping (*line, TRUE, hostname)
+ && !strstr (*line, ADDED_TAG)) {
+
g_string_append (contents, *line);
/* Only append the new line if this isn't the last line in the file */
if (*(line+1))
@@ -370,12 +460,16 @@ nm_policy_get_etc_hosts (const char **lines,
g_string_append_printf (contents, "::1\t%s\tlocalhost6\n", fallback_hostname6);
}
+out:
+ g_free (custom4);
+ g_free (custom6);
g_free (short_hostname);
return contents;
}
gboolean
nm_policy_hosts_update_etc_hosts (const char *hostname,
+ const char *old_hostname,
const char *fallback_hostname4,
const char *fallback_hostname6,
const char *ip4_addr,
@@ -405,6 +499,7 @@ nm_policy_hosts_update_etc_hosts (const char *hostname,
new_contents = nm_policy_get_etc_hosts ((const char **) lines,
contents_len,
hostname,
+ old_hostname,
fallback_hostname4,
fallback_hostname6,
ip4_addr,
diff --git a/src/nm-policy-hosts.h b/src/nm-policy-hosts.h
index 76288bf..ebaaf0f 100644
--- a/src/nm-policy-hosts.h
+++ b/src/nm-policy-hosts.h
@@ -24,6 +24,7 @@
#include <glib.h>
gboolean nm_policy_hosts_update_etc_hosts (const char *hostname,
+ const char *old_hostname,
const char *fallback_hostname4,
const char *fallback_hostname6,
const char *ip4_addr,
@@ -36,6 +37,7 @@ gboolean nm_policy_hosts_find_token (const char *line, const char *token);
GString *nm_policy_get_etc_hosts (const char **lines,
gsize existing_len,
const char *hostname,
+ const char *old_hostname,
const char *fallback_hostname4,
const char *fallback_hostname6,
const char *ip4_addr,
diff --git a/src/tests/test-policy-hosts.c b/src/tests/test-policy-hosts.c
index e6775f3..3c27af2 100644
--- a/src/tests/test-policy-hosts.c
+++ b/src/tests/test-policy-hosts.c
@@ -26,6 +26,8 @@
#define FALLBACK_HOSTNAME4 "localhost.localdomain"
#define FALLBACK_HOSTNAME6 "localhost6.localdomain6"
+#define DEBUG 0
+
static void
test_generic (const char *before,
const char *after,
@@ -43,6 +45,7 @@ test_generic (const char *before,
newc = nm_policy_get_etc_hosts ((const char **) lines,
strlen (before),
hostname,
+ NULL,
FALLBACK_HOSTNAME4,
FALLBACK_HOSTNAME6,
ip4_addr,
@@ -56,11 +59,11 @@ test_generic (const char *before,
g_clear_error (&error);
} else if (after == NULL) {
/* No change to /etc/hosts required */
-#if 0
+#if DEBUG
if (newc != NULL) {
g_message ("\n- NEW ---------------------------------\n"
"%s"
- "- EXPECTED NONE -------------------------\n",
+ "+ EXPECTED NONE +++++++++++++++++++++++++\n",
newc->str);
}
#endif
@@ -70,10 +73,10 @@ test_generic (const char *before,
g_assert (newc != NULL);
g_assert (error == NULL);
-#if 0
+#if DEBUG
g_message ("\n- NEW ---------------------------------\n"
"%s"
- "- EXPECTED ------------------------------\n"
+ "+ EXPECTED ++++++++++++++++++++++++++++++\n"
"%s"
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
newc->str, after);
@@ -167,10 +170,17 @@ static const char *named_generic_before = \
"::1 localhost6.localdomain6 localhost6\n"
"127.0.0.1 lcmd.us.intellitxt.com\n";
+static const char *named_generic_after = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 playboy localhost.localdomain localhost\n"
+ "::1 playboy localhost6.localdomain6 localhost6\n"
+ "127.0.0.1 lcmd.us.intellitxt.com\n";
+
static void
test_hosts_named_generic (void)
{
- test_generic (named_generic_before, NULL, "playboy", NULL, NULL, FALSE);
+ test_generic (named_generic_before, named_generic_after, "playboy", NULL, NULL, FALSE);
}
/*******************************************/
@@ -609,24 +619,114 @@ static const char *long_before = \
"127.0.0.1 ad.doubleclick.net\n"
"127.0.0.1 oascentral.movietickets.com\n"
"127.0.0.1 view.atdmt.com\n"
- "127.0.0.1 ads.chumcity.com\n"
- "127.0.0.1 ads.as4x.tmcs.net\n"
- "127.0.0.1 n4403ad.doubleclick.net\n"
- "127.0.0.1 www.assoc-amazon.com\n"
- "127.0.0.1 s25.sitemeter.com\n"
- "127.0.0.1 adlog.com.com\n"
- "127.0.0.1 ahs.laptopmag.com\n"
- "127.0.0.1 altfarm.mediaplex.com\n"
- "127.0.0.1 ads.addynamix.com\n"
- "127.0.0.1 srx.main.ebayrtm.com\n"
- "127.0.0.1 cdn5.tribalfusion.com\n"
- "127.0.0.1 a.tribalfusion.com\n";
+ "127.0.0.1 ads.chumcity.com\n";
+static const char *long_after = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 comet localhost.localdomain localhost\n"
+ "::1 comet localhost6.localdomain6 localhost6\n"
+ "\n"
+ "127.0.0.1 lcmd.us.intellitxt.com\n"
+ "127.0.0.1 adserver.adtech.de\n"
+ "127.0.0.1 a.as-us.falkag.net\n"
+ "127.0.0.1 a.as-eu.falkag.net\n"
+ "127.0.0.1 ads.doubleclick.com\n"
+ "\n"
+ "# random comment\n"
+ "127.0.0.1 m1.2mdn.net\n"
+ "127.0.0.1 ds.serving-sys.com\n"
+ "127.0.0.1 pagead2.googlesyndication.com\n"
+ "127.0.0.1 ad.doubleclick.com\n"
+ "127.0.0.1 ad.doubleclick.net\n"
+ "127.0.0.1 oascentral.movietickets.com\n"
+ "127.0.0.1 view.atdmt.com\n"
+ "127.0.0.1 ads.chumcity.com\n";
static void
test_hosts_long (void)
{
- test_generic (long_before, NULL, "comet", NULL, NULL, FALSE);
+ test_generic (long_before, long_after, "comet", NULL, NULL, FALSE);
+}
+
+/*******************************************/
+
+static const char *custom4_before = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 localhost.localdomain localhost pintglass\n"
+ "::1 localhost6.localdomain6 localhost6\n";
+
+static const char *custom4_after = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 comet localhost.localdomain localhost pintglass\n"
+ "::1 comet localhost6.localdomain6 localhost6\n";
+
+static void
+test_hosts_custom4 (void)
+{
+ test_generic (custom4_before, custom4_after, "comet", NULL, NULL, FALSE);
+}
+
+/*******************************************/
+
+static const char *custom6_before = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 localhost.localdomain localhost\n"
+ "::1 localhost6.localdomain6 localhost6 pintglass\n";
+
+static const char *custom6_after = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 comet localhost.localdomain localhost\n"
+ "::1 comet localhost6.localdomain6 localhost6 pintglass\n";
+
+static void
+test_hosts_custom6 (void)
+{
+ test_generic (custom6_before, custom6_after, "comet", NULL, NULL, FALSE);
+}
+
+/*******************************************/
+
+static const char *custom46_before = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 localhost.localdomain localhost shotglass\n"
+ "::1 localhost6.localdomain6 localhost6 pintglass\n";
+
+static const char *custom46_after = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 comet localhost.localdomain localhost shotglass\n"
+ "::1 comet localhost6.localdomain6 localhost6 pintglass\n";
+
+static void
+test_hosts_custom46 (void)
+{
+ test_generic (custom46_before, custom46_after, "comet", NULL, NULL, FALSE);
+}
+
+/*******************************************/
+
+static const char *custom46_mixed_before = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 localhost.localdomain localhost shotglass\n"
+ "::1 localhost6.localdomain6 localhost6 pintglass\n";
+
+static const char *custom46_mixed_after = \
+ "# Do not remove the following line, or various programs\n"
+ "# that require network functionality will fail.\n"
+ "127.0.0.1 comet localhost.localdomain localhost shotglass\n"
+ "::1 comet localhost6.localdomain6 localhost6 pintglass\n";
+
+static void
+test_hosts_custom46_mixed (void)
+{
+ test_generic (custom46_mixed_before, custom46_mixed_after, "comet", NULL, NULL, FALSE);
}
/*******************************************/
@@ -712,6 +812,10 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_hosts_no_host4, NULL));
g_test_suite_add (suite, TESTCASE (test_hosts_no_host6, NULL));
g_test_suite_add (suite, TESTCASE (test_hosts_long, NULL));
+ g_test_suite_add (suite, TESTCASE (test_hosts_custom4, NULL));
+ g_test_suite_add (suite, TESTCASE (test_hosts_custom6, NULL));
+ g_test_suite_add (suite, TESTCASE (test_hosts_custom46, NULL));
+ g_test_suite_add (suite, TESTCASE (test_hosts_custom46_mixed, NULL));
return g_test_run ();
}

View File

@ -1,398 +0,0 @@
commit e86ef05d84749c5a15d7bcf30f78056ca205489c
Author: Dan Williams <dcbw@redhat.com>
Date: Wed Sep 1 17:08:10 2010 -0500
wifi: ensure Enabled state is preserved regardless of rfkill (bgo #624479)
Previously the "Enable Wireless" state was somewhat tied to rfkill state,
in that when NM started up, rfkill state would take precedence over what
was listed in the state file, and if you rmmodded your wifi driver and
then modprobed it again after disabling wifi from the menu, wifi would
magically become re-enabled becuase rfkill state changed.
Fix that by creating a third wifi/wwan enable state that tracks the
actual user preference instead of just the rfkill state so that when
the user disables wifi it stays disabled, regardless of what happens
with rfkill.
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 1e9c3c6..abe30bf 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -187,7 +187,8 @@ struct PendingActivation {
};
typedef struct {
- gboolean enabled;
+ gboolean user_enabled;
+ gboolean sw_enabled;
gboolean hw_enabled;
RfKillType rtype;
const char *desc;
@@ -1584,50 +1585,40 @@ write_value_to_state_file (const char *filename,
return ret;
}
+static gboolean
+radio_enabled_for_rstate (RadioState *rstate)
+{
+ return rstate->user_enabled && rstate->sw_enabled && rstate->hw_enabled;
+}
+
+static gboolean
+radio_enabled_for_type (NMManager *self, RfKillType rtype)
+{
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
+
+ return radio_enabled_for_rstate (&priv->radio_states[rtype]);
+}
+
static void
-manager_set_radio_enabled (NMManager *manager,
- RadioState *rstate,
- gboolean enabled)
+manager_update_radio_enabled (NMManager *self, RadioState *rstate)
{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
GSList *iter;
- GError *error = NULL;
/* Do nothing for radio types not yet implemented */
if (!rstate->prop)
return;
- if (rstate->enabled == enabled)
- return;
-
- /* Can't set wireless enabled if it's disabled in hardware */
- if (!rstate->hw_enabled && enabled)
- return;
-
- rstate->enabled = enabled;
-
- g_object_notify (G_OBJECT (manager), rstate->prop);
-
- /* Update enabled key in state file */
- if (priv->state_file) {
- if (!write_value_to_state_file (priv->state_file,
- "main", rstate->key,
- G_TYPE_BOOLEAN, (gpointer) &enabled,
- &error)) {
- nm_log_warn (LOGD_CORE, "writing to state file %s failed: (%d) %s.",
- priv->state_file,
- error ? error->code : -1,
- (error && error->message) ? error->message : "unknown");
- }
- }
+ g_object_notify (G_OBJECT (self), rstate->prop);
/* Don't touch devices if asleep/networking disabled */
- if (manager_sleeping (manager))
+ if (manager_sleeping (self))
return;
/* enable/disable wireless devices as required */
for (iter = priv->devices; iter; iter = iter->next) {
RfKillType devtype = RFKILL_TYPE_UNKNOWN;
+ gboolean enabled = radio_enabled_for_rstate (rstate);
g_object_get (G_OBJECT (iter->data), NM_DEVICE_INTERFACE_RFKILL_TYPE, &devtype, NULL);
if (devtype == rstate->rtype) {
@@ -1750,6 +1741,21 @@ nm_manager_get_modem_enabled_state (NMManager *self)
}
static void
+update_rstate_from_rfkill (RadioState *rstate, RfKillState rfkill)
+{
+ if (rfkill == RFKILL_UNBLOCKED) {
+ rstate->sw_enabled = TRUE;
+ rstate->hw_enabled = TRUE;
+ } else if (rfkill == RFKILL_SOFT_BLOCKED) {
+ rstate->sw_enabled = FALSE;
+ rstate->hw_enabled = TRUE;
+ } else if (rfkill == RFKILL_HARD_BLOCKED) {
+ rstate->sw_enabled = FALSE;
+ rstate->hw_enabled = FALSE;
+ }
+}
+
+static void
manager_rfkill_update_one_type (NMManager *self,
RadioState *rstate,
RfKillType rtype)
@@ -1758,7 +1764,12 @@ manager_rfkill_update_one_type (NMManager *self,
RfKillState udev_state = RFKILL_UNBLOCKED;
RfKillState other_state = RFKILL_UNBLOCKED;
RfKillState composite;
- gboolean new_e = TRUE, new_he = TRUE;
+ gboolean old_enabled, new_enabled, old_rfkilled, new_rfkilled;
+ gboolean old_hwe;
+
+ old_enabled = radio_enabled_for_rstate (rstate);
+ old_rfkilled = rstate->hw_enabled && rstate->sw_enabled;
+ old_hwe = rstate->hw_enabled;
udev_state = nm_udev_manager_get_rfkill_state (priv->udev_mgr, rtype);
@@ -1773,38 +1784,31 @@ manager_rfkill_update_one_type (NMManager *self,
else
composite = RFKILL_UNBLOCKED;
- switch (composite) {
- case RFKILL_UNBLOCKED:
- new_e = TRUE;
- new_he = TRUE;
- break;
- case RFKILL_SOFT_BLOCKED:
- new_e = FALSE;
- new_he = TRUE;
- break;
- case RFKILL_HARD_BLOCKED:
- new_e = FALSE;
- new_he = FALSE;
- break;
- default:
- break;
- }
+ update_rstate_from_rfkill (rstate, composite);
if (rstate->desc) {
- nm_log_dbg (LOGD_RFKILL, "%s hw-enabled %d enabled %d",
- rstate->desc, new_he, new_e);
+ nm_log_dbg (LOGD_RFKILL, "%s hw-enabled %d sw-enabled %d",
+ rstate->desc, rstate->hw_enabled, rstate->sw_enabled);
}
- if (new_he != rstate->hw_enabled) {
+ /* Log new killswitch state */
+ new_rfkilled = rstate->hw_enabled && rstate->sw_enabled;
+ if (old_rfkilled != new_rfkilled) {
nm_log_info (LOGD_RFKILL, "%s now %s by radio killswitch",
rstate->desc,
- (new_e && new_he) ? "enabled" : "disabled");
+ new_rfkilled ? "enabled" : "disabled");
+ }
- rstate->hw_enabled = new_he;
+ /* Send out property changed signal for HW enabled */
+ if (rstate->hw_enabled != old_hwe) {
if (rstate->hw_prop)
g_object_notify (G_OBJECT (self), rstate->hw_prop);
}
- manager_set_radio_enabled (self, rstate, new_e);
+
+ /* And finally update the actual device radio state itself */
+ new_enabled = radio_enabled_for_rstate (rstate);
+ if (new_enabled != old_enabled)
+ manager_update_radio_enabled (self, rstate);
}
static void
@@ -2014,7 +2018,7 @@ add_device (NMManager *self, NMDevice *device)
NMConnection *existing = NULL;
GHashTableIter iter;
gpointer value;
- gboolean managed = FALSE;
+ gboolean managed = FALSE, enabled = FALSE;
iface = nm_device_get_ip_iface (device);
g_assert (iface);
@@ -2053,14 +2057,15 @@ add_device (NMManager *self, NMDevice *device)
* then set this device's rfkill state based on the global state.
*/
nm_manager_rfkill_update (self, RFKILL_TYPE_WLAN);
- nm_device_interface_set_enabled (NM_DEVICE_INTERFACE (device),
- priv->radio_states[RFKILL_TYPE_WLAN].enabled);
+ enabled = radio_enabled_for_type (self, RFKILL_TYPE_WLAN);
+ nm_device_interface_set_enabled (NM_DEVICE_INTERFACE (device), enabled);
} else if (NM_IS_DEVICE_MODEM (device)) {
g_signal_connect (device, NM_DEVICE_MODEM_ENABLE_CHANGED,
G_CALLBACK (manager_modem_enabled_changed),
self);
nm_manager_rfkill_update (self, RFKILL_TYPE_WWAN);
+ enabled = radio_enabled_for_type (self, RFKILL_TYPE_WWAN);
/* Until we start respecting WWAN rfkill switches the modem itself
* is the source of the enabled/disabled state, so the manager shouldn't
* touch it here.
@@ -3305,13 +3310,13 @@ do_sleep_wake (NMManager *self)
*/
for (i = 0; i < RFKILL_TYPE_MAX; i++) {
RadioState *rstate = &priv->radio_states[i];
- gboolean enabled = (rstate->hw_enabled && rstate->enabled);
+ gboolean enabled = radio_enabled_for_rstate (rstate);
RfKillType devtype = RFKILL_TYPE_UNKNOWN;
if (rstate->desc) {
- nm_log_dbg (LOGD_RFKILL, "%s %s devices (hw_enabled %d, enabled %d)",
+ nm_log_dbg (LOGD_RFKILL, "%s %s devices (hw_enabled %d, sw_enabled %d, user_enabled %d)",
enabled ? "enabling" : "disabling",
- rstate->desc, rstate->hw_enabled, rstate->enabled);
+ rstate->desc, rstate->hw_enabled, rstate->sw_enabled, rstate->user_enabled);
}
g_object_get (G_OBJECT (device), NM_DEVICE_INTERFACE_RFKILL_TYPE, &devtype, NULL);
@@ -3879,34 +3884,21 @@ nm_manager_start (NMManager *self)
/* Set initial radio enabled/disabled state */
for (i = 0; i < RFKILL_TYPE_MAX; i++) {
RadioState *rstate = &priv->radio_states[i];
- gboolean enabled = TRUE, hw_enabled = TRUE;
+ RfKillState udev_state;
if (!rstate->desc)
continue;
- switch (nm_udev_manager_get_rfkill_state (priv->udev_mgr, i)) {
- case RFKILL_UNBLOCKED:
- enabled = TRUE;
- hw_enabled = TRUE;
- break;
- case RFKILL_SOFT_BLOCKED:
- enabled = FALSE;
- hw_enabled = TRUE;
- break;
- case RFKILL_HARD_BLOCKED:
- enabled = FALSE;
- hw_enabled = FALSE;
- break;
- default:
- break;
- }
+ udev_state = nm_udev_manager_get_rfkill_state (priv->udev_mgr, i);
+ update_rstate_from_rfkill (rstate, udev_state);
- rstate->hw_enabled = hw_enabled;
- nm_log_info (LOGD_RFKILL, "%s %s by radio killswitch; %s by state file",
- rstate->desc,
- (rstate->hw_enabled && enabled) ? "enabled" : "disabled",
- (rstate->enabled) ? "enabled" : "disabled");
- manager_set_radio_enabled (self, rstate, rstate->enabled && enabled);
+ if (rstate->desc) {
+ nm_log_info (LOGD_RFKILL, "%s %s by radio killswitch; %s by state file",
+ rstate->desc,
+ (rstate->hw_enabled && rstate->sw_enabled) ? "enabled" : "disabled",
+ rstate->user_enabled ? "enabled" : "disabled");
+ }
+ manager_update_radio_enabled (self, rstate);
}
/* Log overall networking status - enabled/disabled */
@@ -4188,8 +4180,8 @@ nm_manager_get (const char *config_file,
priv->net_enabled = initial_net_enabled;
- priv->radio_states[RFKILL_TYPE_WLAN].enabled = initial_wifi_enabled;
- priv->radio_states[RFKILL_TYPE_WWAN].enabled = initial_wwan_enabled;
+ priv->radio_states[RFKILL_TYPE_WLAN].user_enabled = initial_wifi_enabled;
+ priv->radio_states[RFKILL_TYPE_WWAN].user_enabled = initial_wwan_enabled;
g_signal_connect (priv->sys_settings, "notify::" NM_SYSCONFIG_SETTINGS_UNMANAGED_SPECS,
G_CALLBACK (system_unmanaged_devices_changed_cb), singleton);
@@ -4335,6 +4327,42 @@ dispose (GObject *object)
}
static void
+manager_radio_user_toggled (NMManager *self,
+ RadioState *rstate,
+ gboolean enabled)
+{
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
+ GError *error = NULL;
+ gboolean old_enabled, new_enabled;
+
+ if (rstate->desc) {
+ nm_log_dbg (LOGD_RFKILL, "(%s): setting radio %s by user",
+ rstate->desc,
+ enabled ? "enabled" : "disabled");
+ }
+
+ /* Update enabled key in state file */
+ if (priv->state_file) {
+ if (!write_value_to_state_file (priv->state_file,
+ "main", rstate->key,
+ G_TYPE_BOOLEAN, (gpointer) &enabled,
+ &error)) {
+ nm_log_warn (LOGD_CORE, "writing to state file %s failed: (%d) %s.",
+ priv->state_file,
+ error ? error->code : -1,
+ (error && error->message) ? error->message : "unknown");
+ g_clear_error (&error);
+ }
+ }
+
+ old_enabled = radio_enabled_for_rstate (rstate);
+ rstate->user_enabled = enabled;
+ new_enabled = radio_enabled_for_rstate (rstate);
+ if (new_enabled != old_enabled)
+ manager_update_radio_enabled (self, rstate);
+}
+
+static void
set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
@@ -4347,14 +4375,14 @@ set_property (GObject *object, guint prop_id,
priv->net_enabled = g_value_get_boolean (value);
break;
case PROP_WIRELESS_ENABLED:
- manager_set_radio_enabled (NM_MANAGER (object),
- &priv->radio_states[RFKILL_TYPE_WLAN],
- g_value_get_boolean (value));
+ manager_radio_user_toggled (NM_MANAGER (object),
+ &priv->radio_states[RFKILL_TYPE_WLAN],
+ g_value_get_boolean (value));
break;
case PROP_WWAN_ENABLED:
- manager_set_radio_enabled (NM_MANAGER (object),
- &priv->radio_states[RFKILL_TYPE_WWAN],
- g_value_get_boolean (value));
+ manager_radio_user_toggled (NM_MANAGER (object),
+ &priv->radio_states[RFKILL_TYPE_WWAN],
+ g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -4378,13 +4406,13 @@ get_property (GObject *object, guint prop_id,
g_value_set_boolean (value, priv->net_enabled);
break;
case PROP_WIRELESS_ENABLED:
- g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WLAN].enabled);
+ g_value_set_boolean (value, radio_enabled_for_type (self, RFKILL_TYPE_WLAN));
break;
case PROP_WIRELESS_HARDWARE_ENABLED:
g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WLAN].hw_enabled);
break;
case PROP_WWAN_ENABLED:
- g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WWAN].enabled);
+ g_value_set_boolean (value, radio_enabled_for_type (self, RFKILL_TYPE_WWAN));
break;
case PROP_WWAN_HARDWARE_ENABLED:
g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WWAN].hw_enabled);
@@ -4416,7 +4444,7 @@ nm_manager_init (NMManager *manager)
/* Initialize rfkill structures and states */
memset (priv->radio_states, 0, sizeof (priv->radio_states));
- priv->radio_states[RFKILL_TYPE_WLAN].enabled = TRUE;
+ priv->radio_states[RFKILL_TYPE_WLAN].user_enabled = TRUE;
priv->radio_states[RFKILL_TYPE_WLAN].key = "WirelessEnabled";
priv->radio_states[RFKILL_TYPE_WLAN].prop = NM_MANAGER_WIRELESS_ENABLED;
priv->radio_states[RFKILL_TYPE_WLAN].hw_prop = NM_MANAGER_WIRELESS_HARDWARE_ENABLED;
@@ -4424,7 +4452,7 @@ nm_manager_init (NMManager *manager)
priv->radio_states[RFKILL_TYPE_WLAN].other_enabled_func = nm_manager_get_ipw_rfkill_state;
priv->radio_states[RFKILL_TYPE_WLAN].rtype = RFKILL_TYPE_WLAN;
- priv->radio_states[RFKILL_TYPE_WWAN].enabled = TRUE;
+ priv->radio_states[RFKILL_TYPE_WWAN].user_enabled = TRUE;
priv->radio_states[RFKILL_TYPE_WWAN].key = "WWANEnabled";
priv->radio_states[RFKILL_TYPE_WWAN].prop = NM_MANAGER_WWAN_ENABLED;
priv->radio_states[RFKILL_TYPE_WWAN].hw_prop = NM_MANAGER_WWAN_HARDWARE_ENABLED;
@@ -4432,7 +4460,7 @@ nm_manager_init (NMManager *manager)
priv->radio_states[RFKILL_TYPE_WWAN].other_enabled_func = nm_manager_get_modem_enabled_state;
priv->radio_states[RFKILL_TYPE_WWAN].rtype = RFKILL_TYPE_WWAN;
- priv->radio_states[RFKILL_TYPE_WIMAX].enabled = TRUE;
+ priv->radio_states[RFKILL_TYPE_WIMAX].user_enabled = TRUE;
priv->radio_states[RFKILL_TYPE_WIMAX].key = "WiMAXEnabled";
priv->radio_states[RFKILL_TYPE_WIMAX].prop = NULL;
priv->radio_states[RFKILL_TYPE_WIMAX].hw_prop = NULL;

View File

@ -1,100 +0,0 @@
commit bbf3f12d7b2c79c49d87d41e6cf7b65ac7782071
Author: Dan Williams <dcbw@redhat.com>
Date: Thu Oct 7 18:24:59 2010 -0500
policy: prevent hostname duplication in /etc/hosts
diff --git a/src/nm-policy-hosts.c b/src/nm-policy-hosts.c
index ddc828d..a6bb083 100644
--- a/src/nm-policy-hosts.c
+++ b/src/nm-policy-hosts.c
@@ -143,7 +143,9 @@ ip6_addr_matches (const char *str, const char *ip6_addr)
static char *
get_custom_hostnames (const char *line,
const char *hostname,
- const char *old_hostname)
+ const char *old_hostname,
+ const char *short_hostname,
+ const char *fallback_hostname)
{
char **items = NULL, **iter;
guint start = 0;
@@ -173,6 +175,10 @@ get_custom_hostnames (const char *line,
continue;
if (old_hostname && !strcmp (*iter, old_hostname))
continue;
+ if (short_hostname && !strcmp (*iter, short_hostname))
+ continue;
+ if (fallback_hostname && !strcmp (*iter, fallback_hostname))
+ continue;
if (!strcmp (*iter, "localhost"))
continue;
if (!strcmp (*iter, "localhost6"))
@@ -236,6 +242,24 @@ nm_policy_get_etc_hosts (const char **lines,
hostname4_is_fallback = !strcmp (hostname, fallback_hostname4);
hostname6_is_fallback = !strcmp (hostname, fallback_hostname6);
+ /* Find the short hostname, like 'foo' from 'foo.bar.baz'; we want to
+ * make sure that the entries we add for this host also include the short
+ * hostname too so that if the resolver does not answer queries for the
+ * machine's actual hostname/domain, that stuff like 'ping foo' still works.
+ */
+ if (!hostname4_is_fallback || !hostname6_is_fallback) {
+ char *dot;
+
+ short_hostname = g_strdup (hostname);
+ dot = strchr (short_hostname, '.');
+ if (dot && *(dot+1))
+ *dot = '\0';
+ else {
+ g_free (short_hostname);
+ short_hostname = NULL;
+ }
+ }
+
/* We need the following in /etc/hosts:
*
* 1) current hostname mapped to current IPv4 addresses if IPv4 is active
@@ -299,7 +323,7 @@ nm_policy_get_etc_hosts (const char **lines,
if (is_local_mapping (*line, FALSE, "localhost")) {
/* a 127.0.0.1 line containing 'localhost' */
found_localhost4 = TRUE;
- custom4 = get_custom_hostnames (*line, hostname, old_hostname);
+ custom4 = get_custom_hostnames (*line, hostname, old_hostname, short_hostname, fallback_hostname4);
if (!ip4_addr) {
/* If there's no IP-specific mapping for the current hostname
* but that hostname is present on in the local mapping line,
@@ -313,7 +337,7 @@ nm_policy_get_etc_hosts (const char **lines,
} else if (is_local_mapping (*line, TRUE, "localhost6")) {
/* a ::1 line containing 'localhost6' */
found_localhost6 = TRUE;
- custom6 = get_custom_hostnames (*line, hostname, old_hostname);
+ custom6 = get_custom_hostnames (*line, hostname, old_hostname, short_hostname, fallback_hostname6);
if (!ip6_addr) {
/* If there's no IP-specific mapping for the current hostname
* but that hostname is present on in the local mapping line,
@@ -342,24 +366,6 @@ nm_policy_get_etc_hosts (const char **lines,
goto out;
}
- /* Find the short hostname, like 'foo' from 'foo.bar.baz'; we want to
- * make sure that the entries we add for this host also include the short
- * hostname too so that if the resolver does not answer queries for the
- * machine's actual hostname/domain, that stuff like 'ping foo' still works.
- */
- if (!hostname4_is_fallback || !hostname6_is_fallback) {
- char *dot;
-
- short_hostname = g_strdup (hostname);
- dot = strchr (short_hostname, '.');
- if (dot && *(dot+1))
- *dot = '\0';
- else {
- g_free (short_hostname);
- short_hostname = NULL;
- }
- }
-
/* Construct the new hosts file; replace any 127.0.0.1/::1 entry that is
* at the beginning of the file or right after initial comments and contains
* the string 'localhost' (for IPv4) or 'localhost6' (for IPv6). If there

View File

@ -1,112 +0,0 @@
commit 97de44c9a730fbb5a08d27e6899f7caffb015e66
Author: Dan Williams <dcbw@redhat.com>
Date: Thu Oct 7 00:29:44 2010 -0500
policy: ensure stale IP mappings are not left in /etc/hosts (bgo #629020) (rh #630146)
NM-added mappings for active IP addresses were not getting properly
removed when the address disappeared of NM quit, because the bits
of code that determine whether or not /etc/hosts should change were
not taking the disappearance of the IP address into account, and
were leaving the file unchanged.
To fix that, if there is no default IP address, but there are NM-added
IP address entries in /etc/hosts, make sure we update /etc/hosts and
remove them.
diff --git a/src/nm-policy-hosts.c b/src/nm-policy-hosts.c
index 0403b03..1b57d42 100644
--- a/src/nm-policy-hosts.c
+++ b/src/nm-policy-hosts.c
@@ -64,6 +64,21 @@ is_local_mapping (const char *str, gboolean ip6, const char *hostname)
}
static gboolean
+is_ip4_addr (const char *str)
+{
+ struct in_addr found;
+ char buf[INET_ADDRSTRLEN + 2];
+ const char *p = str;
+ guint32 i = 0;
+
+ memset (buf, 0, sizeof (buf));
+ while (*p && !isblank (*p) && (i < sizeof (buf)))
+ buf[i++] = *p++;
+
+ return inet_pton (AF_INET, buf, &found) == 1 ? TRUE : FALSE;
+}
+
+static gboolean
ip4_addr_matches (const char *str, const char *ip4_addr)
{
struct in_addr found, given;
@@ -86,6 +101,21 @@ ip4_addr_matches (const char *str, const char *ip4_addr)
}
static gboolean
+is_ip6_addr (const char *str)
+{
+ struct in6_addr found;
+ char buf[INET6_ADDRSTRLEN + 2];
+ const char *p = str;
+ guint32 i = 0;
+
+ memset (buf, 0, sizeof (buf));
+ while (*p && !isblank (*p) && (i < sizeof (buf)))
+ buf[i++] = *p++;
+
+ return inet_pton (AF_INET6, buf, &found) == 1 ? TRUE : FALSE;
+}
+
+static gboolean
ip6_addr_matches (const char *str, const char *ip6_addr)
{
struct in6_addr found, given;
@@ -176,7 +206,14 @@ nm_policy_get_etc_hosts (const char **lines,
found_user_host4 = TRUE;
host4_before = TRUE; /* Ignore if user added mapping manually */
}
+ } else if (!ip4_addr && strstr (*line, ADDED_TAG)) {
+ /* If this is a stale NM-added IPv4 entry we need to remove it,
+ * so make sure we update /etc/hosts.
+ */
+ if (is_ip4_addr (*line))
+ found_host4 = FALSE;
}
+
if (ip6_addr && ip6_addr_matches (*line, ip6_addr)) {
found_host6 = TRUE;
if (strstr (*line, ADDED_TAG)) {
@@ -186,6 +223,12 @@ nm_policy_get_etc_hosts (const char **lines,
found_user_host6 = TRUE;
host6_before = TRUE; /* Ignore if user added mapping manually */
}
+ } else if (!ip6_addr && strstr (*line, ADDED_TAG)) {
+ /* If this is a stale NM-added IPv6 entry we need to remove it,
+ * so make sure we update /etc/hosts.
+ */
+ if (is_ip6_addr (*line))
+ found_host6 = FALSE;
}
}
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 3ab4db5..7382ece 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1234,6 +1234,15 @@ nm_policy_destroy (NMPolicy *policy)
}
g_slist_free (policy->dev_signal_ids);
+ /* Rewrite /etc/hosts on exit to ensure we don't leave stale IP addresses
+ * lying around. FIXME: this will take out a valid IP address of an
+ * ethernet device we're leaving active (ie, a connection we can "assume"
+ * when NM starts again).
+ */
+ policy->default_device4 = NULL;
+ policy->default_device6 = NULL;
+ update_system_hostname (policy, NULL, NULL);
+
g_free (policy->orig_hostname);
g_free (policy->cur_hostname);

View File

@ -1,122 +0,0 @@
commit 878f6c4074acfdee42c320680f5529e01b909ba2
Author: Dan Williams <dcbw@redhat.com>
Date: Fri Oct 15 10:28:38 2010 -0500
core: ignore authorization for sleep/wake requests (but restrict to root) (rh #638640)
Everyone uses pm-utils still for sleep/wake support, and that's
traditionally how NM was put to sleep and woken up. But pm-utils
uses dbus-send without --print-reply so dbus-send quits immediately
after sending the message. That doesn't give NM enough time to
get the senders UID and thus validate the request, so the request
gets denied, and sometimes NM stays asleep after the machine is
woken up.
Instead, don't get the sender's UID and try to authorize it, but
just let the request go through. Rely on D-Bus permissions to
make sure that only root can call sleep/wake methods.
diff --git a/src/NetworkManager.conf b/src/NetworkManager.conf
index 8d08314..1f1ed49 100644
--- a/src/NetworkManager.conf
+++ b/src/NetworkManager.conf
@@ -60,6 +60,18 @@
<deny send_destination="org.freedesktop.NetworkManager"
send_interface="org.freedesktop.NetworkManager"
send_member="SetLogging"/>
+
+ <deny send_destination="org.freedesktop.NetworkManager"
+ send_interface="org.freedesktop.NetworkManager"
+ send_member="Sleep"/>
+
+ <deny send_destination="org.freedesktop.NetworkManager"
+ send_interface="org.freedesktop.NetworkManager"
+ send_member="sleep"/>
+
+ <deny send_destination="org.freedesktop.NetworkManager"
+ send_interface="org.freedesktop.NetworkManager"
+ send_member="wake"/>
</policy>
<policy context="default">
<deny own="org.freedesktop.NetworkManager"/>
@@ -72,6 +84,18 @@
send_interface="org.freedesktop.NetworkManager"
send_member="SetLogging"/>
+ <deny send_destination="org.freedesktop.NetworkManager"
+ send_interface="org.freedesktop.NetworkManager"
+ send_member="Sleep"/>
+
+ <deny send_destination="org.freedesktop.NetworkManager"
+ send_interface="org.freedesktop.NetworkManager"
+ send_member="sleep"/>
+
+ <deny send_destination="org.freedesktop.NetworkManager"
+ send_interface="org.freedesktop.NetworkManager"
+ send_member="wake"/>
+
<!-- The org.freedesktop.NetworkManagerSettings.Connection.Secrets
interface is secured via PolicyKit.
-->
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 758a082..4a3e499 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -3369,6 +3369,7 @@ _internal_sleep (NMManager *self, gboolean do_sleep)
g_object_notify (G_OBJECT (self), NM_MANAGER_SLEEPING);
}
+#if 0
static void
sleep_auth_done_cb (NMAuthChain *chain,
GError *error,
@@ -3407,6 +3408,7 @@ sleep_auth_done_cb (NMAuthChain *chain,
nm_auth_chain_unref (chain);
}
+#endif
static void
impl_manager_sleep (NMManager *self,
@@ -3414,10 +3416,12 @@ impl_manager_sleep (NMManager *self,
DBusGMethodInvocation *context)
{
NMManagerPrivate *priv;
- NMAuthChain *chain;
GError *error = NULL;
+#if 0
+ NMAuthChain *chain;
gulong sender_uid = G_MAXULONG;
const char *error_desc = NULL;
+#endif
g_return_if_fail (NM_IS_MANAGER (self));
@@ -3432,6 +3436,19 @@ impl_manager_sleep (NMManager *self,
return;
}
+ /* Unconditionally allow the request. Previously it was polkit protected
+ * but unfortunately that doesn't work for short-lived processes like
+ * pm-utils. It uses dbus-send without --print-reply, which quits
+ * immediately after sending the request, and NM is unable to obtain the
+ * sender's UID as dbus-send has already dropped off the bus. Thus NM
+ * fails the request. Instead, don't validate the request, but rely on
+ * D-Bus permissions to restrict the call to root.
+ */
+ _internal_sleep (self, do_sleep);
+ dbus_g_method_return (context);
+ return;
+
+#if 0
if (!nm_auth_get_caller_uid (context, priv->dbus_mgr, &sender_uid, &error_desc)) {
error = g_error_new_literal (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
@@ -3457,6 +3474,7 @@ impl_manager_sleep (NMManager *self,
nm_auth_chain_set_data (chain, "sleep", GUINT_TO_POINTER (do_sleep), NULL);
nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_SLEEP_WAKE, TRUE);
+#endif
}
static void

View File

@ -1,2 +1,2 @@
43c0b014895dc78e0ea9c86aa917b427 network-manager-applet-0.8.1.git20100831.tar.bz2
23b3f273d4e24bd6b117617b6fd89861 NetworkManager-0.8.1.git20100831.tar.bz2
dc9e73fcf67d3897af878ef2ba5c7aff NetworkManager-0.8.2.tar.bz2
021de95fc1e943346ceea28fbaddf45f network-manager-applet-0.8.2.tar.bz2