[epiphany] ephy-nss-glue.c: ask for the NSS master password if needed
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-nss-glue.c: ask for the NSS master password if needed
- Date: Fri, 11 Sep 2009 09:14:56 +0000 (UTC)
commit ec94410d508aaeb3498c7ae887d829ff8a77e4d8
Author: Xan Lopez <xan gnome org>
Date: Fri Sep 11 12:14:39 2009 +0300
ephy-nss-glue.c: ask for the NSS master password if needed
It was possible to set a master password for NSS through the
certificate manager extension, so we have to support this.
Bug #594694
src/ephy-nss-glue.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-nss-glue.c b/src/ephy-nss-glue.c
index 84992e7..d60326c 100644
--- a/src/ephy-nss-glue.c
+++ b/src/ephy-nss-glue.c
@@ -37,10 +37,50 @@
#include <nss.h>
#include <pk11pub.h>
#include <pk11sdr.h>
+#include <glib/gi18n.h>
static gboolean nss_initialized = FALSE;
static PK11SlotInfo *db_slot = NULL;
+static char*
+ask_for_nss_password (PK11SlotInfo *slot,
+ PRBool retry,
+ void *arg)
+{
+ GtkWidget *dialog;
+ GtkWidget *entry;
+ gint result;
+ char *password = NULL;
+
+ if (retry)
+ return NULL;
+
+ dialog = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_OK_CANCEL,
+ _("Master password needed"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("The passwords from the previous version (Gecko) are locked with a master password. If you want Epiphany to import them, please enter your master password below."));
+ entry = gtk_entry_new ();
+ gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), entry);
+ gtk_widget_show (entry);
+
+ result = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ switch (result) {
+ case GTK_RESPONSE_OK:
+ password = PL_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+ break;
+ default:
+ break;
+ }
+
+ gtk_widget_destroy (dialog);
+ return password;
+}
+
gboolean ephy_nss_glue_init ()
{
char *config_dir, *modspec;
@@ -65,6 +105,10 @@ gboolean ephy_nss_glue_init ()
if (!db_slot)
return FALSE;
+ /* It's possibly to set a master password for NSS through the
+ certificate manager extension, so we must support that too */
+ PK11_SetPasswordFunc (ask_for_nss_password);
+
nss_initialized = TRUE;
return TRUE;
@@ -77,6 +121,8 @@ void ephy_nss_glue_close ()
db_slot = NULL;
}
+ PK11_SetPasswordFunc (NULL);
+
NSS_Shutdown ();
nss_initialized = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]