From 278ec174489087f2b905822bece75df1bf4b7574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 16 Oct 2014 16:08:24 +0200 Subject: [PATCH] cli: fix errors and crash for invisible connections * two users are logged in: user_a and user_b * user_b creates a connection visible only to him 'user_b_private' (permissions: user:user_b) * user_b activates the connection user_b_private * user_a does not see the connection profile, but he does see the active connection * user_a calls nmcli con nmcli con show user_b_private --- clients/cli/connections.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 3d1245efbf..9a0b23d634 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -606,7 +606,7 @@ get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection) NMRemoteConnection *con; con = nm_active_connection_get_connection (candidate); - ac_con_path = nm_connection_get_path (NM_CONNECTION (con)); + ac_con_path = con ? nm_connection_get_path (NM_CONNECTION (con)) : NULL; if (!g_strcmp0 (ac_con_path, con_path)) { ac = candidate; break; @@ -693,19 +693,19 @@ find_active_connection (const GPtrArray *active_cons, const char *path, *a_path, *path_num, *a_path_num; const char *id; const char *uuid; - NMConnection *con; + NMRemoteConnection *con; NMActiveConnection *found = NULL; for (i = start; i < active_cons->len; i++) { NMActiveConnection *candidate = g_ptr_array_index (active_cons, i); - con = NM_CONNECTION (nm_active_connection_get_connection (candidate)); - id = nm_connection_get_id (con); + con = nm_active_connection_get_connection (candidate); - path = nm_connection_get_path (con); - a_path = nm_object_get_path (NM_OBJECT (candidate)); + id = nm_active_connection_get_id (candidate); uuid = nm_active_connection_get_uuid (candidate); + path = con ? nm_connection_get_path (NM_CONNECTION (con)) : NULL; path_num = path ? strrchr (path, '/') + 1 : NULL; + a_path = nm_object_get_path (NM_OBJECT (candidate)); a_path_num = a_path ? strrchr (a_path, '/') + 1 : NULL; /* When filter_type is NULL, compare connection ID (filter_val)