core: pass hints as strv to nm_act_request_get_secrets()
Extend nm_act_request_get_secrets() API to allow for the underlying flexibility (of the API that it calls) to accept a strv list of hints.
This commit is contained in:
@@ -1380,7 +1380,7 @@ wifi_secrets_get_one (NMDeviceIwd *self,
|
||||
TRUE,
|
||||
setting_name,
|
||||
flags,
|
||||
setting_key,
|
||||
NM_MAKE_STRV (setting_key),
|
||||
wifi_secrets_cb,
|
||||
nm_utils_user_data_pack (self, invocation));
|
||||
}
|
||||
@@ -1894,7 +1894,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
TRUE,
|
||||
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION,
|
||||
"psk",
|
||||
NM_MAKE_STRV ("psk"),
|
||||
act_psk_cb,
|
||||
self);
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE);
|
||||
|
@@ -948,7 +948,7 @@ nm_modem_get_secrets (NMModem *self,
|
||||
FALSE,
|
||||
setting_name,
|
||||
flags,
|
||||
hint,
|
||||
NM_MAKE_STRV (hint),
|
||||
modem_secrets_cb,
|
||||
self);
|
||||
g_return_if_fail (priv->secrets_id);
|
||||
@@ -986,8 +986,7 @@ nm_modem_act_stage1_prepare (NMModem *self,
|
||||
|
||||
setting_name = nm_connection_need_secrets (connection, &hints);
|
||||
if (!setting_name) {
|
||||
/* Ready to connect */
|
||||
g_assert (!hints);
|
||||
nm_assert (!hints);
|
||||
return NM_MODEM_GET_CLASS (self)->act_stage1_prepare (self, connection, out_failure_reason);
|
||||
}
|
||||
|
||||
@@ -995,11 +994,14 @@ nm_modem_act_stage1_prepare (NMModem *self,
|
||||
if (priv->secrets_tries++)
|
||||
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
|
||||
|
||||
if (hints)
|
||||
g_ptr_array_add (hints, NULL);
|
||||
|
||||
priv->secrets_id = nm_act_request_get_secrets (req,
|
||||
FALSE,
|
||||
setting_name,
|
||||
flags,
|
||||
hints ? g_ptr_array_index (hints, 0) : NULL,
|
||||
hints ? (const char *const*) hints->pdata : NULL,
|
||||
modem_secrets_cb,
|
||||
self);
|
||||
g_return_val_if_fail (priv->secrets_id, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
@@ -166,7 +166,7 @@ nm_act_request_get_secrets (NMActRequest *self,
|
||||
gboolean ref_self,
|
||||
const char *setting_name,
|
||||
NMSecretAgentGetSecretsFlags flags,
|
||||
const char *hint,
|
||||
const char *const*hints,
|
||||
NMActRequestSecretsFunc callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
@@ -175,7 +175,6 @@ nm_act_request_get_secrets (NMActRequest *self,
|
||||
NMSettingsConnectionCallId *call_id_s;
|
||||
NMSettingsConnection *settings_connection;
|
||||
NMConnection *applied_connection;
|
||||
const char *hints[2] = { hint, NULL };
|
||||
|
||||
g_return_val_if_fail (NM_IS_ACT_REQUEST (self), NULL);
|
||||
|
||||
|
@@ -69,7 +69,7 @@ NMActRequestGetSecretsCallId *nm_act_request_get_secrets (NMActRequest *req,
|
||||
gboolean take_ref,
|
||||
const char *setting_name,
|
||||
NMSecretAgentGetSecretsFlags flags,
|
||||
const char *hint,
|
||||
const char *const*hints,
|
||||
NMActRequestSecretsFunc callback,
|
||||
gpointer callback_data);
|
||||
|
||||
|
@@ -363,7 +363,7 @@ impl_ppp_manager_need_secrets (NMDBusObject *obj,
|
||||
const char *username = NULL;
|
||||
const char *password = NULL;
|
||||
guint32 tries;
|
||||
GPtrArray *hints = NULL;
|
||||
gs_unref_ptrarray GPtrArray *hints = NULL;
|
||||
GError *error = NULL;
|
||||
NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
|
||||
|
||||
@@ -393,18 +393,18 @@ impl_ppp_manager_need_secrets (NMDBusObject *obj,
|
||||
if (tries > 1)
|
||||
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
|
||||
|
||||
if (hints)
|
||||
g_ptr_array_add (hints, NULL);
|
||||
|
||||
priv->secrets_id = nm_act_request_get_secrets (priv->act_req,
|
||||
FALSE,
|
||||
priv->secrets_setting_name,
|
||||
flags,
|
||||
hints ? g_ptr_array_index (hints, 0) : NULL,
|
||||
hints ? (const char *const*) hints->pdata : NULL,
|
||||
ppp_secrets_cb,
|
||||
self);
|
||||
g_object_set_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark (), GUINT_TO_POINTER (++tries));
|
||||
priv->pending_secrets_context = invocation;
|
||||
|
||||
if (hints)
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user