agents: change secrets request hints back to char **

Previously I didn't think they'd be used for anything other than connection secrets
which only have one hint, but in the future we'll want to pass more information.
This commit is contained in:
Dan Williams
2013-06-19 17:51:09 -05:00
parent b34fdde19c
commit 0eb97f3ad5
7 changed files with 29 additions and 22 deletions

View File

@@ -116,6 +116,7 @@ nm_act_request_get_secrets (NMActRequest *self,
guint32 call_id;
NMConnection *connection;
gboolean user_requested;
const char *hints[2] = { hint, NULL };
g_return_val_if_fail (self, 0);
g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 0);
@@ -137,7 +138,7 @@ nm_act_request_get_secrets (NMActRequest *self,
nm_active_connection_get_user_uid (NM_ACTIVE_CONNECTION (self)),
setting_name,
flags,
hint,
hints,
get_secrets_cb,
info,
NULL);

View File

@@ -646,7 +646,7 @@ typedef struct {
NMSettingsGetSecretsFlags flags;
NMConnection *connection;
char *setting_name;
char *hint;
char **hints;
GHashTable *existing_secrets;
@@ -670,7 +670,7 @@ connection_request_free (gpointer data)
g_object_unref (req->connection);
g_free (req->setting_name);
g_free (req->hint);
g_strfreev (req->hints);
if (req->existing_secrets)
g_hash_table_unref (req->existing_secrets);
if (req->chain)
@@ -707,7 +707,7 @@ connection_request_new_get (NMConnection *connection,
const char *setting_name,
const char *verb,
NMSettingsGetSecretsFlags flags,
const char *hint,
const char **hints,
NMAgentSecretsResultFunc callback,
gpointer callback_data,
gpointer other_data2,
@@ -736,7 +736,7 @@ connection_request_new_get (NMConnection *connection,
if (existing_secrets)
req->existing_secrets = g_hash_table_ref (existing_secrets);
req->setting_name = g_strdup (setting_name);
req->hint = g_strdup (hint);
req->hints = g_strdupv ((char **) hints);
req->flags = flags;
req->callback = callback;
req->callback_data = callback_data;
@@ -891,7 +891,7 @@ get_agent_request_secrets (ConnectionRequest *req, gboolean include_system_secre
parent->current_call_id = nm_secret_agent_get_secrets (parent->current,
tmp,
req->setting_name,
req->hint,
(const char **) req->hints,
req->flags,
get_done_cb,
req);
@@ -1140,7 +1140,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
GHashTable *existing_secrets,
const char *setting_name,
NMSettingsGetSecretsFlags flags,
const char *hint,
const char **hints,
NMAgentSecretsResultFunc callback,
gpointer callback_data,
gpointer other_data2,
@@ -1173,7 +1173,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
setting_name,
"getting",
flags,
hint,
hints,
callback,
callback_data,
other_data2,

View File

@@ -80,7 +80,7 @@ guint32 nm_agent_manager_get_secrets (NMAgentManager *manager,
GHashTable *existing_secrets,
const char *setting_name,
NMSettingsGetSecretsFlags flags,
const char *hint,
const char **hints,
NMAgentSecretsResultFunc callback,
gpointer callback_data,
gpointer other_data2,

View File

@@ -251,14 +251,13 @@ gconstpointer
nm_secret_agent_get_secrets (NMSecretAgent *self,
NMConnection *connection,
const char *setting_name,
const char *hint,
const char **hints,
NMSettingsGetSecretsFlags flags,
NMSecretAgentCallback callback,
gpointer callback_data)
{
NMSecretAgentPrivate *priv;
GHashTable *hash;
const char *hints[2] = { hint, NULL };
Request *r;
g_return_val_if_fail (self != NULL, NULL);

View File

@@ -80,7 +80,7 @@ typedef void (*NMSecretAgentCallback) (NMSecretAgent *agent,
gconstpointer nm_secret_agent_get_secrets (NMSecretAgent *agent,
NMConnection *connection,
const char *setting_name,
const char *hint,
const char **hints,
NMSettingsGetSecretsFlags flags,
NMSecretAgentCallback callback,
gpointer callback_data);

View File

@@ -848,7 +848,8 @@ agent_secrets_done_cb (NMAgentManager *manager,
* to this UID
* @setting_name: the setting to return secrets for
* @flags: flags to modify the secrets request
* @hint: the name of a key in @setting_name for which a secret may be required
* @hints: key names in @setting_name for which secrets may be required, or some
* other information about the request
* @callback: the function to call with returned secrets
* @callback_data: user data to pass to @callback
*
@@ -863,7 +864,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
gulong uid,
const char *setting_name,
NMSettingsGetSecretsFlags flags,
const char *hint,
const char **hints,
NMSettingsConnectionSecretsFunc callback,
gpointer callback_data,
GError **error)
@@ -871,6 +872,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
GHashTable *existing_secrets;
guint32 call_id = 0;
char *joined_hints = NULL;
/* Use priv->secrets to work around the fact that nm_connection_clear_secrets()
* will clear secrets on this object's settings.
@@ -898,7 +900,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
existing_secrets,
setting_name,
flags,
hint,
hints,
agent_secrets_done_cb,
self,
callback,
@@ -906,12 +908,17 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
if (existing_secrets)
g_hash_table_unref (existing_secrets);
nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) secrets requested flags 0x%X hint '%s'",
if (nm_logging_level_enabled (LOGL_DEBUG)) {
if (hints)
joined_hints = g_strjoinv (",", (char **) hints);
nm_log_dbg (LOGD_SETTINGS, "(%s/%s:%u) secrets requested flags 0x%X hints '%s'",
nm_connection_get_uuid (NM_CONNECTION (self)),
setting_name,
call_id,
flags,
hint);
joined_hints ? joined_hints : "(none)");
g_free (joined_hints);
}
return call_id;
}

View File

@@ -108,7 +108,7 @@ guint32 nm_settings_connection_get_secrets (NMSettingsConnection *connection,
gulong uid,
const char *setting_name,
NMSettingsGetSecretsFlags flags,
const char *hint,
const char **hints,
NMSettingsConnectionSecretsFunc callback,
gpointer callback_data,
GError **error);