diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2014-11-13 20:22:04 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2014-11-14 09:45:26 +0100 |
commit | 7d5069ee350a328404ed9b757893589d2f5426fc (patch) | |
tree | dd89628842756ab2c75a45a822103275486150f4 | |
parent | 9bf928fee9b0092dcd5eaa8bbbc2d4a3d855a21c (diff) | |
download | NetworkManager-lr/polkit.tar.gz |
cli: Only construct an agent for a connection if there is a connectionlr/polkit
[lkundrak@fedora20-2 ~]$ nmcli --ask c ifname wlan0
(process:18405): libnm-CRITICAL **: nm_object_get_path: assertion 'NM_IS_OBJECT (object)' failed
Error: Connection activation failed: The device has no connections available.
[lkundrak@fedora20-2 ~]$
-rw-r--r-- | clients/cli/connections.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 02cab47c7e..4bc79a8cbf 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -2130,6 +2130,11 @@ nmc_activate_connection (NmCli *nmc, return FALSE; } g_clear_error (&local); + + /* Create -a secret agent for the connection */ + nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect", nm_object_get_path (NM_OBJECT (connection))); + if (nmc->secret_agent) + g_signal_connect (nmc->secret_agent, "request-secrets", G_CALLBACK (secrets_requested), nmc); } else if (ifname) { device = nm_client_get_device_by_iface (nmc->client, ifname); if (!device) { @@ -2153,11 +2158,6 @@ nmc_activate_connection (NmCli *nmc, g_hash_table_destroy (nmc->pwds_hash); nmc->pwds_hash = pwds_hash; - /* Create secret agent */ - nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-connect", nm_object_get_path (NM_OBJECT (connection))); - if (nmc->secret_agent) - g_signal_connect (nmc->secret_agent, "request-secrets", G_CALLBACK (secrets_requested), nmc); - info = g_malloc0 (sizeof (ActivateConnectionInfo)); info->nmc = nmc; info->device = device; |