[network-manager-openconnect] Always dump secrets on exit, even on failure.



commit 7633de58be9aadbbdb2a3a15a22ee1f9e8896cf4
Author: David Woodhouse <David Woodhouse intel com>
Date:   Tue Apr 19 12:21:31 2011 +0100

    Always dump secrets on exit, even on failure.
    
    This means that configuration options like 'autoconnect' can still be saved

 auth-dialog/main.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 54c8b8b..2545735 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1033,7 +1033,6 @@ static gboolean cookie_obtained(auth_ui_data *ui_data)
 		}
 		ui_data->retval = 1;
 	} else if (!ui_data->cookie_retval) {
-		GHashTableIter iter;
 		X509 *cert;
 		gchar *key, *value;
 
@@ -1064,15 +1063,6 @@ static gboolean cookie_obtained(auth_ui_data *ui_data)
 			g_hash_table_insert (ui_data->secrets, key, value);
 		}
 
-		/* Dump all secrets to stdout */
-		g_hash_table_iter_init (&iter, ui_data->secrets);
-		while (g_hash_table_iter_next (&iter, (gpointer *)&key,
-					       (gpointer *)&value))
-			printf("%s\n%s\n", key, value);
-
-
-		printf("\n\n");
-		fflush(stdout);
 		ui_data->retval = 0;
 
 		gtk_main_quit();
@@ -1355,6 +1345,8 @@ int main (int argc, char **argv)
 	char *vpn_name = NULL, *vpn_uuid = NULL, *vpn_service = NULL;
 	GHashTable *options = NULL, *secrets = NULL;
 	gboolean allow_interaction = FALSE;
+	GHashTableIter iter;
+	gchar *key, *value;
 	int opt;
 
 	while ((opt = getopt_long(argc, argv, "ru:n:s:i", long_options, NULL))) {
@@ -1432,5 +1424,14 @@ int main (int argc, char **argv)
 	gtk_window_present(GTK_WINDOW(_ui_data->dialog));
 	gtk_main();
 
+	/* Dump all secrets to stdout */
+	g_hash_table_iter_init (&iter, _ui_data->secrets);
+	while (g_hash_table_iter_next (&iter, (gpointer *)&key,
+				       (gpointer *)&value))
+		printf("%s\n%s\n", key, value);
+
+	printf("\n\n");
+	fflush(stdout);
+
 	return _ui_data->retval;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]