summary refs log tree commit diff
path: root/clients/cli
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2017-02-16 00:00:34 +0100
committerMichael Biebl <biebl@debian.org>2017-02-16 00:00:34 +0100
commita222e56e103f949b148a6942e385ccca2c26d9f3 (patch)
tree7978165f4d291224c854adb4c96c863a924b4882 /clients/cli
parent7f4dff3943c64e1d0e5d13b2ac915088dde165e6 (diff)
New upstream version 1.6.2 upstream/1.6.2
Diffstat (limited to 'clients/cli')
-rw-r--r--clients/cli/connections.c9
-rw-r--r--clients/cli/settings.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index c73f96a9..b40d517b 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -2704,6 +2704,7 @@ typedef struct {
 	NmCli *nmc;
 	GSList *queue;
 	guint timeout_id;
+	GCancellable *cancellable;
 } ConnectionCbInfo;
 
 static void connection_cb_info_finish (ConnectionCbInfo *info,
@@ -2773,6 +2774,9 @@ connection_cb_info_finish (ConnectionCbInfo *info, gpointer connection)
 
 	if (info->timeout_id)
 		g_source_remove (info->timeout_id);
+
+	nm_clear_g_cancellable (&info->cancellable);
+
 	g_signal_handlers_disconnect_by_func (info->nmc->client, connection_removed_cb, info);
 	g_slice_free (ConnectionCbInfo, info);
 	quit ();
@@ -8280,6 +8284,8 @@ delete_cb (GObject *con, GAsyncResult *result, gpointer user_data)
 	GError *error = NULL;
 
 	if (!nm_remote_connection_delete_finish (NM_REMOTE_CONNECTION (con), result, &error)) {
+		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+			return;
 		g_string_printf (info->nmc->return_text, _("Error: not all connections deleted."));
 		g_printerr (_("Error: Connection deletion failed: %s"),
 		            error->message);
@@ -8366,6 +8372,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
 	info->nmc = nmc;
 	info->queue = queue;
 	info->timeout_id = g_timeout_add_seconds (nmc->timeout, connection_op_timeout_cb, info);
+	info->cancellable = g_cancellable_new ();
 
 	nmc->nowait_flag = (nmc->timeout == 0);
 	nmc->should_wait++;
@@ -8376,7 +8383,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
 	/* Now delete the connections */
 	for (iter = queue; iter; iter = g_slist_next (iter))
 		nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (iter->data),
-		                                   NULL, delete_cb, info);
+		                                   info->cancellable, delete_cb, info);
 
 finish:
 	if (invalid_cons) {
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index df0effa3..1c8d5462 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -1916,6 +1916,7 @@ nmc_property_802_1X_get_phase2_private_key_full (NMSetting *setting, NmcProperty
 		char *val_strip = g_strstrip (g_strdup (val)); \
 		char *p = val_strip; \
 		const char *path, *password; \
+		gs_free char *password_free = NULL; \
 		NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_PATH; \
 		gboolean success; \
 		\
@@ -1929,7 +1930,7 @@ nmc_property_802_1X_get_phase2_private_key_full (NMSetting *setting, NmcProperty
 		if (g_strv_length (strv) == 2) \
 			password = strv[1]; \
 		else \
-			password = pwd_func (NM_SETTING_802_1X (setting)); \
+			password = password_free = g_strdup (pwd_func (NM_SETTING_802_1X (setting))); \
 		success = set_func (NM_SETTING_802_1X (setting), path, password, scheme, NULL, error); \
 		g_free (val_strip); \
 		g_strfreev (strv); \