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,
|
TRUE,
|
||||||
setting_name,
|
setting_name,
|
||||||
flags,
|
flags,
|
||||||
setting_key,
|
NM_MAKE_STRV (setting_key),
|
||||||
wifi_secrets_cb,
|
wifi_secrets_cb,
|
||||||
nm_utils_user_data_pack (self, invocation));
|
nm_utils_user_data_pack (self, invocation));
|
||||||
}
|
}
|
||||||
@@ -1894,7 +1894,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||||||
TRUE,
|
TRUE,
|
||||||
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION,
|
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION,
|
||||||
"psk",
|
NM_MAKE_STRV ("psk"),
|
||||||
act_psk_cb,
|
act_psk_cb,
|
||||||
self);
|
self);
|
||||||
nm_device_state_changed (device, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE);
|
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,
|
FALSE,
|
||||||
setting_name,
|
setting_name,
|
||||||
flags,
|
flags,
|
||||||
hint,
|
NM_MAKE_STRV (hint),
|
||||||
modem_secrets_cb,
|
modem_secrets_cb,
|
||||||
self);
|
self);
|
||||||
g_return_if_fail (priv->secrets_id);
|
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);
|
setting_name = nm_connection_need_secrets (connection, &hints);
|
||||||
if (!setting_name) {
|
if (!setting_name) {
|
||||||
/* Ready to connect */
|
nm_assert (!hints);
|
||||||
g_assert (!hints);
|
|
||||||
return NM_MODEM_GET_CLASS (self)->act_stage1_prepare (self, connection, out_failure_reason);
|
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++)
|
if (priv->secrets_tries++)
|
||||||
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
|
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,
|
priv->secrets_id = nm_act_request_get_secrets (req,
|
||||||
FALSE,
|
FALSE,
|
||||||
setting_name,
|
setting_name,
|
||||||
flags,
|
flags,
|
||||||
hints ? g_ptr_array_index (hints, 0) : NULL,
|
hints ? (const char *const*) hints->pdata : NULL,
|
||||||
modem_secrets_cb,
|
modem_secrets_cb,
|
||||||
self);
|
self);
|
||||||
g_return_val_if_fail (priv->secrets_id, NM_ACT_STAGE_RETURN_FAILURE);
|
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,
|
gboolean ref_self,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char *const*hints,
|
||||||
NMActRequestSecretsFunc callback,
|
NMActRequestSecretsFunc callback,
|
||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,6 @@ nm_act_request_get_secrets (NMActRequest *self,
|
|||||||
NMSettingsConnectionCallId *call_id_s;
|
NMSettingsConnectionCallId *call_id_s;
|
||||||
NMSettingsConnection *settings_connection;
|
NMSettingsConnection *settings_connection;
|
||||||
NMConnection *applied_connection;
|
NMConnection *applied_connection;
|
||||||
const char *hints[2] = { hint, NULL };
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 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,
|
gboolean take_ref,
|
||||||
const char *setting_name,
|
const char *setting_name,
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
NMSecretAgentGetSecretsFlags flags,
|
||||||
const char *hint,
|
const char *const*hints,
|
||||||
NMActRequestSecretsFunc callback,
|
NMActRequestSecretsFunc callback,
|
||||||
gpointer callback_data);
|
gpointer callback_data);
|
||||||
|
|
||||||
|
@@ -363,7 +363,7 @@ impl_ppp_manager_need_secrets (NMDBusObject *obj,
|
|||||||
const char *username = NULL;
|
const char *username = NULL;
|
||||||
const char *password = NULL;
|
const char *password = NULL;
|
||||||
guint32 tries;
|
guint32 tries;
|
||||||
GPtrArray *hints = NULL;
|
gs_unref_ptrarray GPtrArray *hints = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
|
NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
|
||||||
|
|
||||||
@@ -393,18 +393,18 @@ impl_ppp_manager_need_secrets (NMDBusObject *obj,
|
|||||||
if (tries > 1)
|
if (tries > 1)
|
||||||
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
|
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,
|
priv->secrets_id = nm_act_request_get_secrets (priv->act_req,
|
||||||
FALSE,
|
FALSE,
|
||||||
priv->secrets_setting_name,
|
priv->secrets_setting_name,
|
||||||
flags,
|
flags,
|
||||||
hints ? g_ptr_array_index (hints, 0) : NULL,
|
hints ? (const char *const*) hints->pdata : NULL,
|
||||||
ppp_secrets_cb,
|
ppp_secrets_cb,
|
||||||
self);
|
self);
|
||||||
g_object_set_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark (), GUINT_TO_POINTER (++tries));
|
g_object_set_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark (), GUINT_TO_POINTER (++tries));
|
||||||
priv->pending_secrets_context = invocation;
|
priv->pending_secrets_context = invocation;
|
||||||
|
|
||||||
if (hints)
|
|
||||||
g_ptr_array_free (hints, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user