summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-10-16 16:08:24 +0200
committerJiří Klimeš <jklimes@redhat.com>2014-10-20 09:11:57 +0200
commit278ec174489087f2b905822bece75df1bf4b7574 (patch)
tree04b81dd97d6c3341f6aea573a94dd97dbe453fc8
parent7b1aae969d2b1bdc6a13bbc464ee13ad30cf66f9 (diff)
downloadNetworkManager-278ec174489087f2b905822bece75df1bf4b7574.tar.gz
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
-rw-r--r--clients/cli/connections.c12
1 files 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)