diff options
-rw-r--r-- | src/settings/nm-agent-manager.c | 2 | ||||
-rw-r--r-- | src/settings/nm-agent-manager.h | 2 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.c | 2 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.h | 2 | ||||
-rw-r--r-- | src/vpn/nm-vpn-connection.c | 32 |
5 files changed, 22 insertions, 18 deletions
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index bcd178435f..29abd71bd5 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -1213,7 +1213,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self, GVariant *existing_secrets, const char *setting_name, NMSecretAgentGetSecretsFlags flags, - const char **hints, + const char *const*hints, NMAgentSecretsResultFunc callback, gpointer callback_data) { diff --git a/src/settings/nm-agent-manager.h b/src/settings/nm-agent-manager.h index 7f8126935f..c2a2ec1d8f 100644 --- a/src/settings/nm-agent-manager.h +++ b/src/settings/nm-agent-manager.h @@ -60,7 +60,7 @@ NMAgentManagerCallId nm_agent_manager_get_secrets (NMAgentManager *manager, GVariant *existing_secrets, const char *setting_name, NMSecretAgentGetSecretsFlags flags, - const char **hints, + const char *const*hints, NMAgentSecretsResultFunc callback, gpointer callback_data); diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index ed69115c8b..1185aef905 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -1228,7 +1228,7 @@ nm_settings_connection_get_secrets (NMSettingsConnection *self, NMAuthSubject *subject, const char *setting_name, NMSecretAgentGetSecretsFlags flags, - const char **hints, + const char *const*hints, NMSettingsConnectionSecretsFunc callback, gpointer callback_data) { diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index faacd94909..7a9e383259 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -167,7 +167,7 @@ NMSettingsConnectionCallId nm_settings_connection_get_secrets (NMSettingsConnect NMAuthSubject *subject, const char *setting_name, NMSecretAgentGetSecretsFlags flags, - const char **hints, + const char *const*hints, NMSettingsConnectionSecretsFunc callback, gpointer callback_data); diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index 7122243d35..e441bbd051 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -185,13 +185,13 @@ static NMSettingsConnection *_get_settings_connection (NMVpnConnection *self, static void get_secrets (NMVpnConnection *self, SecretsReq secrets_idx, - const char **hints); + const char *const*hints); static guint32 get_route_table (NMVpnConnection *self, int addr_family, gboolean fallback_main); static void plugin_interactive_secrets_required (NMVpnConnection *self, const char *message, - const char **secrets); + const char *const*secrets); static void _set_vpn_state (NMVpnConnection *self, VpnState vpn_state, @@ -2047,7 +2047,7 @@ state_changed_cb (GDBusProxy *proxy, static void secrets_required_cb (GDBusProxy *proxy, const char *message, - const char **secrets, + const char *const*secrets, gpointer user_data) { NMVpnConnection *self = NM_VPN_CONNECTION (user_data); @@ -2638,7 +2638,7 @@ get_secrets_cb (NMSettingsConnection *connection, static void get_secrets (NMVpnConnection *self, SecretsReq secrets_idx, - const char **hints) + const char *const*hints) { NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self); NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE; @@ -2683,12 +2683,13 @@ get_secrets (NMVpnConnection *self, static void plugin_interactive_secrets_required (NMVpnConnection *self, const char *message, - const char **secrets) + const char *const*secrets) { NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self); - guint32 secrets_len = secrets ? g_strv_length ((char **) secrets) : 0; - char **hints; - guint32 i; + const gsize secrets_len = NM_PTRARRAY_LEN (secrets); + gsize i; + gs_free const char **hints = NULL; + gs_free char *message_hint = NULL; _LOGI ("VPN plugin: requested secrets; state %s (%d)", vpn_state_to_string (priv->vpn_state), priv->vpn_state); @@ -2700,14 +2701,17 @@ plugin_interactive_secrets_required (NMVpnConnection *self, _set_vpn_state (self, STATE_NEED_AUTH, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE); /* Copy hints and add message to the end */ - hints = g_malloc0 (sizeof (char *) * (secrets_len + 2)); + hints = g_new (const char *, secrets_len + 2); for (i = 0; i < secrets_len; i++) - hints[i] = g_strdup (secrets[i]); - if (message) - hints[i] = g_strdup_printf ("x-vpn-message:%s", message); + hints[i] = secrets[i]; + if (message) { + message_hint = g_strdup_printf ("x-vpn-message:%s", message); + hints[i++] = message_hint; + } + hints[i] = NULL; + nm_assert (i < secrets_len + 2); - get_secrets (self, SECRETS_REQ_INTERACTIVE, (const char **) hints); - g_strfreev (hints); + get_secrets (self, SECRETS_REQ_INTERACTIVE, hints); } /*****************************************************************************/ |