aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2009-09-11 17:14:39 +0800
committerXan Lopez <xan@gnome.org>2009-09-11 17:14:39 +0800
commitec94410d508aaeb3498c7ae887d829ff8a77e4d8 (patch)
tree957f8a51056181debfdd5130266118870dc040e1 /src
parentba217a89984a7a8af029e88ec774f4e71309d574 (diff)
downloadgsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.tar
gsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.tar.gz
gsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.tar.bz2
gsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.tar.lz
gsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.tar.xz
gsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.tar.zst
gsoc2013-epiphany-ec94410d508aaeb3498c7ae887d829ff8a77e4d8.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/ephy-nss-glue.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ephy-nss-glue.c b/src/ephy-nss-glue.c
index 84992e782..d60326cdb 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;