File nm-clear-secrets.patch of Package NetworkManager

Index: NetworkManager-0.7.0/src/vpn-manager/nm-vpn-connection.c
===================================================================
--- NetworkManager-0.7.0.orig/src/vpn-manager/nm-vpn-connection.c
+++ NetworkManager-0.7.0/src/vpn-manager/nm-vpn-connection.c
@@ -288,31 +288,30 @@ plugin_state_changed (DBusGProxy *proxy,
 
 	nm_info ("VPN plugin state changed: %d", state);
 
-	if (state != NM_VPN_SERVICE_STATE_STOPPED)
-		return;
-
-	switch (nm_vpn_connection_get_vpn_state (connection)) {
-	case NM_VPN_CONNECTION_STATE_PREPARE:
-	case NM_VPN_CONNECTION_STATE_NEED_AUTH:
-	case NM_VPN_CONNECTION_STATE_CONNECT:
-	case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
-	case NM_VPN_CONNECTION_STATE_ACTIVATED:
-		nm_info ("VPN plugin state change reason: %d", priv->failure_reason);
-		nm_vpn_connection_set_vpn_state (connection,
-		                                 NM_VPN_CONNECTION_STATE_FAILED,
-										 priv->failure_reason);
-
-		/* Reset the failure reason */
-		priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;
-		break;
-	default:
-		break;
+	if (state == NM_VPN_SERVICE_STATE_STOPPED) {
+		/* Clear connection secrets to ensure secrets get requested each time the
+		 * connection is activated.
+		 */
+		nm_connection_clear_secrets (priv->connection);
+
+		switch (nm_vpn_connection_get_vpn_state (connection)) {
+		case NM_VPN_CONNECTION_STATE_PREPARE:
+		case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+		case NM_VPN_CONNECTION_STATE_CONNECT:
+		case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+		case NM_VPN_CONNECTION_STATE_ACTIVATED:
+			nm_info ("VPN plugin state change reason: %d", priv->failure_reason);
+			nm_vpn_connection_set_vpn_state (connection,
+			                                 NM_VPN_CONNECTION_STATE_FAILED,
+											 priv->failure_reason);
+
+			/* Reset the failure reason */
+			priv->failure_reason = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;
+			break;
+		default:
+			break;
+		}
 	}
-
-	/* Clear connection secrets too so the auth dialogs get asked
-	 * for them next time.
-	 */
-	nm_connection_clear_secrets (priv->connection);
 }
 
 static const char *
openSUSE Build Service is sponsored by