https://bugzilla.redhat.com/show_bug.cgi?id=1010288 https://bugzilla.redhat.com/show_bug.cgi?id=1122593
This commit is contained in:
parent
edf80dcb59
commit
853145abcf
104
0072-rh1010288-nm_client_new-fix.patch
Normal file
104
0072-rh1010288-nm_client_new-fix.patch
Normal file
@ -0,0 +1,104 @@
|
||||
From 570b9b362db0372e90d1598519132ce805a01d4f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
|
||||
Date: Fri, 11 Oct 2013 11:14:05 +0200
|
||||
Subject: [PATCH] libnm-glib: fix a crash in nm_client_new() (rh #1010288)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We have to check if 'client' is valid when calling _nm_object_ensure_inited().
|
||||
Creation of NMClient object can fail, because its parent NMObject's
|
||||
constructor() returns NULL for D-Bus errors.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1010288
|
||||
|
||||
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
||||
---
|
||||
libnm-glib/nm-client.c | 35 ++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 30 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
|
||||
index f34b685..15c708a 100644
|
||||
--- a/libnm-glib/nm-client.c
|
||||
+++ b/libnm-glib/nm-client.c
|
||||
@@ -18,7 +18,7 @@
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2007 - 2008 Novell, Inc.
|
||||
- * Copyright (C) 2007 - 2012 Red Hat, Inc.
|
||||
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include <dbus/dbus-glib.h>
|
||||
@@ -1616,7 +1616,7 @@ nm_client_check_connectivity_finish (NMClient *client,
|
||||
* control them. To access and modify network configuration data, use the
|
||||
* #NMRemoteSettings object.
|
||||
*
|
||||
- * Returns: a new #NMClient
|
||||
+ * Returns: a new #NMClient or NULL on an error
|
||||
**/
|
||||
NMClient *
|
||||
nm_client_new (void)
|
||||
@@ -1624,7 +1624,13 @@ nm_client_new (void)
|
||||
NMClient *client;
|
||||
|
||||
client = g_object_new (NM_TYPE_CLIENT, NM_OBJECT_DBUS_PATH, NM_DBUS_PATH, NULL);
|
||||
- _nm_object_ensure_inited (NM_OBJECT (client));
|
||||
+
|
||||
+ /* NMObject's constructor() can fail on a D-Bus connection error. So we can
|
||||
+ * get NULL here instead of a valid NMClient object.
|
||||
+ */
|
||||
+ if (client)
|
||||
+ _nm_object_ensure_inited (NM_OBJECT (client));
|
||||
+
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -1650,7 +1656,8 @@ client_inited (GObject *source, GAsyncResult *result, gpointer user_data)
|
||||
*
|
||||
* Creates a new #NMClient and begins asynchronously initializing it.
|
||||
* @callback will be called when it is done; use
|
||||
- * nm_client_new_finish() to get the result.
|
||||
+ * nm_client_new_finish() to get the result. Note that on an error,
|
||||
+ * the callback can be invoked with two first parameters as NULL.
|
||||
*
|
||||
* NOTE: #NMClient provides information about devices and a mechanism to
|
||||
* control them. To access and modify network configuration data, use the
|
||||
@@ -1664,8 +1671,16 @@ nm_client_new_async (GCancellable *cancellable,
|
||||
NMClient *client;
|
||||
GSimpleAsyncResult *simple;
|
||||
|
||||
- simple = g_simple_async_result_new (NULL, callback, user_data, nm_client_new_async);
|
||||
client = g_object_new (NM_TYPE_CLIENT, NM_OBJECT_DBUS_PATH, NM_DBUS_PATH, NULL);
|
||||
+ /* When client is NULL, do no continue with initialization and run callback
|
||||
+ * directly with result == NULL indicating NMClient creation failure.
|
||||
+ */
|
||||
+ if (!client) {
|
||||
+ callback (NULL, NULL, user_data);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ simple = g_simple_async_result_new (NULL, callback, user_data, nm_client_new_async);
|
||||
g_async_initable_init_async (G_ASYNC_INITABLE (client), G_PRIORITY_DEFAULT,
|
||||
cancellable, client_inited, simple);
|
||||
}
|
||||
@@ -1684,6 +1699,16 @@ nm_client_new_finish (GAsyncResult *result, GError **error)
|
||||
{
|
||||
GSimpleAsyncResult *simple;
|
||||
|
||||
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
+
|
||||
+ if (!result) {
|
||||
+ g_set_error_literal (error,
|
||||
+ NM_CLIENT_ERROR,
|
||||
+ NM_CLIENT_ERROR_UNKNOWN,
|
||||
+ "NMClient initialization failed (or you passed NULL 'result' by mistake)");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, nm_client_new_async), NULL);
|
||||
|
||||
simple = G_SIMPLE_ASYNC_RESULT (result);
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -46,7 +46,7 @@ Name: NetworkManager
|
||||
Summary: Network connection manager and user applications
|
||||
Epoch: 1
|
||||
Version: 0.9.9.0
|
||||
Release: 41%{snapshot}%{?dist}
|
||||
Release: 42%{snapshot}%{?dist}
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
URL: http://www.gnome.org/projects/NetworkManager/
|
||||
@ -127,6 +127,7 @@ Patch68: 0068-cli-bash-completion-escaping.patch
|
||||
Patch69: 0069-rh1115538-fix-supplicant-crash-for-AddBlob.patch
|
||||
Patch70: 0070-rh1047083-handle-mtu-for-ip4-config-merge-and-subtract.patch
|
||||
Patch71: 0071-fix-connectivity-notification.patch
|
||||
Patch72: 0072-rh1010288-nm_client_new-fix.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
@ -372,6 +373,7 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
|
||||
%patch69 -p1 -b .0069-rh1115538-fix-supplicant-crash-for-AddBlob.orig
|
||||
%patch70 -p1 -b .0070-rh1047083-handle-mtu-for-ip4-config-merge-and-subtract.orig
|
||||
%patch71 -p1 -b .0071-fix-connectivity-notification.orig
|
||||
%patch72 -p1 -b .0072-rh1010288-nm_client_new-fix.orig
|
||||
|
||||
%build
|
||||
|
||||
@ -605,6 +607,11 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jul 24 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-42.git20131003
|
||||
- libnm-glib: fix a crash in nm_client_new() (rh #1010288) (rh #1122593)
|
||||
- manager: fix notification of the connectivity property
|
||||
- new NetworkManager-config-connectivity-fedora package with connectivity config
|
||||
|
||||
* Wed Jul 2 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-41.git20131003
|
||||
- core: fix crash passing wrong parameter to AddBlob for wpa_supplicant (rh #1115538)
|
||||
- core: fix setting MTU from DHCP (rh #1047083)
|
||||
|
Loading…
Reference in New Issue
Block a user