summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Vogt <fvogt@suse.com>2018-03-06 13:04:00 +0000
committerThomas Haller <thaller@redhat.com>2018-03-08 11:35:26 +0100
commit0824a327039d7fe7f9723f316da30538c7b688d0 (patch)
tree49e73de941a26e577cfa46855be4635a98c6fb84
parent596d59bda0da944e8e2f588e92c9a44f017e9e85 (diff)
downloadNetworkManager-0824a327039d7fe7f9723f316da30538c7b688d0.tar.gz
policy: fix blocking autoconnect for no-secrets
The condition was obviosly inverted, blocking autoconnect when it should not, and not blocking it when it should. [thaller@redhat.com: modified original patch and rewrite commit message] Fixes: e2c8ef45ac9fba8d4f5722ab10831bf42085a110 https://bugzilla.gnome.org/show_bug.cgi?id=794014 (cherry picked from commit d2f019409d0906814ccd2050ce39609903f879f7)
-rw-r--r--src/nm-policy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 4d0ef91a1c..b73e04cb25 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1758,10 +1758,16 @@ device_state_changed (NMDevice *device,
* been consulted, and it may be able to provide the secrets.
*
* We detect this by using a version-id of the agent-manager, which increments
- * whenever new agents register. */
+ * whenever new agents register. Note that the agent-manager's version-id is
+ * never zero and strictly increasing.
+ *
+ * A connection's version-id of zero means that the connection never tried to request secrets.
+ * That can happen when nm_settings_connection_get_secrets() fails early without actually
+ * consulting any agents.
+ */
con_v = nm_settings_connection_get_last_secret_agent_version_id (connection);
if ( con_v == 0
- || con_v != nm_agent_manager_get_agent_version_id (priv->agent_mgr))
+ || con_v == nm_agent_manager_get_agent_version_id (priv->agent_mgr))
block_no_secrets = TRUE;
}