diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 14:19:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 14:19:32 +0100 |
commit | 0852facdb91ae18d0fe255e575d8fa0fb7c4864c (patch) | |
tree | 0fbbe04dacf5f15baf93fb464774809014a7211f /src/libutil | |
parent | 775530cc7484286079af2ca103fbe4dc351726d9 (diff) | |
download | rspamd-0852facdb91ae18d0fe255e575d8fa0fb7c4864c.tar.gz rspamd-0852facdb91ae18d0fe255e575d8fa0fb7c4864c.zip |
Move libraries initialization to a specific routine.
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.c | 41 | ||||
-rw-r--r-- | src/libutil/util.h | 5 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index a001e5ed2..05bf4a31e 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2368,3 +2368,44 @@ rspamd_array_free_hard (gpointer p) g_array_free (ar, TRUE); } + + +void +rspamd_init_libs (void) +{ + struct rlimit rlim; + + ottery_init (NULL); + + rspamd_cryptobox_init (); +#ifdef HAVE_SETLOCALE + /* Set locale setting to C locale to avoid problems in future */ + setlocale (LC_ALL, "C"); + setlocale (LC_CTYPE, "C"); + setlocale (LC_MESSAGES, "C"); + setlocale (LC_TIME, "C"); +#endif + +#ifdef HAVE_OPENSSL + ERR_load_crypto_strings (); + + OpenSSL_add_all_algorithms (); + OpenSSL_add_all_digests (); + OpenSSL_add_all_ciphers (); +#endif + g_random_set_seed (ottery_rand_uint32 ()); + + /* Set stack size for pcre */ + getrlimit (RLIMIT_STACK, &rlim); + rlim.rlim_cur = 100 * 1024 * 1024; + setrlimit (RLIMIT_STACK, &rlim); + + rspamd_regexp_library_init (); + + event_init (); +#ifdef GMIME_ENABLE_RFC2047_WORKAROUNDS + g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS); +#else + g_mime_init (0); +#endif +} diff --git a/src/libutil/util.h b/src/libutil/util.h index 2f58c51b6..b3d7f42e0 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -455,4 +455,9 @@ void rspamd_ptr_array_free_hard (gpointer p); */ void rspamd_array_free_hard (gpointer p); +/** + * Initialize rspamd libraries + */ +void rspamd_init_libs (void); + #endif |