aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dkim.c25
-rw-r--r--src/main.c4
-rw-r--r--src/plugins/regexp.c4
3 files changed, 33 insertions, 0 deletions
diff --git a/src/dkim.c b/src/dkim.c
index b0bc19541..feb11893d 100644
--- a/src/dkim.c
+++ b/src/dkim.c
@@ -79,7 +79,15 @@ rspamd_dkim_parse_signature (rspamd_dkim_context_t* ctx, const gchar *param, gsi
{
ctx->b = memory_pool_alloc (ctx->pool, len + 1);
rspamd_strlcpy (ctx->b, param, len + 1);
+#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 20))
+ gchar *tmp;
+ gsize tmp_len = len;
+ tmp = g_base64_decode (ctx->b, &tmp_len);
+ rspamd_strlcpy (ctx->b, tmp, len + 1);
+ g_free (tmp);
+#else
g_base64_decode_inplace (ctx->b, &len);
+#endif
ctx->blen = len;
return TRUE;
}
@@ -322,7 +330,15 @@ rspamd_dkim_parse_bodyhash (rspamd_dkim_context_t* ctx, const gchar *param, gsiz
{
ctx->bh = memory_pool_alloc (ctx->pool, len + 1);
rspamd_strlcpy (ctx->bh, param, len + 1);
+#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 20))
+ gchar *tmp;
+ gsize tmp_len = len;
+ tmp = g_base64_decode (ctx->bh, &tmp_len);
+ rspamd_strlcpy (ctx->bh, tmp, len + 1);
+ g_free (tmp);
+#else
g_base64_decode_inplace (ctx->bh, &len);
+#endif
ctx->bhlen = len;
return TRUE;
}
@@ -627,7 +643,16 @@ rspamd_dkim_make_key (const gchar *keydata, guint keylen, GError **err)
rspamd_strlcpy (key->keydata, keydata, keylen + 1);
key->keylen = keylen + 1;
key->decoded_len = keylen + 1;
+#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 20))
+ gchar *tmp;
+ gsize tmp_len = keylen;
+ tmp = g_base64_decode (key->keydata, &tmp_len);
+ rspamd_strlcpy (key->keydata, tmp, keylen + 1);
+ g_free (tmp);
+ key->decoded_len = tmp_len;
+#else
g_base64_decode_inplace (key->keydata, &key->decoded_len);
+#endif
#ifdef HAVE_OPENSSL
key->key_bio = BIO_new_mem_buf (key->keydata, key->decoded_len);
if (key->key_bio == NULL) {
diff --git a/src/main.c b/src/main.c
index e50b223aa..ed72e48bc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -467,10 +467,14 @@ fork_worker (struct rspamd_main *rspamd, struct worker_conf *cf)
close_log (rspamd->logger);
open_log (rspamd->logger);
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30))
+# if (GLIB_MINOR_VERSION > 20)
/* Ugly hack for old glib */
if (!g_thread_get_initialized ()) {
g_thread_init (NULL);
}
+# else
+ g_thread_init (NULL);
+# endif
#endif
msg_info ("starting %s process %P", cf->worker->name, getpid ());
cf->worker->worker_start_func (cur);
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index 9dce07772..272805548 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -1309,9 +1309,13 @@ process_regexp_item (struct worker_task *task, void *user_data)
if (!item->lua_function && regexp_module_ctx->max_threads > 1) {
if (regexp_module_ctx->workers == NULL) {
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30))
+# if GLIB_MINOR_VERSION > 20
if (! g_thread_get_initialized ()) {
g_thread_init (NULL);
}
+# else
+ g_thread_init (NULL);
+# endif
workers_mtx = g_mutex_new ();
#else
workers_mtx = memory_pool_alloc (regexp_module_ctx->regexp_pool, sizeof (GMutex));