=?UTF-8?q?=5BPATCH=204/7=5D=20Handle=20string=20=3D=3D=20NULL=20in=20gnome-keyring=20callback=20=28cherry=20picked=20from=20commit=2031a0e8b8cf78206cda34ab593ba90c3d28ebbc29=29?=



Signed-off-by: Murilo Opsfelder Araujo <muriloo linux vnet ibm com>

Conflicts:
	auth-dialog/main.c
---
 auth-dialog/main.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index e69b618..6ae3ea4 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -311,6 +311,7 @@ static void ssl_box_clear(auth_ui_data *ui_data)
 typedef struct ui_fragment_data {
 	GtkWidget *widget;
 	GtkWidget *entry;
+	gpointer find_request;
 	auth_ui_data *ui_data;
 #ifdef OPENCONNECT_OPENSSL
 	UI_STRING *uis;
@@ -665,6 +666,7 @@ static char *find_form_answer(struct oc_auth_form *form, struct oc_form_opt *opt
 static void got_keyring_pw(GnomeKeyringResult result, const char *string, gpointer userdata)
 {
 	ui_fragment_data *data = (ui_fragment_data*)userdata;
+	if (string != NULL) {
 		if (data->entry) {
 			if (g_ascii_strncasecmp("", gtk_entry_get_text(GTK_ENTRY(data->entry)), 0) == 0)
 				gtk_entry_set_text(GTK_ENTRY(data->entry), string);
@@ -672,6 +674,11 @@ static void got_keyring_pw(GnomeKeyringResult result, const char *string, gpoint
 			data->entry_text = g_strdup (string);
 	}
 
+	/* zero the find request so that we don’t attempt to cancel it when
+	 * closing the dialog */
+	data->find_request = NULL;
+}
+
 /* This part for processing forms from openconnect directly, rather than
    through the SSL UI abstraction (which doesn't allow 'select' options) */
 
@@ -713,7 +720,7 @@ static gboolean ui_form (struct oc_auth_form *form)
 			if (opt->type != OC_FORM_OPT_PASSWORD)
 				data->entry_text = find_form_answer(form, opt);
 			else {
-				gnome_keyring_find_password(
+				data->find_request = gnome_keyring_find_password(
 						OPENCONNECT_SCHEMA,
 						got_keyring_pw,
 						data,
@@ -769,6 +776,10 @@ static int nm_process_auth_form (void *cbdata, struct oc_auth_form *form)
 		while (!g_queue_is_empty (ui_data->form_entries)) {
 			ui_fragment_data *data;
 			data = g_queue_pop_tail (ui_data->form_entries);
+
+			if (data->find_request)
+				gnome_keyring_cancel_request (data->find_request);
+
 			if (data->entry_text) {
 				data->opt->value = data->entry_text;
 
-- 
1.8.0



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