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:
@@ -116,6 +116,7 @@ nm_act_request_get_secrets (NMActRequest *self,
|
|||||||
guint32 call_id;
|
guint32 call_id;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
gboolean user_requested;
|
gboolean user_requested;
|
||||||
|
const char *hints[2] = { hint, NULL };
|
||||||
|
|
||||||
g_return_val_if_fail (self, 0);
|
g_return_val_if_fail (self, 0);
|
||||||
g_return_val_if_fail (NM_IS_ACT_REQUEST (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)),
|
nm_active_connection_get_user_uid (NM_ACTIVE_CONNECTION (self)),
|
||||||
setting_name,
|
setting_name,
|
||||||
flags,
|
flags,
|
||||||
hint,
|
hints,
|
||||||
get_secrets_cb,
|
get_secrets_cb,
|
||||||
info,
|
info,
|
||||||
NULL);
|
NULL);
|
||||||
|
@@ -646,7 +646,7 @@ typedef struct {
|
|||||||
NMSettingsGetSecretsFlags flags;
|
NMSettingsGetSecretsFlags flags;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
char *setting_name;
|
char *setting_name;
|
||||||
char *hint;
|
char **hints;
|
||||||
|
|
||||||
GHashTable *existing_secrets;
|
GHashTable *existing_secrets;
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ connection_request_free (gpointer data)
|
|||||||
|
|
||||||
g_object_unref (req->connection);
|
g_object_unref (req->connection);
|
||||||
g_free (req->setting_name);
|
g_free (req->setting_name);
|
||||||
g_free (req->hint);
|
g_strfreev (req->hints);
|
||||||
if (req->existing_secrets)
|
if (req->existing_secrets)
|
||||||
g_hash_table_unref (req->existing_secrets);
|
g_hash_table_unref (req->existing_secrets);
|
||||||
if (req->chain)
|
if (req->chain)
|
||||||
@@ -707,7 +707,7 @@ connection_request_new_get (NMConnection *connection,
|
|||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char *verb,
|
const char *verb,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMAgentSecretsResultFunc callback,
|
NMAgentSecretsResultFunc callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
gpointer other_data2,
|
gpointer other_data2,
|
||||||
@@ -736,7 +736,7 @@ connection_request_new_get (NMConnection *connection,
|
|||||||
if (existing_secrets)
|
if (existing_secrets)
|
||||||
req->existing_secrets = g_hash_table_ref (existing_secrets);
|
req->existing_secrets = g_hash_table_ref (existing_secrets);
|
||||||
req->setting_name = g_strdup (setting_name);
|
req->setting_name = g_strdup (setting_name);
|
||||||
req->hint = g_strdup (hint);
|
req->hints = g_strdupv ((char **) hints);
|
||||||
req->flags = flags;
|
req->flags = flags;
|
||||||
req->callback = callback;
|
req->callback = callback;
|
||||||
req->callback_data = callback_data;
|
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,
|
parent->current_call_id = nm_secret_agent_get_secrets (parent->current,
|
||||||
tmp,
|
tmp,
|
||||||
req->setting_name,
|
req->setting_name,
|
||||||
req->hint,
|
(const char **) req->hints,
|
||||||
req->flags,
|
req->flags,
|
||||||
get_done_cb,
|
get_done_cb,
|
||||||
req);
|
req);
|
||||||
@@ -1140,7 +1140,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
|
|||||||
GHashTable *existing_secrets,
|
GHashTable *existing_secrets,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMAgentSecretsResultFunc callback,
|
NMAgentSecretsResultFunc callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
gpointer other_data2,
|
gpointer other_data2,
|
||||||
@@ -1173,7 +1173,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
|
|||||||
setting_name,
|
setting_name,
|
||||||
"getting",
|
"getting",
|
||||||
flags,
|
flags,
|
||||||
hint,
|
hints,
|
||||||
callback,
|
callback,
|
||||||
callback_data,
|
callback_data,
|
||||||
other_data2,
|
other_data2,
|
||||||
|
@@ -80,7 +80,7 @@ guint32 nm_agent_manager_get_secrets (NMAgentManager *manager,
|
|||||||
GHashTable *existing_secrets,
|
GHashTable *existing_secrets,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMAgentSecretsResultFunc callback,
|
NMAgentSecretsResultFunc callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
gpointer other_data2,
|
gpointer other_data2,
|
||||||
|
@@ -251,14 +251,13 @@ gconstpointer
|
|||||||
nm_secret_agent_get_secrets (NMSecretAgent *self,
|
nm_secret_agent_get_secrets (NMSecretAgent *self,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
NMSecretAgentCallback callback,
|
NMSecretAgentCallback callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentPrivate *priv;
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
const char *hints[2] = { hint, NULL };
|
|
||||||
Request *r;
|
Request *r;
|
||||||
|
|
||||||
g_return_val_if_fail (self != NULL, NULL);
|
g_return_val_if_fail (self != NULL, NULL);
|
||||||
|
@@ -80,7 +80,7 @@ typedef void (*NMSecretAgentCallback) (NMSecretAgent *agent,
|
|||||||
gconstpointer nm_secret_agent_get_secrets (NMSecretAgent *agent,
|
gconstpointer nm_secret_agent_get_secrets (NMSecretAgent *agent,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
NMSecretAgentCallback callback,
|
NMSecretAgentCallback callback,
|
||||||
gpointer callback_data);
|
gpointer callback_data);
|
||||||
|
@@ -848,7 +848,8 @@ agent_secrets_done_cb (NMAgentManager *manager,
|
|||||||
* to this UID
|
* to this UID
|
||||||
* @setting_name: the setting to return secrets for
|
* @setting_name: the setting to return secrets for
|
||||||
* @flags: flags to modify the secrets request
|
* @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: the function to call with returned secrets
|
||||||
* @callback_data: user data to pass to @callback
|
* @callback_data: user data to pass to @callback
|
||||||
*
|
*
|
||||||
@@ -863,7 +864,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
|
|||||||
gulong uid,
|
gulong uid,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMSettingsConnectionSecretsFunc callback,
|
NMSettingsConnectionSecretsFunc callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
@@ -871,6 +872,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
|
|||||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||||
GHashTable *existing_secrets;
|
GHashTable *existing_secrets;
|
||||||
guint32 call_id = 0;
|
guint32 call_id = 0;
|
||||||
|
char *joined_hints = NULL;
|
||||||
|
|
||||||
/* Use priv->secrets to work around the fact that nm_connection_clear_secrets()
|
/* Use priv->secrets to work around the fact that nm_connection_clear_secrets()
|
||||||
* will clear secrets on this object's settings.
|
* will clear secrets on this object's settings.
|
||||||
@@ -898,7 +900,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
|
|||||||
existing_secrets,
|
existing_secrets,
|
||||||
setting_name,
|
setting_name,
|
||||||
flags,
|
flags,
|
||||||
hint,
|
hints,
|
||||||
agent_secrets_done_cb,
|
agent_secrets_done_cb,
|
||||||
self,
|
self,
|
||||||
callback,
|
callback,
|
||||||
@@ -906,12 +908,17 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self,
|
|||||||
if (existing_secrets)
|
if (existing_secrets)
|
||||||
g_hash_table_unref (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)),
|
nm_connection_get_uuid (NM_CONNECTION (self)),
|
||||||
setting_name,
|
setting_name,
|
||||||
call_id,
|
call_id,
|
||||||
flags,
|
flags,
|
||||||
hint);
|
joined_hints ? joined_hints : "(none)");
|
||||||
|
g_free (joined_hints);
|
||||||
|
}
|
||||||
|
|
||||||
return call_id;
|
return call_id;
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ guint32 nm_settings_connection_get_secrets (NMSettingsConnection *connection,
|
|||||||
gulong uid,
|
gulong uid,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
NMSettingsGetSecretsFlags flags,
|
NMSettingsGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char **hints,
|
||||||
NMSettingsConnectionSecretsFunc callback,
|
NMSettingsConnectionSecretsFunc callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
Reference in New Issue
Block a user