1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Authors: Jeffrey Stedfast <fejj@ximian.com>
4 * Bertrand Guiheneuf <bertrand@helixcode.com>
6 * Copyright 1999-2003 Ximian, Inc. (www.ximian.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
34 #include "nss.h" /* Don't use <> here or it will include the system nss.h instead */
39 #include "camel-certdb.h"
40 #include "camel-mime-utils.h"
42 gboolean camel_verbose_debug = FALSE;
55 certdb = camel_certdb_get_default ();
57 camel_certdb_save (certdb);
58 camel_object_unref (certdb);
63 camel_init (const char *configdir, gboolean nss_init)
68 if (getenv ("CAMEL_VERBOSE_DEBUG"))
69 camel_verbose_debug = TRUE;
71 /* initialise global camel_object_type */
72 camel_object_get_type ();
74 camel_mime_utils_init ();
78 PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10);
80 if (NSS_InitReadWrite (configdir) == SECFailure) {
81 /* fall back on using volatile dbs? */
82 if (NSS_NoDB_Init (configdir) == SECFailure) {
83 g_warning ("Failed to initialize NSS");
88 NSS_SetDomesticPolicy ();
90 SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE);
91 SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE);
92 SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE);
93 SSL_OptionSetDefault (SSL_V2_COMPATIBLE_HELLO, PR_TRUE /* maybe? */);
97 path = g_strdup_printf ("%s/camel-cert.db", configdir);
98 certdb = camel_certdb_new ();
99 camel_certdb_set_filename (certdb, path);
102 /* if we fail to load, who cares? it'll just be a volatile certdb */
103 camel_certdb_load (certdb);
105 /* set this certdb as the default db */
106 camel_certdb_set_default (certdb);
108 camel_object_unref (certdb);
110 g_atexit (camel_shutdown);