From 7a6baa8ab4dd8a8420f9eded236f38b38890f3c9 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 22 Jun 2012 15:03:05 -0500 Subject: [PATCH] vpn: ensure secrets requests fail when exhausted If the plugin says the user-provided secrets are insufficient, make sure we fail instead of potentially overrunning the secrets counter (which triggered an assert). --- src/vpn-manager/nm-vpn-connection.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index 1d6c6c2a33..d01595d017 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1357,11 +1357,19 @@ plugin_need_secrets_cb (DBusGProxy *proxy, if (setting_name && strlen (setting_name)) { /* More secrets required */ - nm_log_dbg (LOGD_VPN, "(%s/%s) service indicated additional secrets required", - nm_connection_get_uuid (priv->connection), - nm_connection_get_id (priv->connection)); - get_secrets (self, priv->secrets_idx + 1); + if (priv->secrets_idx == SECRETS_REQ_NEW) { + nm_log_err (LOGD_VPN, "(%s/%s) final secrets request failed to provide sufficient secrets", + nm_connection_get_uuid (priv->connection), + nm_connection_get_id (priv->connection)); + nm_vpn_connection_fail (self, NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS); + } else { + nm_log_dbg (LOGD_VPN, "(%s/%s) service indicated additional secrets required", + nm_connection_get_uuid (priv->connection), + nm_connection_get_id (priv->connection)); + + get_secrets (self, priv->secrets_idx + 1); + } return; }