summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2014-11-22 10:05:48 +0100
committerLubomir Rintel <lkundrak@v3.sk>2014-12-11 11:15:53 +0100
commita3f9e51927939dce17944b31c698060db89bc77d (patch)
tree74bdb9775106ed0a452c6b992e28c44266b2d29a
parent5849c97c0368d51ea35590736aaf40ee522fed0d (diff)
downloadNetworkManager-a3f9e51927939dce17944b31c698060db89bc77d.tar.gz
agent-manager: don't ever fail the secrets requests from GetSecrets()
VPN connections always return true for nm_connection_need_secrets(), but the documented behavior of GetSecrets() is just to return any secrets we have (otherwise nmcli c --show-secrets would not be useful for VPN connections).
-rw-r--r--libnm-core/nm-dbus-interface.h5
-rw-r--r--libnm/nm-secret-agent-old.c1
-rw-r--r--src/settings/nm-agent-manager.c8
-rw-r--r--src/settings/nm-secret-agent.c3
-rw-r--r--src/settings/nm-settings-connection.c3
5 files changed, 16 insertions, 4 deletions
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index ccf21ee14a..dd2b70a0dc 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -571,6 +571,8 @@ typedef enum {
* results or carrier changes.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM: Internal flag, not part of
* the D-Bus API.
+ * @NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS: Internal flag, not part of
+ * the D-Bus API.
*
* #NMSecretAgentGetSecretsFlags values modify the behavior of a GetSecrets request.
*
@@ -583,7 +585,8 @@ typedef enum { /*< flags >*/
NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED = 0x4,
/* Internal to NM; not part of the D-Bus API */
- NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM = 0x80000000
+ NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM = 0x80000000,
+ NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS = 0x40000000,
} NMSecretAgentGetSecretsFlags;
/**
diff --git a/libnm/nm-secret-agent-old.c b/libnm/nm-secret-agent-old.c
index 9e116501b9..606c40999d 100644
--- a/libnm/nm-secret-agent-old.c
+++ b/libnm/nm-secret-agent-old.c
@@ -920,6 +920,7 @@ nm_secret_agent_old_get_secrets (NMSecretAgentOld *self,
g_return_if_fail (setting_name != NULL);
g_return_if_fail (strlen (setting_name) > 0);
g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM));
+ g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS));
g_return_if_fail (callback != NULL);
NM_SECRET_AGENT_OLD_GET_CLASS (self)->get_secrets (self,
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index 117fb2150a..cc4b1943ca 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -1107,7 +1107,13 @@ get_start (gpointer user_data)
req, parent->detail, req->setting_name);
/* We don't, so ask some agents for additional secrets */
- request_next_agent (parent);
+ if ( req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS
+ && !parent->pending) {
+ /* The request initiated from GetSecrets() via DBus,
+ * don't error out if any secrets are missing. */
+ req_complete_success (parent, req->existing_secrets, NULL, NULL);
+ } else
+ request_next_agent (parent);
}
}
g_variant_unref (secrets_dict);
diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c
index 054e07a8c7..69a5cea226 100644
--- a/src/settings/nm-secret-agent.c
+++ b/src/settings/nm-secret-agent.c
@@ -299,8 +299,9 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
hash = nm_utils_connection_dict_to_hash (dict);
g_variant_unref (dict);
- /* Mask off the private ONLY_SYSTEM flag if present */
+ /* Mask off the private flags if present */
flags &= ~NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM;
+ flags &= ~NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS;
r = request_new (self, nm_connection_get_path (connection), setting_name, callback, callback_data);
r->call = dbus_g_proxy_begin_call_with_timeout (priv->proxy,
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 78a830bad6..49331d6d72 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -1604,7 +1604,8 @@ dbus_get_secrets_auth_cb (NMSettingsConnection *self,
call_id = nm_settings_connection_get_secrets (self,
subject,
setting_name,
- NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED,
+ NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED
+ | NM_SECRET_AGENT_GET_SECRETS_FLAG_NO_ERRORS,
NULL,
dbus_get_agent_secrets_cb,
context,