diff options
Diffstat (limited to 'smime')
-rw-r--r-- | smime/ChangeLog | 21 | ||||
-rw-r--r-- | smime/gui/component.c | 29 | ||||
-rw-r--r-- | smime/lib/e-cert-db.c | 29 | ||||
-rw-r--r-- | smime/lib/e-cert-db.h | 2 | ||||
-rw-r--r-- | smime/lib/smime-marshal.list | 1 |
5 files changed, 78 insertions, 4 deletions
diff --git a/smime/ChangeLog b/smime/ChangeLog index 9627956f49..fd54b722fb 100644 --- a/smime/ChangeLog +++ b/smime/ChangeLog @@ -1,3 +1,24 @@ +2004-03-19 Chris Toshok <toshok@ximian.com> + + [ fixes bug #52829 ] + + * lib/smime-marshal.list: add BOOL:POINTER,POINTER for + pk11_change_passwd. + + * lib/e-cert-db.c (e_cert_db_class_init): initialize the + pk11_change_passwd signal. + (e_cert_db_login_to_slot): emit "pk11_change_passwd" with + old_passwd == NULL to initialize the database. + + * lib/e-cert-db.h: add pk11_change_passwd signal slot. + + * gui/component.c (smime_pk11_change_passwd): implement the + portion of this that gets called with old_passwd == NULL (the only + part that needs implementing yet, since we don't have a UI for + changing the password.) + (smime_component_init): hook up to the pk11_change_passwd signal + on ECertDB. + 2004-03-10 Rodney Dawes <dobey@ximian.com> * gui/certificate-viewer.c (certificate_viewer_show): Fix the border diff --git a/smime/gui/component.c b/smime/gui/component.c index 1b27f2d3d2..3c86b6e820 100644 --- a/smime/gui/component.c +++ b/smime/gui/component.c @@ -52,6 +52,31 @@ smime_pk11_passwd (ECertDB *db, PK11SlotInfo* slot, gboolean retry, char **passw return TRUE; } +static gboolean +smime_pk11_change_passwd (ECertDB *db, char **old_passwd, char **passwd, gpointer arg) +{ + char *prompt; + + /* XXX need better strings here, just copy mozilla's? */ + + if (!old_passwd) { + /* we're setting the password initially */ + prompt = _("Enter new password for certificate database"); + + *passwd = e_passwords_ask_password (_("Enter new password"), NULL, NULL, + prompt, TRUE, + E_PASSWORDS_DO_NOT_REMEMBER, NULL, + NULL); + } + else { + /* we're changing the password */ + /* XXX implement this... */ + } + + /* this should return FALSE if they canceled. */ + return TRUE; +} + void smime_component_init (void) { @@ -63,4 +88,8 @@ smime_component_init (void) g_signal_connect (e_cert_db_peek (), "pk11_passwd", G_CALLBACK (smime_pk11_passwd), NULL); + + g_signal_connect (e_cert_db_peek (), + "pk11_change_passwd", + G_CALLBACK (smime_pk11_change_passwd), NULL); } diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index be45f88883..8de335e04a 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -94,6 +94,7 @@ enum { PK11_PASSWD, + PK11_CHANGE_PASSWD, LAST_SIGNAL }; @@ -271,6 +272,16 @@ e_cert_db_class_init (ECertDBClass *klass) smime_marshal_BOOLEAN__POINTER_BOOLEAN_POINTER, G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_BOOLEAN, G_TYPE_POINTER); + + e_cert_db_signals[PK11_CHANGE_PASSWD] = + g_signal_new ("pk11_change_passwd", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECertDBClass, pk11_change_passwd), + NULL, NULL, + smime_marshal_BOOLEAN__POINTER_POINTER, + G_TYPE_BOOLEAN, 2, + G_TYPE_POINTER, G_TYPE_POINTER); } static void @@ -1117,12 +1128,22 @@ e_cert_db_login_to_slot (ECertDB *cert_db, PK11_Logout (slot); if (PK11_NeedUserInit (slot)) { + char *pwd; + gboolean rv = FALSE; + printf ("initializing slot password\n"); + + g_signal_emit (e_cert_db_peek (), + e_cert_db_signals[PK11_CHANGE_PASSWD], 0, + NULL, + &pwd, + &rv); + + if (!rv) + return FALSE; + /* the user needs to specify the initial password */ - /* XXX toshok - this should use a signal to - pop up a password dialog ala the - pk11_passwd prompt. for now we do it - here. */ + PK11_InitPin (slot, "", pwd); } if (PK11_Authenticate (slot, PR_TRUE, NULL) != SECSuccess) { diff --git a/smime/lib/e-cert-db.h b/smime/lib/e-cert-db.h index d31fc02186..3fb6c62c71 100644 --- a/smime/lib/e-cert-db.h +++ b/smime/lib/e-cert-db.h @@ -50,6 +50,8 @@ struct _ECertDBClass { /* signals */ gboolean (*pk11_passwd) (ECertDB *db, PK11SlotInfo *slot, gboolean retry, char **passwd); + gboolean (*pk11_change_passwd) (ECertDB *db, char **orig_passwd, char **passwd); + /* Padding for future expansion */ void (*_ecert_reserved0) (void); void (*_ecert_reserved1) (void); diff --git a/smime/lib/smime-marshal.list b/smime/lib/smime-marshal.list index 97c7a93233..dbdd3c3159 100644 --- a/smime/lib/smime-marshal.list +++ b/smime/lib/smime-marshal.list @@ -1 +1,2 @@ BOOL:POINTER,BOOL,POINTER +BOOL:POINTER,POINTER |