NetworkManager/nmtui-fix-crash-in-secret-agent.patch
2015-10-19 13:43:23 +02:00

89 lines
2.6 KiB
Diff

From 269a4483be917fcc7ba66bcf061f75e76df0c6c7 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 30 Sep 2015 17:25:49 +0200
Subject: [PATCH] tui: fix crash during activation when failed to create
secret-agent
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NetworkManager only allows one 'client:user-id' to register as secret
agent. Thus, when starting nmtui in two terminals, creating the secret
agent can fail.
This can lead to a crash.
https://bugzilla.gnome.org/show_bug.cgi?id=755883
(cherry picked from commit b861900d45da588f4239be418c3e1f62505cbde1)
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
clients/tui/nmtui-connect.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/clients/tui/nmtui-connect.c b/clients/tui/nmtui-connect.c
index 438915d..5eabbc8 100644
--- a/clients/tui/nmtui-connect.c
+++ b/clients/tui/nmtui-connect.c
@@ -132,7 +132,7 @@ activate_connection (NMConnection *connection,
NMObject *specific_object)
{
NmtNewtForm *form;
- NMSecretAgentOld *agent;
+ gs_unref_object NMSecretAgentOld *agent = NULL;
NmtNewtWidget *label;
NmtSyncOp op;
const char *specific_object_path;
@@ -188,7 +188,7 @@ activate_connection (NMConnection *connection,
goto done;
}
- if (!connection) {
+ if (agent && !connection) {
connection = NM_CONNECTION (nm_active_connection_get_connection (ac));
if (connection) {
nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent),
@@ -220,8 +220,8 @@ activate_connection (NMConnection *connection,
nmt_newt_form_quit (form);
g_object_unref (form);
- nm_secret_agent_old_unregister (agent, NULL, NULL);
- g_object_unref (agent);
+ if (agent)
+ nm_secret_agent_old_unregister (agent, NULL, NULL);
}
static void
--
2.1.0
From e88161172e2d675783027a839b50488cc75fbf6f Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Wed, 30 Sep 2015 19:37:10 +0200
Subject: [PATCH] tui: add a missing include to fix build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes: 269a4483be917fcc7ba66bcf061f75e76df0c6c7
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
clients/tui/nmtui-connect.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clients/tui/nmtui-connect.c b/clients/tui/nmtui-connect.c
index 5eabbc8..cacb0b4 100644
--- a/clients/tui/nmtui-connect.c
+++ b/clients/tui/nmtui-connect.c
@@ -30,6 +30,8 @@
#include <glib/gi18n-lib.h>
+#include "gsystem-local-alloc.h"
+
#include "nmt-newt.h"
#include "nmtui.h"
--
2.1.0