[PATCH v2 2/7] gnome-keyring: use the vpn_uuid instead of the host (cherry picked from commit db47228f8e73b41549f89d941d52ae8e3acafb62)



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

Conflicts:
	auth-dialog/main.c
---
 auth-dialog/main.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index af797e7..fe1620b 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -118,7 +118,7 @@ static char *_config_path;
 static const GnomeKeyringPasswordSchema OPENCONNECT_SCHEMA_DEF = {
   GNOME_KEYRING_ITEM_GENERIC_SECRET,
   {
-    {"host", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
+    {"vpn_uuid", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
     {"auth_id", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
     {"label", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING},
     {NULL, 0}
@@ -154,6 +154,7 @@ struct gconf_key {
 
 typedef struct auth_ui_data {
 	char *vpn_name;
+	char *vpn_uuid;
 	struct openconnect_info *vpninfo;
 	struct gconf_key *success_keys;
 	GtkWidget *dialog;
@@ -671,14 +672,12 @@ 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 {
-				char *hostname;
-				hostname = openconnect_get_hostname(ui_data->vpninfo);
 				gnome_keyring_find_password(
 						OPENCONNECT_SCHEMA,
 						got_keyring_pw,
 						data,
 						NULL,
-						"host", hostname,
+						"vpn_uuid", ui_data->vpn_uuid,
 						"auth_id", form->auth_id,
 						"label", data->opt->name,
 						NULL
@@ -742,16 +741,14 @@ static int nm_process_auth_form (void *cbdata, struct oc_auth_form *form)
 				if (data->opt->type == OC_FORM_OPT_PASSWORD) {
 					/* store the password in gnome-keyring */
 					char *description;
-					char *hostname;
 					//int result;
 					description = g_strdup_printf(_("OpenConnect: %s: %s:%s"), ui_data->vpn_name, form->auth_id, data->opt->name);
-					hostname = openconnect_get_hostname(ui_data->vpninfo);
 					gnome_keyring_store_password_sync (
 							OPENCONNECT_SCHEMA,
 							GNOME_KEYRING_DEFAULT,
 							description,
 							data->entry_text, /* password */
-							"host", hostname,
+							"vpn_uuid", ui_data->vpn_uuid,
 							"auth_id", form->auth_id,
 							"label", data->opt->name,
 							NULL
@@ -1587,7 +1584,7 @@ static void build_main_dialog(auth_ui_data *ui_data)
 	g_signal_connect(ui_data->log, "changed", G_CALLBACK(scroll_log), view);
 }
 
-static auth_ui_data *init_ui_data (char *vpn_name)
+static auth_ui_data *init_ui_data (char *vpn_name, char *vpn_uuid)
 {
 	auth_ui_data *ui_data;
 
@@ -1600,6 +1597,7 @@ static auth_ui_data *init_ui_data (char *vpn_name)
 	ui_data->form_shown_changed = g_cond_new();
 	ui_data->cert_response_changed = g_cond_new();
 	ui_data->vpn_name = vpn_name;
+	ui_data->vpn_uuid = vpn_uuid;
 	if (pipe(ui_data->cancel_pipes)) {
 		/* This should never happen, and the world is probably about
 		   to come crashing down around our ears. But attempt to cope
@@ -1686,7 +1684,7 @@ int main (int argc, char **argv)
 	g_thread_init (NULL);
 	gtk_init(0, NULL);
 
-	_ui_data = init_ui_data(vpn_name);
+	_ui_data = init_ui_data(vpn_name, vpn_uuid);
 	if (get_config(vpn_uuid, _ui_data->vpninfo)) {
 		fprintf(stderr, "Failed to find VPN UUID %s in gconf\n", vpn_uuid);
 		return 1;
-- 
1.8.0



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