Browse Source

Fix CentOS 5 build.

tags/0.5.5
Vsevolod Stakhov 11 years ago
parent
commit
1650f051c1
5 changed files with 52 additions and 1 deletions
  1. 15
    1
      CMakeLists.txt
  2. 4
    0
      config.h.in
  3. 25
    0
      src/dkim.c
  4. 4
    0
      src/main.c
  5. 4
    0
      src/plugins/regexp.c

+ 15
- 1
CMakeLists.txt View File

@@ -538,6 +538,20 @@ INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS})


FIND_LIBRARY(LIBZ_LIBRARY NAMES z PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
DOC "Path where the libz library can be found")
IF(NOT LIBZ_LIBRARY)
MESSAGE(FATAL_ERROR "libz is required for libgmime")
ENDIF(NOT LIBZ_LIBRARY)
# Check for libevent

FIND_LIBRARY(LIBEVENT_LIBRARY NAMES event PATH_SUFFIXES lib64 lib
@@ -955,8 +969,8 @@ AddModules(MODULES_LIST WORKERS_LIST)

################################ SUBDIRS SECTION ###########################

ADD_SUBDIRECTORY(contrib/lgpl)
IF(GLIB_COMPAT)
ADD_SUBDIRECTORY(contrib/lgpl)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
ENDIF(GLIB_COMPAT)


+ 4
- 0
config.h.in View File

@@ -426,6 +426,10 @@
#include "gchecksum.h"
#endif

#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)
typedef off_t goffset;
#endif

#ifndef BUILD_STATIC
#include <gmodule.h>
#endif

+ 25
- 0
src/dkim.c View File

@@ -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) {

+ 4
- 0
src/main.c View File

@@ -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);

+ 4
- 0
src/plugins/regexp.c View File

@@ -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));

Loading…
Cancel
Save