aboutsummaryrefslogtreecommitdiffstats
path: root/smime/lib/e-cert.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-11-13 10:23:52 +0800
committerChris Toshok <toshok@src.gnome.org>2003-11-13 10:23:52 +0800
commitbdba680ed59ee12b4bdcdae2d5a6c3e8cc59daea (patch)
tree18089837a8fe8eb029233dac94a8f5a06d9ea39b /smime/lib/e-cert.c
parent7e734202c2be76070d5f9a0af821f03191aaf25e (diff)
downloadgsoc2013-evolution-bdba680ed59ee12b4bdcdae2d5a6c3e8cc59daea.tar.gz
gsoc2013-evolution-bdba680ed59ee12b4bdcdae2d5a6c3e8cc59daea.tar.zst
gsoc2013-evolution-bdba680ed59ee12b4bdcdae2d5a6c3e8cc59daea.zip
implement using the e-cert-trust foo. (e_cert_get_email): implement.
2003-11-12 Chris Toshok <toshok@ximian.com> * lib/e-cert.c (e_cert_get_cert_type): implement using the e-cert-trust foo. (e_cert_get_email): implement. * lib/e-cert.h: add UNKNOWN cert type. * gui/smime-ui.glade: fix capitalization of "Import" on the contact certificate page. * gui/certificate-manager.c (import_contact): new function. implement email cert importing. (delete_contact): new function. (unload_certs): implement for E_CERT_CONTACT. (certificate_manager_config_control_new): get the contact cert action buttons from libglade. * lib/e-cert-db.c (handle_ca_cert_download): mostly implement the trust settings correctly. this still needs work pending the CA trust dialog's completion. (e_cert_db_delete_cert): fix the ifdef'ed code. (e_cert_db_import_user_cert): remove the ifdef'ed body of this, since it was copied from the CA code. * lib/Makefile.am (libessmime_la_SOURCES): add e-cert-trust.[ch] * lib/e-cert-trust.[ch]: new files, basically c&p nsNSSCertTrust from mozilla's PSM. svn path=/trunk/; revision=23308
Diffstat (limited to 'smime/lib/e-cert.c')
-rw-r--r--smime/lib/e-cert.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c
index 7db638b884..9563468de3 100644
--- a/smime/lib/e-cert.c
+++ b/smime/lib/e-cert.c
@@ -56,6 +56,7 @@
*/
#include "e-cert.h"
+#include "e-cert-trust.h"
#include "pk11func.h"
#include "certdb.h"
@@ -219,6 +220,7 @@ e_cert_get_nickname (ECert *cert)
const char*
e_cert_get_email (ECert *cert)
{
+ return cert->priv->cert->emailAddr;
}
const char*
@@ -269,10 +271,23 @@ e_cert_mark_for_deletion (ECert *cert)
}
ECertType
-e_cert_get_cert_type (ECert *cert)
+e_cert_get_cert_type (ECert *ecert)
{
- if (CERT_IsCACert (cert->priv->cert, NULL))
- return E_CERT_CA;
- else /* XXX more here */
- return E_CERT_USER;
+ const char *nick = e_cert_get_nickname (ecert);
+ const char *email = e_cert_get_email (ecert);
+ CERTCertificate *cert = ecert->priv->cert;
+
+ if (nick) {
+ if (e_cert_trust_has_any_user (cert->trust))
+ return E_CERT_USER;
+ if (e_cert_trust_has_any_ca (cert->trust)
+ || CERT_IsCACert(cert,NULL))
+ return E_CERT_CA;
+ if (e_cert_trust_has_peer (cert->trust, PR_TRUE, PR_FALSE, PR_FALSE))
+ return E_CERT_SITE;
+ }
+ if (email && e_cert_trust_has_peer (cert->trust, PR_FALSE, PR_TRUE, PR_FALSE))
+ return E_CERT_CONTACT;
+
+ return E_CERT_UNKNOWN;
}