aboutsummaryrefslogtreecommitdiffstats
path: root/smime/lib
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-03-25 06:27:01 +0800
committerChris Toshok <toshok@src.gnome.org>2004-03-25 06:27:01 +0800
commit4abed2292a3e45072da19c81b6c53fab926660c7 (patch)
tree5c16f8f099a57565169029004f124bc6d3732af7 /smime/lib
parent2ac983181ab03ef7f71cba91201c2d88add302b0 (diff)
downloadgsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.tar
gsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.tar.gz
gsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.tar.bz2
gsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.tar.lz
gsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.tar.xz
gsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.tar.zst
gsoc2013-evolution-4abed2292a3e45072da19c81b6c53fab926660c7.zip
add BOOL:POINTER,POINTER,POINTER,POINTER for confirm_ca_cert_import.
2004-03-24 Chris Toshok <toshok@ximian.com> * lib/smime-marshal.list: add BOOL:POINTER,POINTER,POINTER,POINTER for confirm_ca_cert_import. * lib/e-cert-db.c (e_cert_db_class_init): initialize the confirm_ca_cert_import signal. (confirm_download_ca_cert): emit confirm_ca_cert_import and use the returned values. (handle_ca_cert_download): fix the ca trust foo. (e_cert_db_import_certs): pass the cerdb to handle_ca_cert_download since we need to emit something on that object. * lib/e-cert-db.h (struct _ECertDBClass): add confirm_ca_cert_import signal. * gui/smime-ui.glade: give names to the check buttons in the ca trust dialog. * gui/component.c (smime_confirm_ca_cert_import): new function, show the trust dialog. (smime_component_init): connect to "confirm_ca_cert_import" signal. * gui/certificate-viewer.c (fill_in_general): fix lots of uninitialized variable accesses. (certificate_viewer_show): don't show the dialog (or connect to the response signal.) that's the caller's job. * gui/certificate-manager.c (view_your): do the showing of the certificate_viewer here. (view_contact): same. (view_ca): same. (edit_ca): new function, pop up the ca trust dialog. we need more here though, to fill in the toggle buttons when bringing up the dialog, and also to save out the settings when the user clicks ok. (initialize_authoritycerts_ui): hook up the edit_ca button. * gui/Makefile.am (libevolution_smime_la_SOURCES): add ca-trust-dialog.[ch]. * gui/ca-trust-dialog.[ch]: new file implementing the ca trust dialog used for importing/editing ca trust levels. svn path=/trunk/; revision=25177
Diffstat (limited to 'smime/lib')
-rw-r--r--smime/lib/e-cert-db.c59
-rw-r--r--smime/lib/e-cert-db.h2
-rw-r--r--smime/lib/smime-marshal.list1
3 files changed, 37 insertions, 25 deletions
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c
index 8de335e04a..7831572097 100644
--- a/smime/lib/e-cert-db.c
+++ b/smime/lib/e-cert-db.c
@@ -95,6 +95,7 @@
enum {
PK11_PASSWD,
PK11_CHANGE_PASSWD,
+ CONFIRM_CA_CERT_IMPORT,
LAST_SIGNAL
};
@@ -282,6 +283,16 @@ e_cert_db_class_init (ECertDBClass *klass)
smime_marshal_BOOLEAN__POINTER_POINTER,
G_TYPE_BOOLEAN, 2,
G_TYPE_POINTER, G_TYPE_POINTER);
+
+ e_cert_db_signals[CONFIRM_CA_CERT_IMPORT] =
+ g_signal_new ("confirm_ca_cert_import",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECertDBClass, confirm_ca_cert_import),
+ NULL, NULL,
+ smime_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER,
+ G_TYPE_BOOLEAN, 4,
+ G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
}
static void
@@ -475,16 +486,27 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb,
}
static gboolean
-_confirm_download_ca_cert (ECert *cert, guint32 *trustBits, gboolean *allow)
+confirm_download_ca_cert (ECertDB *cert_db, ECert *cert, gboolean *trust_ssl, gboolean *trust_email, gboolean *trust_objsign)
{
- /* right now just allow it and set the trustBits to 0 */
- *trustBits = 0;
- *allow = TRUE;
- return TRUE;
+ gboolean rv = FALSE;
+
+ *trust_ssl =
+ *trust_email =
+ *trust_objsign = FALSE;
+
+ g_signal_emit (e_cert_db_peek (),
+ e_cert_db_signals[CONFIRM_CA_CERT_IMPORT], 0,
+ cert,
+ trust_ssl,
+ trust_email,
+ trust_objsign,
+ &rv);
+
+ return rv;
}
static gboolean
-handle_ca_cert_download(GList *certs, GError **error)
+handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error)
{
ECert *certToShow;
SECItem der;
@@ -579,23 +601,18 @@ handle_ca_cert_download(GList *certs, GError **error)
#endif
if (tmpCert->isperm) {
+ /* XXX we shouldn't be popping up dialogs in this code. */
e_notice (NULL, GTK_MESSAGE_WARNING, _("Certificate already exists"));
/* XXX gerror */
return FALSE;
}
else {
- guint32 trustBits;
- gboolean allow;
+ gboolean trust_ssl, trust_email, trust_objsign;
char *nickname;
SECStatus srv;
CERTCertTrust trust;
- if (!_confirm_download_ca_cert (certToShow, &trustBits, &allow)) {
- /* XXX gerror */
- return FALSE;
- }
-
- if (!allow) {
+ if (!confirm_download_ca_cert (cert_db, certToShow, &trust_ssl, &trust_email, &trust_objsign)) {
/* XXX gerror */
return FALSE;
}
@@ -609,15 +626,9 @@ handle_ca_cert_download(GList *certs, GError **error)
e_cert_trust_init (&trust);
e_cert_trust_set_valid_ca (&trust);
e_cert_trust_add_ca_trust (&trust,
-#if 1
- /* XXX we need that ui working i guess. */
- 0, 0, 0
-#else
- trustBits & nsIX509CertDB::TRUSTED_SSL,
- trustBits & nsIX509CertDB::TRUSTED_EMAIL,
- trustBits & nsIX509CertDB::TRUSTED_OBJSIGN
-#endif
-);
+ trust_ssl,
+ trust_email,
+ trust_objsign);
srv = CERT_AddTempCertToPerm(tmpCert,
nickname,
@@ -730,7 +741,7 @@ e_cert_db_import_certs (ECertDB *certdb,
}
switch (cert_type) {
case E_CERT_CA:
- rv = handle_ca_cert_download(certs, error);
+ rv = handle_ca_cert_download(certdb, certs, error);
break;
default:
/* We only deal with import CA certs in this method currently.*/
diff --git a/smime/lib/e-cert-db.h b/smime/lib/e-cert-db.h
index 3fb6c62c71..59cd10906a 100644
--- a/smime/lib/e-cert-db.h
+++ b/smime/lib/e-cert-db.h
@@ -49,8 +49,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);
+ gboolean (*confirm_ca_cert_import) (ECertDB *db, ECert *cert, gboolean *trust_ssl, gboolean *trust_email, gboolean *trust_objsign);
/* Padding for future expansion */
void (*_ecert_reserved0) (void);
diff --git a/smime/lib/smime-marshal.list b/smime/lib/smime-marshal.list
index dbdd3c3159..6eb2617ec0 100644
--- a/smime/lib/smime-marshal.list
+++ b/smime/lib/smime-marshal.list
@@ -1,2 +1,3 @@
BOOL:POINTER,BOOL,POINTER
BOOL:POINTER,POINTER
+BOOL:POINTER,POINTER,POINTER,POINTER