diff options
author | Dan Winship <danw@gnome.org> | 2014-10-15 15:27:25 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-22 08:29:09 -0400 |
commit | 821258048b620bdc381089c0f442674b0f83be6e (patch) | |
tree | 3122b22b72662fbfa79454fc13011d5bc3f7b7b5 /libnm-core | |
parent | 86331d9ef49716a4bd2a7790289b5665eed84dd1 (diff) | |
download | NetworkManager-821258048b620bdc381089c0f442674b0f83be6e.tar.gz |
libnm-core, libnm, settings: move NMSecretAgentError to nm-errors
Move the definition of NMSecretAgentError to nm-errors, register it
with D-Bus, and verify in the tests that it maps correctly.
NM_SECRET_AGENT_ERROR_INTERNAL_ERROR is renamed to
NM_SECRET_AGENT_ERROR_FAILED, and NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED
to NM_SECRET_AGENT_ERROR_PERMISSION_DENIED, for consistency with other
error domains. While NMSecretAgentError, unlike most other error
domains, has always been correctly mapped across D-Bus, the renaming
is not an ABI break, because the daemon never checks for either of
those values, so all versions of the daemon will treat
"org.freedesktop.NetworkManager.SecretAgent.InternalError" and
"org.freedesktop.NetworkManager.SecretAgent.Failed" the same (by just
ignoring the error name and keeping only the error message).
Diffstat (limited to 'libnm-core')
-rw-r--r-- | libnm-core/nm-errors.c | 4 | ||||
-rw-r--r-- | libnm-core/nm-errors.h | 34 |
2 files changed, 38 insertions, 0 deletions
diff --git a/libnm-core/nm-errors.c b/libnm-core/nm-errors.c index 0e45f50ce8..12da2aa89c 100644 --- a/libnm-core/nm-errors.c +++ b/libnm-core/nm-errors.c @@ -31,6 +31,7 @@ G_DEFINE_QUARK (nm-connection-error-quark, nm_connection_error) G_DEFINE_QUARK (nm-crypto-error-quark, nm_crypto_error) G_DEFINE_QUARK (nm-device-error-quark, nm_device_error) G_DEFINE_QUARK (nm-manager-error-quark, nm_manager_error) +G_DEFINE_QUARK (nm-secret-agent-error-quark, nm_secret_agent_error) G_DEFINE_QUARK (nm-settings-error-quark, nm_settings_error) static void @@ -70,6 +71,9 @@ _nm_dbus_errors_init (void) register_error_domain (NM_MANAGER_ERROR, NM_DBUS_INTERFACE, NM_TYPE_MANAGER_ERROR); + register_error_domain (NM_SECRET_AGENT_ERROR, + NM_DBUS_INTERFACE_SECRET_AGENT, + NM_TYPE_SECRET_AGENT_ERROR); register_error_domain (NM_SETTINGS_ERROR, NM_DBUS_INTERFACE_SETTINGS, NM_TYPE_SETTINGS_ERROR); diff --git a/libnm-core/nm-errors.h b/libnm-core/nm-errors.h index 62434dfb75..c3c26e8763 100644 --- a/libnm-core/nm-errors.h +++ b/libnm-core/nm-errors.h @@ -208,6 +208,40 @@ GQuark nm_manager_error_quark (void); #define NM_MANAGER_ERROR (nm_manager_error_quark ()) /** + * NMSecretAgentError: + * @NM_SECRET_AGENT_ERROR_FAILED: unknown or unclassified error + * @NM_SECRET_AGENT_ERROR_PERMISSION_DENIED: the caller (ie, NetworkManager) is + * not authorized to make this request + * @NM_SECRET_AGENT_ERROR_INVALID_CONNECTION: the connection for which secrets + * were requested is invalid + * @NM_SECRET_AGENT_ERROR_USER_CANCELED: the request was canceled by the user + * @NM_SECRET_AGENT_ERROR_AGENT_CANCELED: the agent canceled the request + * because it was requested to do so by NetworkManager + * @NM_SECRET_AGENT_ERROR_NO_SECRETS: the agent cannot find any secrets for this + * connection + * + * #NMSecretAgentError values are passed by secret agents back to NetworkManager + * when they encounter problems retrieving secrets on behalf of NM. They + * correspond to errors in the "org.freedesktop.NetworkManager.SecretManager" + * namespace. + * + * Client APIs such as nm_client_activate_connection() will not see these error + * codes; instead, the secret agent manager will translate them to the + * corresponding #NMAgentManagerError codes. + */ +typedef enum { + NM_SECRET_AGENT_ERROR_FAILED = 0, /*< nick=Failed >*/ + NM_SECRET_AGENT_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/ + NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/ + NM_SECRET_AGENT_ERROR_USER_CANCELED, /*< nick=UserCanceled >*/ + NM_SECRET_AGENT_ERROR_AGENT_CANCELED, /*< nick=AgentCanceled >*/ + NM_SECRET_AGENT_ERROR_NO_SECRETS, /*< nick=NoSecrets >*/ +} NMSecretAgentError; + +GQuark nm_secret_agent_error_quark (void); +#define NM_SECRET_AGENT_ERROR (nm_secret_agent_error_quark ()) + +/** * NMSettingsError: * @NM_SETTINGS_ERROR_FAILED: unknown or unclassified error * @NM_SETTINGS_ERROR_PERMISSION_DENIED: permission denied |