1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Bertrand Guiheneuf <bertrand@helixcode.com>
8 * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
34 #include "nss.h" /* Don't use <> here or it will include the system nss.h instead */
39 #include "camel-iconv.h"
40 #include "camel-certdb.h"
41 #include "camel-mime-utils.h"
43 gboolean camel_verbose_debug = FALSE;
56 certdb = camel_certdb_get_default ();
58 camel_certdb_save (certdb);
59 camel_object_unref (certdb);
62 camel_iconv_shutdown ();
66 camel_init (const char *configdir, gboolean nss_init)
72 #ifdef G_THREADS_ENABLED
73 /*g_thread_init (NULL);*/
74 #else /* G_THREADS_ENABLED */
75 g_warning ("Threads are not supported by your version of glib");
76 #endif /* G_THREADS_ENABLED */
77 #endif /* ENABLE_THREADS */
79 if (getenv ("CAMEL_VERBOSE_DEBUG"))
80 camel_verbose_debug = TRUE;
82 /* initialise global camel_object_type */
83 camel_object_get_type();
87 camel_mime_utils_init ();
91 PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10);
93 if (NSS_InitReadWrite (configdir) == SECFailure) {
94 /* fall back on using volatile dbs? */
95 if (NSS_NoDB_Init (configdir) == SECFailure) {
96 g_warning ("Failed to initialize NSS");
101 NSS_SetDomesticPolicy ();
103 SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE);
104 SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE);
105 SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE);
106 SSL_OptionSetDefault (SSL_V2_COMPATIBLE_HELLO, PR_TRUE /* maybe? */);
108 #endif /* HAVE_NSS */
110 path = g_strdup_printf ("%s/camel-cert.db", configdir);
111 certdb = camel_certdb_new ();
112 camel_certdb_set_filename (certdb, path);
115 /* if we fail to load, who cares? it'll just be a volatile certdb */
116 camel_certdb_load (certdb);
118 /* set this certdb as the default db */
119 camel_certdb_set_default (certdb);
121 camel_object_unref (certdb);
123 g_atexit (camel_shutdown);