aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-12-04 04:17:35 +0800
committerChris Toshok <toshok@src.gnome.org>2003-12-04 04:17:35 +0800
commitd5cf06d5c681e540a545ccc11dfb9f1413ee02d6 (patch)
tree649fd4a25df8c92b72276aaa9977ee68f32a7221
parent9407166101cd70d7920e1122eb96617b6028ea38 (diff)
downloadgsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.tar
gsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.tar.gz
gsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.tar.bz2
gsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.tar.lz
gsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.tar.xz
gsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.tar.zst
gsoc2013-evolution-d5cf06d5c681e540a545ccc11dfb9f1413ee02d6.zip
grovel around at startup time for mozilla's pkcs11 module so we can get
2003-12-03 Chris Toshok <toshok@ximian.com> * lib/e-cert-db.c (e_cert_db_class_init): grovel around at startup time for mozilla's pkcs11 module so we can get the same default set of root certs. svn path=/trunk/; revision=23621
-rw-r--r--smime/ChangeLog6
-rw-r--r--smime/lib/e-cert-db.c48
2 files changed, 54 insertions, 0 deletions
diff --git a/smime/ChangeLog b/smime/ChangeLog
index b2fa0046b0..243ad27657 100644
--- a/smime/ChangeLog
+++ b/smime/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-03 Chris Toshok <toshok@ximian.com>
+
+ * lib/e-cert-db.c (e_cert_db_class_init): grovel around at startup
+ time for mozilla's pkcs11 module so we can get the same default
+ set of root certs.
+
2003-11-30 Larry Ewing <lewing@ximian.com>
* lib/e-pkcs12.c (nickname_collision): make sure declarations
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c
index a597a305af..5acdf4e847 100644
--- a/smime/lib/e-cert-db.c
+++ b/smime/lib/e-cert-db.c
@@ -65,8 +65,11 @@
#include "e-cert-db.h"
#include "e-cert-trust.h"
+#include "gmodule.h"
+
#include "nss.h"
#include "pk11func.h"
+#include "secmod.h"
#include "certdb.h"
#include "plstr.h"
#include "prprf.h"
@@ -112,6 +115,8 @@ e_cert_db_class_init (ECertDBClass *klass)
GObjectClass *object_class;
char *evolution_dir_path;
gboolean success;
+ gboolean has_roots;
+ PK11SlotList *list;
object_class = G_OBJECT_CLASS(klass);
@@ -138,6 +143,49 @@ e_cert_db_class_init (ECertDBClass *klass)
if (!success) {
g_warning ("Failed all methods for initializing NSS");
}
+
+ /*
+ * check to see if you have a rootcert module installed
+ */
+
+ has_roots = FALSE;
+ list = PK11_GetAllTokens(CKM_INVALID_MECHANISM, PR_FALSE, PR_FALSE, NULL);
+ if (list) {
+ PK11SlotListElement *le;
+
+ for (le = list->head; le; le = le->next) {
+ if (PK11_HasRootCerts(le->slot)) {
+ has_roots = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (!has_roots) {
+ /* grovel in various places for mozilla's built-in
+ cert module.
+
+ XXX yes this is gross. *sigh*
+ */
+ char *paths_to_check[] = {
+ "/usr/lib",
+ "/usr/lib/mozilla",
+ };
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS (paths_to_check); i ++) {
+ char *dll_path = g_module_build_path (paths_to_check [i],
+ "nssckbi");
+
+ if (g_file_test (dll_path, G_FILE_TEST_EXISTS)) {
+ SECMOD_AddNewModule("Mozilla Root Certs",dll_path, 0, 0);
+ g_free (dll_path);
+ break;
+ }
+
+ g_free (dll_path);
+ }
+ }
}
static void