mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 23:10:18 +01:00
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).
This commit is contained in:
parent
5849c97c03
commit
a3f9e51927
5 changed files with 16 additions and 4 deletions
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue