From 9cf13cc3e11499c4b760a3ba1bfddabea62206dc Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 18 Jan 2011 14:17:18 -0600 Subject: [PATCH] agent: request_new -> flags Use some flags to modify GetSecrets behavior instead of just the request_new boolean. --- introspection/nm-secret-agent.xml | 30 +++++++++++++++++++++++++++++- libnm-glib/nm-secret-agent.c | 12 ++++++------ libnm-glib/nm-secret-agent.h | 9 +++++++-- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/introspection/nm-secret-agent.xml b/introspection/nm-secret-agent.xml index 9ac6950faf..655b2b72f2 100644 --- a/introspection/nm-secret-agent.xml +++ b/introspection/nm-secret-agent.xml @@ -41,8 +41,9 @@ in this request. - + + Flags which modify the behavior of the secrets request. If true, new secrets are assumed to be invalid or incorrect, and the agent should ask the user for new secrets. If false, existing secrets should be retrieved from storage and @@ -59,6 +60,33 @@ + + + Flags modifying the behavior of GetSecrets request. + + + + No special behavior; by default no user interaction is allowed and + requests for secrets are fulfilled from persistent storage, or + if no secrets are available an error is returned. + + + + + Allows the request to interact with the user, possibly prompting + via UI for secrets if any are required, or if none are found in + persistent storage. + + + + + Explicitly prompt for new secrets from the user. This flag + signals that NetworkManager thinks any existing secrets are + invalid or wrong. This flag implies that interaction is allowed. + + + + Cancel a pending GetSecrets request for secrets of the given diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index c5b80dc725..cfe13dae86 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -15,7 +15,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2010 Red Hat, Inc. + * (C) Copyright 2010 - 2011 Red Hat, Inc. */ #include @@ -33,7 +33,7 @@ static void impl_secret_agent_get_secrets (NMSecretAgent *self, const char *connection_path, const char *setting_name, const char **hints, - gboolean request_new, + guint32 flags, DBusGMethodInvocation *context); static void impl_secret_agent_cancel_get_secrets (NMSecretAgent *self, @@ -295,7 +295,7 @@ impl_secret_agent_get_secrets (NMSecretAgent *self, const char *connection_path, const char *setting_name, const char **hints, - gboolean request_new, + guint32 flags, DBusGMethodInvocation *context) { GError *error = NULL; @@ -313,7 +313,7 @@ impl_secret_agent_get_secrets (NMSecretAgent *self, connection_path, setting_name, hints, - request_new, + flags, get_secrets_cb, context); g_object_unref (connection); @@ -522,7 +522,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self, NMConnection *connection, const char *setting_name, const char **hints, - gboolean request_new, + guint32 flags, NMSecretAgentGetSecretsFunc callback, gpointer callback_data) { @@ -540,7 +540,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self, nm_connection_get_path (connection), setting_name, hints, - request_new, + flags, callback, callback_data); } diff --git a/libnm-glib/nm-secret-agent.h b/libnm-glib/nm-secret-agent.h index f62ebacd00..6fb4705778 100644 --- a/libnm-glib/nm-secret-agent.h +++ b/libnm-glib/nm-secret-agent.h @@ -40,6 +40,11 @@ typedef enum { NM_SECRET_AGENT_ERROR_NO_SECRETS, } NMSecretAgentError; +enum { + NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE = 0x0, + NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1, + NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW = 0x2 +}; #define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ()) #define NM_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgent)) @@ -89,7 +94,7 @@ typedef struct { const char *connection_path, const char *setting_name, const char **hints, - gboolean request_new, + guint32 flags, NMSecretAgentGetSecretsFunc callback, gpointer callback_data); @@ -148,7 +153,7 @@ void nm_secret_agent_get_secrets (NMSecretAgent *self, NMConnection *connection, const char *setting_name, const char **hints, - gboolean request_new, + guint32 flags, NMSecretAgentGetSecretsFunc callback, gpointer callback_data);