LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DSOLARIS")
+ IF(NOT ETC_PREFIX)
+ SET(ETC_PREFIX /etc)
+ SET(PREFIX /opt/rspamd)
+ ENDIF(NOT ETC_PREFIX)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv)
+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
+ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+
IF(ENABLE_PERL MATCHES "ON")
IF(NOT PERL_EXECUTABLE)
TARGET_LINK_LIBRARIES(rspamd rspamd_evdns)
TARGET_LINK_LIBRARIES(rspamd event)
TARGET_LINK_LIBRARIES(rspamd rspamd_json)
+TARGET_LINK_LIBRARIES(rspamd ${CMAKE_REQUIRED_LIBRARIES})
TARGET_LINK_LIBRARIES(rspamd ${GLIB2_LIBRARIES})
IF(GMIME2_FOUND)
TARGET_LINK_LIBRARIES(rspamd ${GMIME2_LIBRARIES})
SET_TARGET_PROPERTIES(test/rspamd-test PROPERTIES LINKER_LANGUAGE C)
TARGET_LINK_LIBRARIES(test/rspamd-test event)
TARGET_LINK_LIBRARIES(test/rspamd-test ${GLIB2_LIBRARIES})
+TARGET_LINK_LIBRARIES(test/rspamd-test ${CMAKE_REQUIRED_LIBRARIES})
IF(GMIME2_FOUND)
TARGET_LINK_LIBRARIES(test/rspamd-test ${GMIME2_LIBRARIES})
ELSE(GMIME2_FOUND)
ADD_EXECUTABLE(utils/url-extracter ${UTILSDEPENDS} ${CONTRIBSRC} ${UTILSSRC})
SET_TARGET_PROPERTIES(utils/url-extracter PROPERTIES LINKER_LANGUAGE C)
+TARGET_LINK_LIBRARIES(utils/url-extracter ${CMAKE_REQUIRED_LIBRARIES})
TARGET_LINK_LIBRARIES(utils/url-extracter ${GLIB2_LIBRARIES})
IF(GMIME2_FOUND)
TARGET_LINK_LIBRARIES(utils/url-extracter ${GMIME2_LIBRARIES})
ADD_EXECUTABLE(utils/expression-parser ${UTILSDEPENDS} ${CONTRIBSRC} ${EXPRSRC})
SET_TARGET_PROPERTIES(utils/expression-parser PROPERTIES LINKER_LANGUAGE C)
-TARGET_LINK_LIBRARIES(utils/expression-parser m)
+TARGET_LINK_LIBRARIES(utils/expression-parser ${CMAKE_REQUIRED_LIBRARIES})
IF(LIBUTIL_LIBRARY)
TARGET_LINK_LIBRARIES(utils/expression-parser util)
ENDIF(LIBUTIL_LIBRARY)
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
-#include <sys/cdefs.h>
-
/*
* This file defines four types of data structures: singly-linked lists,
* singly-linked tail queues, lists and tail queues.
/* string */
-#ifdef HAVE_STDIO_H
+#ifdef HAVE_STRING_H
#include <string.h>
#endif
+/* strings */
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
/* fcntl */
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
CRED_NORMAL,
CRED_CONTROL,
CRED_LMTP,
- CRED_DELIVERY,
+ CRED_DELIVERY
};
/**
REGEXP_MIME,
REGEXP_MESSAGE,
REGEXP_URL,
- REGEXP_RAW_HEADER,
+ REGEXP_RAW_HEADER
};
/**
enum rspamd_log_type {
RSPAMD_LOG_CONSOLE,
RSPAMD_LOG_SYSLOG,
- RSPAMD_LOG_FILE,
+ RSPAMD_LOG_FILE
};
/**
SCALAR_TYPE_INT,
SCALAR_TYPE_UINT,
SCALAR_TYPE_STR,
- SCALAR_TYPE_SIZE,
+ SCALAR_TYPE_SIZE
} type; /**< type of data */
};
}
}
+/*
+ * Find the first occurrence of find in s, ignore case.
+ */
+static gchar *
+html_strcasestr (const gchar *s, const gchar *find)
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0) {
+ c = g_ascii_tolower (c);
+ len = strlen (find);
+ do {
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while (g_ascii_tolower (sc) != c);
+ } while (g_ascii_strncasecmp (s, find, len) != 0);
+ s--;
+ }
+ return ((gchar *)s);
+}
+
static void
parse_tag_url (struct worker_task *task, struct mime_text_part *part, tag_id_t id, char *tag_text)
{
/* For A tags search for href= and for IMG tags search for src= */
if (id == Tag_A) {
- c = strcasestr (tag_text, "href=");
+ c = html_strcasestr (tag_text, "href=");
len = sizeof ("href=") - 1;
}
else if (id == Tag_IMG) {
- c = strcasestr (tag_text, "src=");
+ c = html_strcasestr (tag_text, "src=");
len = sizeof ("src=") - 1;
}
#include "cfg_file.h"
#include "radix.h"
-/* Forwarded declaration */
-enum process_type;
+/**
+ * Process type: main or worker
+ */
+enum process_type {
+ TYPE_MAIN,
+ TYPE_WORKER,
+ TYPE_CONTROLLER,
+ TYPE_LMTP,
+ TYPE_SMTP,
+ TYPE_FUZZY,
+ TYPE_GREYLIST
+};
typedef void (*rspamd_log_func_t)(const gchar * log_domain, const gchar *function,
GLogLevelFlags log_level, const gchar * message,
#define CR '\r'
#define LF '\n'
-/**
- * Process type: main or worker
- */
-enum process_type {
- TYPE_MAIN,
- TYPE_WORKER,
- TYPE_CONTROLLER,
- TYPE_LMTP,
- TYPE_SMTP,
- TYPE_FUZZY,
- TYPE_GREYLIST
-};
/**
struct _pool_chain_shared *chain;
#if defined(HAVE_MMAP_ANON)
- chain = mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
+ chain = (struct _pool_chain_shared *)mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
g_assert (chain != MAP_FAILED);
chain->begin = ((u_char *) chain) + sizeof (struct _pool_chain_shared);
g_assert (chain->begin != MAP_FAILED);
if (fd == -1) {
return NULL;
}
- chain = mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ chain = (struct _pool_chain_shared *)mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
g_assert (chain != MAP_FAILED);
chain->begin = ((u_char *) chain) + sizeof (struct _pool_chain_shared);
g_assert (chain->begin != MAP_FAILED);
/* Allocate statistic structure if it is not allocated before */
if (mem_pool_stat == NULL) {
#if defined(HAVE_MMAP_ANON)
- mem_pool_stat = mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
+ mem_pool_stat = (memory_pool_stat_t *)mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
g_assert (stat != MAP_FAILED);
#elif defined(HAVE_MMAP_ZERO)
int fd;
fd = open ("/dev/zero", O_RDWR);
g_assert (fd != -1);
- mem_pool_stat = mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ mem_pool_stat = (memory_pool_stat_t *)mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
g_assert (chain != MAP_FAILED);
#else
# error No mmap methods are defined
while (cur_shared) {
tmp_shared = cur_shared;
cur_shared = cur_shared->next;
- munmap (tmp_shared, tmp_shared->len + sizeof (struct _pool_chain_shared));
+ munmap ((void *)tmp_shared, tmp_shared->len + sizeof (struct _pool_chain_shared));
STAT_LOCK ();
mem_pool_stat->chunks_freed++;
STAT_UNLOCK ();
*/
-#include <evdns.h>
#include "../config.h"
#include "../main.h"
#include "../view.h"
#include "../lua/lua_common.h"
#include "../json/jansson.h"
+#include "../evdns/evdns.h"
#define DEFAULT_STATFILE_PREFIX "./"
goto out;
}
+ memset (&sin, 0, sizeof (sin));
+
/* Bind options */
sin.sin_family = AF_INET;
sin.sin_port = htons (port);
int
init_title (int argc, char *argv[], char *envp[])
{
+#if defined(DARWIN) || defined(SOLARIS)
+ /* XXX: try to handle these OSes too */
+ return 0;
+#else
char *begin_of_buffer = 0, *end_of_buffer = 0;
int i;
}
g_free (new_environ);
return 0;
+#endif
}
#endif
return NULL;
if (path == NULL)
- len = snprintf (pfh->pf_path, sizeof (pfh->pf_path), "/var/run/%s.pid", __progname);
+ len = snprintf (pfh->pf_path, sizeof (pfh->pf_path), "/var/run/%s.pid", g_get_prgname ());
else
len = snprintf (pfh->pf_path, sizeof (pfh->pf_path), "%s", path);
if (len >= (int)sizeof (pfh->pf_path)) {
return -1;
}
- snprintf (pidstr, sizeof (pidstr), "%u", getpid ());
+ snprintf (pidstr, sizeof (pidstr), "%lu", (long unsigned)getpid ());
if (pwrite (fd, pidstr, strlen (pidstr), 0) != (ssize_t) strlen (pidstr)) {
error = errno;
_pidfile_remove (pfh, 0);
#else
char pf_path[1024 + 1];
#endif
- __dev_t pf_dev;
+ dev_t pf_dev;
ino_t pf_ino;
};
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
#include "message.h"
#include "map.h"
-#include <evdns.h>
+#include "evdns/evdns.h"
#ifndef WITHOUT_PERL
# include <EXTERN.h> /* from the Perl distribution */