aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-04-27 08:16:41 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-04-27 08:16:41 +0800
commit533abeb00f0777da365e3609d4335394680ffeaf (patch)
treea3f6ce81aae93355b3b292b23cc3b292eae9f05a /camel/camel.c
parentfd660c14c61eabf177c706d5c07d9e3e549a35f7 (diff)
downloadgsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.tar
gsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.tar.gz
gsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.tar.bz2
gsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.tar.lz
gsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.tar.xz
gsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.tar.zst
gsoc2013-evolution-533abeb00f0777da365e3609d4335394680ffeaf.zip
Automagically call camel_shutdown() atexit() ;-) (camel_init): Also
2001-04-26 Jeffrey Stedfast <fejj@ximian.com> * camel.c (camel_init): Automagically call camel_shutdown() atexit() ;-) (camel_init): Also initialize NSS databases as read/write for S/MIME and if NSS fails to init, try initializing with volatile databases. * camel-file-utils.h: #include <sys/types.h> for off_t. svn path=/trunk/; revision=9609
Diffstat (limited to 'camel/camel.c')
-rw-r--r--camel/camel.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/camel/camel.c b/camel/camel.c
index f2d8b8d369..6ae93081d6 100644
--- a/camel/camel.c
+++ b/camel/camel.c
@@ -38,8 +38,18 @@
gboolean camel_verbose_debug = FALSE;
+static void
+camel_shutdown (void)
+{
+#ifdef HAVE_NSS
+ NSS_Shutdown ();
+
+ PR_Cleanup ();
+#endif /* HAVE_NSS */
+}
+
gint
-camel_init (const char *certdb_dir, gboolean nss_init)
+camel_init (const char *configdir, gboolean nss_init)
{
#ifdef ENABLE_THREADS
#ifdef G_THREADS_ENABLED
@@ -56,12 +66,17 @@ camel_init (const char *certdb_dir, gboolean nss_init)
if (nss_init) {
PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10);
- if (NSS_Init (certdb_dir) == SECFailure) {
- g_warning ("Failed to initialize NSS");
- return -1;
+ if (NSS_InitReadWrite (configdir) == SECFailure) {
+ /* fall back on using volatile dbs? */
+ if (NSS_NoDB_Init (configdir) == SECFailure) {
+ g_warning ("Failed to initialize NSS");
+ return -1;
+ }
}
NSS_SetDomesticPolicy ();
+
+ g_atexit (camel_shutdown);
}
SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE);
@@ -72,13 +87,3 @@ camel_init (const char *certdb_dir, gboolean nss_init)
return 0;
}
-
-void
-camel_shutdown (void)
-{
-#ifdef HAVE_NSS
- NSS_Shutdown ();
-
- PR_Cleanup ();
-#endif /* HAVE_NSS */
-}