aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt250
-rw-r--r--src/dns_private.h209
-rw-r--r--src/libmime/CMakeLists.txt29
-rw-r--r--src/libmime/expressions.c (renamed from src/expressions.c)0
-rw-r--r--src/libmime/expressions.h (renamed from src/expressions.h)0
-rw-r--r--src/libmime/filter.c (renamed from src/filter.c)0
-rw-r--r--src/libmime/filter.h (renamed from src/filter.h)0
-rw-r--r--src/libmime/images.c (renamed from src/images.c)0
-rw-r--r--src/libmime/images.h (renamed from src/images.h)0
-rw-r--r--src/libmime/message.c (renamed from src/message.c)0
-rw-r--r--src/libmime/message.h (renamed from src/message.h)0
-rw-r--r--src/libmime/protocol.c (renamed from src/protocol.c)0
-rw-r--r--src/libmime/protocol.h (renamed from src/protocol.h)0
-rw-r--r--src/libmime/smtp_proto.c (renamed from src/smtp_proto.c)0
-rw-r--r--src/libmime/smtp_proto.h (renamed from src/smtp_proto.h)0
-rw-r--r--src/libmime/smtp_utils.c (renamed from src/smtp_utils.c)0
-rw-r--r--src/libmime/smtp_utils.h (renamed from src/smtp_utils.h)0
-rw-r--r--src/libmime/worker_util.c (renamed from src/worker_util.c)0
-rw-r--r--src/libserver/CMakeLists.txt63
-rw-r--r--src/libserver/binlog.c (renamed from src/binlog.c)0
-rw-r--r--src/libserver/binlog.h (renamed from src/binlog.h)0
-rw-r--r--src/libserver/buffer.c (renamed from src/buffer.c)0
-rw-r--r--src/libserver/buffer.h (renamed from src/buffer.h)0
-rw-r--r--src/libserver/cfg_file.h (renamed from src/cfg_file.h)0
-rw-r--r--src/libserver/cfg_rcl.c (renamed from src/cfg_rcl.c)0
-rw-r--r--src/libserver/cfg_rcl.h (renamed from src/cfg_rcl.h)0
-rw-r--r--src/libserver/cfg_utils.c (renamed from src/cfg_utils.c)0
-rw-r--r--src/libserver/dkim.c (renamed from src/dkim.c)0
-rw-r--r--src/libserver/dkim.h (renamed from src/dkim.h)0
-rw-r--r--src/libserver/dns.c (renamed from src/dns.c)0
-rw-r--r--src/libserver/dns.h (renamed from src/dns.h)0
-rw-r--r--src/libserver/dynamic_cfg.c (renamed from src/dynamic_cfg.c)0
-rw-r--r--src/libserver/dynamic_cfg.h (renamed from src/dynamic_cfg.h)0
-rw-r--r--src/libserver/events.c (renamed from src/events.c)0
-rw-r--r--src/libserver/events.h (renamed from src/events.h)0
-rw-r--r--src/libserver/html.c (renamed from src/html.c)0
-rw-r--r--src/libserver/html.h (renamed from src/html.h)0
-rw-r--r--src/libserver/proxy.c (renamed from src/proxy.c)0
-rw-r--r--src/libserver/proxy.h (renamed from src/proxy.h)0
-rw-r--r--src/libserver/roll_history.c (renamed from src/roll_history.c)0
-rw-r--r--src/libserver/roll_history.h (renamed from src/roll_history.h)0
-rw-r--r--src/libserver/settings.c (renamed from src/settings.c)0
-rw-r--r--src/libserver/settings.h (renamed from src/settings.h)0
-rw-r--r--src/libserver/spf.c (renamed from src/spf.c)0
-rw-r--r--src/libserver/spf.h (renamed from src/spf.h)0
-rw-r--r--src/libserver/statfile.c (renamed from src/statfile.c)0
-rw-r--r--src/libserver/statfile.h (renamed from src/statfile.h)0
-rw-r--r--src/libserver/statfile_sync.c (renamed from src/statfile_sync.c)0
-rw-r--r--src/libserver/statfile_sync.h (renamed from src/statfile_sync.h)0
-rw-r--r--src/libserver/symbols_cache.c (renamed from src/symbols_cache.c)0
-rw-r--r--src/libserver/symbols_cache.h (renamed from src/symbols_cache.h)0
-rw-r--r--src/libserver/task.c (renamed from src/task.c)0
-rw-r--r--src/libserver/task.h (renamed from src/task.h)0
-rw-r--r--src/libserver/url.c (renamed from src/url.c)0
-rw-r--r--src/libserver/url.h (renamed from src/url.h)0
-rw-r--r--src/libutil/CMakeLists.txt50
-rw-r--r--src/libutil/aio_event.c (renamed from src/aio_event.c)0
-rw-r--r--src/libutil/aio_event.h (renamed from src/aio_event.h)0
-rw-r--r--src/libutil/bloom.c (renamed from src/bloom.c)0
-rw-r--r--src/libutil/bloom.h (renamed from src/bloom.h)0
-rw-r--r--src/libutil/diff.c (renamed from src/diff.c)0
-rw-r--r--src/libutil/diff.h (renamed from src/diff.h)0
-rw-r--r--src/libutil/fstring.c (renamed from src/fstring.c)0
-rw-r--r--src/libutil/fstring.h (renamed from src/fstring.h)0
-rw-r--r--src/libutil/fuzzy.c (renamed from src/fuzzy.c)0
-rw-r--r--src/libutil/fuzzy.h (renamed from src/fuzzy.h)0
-rw-r--r--src/libutil/hash.c (renamed from src/hash.c)0
-rw-r--r--src/libutil/hash.h (renamed from src/hash.h)0
-rw-r--r--src/libutil/http.c (renamed from src/http.c)0
-rw-r--r--src/libutil/http.h (renamed from src/http.h)0
-rw-r--r--src/libutil/logger.c (renamed from src/logger.c)0
-rw-r--r--src/libutil/logger.h (renamed from src/logger.h)0
-rw-r--r--src/libutil/map.c (renamed from src/map.c)0
-rw-r--r--src/libutil/map.h (renamed from src/map.h)0
-rw-r--r--src/libutil/mem_pool.c (renamed from src/mem_pool.c)0
-rw-r--r--src/libutil/mem_pool.h (renamed from src/mem_pool.h)0
-rw-r--r--src/libutil/memcached.c (renamed from src/memcached.c)0
-rw-r--r--src/libutil/memcached.h (renamed from src/memcached.h)0
-rw-r--r--src/libutil/printf.c (renamed from src/printf.c)0
-rw-r--r--src/libutil/printf.h (renamed from src/printf.h)0
-rw-r--r--src/libutil/radix.c (renamed from src/radix.c)0
-rw-r--r--src/libutil/radix.h (renamed from src/radix.h)0
-rw-r--r--src/libutil/rrd.c (renamed from src/rrd.c)0
-rw-r--r--src/libutil/rrd.h (renamed from src/rrd.h)0
-rw-r--r--src/libutil/trie.c (renamed from src/trie.c)0
-rw-r--r--src/libutil/trie.h (renamed from src/trie.h)0
-rw-r--r--src/libutil/upstream.c (renamed from src/upstream.c)0
-rw-r--r--src/libutil/upstream.h (renamed from src/upstream.h)0
-rw-r--r--src/libutil/util.c (renamed from src/util.c)0
-rw-r--r--src/libutil/util.h (renamed from src/util.h)0
90 files changed, 262 insertions, 339 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 70c96f99d..270648697 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,149 +1,139 @@
-# Librspamd-util
-SET(LIBRSPAMDUTILSRC aio_event.c
- bloom.c
- diff.c
- fstring.c
- fuzzy.c
- hash.c
- http.c
- logger.c
- map.c
- memcached.c
- mem_pool.c
- printf.c
- radix.c
- rrd.c
- trie.c
- upstream.c
- util.c)
+MACRO(_AddModulesForced MLIST WLIST)
+# Generate unique string for this build
+ STRING(RANDOM LENGTH 8 _MODULES_ID)
+ SET(MODULES_ID ${_MODULES_ID} CACHE INTERNAL "Modules ID" FORCE)
+ FILE(WRITE "src/modules.c" "/* ${MODULES_ID} */\n#include \"config.h\"\n")
+
+ # Handle even old cmake
+ LIST(LENGTH ${MLIST} MLIST_COUNT)
+ LIST(LENGTH ${WLIST} WLIST_COUNT)
+ MATH(EXPR MLIST_MAX ${MLIST_COUNT}-1)
+ MATH(EXPR WLIST_MAX ${WLIST_COUNT}-1)
+
+ FOREACH(MOD_IDX RANGE ${MLIST_MAX})
+ LIST(GET ${MLIST} ${MOD_IDX} MOD)
+ FILE(APPEND "src/modules.c" "extern module_t ${MOD}_module;\n")
+ ENDFOREACH(MOD_IDX RANGE ${MLIST_MAX})
+
+ FILE(APPEND "src/modules.c" "\n\nmodule_t *modules[] = {\n")
+
+ FOREACH(MOD_IDX RANGE ${MLIST_MAX})
+ LIST(GET ${MLIST} ${MOD_IDX} MOD)
+ FILE(APPEND "src/modules.c" "&${MOD}_module,\n")
+ ENDFOREACH(MOD_IDX RANGE ${MLIST_MAX})
+
+ FILE(APPEND "src/modules.c" "NULL\n};\n")
+
+ FOREACH(MOD_IDX RANGE ${WLIST_MAX})
+ LIST(GET ${WLIST} ${MOD_IDX} WRK)
+ FILE(APPEND "src/modules.c" "extern worker_t ${WRK}_worker;\n")
+ ENDFOREACH(MOD_IDX RANGE ${WLIST_MAX})
+
+ FILE(APPEND "src/modules.c" "\n\nworker_t *workers[] = {\n")
+
+ FOREACH(MOD_IDX RANGE ${WLIST_MAX})
+ LIST(GET ${WLIST} ${MOD_IDX} WRK)
+ FILE(APPEND "src/modules.c" "&${WRK}_worker,\n")
+ ENDFOREACH(MOD_IDX RANGE ${WLIST_MAX})
+ FILE(APPEND "src/modules.c" "NULL\n};\n")
+ENDMACRO(_AddModulesForced MLIST WLIST)
-# Librspamdserver
-SET(LIBRSPAMDSERVERSRC
- binlog.c
- buffer.c
- cfg_utils.c
- cfg_rcl.c
- dkim.c
- dns.c
- dynamic_cfg.c
- events.c
- html.c
- proxy.c
- roll_history.c
- settings.c
- spf.c
- statfile.c
- statfile_sync.c
- symbols_cache.c
- task.c
- url.c)
-
-# Librspamd mime
-SET(LIBRSPAMDMIMESRC
- expressions.c
- filter.c
- images.c
- message.c
- protocol.c
- smtp_utils.c
- smtp_proto.c
- worker_util.c)
-
-SET(TOKENIZERSSRC tokenizers/tokenizers.c
- tokenizers/osb.c)
-
-SET(CLASSIFIERSSRC classifiers/classifiers.c
- classifiers/bayes.c
- classifiers/winnow.c)
-# Add targets
+MACRO(AddModules MLIST WLIST)
+ _AddModulesForced(${MLIST} ${WLIST})
+ #IF(NOT EXISTS "src/modules.c")
+ # _AddModulesForced(${MLIST} ${WLIST})
+ #ELSE(NOT EXISTS "src/modules.c")
+ # FILE(STRINGS "src/modules.c" FILE_ID_RAW REGEX "^/.*[a-zA-Z0-9]+.*/$")
+ # STRING(REGEX MATCH "[a-zA-Z0-9]+" FILE_ID "${FILE_ID_RAW}")
+ # IF(NOT FILE_ID STREQUAL MODULES_ID)
+ # MESSAGE("Regenerate modules info")
+ # _AddModulesForced(${MLIST} ${WLIST})
+ # ENDIF(NOT FILE_ID STREQUAL MODULES_ID)
+ #ENDIF(NOT EXISTS "src/modules.c")
+ENDMACRO(AddModules MLIST WLIST)
-# Rspamdutil
-ADD_LIBRARY(rspamd-util ${LINK_TYPE} ${LIBRSPAMDUTILSRC})
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-util PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
+# Contrib software
+ADD_SUBDIRECTORY(json)
+ADD_SUBDIRECTORY(cdb)
+ADD_SUBDIRECTORY(ucl/cmake)
+SET(SLAVE_BUILD 1)
+ADD_SUBDIRECTORY(rdns)
+UNSET(SLAVE_BUILD)
+INCLUDE_DIRECTORIES(libutil libserver libmime)
-TARGET_LINK_LIBRARIES(rspamd-util ${RSPAMD_REQUIRED_LIBRARIES})
-TARGET_LINK_LIBRARIES(rspamd-util pcre)
-TARGET_LINK_LIBRARIES(rspamd-util ucl)
-TARGET_LINK_LIBRARIES(rspamd-util ottery)
-TARGET_LINK_LIBRARIES(rspamd-util rspamd-http-parser)
-TARGET_LINK_LIBRARIES(rspamd-util event)
-TARGET_LINK_LIBRARIES(rspamd-util xxhash)
-IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamd-util ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
+# Rspamd core components
+ADD_SUBDIRECTORY(lua)
+ADD_SUBDIRECTORY(libutil)
+ADD_SUBDIRECTORY(libserver)
+ADD_SUBDIRECTORY(libmime)
+ADD_SUBDIRECTORY(client)
+
+SET(RSPAMDSRC modules.c
+ controller.c
+ fuzzy_storage.c
+ lua_worker.c
+ main.c
+ smtp_proxy.c
+ webui.c
+ worker.c)
-IF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-util PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
+SET(PLUGINSSRC plugins/surbl.c
+ plugins/regexp.c
+ plugins/chartable.c
+ plugins/fuzzy_check.c
+ plugins/spf.c
+ plugins/dkim_check.c)
+
+SET(MODULES_LIST surbl regexp chartable fuzzy_check spf dkim)
+SET(WORKERS_LIST normal controller smtp_proxy fuzzy lua webui)
-IF(GLIB_COMPAT)
- INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
- TARGET_LINK_LIBRARIES(rspamd-util glibadditions)
-ENDIF(GLIB_COMPAT)
+AddModules(MODULES_LIST WORKERS_LIST)
+LIST(LENGTH PLUGINSSRC RSPAMD_MODULES_NUM)
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-util
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION include)
-ENDIF(NO_SHARED MATCHES "OFF")
-
-# Librspamd-server
+######################### LINK SECTION ###############################
-#IF(WITH_DB)
-# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_bdb.c)
-#ENDIF(WITH_DB)
-#IF(WITH_SQLITE)
-# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_sqlite.c)
-#ENDIF(WITH_SQLITE)
-
-ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC})
+ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${PLUGINSSRC})
+SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C)
+SET_TARGET_PROPERTIES(rspamd PROPERTIES COMPILE_FLAGS "-DRSPAMD_MAIN")
IF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-server PROPERTIES VERSION ${RSPAMD_VERSION})
+SET_TARGET_PROPERTIES(rspamd PROPERTIES VERSION ${RSPAMD_VERSION})
ENDIF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-server PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB")
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-lua)
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-json)
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb)
-TARGET_LINK_LIBRARIES(rspamd-server rspamd-util)
-TARGET_LINK_LIBRARIES(rspamd-server rdns)
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-server PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
+TARGET_LINK_LIBRARIES(rspamd rspamd-mime)
+TARGET_LINK_LIBRARIES(rspamd rspamd-server)
+TARGET_LINK_LIBRARIES(rspamd rspamd-util)
+TARGET_LINK_LIBRARIES(rspamd rspamd-lua)
+
+TARGET_LINK_LIBRARIES(rspamd event)
+IF(HAVE_LIBEVENT2)
+ TARGET_LINK_LIBRARIES(rspamd event_pthreads)
+ENDIF(HAVE_LIBEVENT2)
IF(WITH_DB)
- TARGET_LINK_LIBRARIES(rspamd-server db)
+ TARGET_LINK_LIBRARIES(rspamd db)
ENDIF(WITH_DB)
IF(OPENSSL_FOUND)
- TARGET_LINK_LIBRARIES(rspamd-server ${OPENSSL_LIBRARIES})
+ TARGET_LINK_LIBRARIES(rspamd ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
+IF(HAVE_FETCH_H)
+ TARGET_LINK_LIBRARIES(rspamd fetch)
+ENDIF(HAVE_FETCH_H)
+TARGET_LINK_LIBRARIES(rspamd ${RSPAMD_REQUIRED_LIBRARIES})
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-server
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF")
-
-# Librspamdmime
-ADD_LIBRARY(rspamd-mime ${LINK_TYPE} ${LIBRSPAMDMIMESRC})
-IF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES LINKER_LANGUAGE C)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB")
-TARGET_LINK_LIBRARIES(rspamd-mime rspamd-server)
-TARGET_LINK_LIBRARIES(rspamd-mime rspamd-util)
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
+IF(ENABLE_LUAJIT MATCHES "ON")
+ TARGET_LINK_LIBRARIES(rspamd "${LUAJIT_LIBRARY}")
+ELSE(ENABLE_LUAJIT MATCHES "ON")
+ TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}")
+ENDIF(ENABLE_LUAJIT MATCHES "ON")
+
+IF(ENABLE_GPERF_TOOLS MATCHES "ON")
+ TARGET_LINK_LIBRARIES(rspamd profiler)
+ENDIF(ENABLE_GPERF_TOOLS MATCHES "ON")
+TARGET_LINK_LIBRARIES(rspamd hiredis)
+IF(GLIB_COMPAT)
+ TARGET_LINK_LIBRARIES(rspamd glibadditions)
+ENDIF(GLIB_COMPAT)
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-mime
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF")
-INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/src") \ No newline at end of file
+INSTALL(TARGETS rspamd RUNTIME DESTINATION bin) \ No newline at end of file
diff --git a/src/dns_private.h b/src/dns_private.h
deleted file mode 100644
index 1c1df8ded..000000000
--- a/src/dns_private.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright (c) 2014, Vsevolod Stakhov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DNS_PRIVATE_H_
-#define DNS_PRIVATE_H_
-
-#include "config.h"
-
-#define MAX_SERVERS 16
-/* Upstream timeouts */
-#define DEFAULT_UPSTREAM_ERROR_TIME 10
-#define DEFAULT_UPSTREAM_DEAD_TIME 300
-#define DEFAULT_UPSTREAM_MAXERRORS 10
-
-static const unsigned base = 36;
-static const unsigned t_min = 1;
-static const unsigned t_max = 26;
-static const unsigned skew = 38;
-static const unsigned damp = 700;
-static const unsigned initial_n = 128;
-static const unsigned initial_bias = 72;
-
-static const gint dns_port = 53;
-
-#define UDP_PACKET_SIZE 4096
-
-#define DNS_COMPRESSION_BITS 0xC0
-
-#define DNS_D_MAXLABEL 63 /* + 1 '\0' */
-#define DNS_D_MAXNAME 255 /* + 1 '\0' */
-
-#define RESOLV_CONF "/etc/resolv.conf"
-
-/**
- * Represents DNS server
- */
-struct rspamd_dns_server {
- struct upstream up; /**< upstream structure */
- gchar *name; /**< name of DNS server */
- struct rspamd_dns_io_channel *io_channels;
- struct rspamd_dns_io_channel *cur_io_channel;
-};
-
-/**
- * IO channel for a specific DNS server
- */
-struct rspamd_dns_io_channel {
- struct rspamd_dns_server *srv;
- struct rspamd_dns_resolver *resolver;
- gint sock; /**< persistent socket */
- struct event ev;
- GHashTable *requests; /**< requests in flight */
- struct rspamd_dns_io_channel *prev, *next;
-};
-
-
-struct rspamd_dns_resolver {
- struct rspamd_dns_server servers[MAX_SERVERS];
- gint servers_num; /**< number of DNS servers registered */
- guint request_timeout;
- guint max_retransmits;
- guint max_errors;
- GHashTable *io_channels; /**< hash of io chains indexed by socket */
- gboolean throttling; /**< dns servers are busy */
- gboolean is_master_slave; /**< if this is true, then select upstreams as master/slave */
- guint errors; /**< resolver errors */
- struct timeval throttling_time; /**< throttling time */
- struct event throttling_event; /**< throttling event */
- struct event_base *ev_base; /**< base for event ops */
-};
-
-struct dns_header;
-struct dns_query;
-
-/* Internal DNS structs */
-
-struct dns_header {
- guint qid :16;
-
-#if BYTE_ORDER == BIG_ENDIAN
- guint qr:1;
- guint opcode:4;
- guint aa:1;
- guint tc:1;
- guint rd:1;
-
- guint ra:1;
- guint unused:3;
- guint rcode:4;
-#else
- guint rd :1;
- guint tc :1;
- guint aa :1;
- guint opcode :4;
- guint qr :1;
-
- guint rcode :4;
- guint unused :3;
- guint ra :1;
-#endif
-
- guint qdcount :16;
- guint ancount :16;
- guint nscount :16;
- guint arcount :16;
-};
-
-enum dns_section {
- DNS_S_QD = 0x01,
-#define DNS_S_QUESTION DNS_S_QD
-
- DNS_S_AN = 0x02,
-#define DNS_S_ANSWER DNS_S_AN
-
- DNS_S_NS = 0x04,
-#define DNS_S_AUTHORITY DNS_S_NS
-
- DNS_S_AR = 0x08,
-#define DNS_S_ADDITIONAL DNS_S_AR
-
- DNS_S_ALL = 0x0f
-};
-/* enum dns_section */
-
-enum dns_opcode {
- DNS_OP_QUERY = 0,
- DNS_OP_IQUERY = 1,
- DNS_OP_STATUS = 2,
- DNS_OP_NOTIFY = 4,
- DNS_OP_UPDATE = 5,
-};
-/* dns_opcode */
-
-enum dns_class {
- DNS_C_IN = 1,
-
- DNS_C_ANY = 255
-};
-/* enum dns_class */
-
-struct dns_query {
- gchar *qname;
- guint qtype :16;
- guint qclass :16;
-};
-
-enum dns_type {
- DNS_T_A = 1,
- DNS_T_NS = 2,
- DNS_T_CNAME = 5,
- DNS_T_SOA = 6,
- DNS_T_PTR = 12,
- DNS_T_MX = 15,
- DNS_T_TXT = 16,
- DNS_T_AAAA = 28,
- DNS_T_SRV = 33,
- DNS_T_OPT = 41,
- DNS_T_SSHFP = 44,
- DNS_T_SPF = 99,
-
- DNS_T_ALL = 255
-};
-/* enum dns_type */
-
-static const gchar dns_rcodes[16][16] = {
- [DNS_RC_NOERROR] = "NOERROR",
- [DNS_RC_FORMERR] = "FORMERR",
- [DNS_RC_SERVFAIL] = "SERVFAIL",
- [DNS_RC_NXDOMAIN] = "NXDOMAIN",
- [DNS_RC_NOTIMP] = "NOTIMP",
- [DNS_RC_REFUSED] = "REFUSED",
- [DNS_RC_YXDOMAIN] = "YXDOMAIN",
- [DNS_RC_YXRRSET] = "YXRRSET",
- [DNS_RC_NXRRSET] = "NXRRSET",
- [DNS_RC_NOTAUTH] = "NOTAUTH",
- [DNS_RC_NOTZONE] = "NOTZONE",
-};
-
-static const gchar dns_types[7][16] = {
- [DNS_REQUEST_A] = "A request",
- [DNS_REQUEST_PTR] = "PTR request",
- [DNS_REQUEST_MX] = "MX request",
- [DNS_REQUEST_TXT] = "TXT request",
- [DNS_REQUEST_SRV] = "SRV request",
- [DNS_REQUEST_SPF] = "SPF request",
- [DNS_REQUEST_AAA] = "AAA request"
-};
-
-#endif /* DNS_PRIVATE_H_ */
diff --git a/src/libmime/CMakeLists.txt b/src/libmime/CMakeLists.txt
new file mode 100644
index 000000000..303b7a088
--- /dev/null
+++ b/src/libmime/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Librspamd mime
+SET(LIBRSPAMDMIMESRC
+ expressions.c
+ filter.c
+ images.c
+ message.c
+ protocol.c
+ smtp_utils.c
+ smtp_proto.c
+ worker_util.c)
+
+# Librspamdmime
+ADD_LIBRARY(rspamd-mime ${LINK_TYPE} ${LIBRSPAMDMIMESRC})
+IF(NOT DEBIAN_BUILD)
+SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES VERSION ${RSPAMD_VERSION})
+ENDIF(NOT DEBIAN_BUILD)
+SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES LINKER_LANGUAGE C)
+SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB")
+TARGET_LINK_LIBRARIES(rspamd-mime rspamd-server)
+TARGET_LINK_LIBRARIES(rspamd-mime rspamd-util)
+IF(CMAKE_COMPILER_IS_GNUCC)
+SET_TARGET_PROPERTIES(rspamd-mime PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+IF(NO_SHARED MATCHES "OFF")
+ INSTALL(TARGETS rspamd-mime
+ LIBRARY DESTINATION ${LIBDIR}
+ PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
+ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
diff --git a/src/expressions.c b/src/libmime/expressions.c
index 5d19626bb..5d19626bb 100644
--- a/src/expressions.c
+++ b/src/libmime/expressions.c
diff --git a/src/expressions.h b/src/libmime/expressions.h
index 954cc74f7..954cc74f7 100644
--- a/src/expressions.h
+++ b/src/libmime/expressions.h
diff --git a/src/filter.c b/src/libmime/filter.c
index cb0630d9d..cb0630d9d 100644
--- a/src/filter.c
+++ b/src/libmime/filter.c
diff --git a/src/filter.h b/src/libmime/filter.h
index 258bd9447..258bd9447 100644
--- a/src/filter.h
+++ b/src/libmime/filter.h
diff --git a/src/images.c b/src/libmime/images.c
index ff07bbd72..ff07bbd72 100644
--- a/src/images.c
+++ b/src/libmime/images.c
diff --git a/src/images.h b/src/libmime/images.h
index c43941ebc..c43941ebc 100644
--- a/src/images.h
+++ b/src/libmime/images.h
diff --git a/src/message.c b/src/libmime/message.c
index 4567869e9..4567869e9 100644
--- a/src/message.c
+++ b/src/libmime/message.c
diff --git a/src/message.h b/src/libmime/message.h
index 5e27579d1..5e27579d1 100644
--- a/src/message.h
+++ b/src/libmime/message.h
diff --git a/src/protocol.c b/src/libmime/protocol.c
index 8a5c3f0df..8a5c3f0df 100644
--- a/src/protocol.c
+++ b/src/libmime/protocol.c
diff --git a/src/protocol.h b/src/libmime/protocol.h
index 8d2efe118..8d2efe118 100644
--- a/src/protocol.h
+++ b/src/libmime/protocol.h
diff --git a/src/smtp_proto.c b/src/libmime/smtp_proto.c
index 3af1c3910..3af1c3910 100644
--- a/src/smtp_proto.c
+++ b/src/libmime/smtp_proto.c
diff --git a/src/smtp_proto.h b/src/libmime/smtp_proto.h
index 42fecd255..42fecd255 100644
--- a/src/smtp_proto.h
+++ b/src/libmime/smtp_proto.h
diff --git a/src/smtp_utils.c b/src/libmime/smtp_utils.c
index 5178de9dd..5178de9dd 100644
--- a/src/smtp_utils.c
+++ b/src/libmime/smtp_utils.c
diff --git a/src/smtp_utils.h b/src/libmime/smtp_utils.h
index 652b6759f..652b6759f 100644
--- a/src/smtp_utils.h
+++ b/src/libmime/smtp_utils.h
diff --git a/src/worker_util.c b/src/libmime/worker_util.c
index d029f5dc4..d029f5dc4 100644
--- a/src/worker_util.c
+++ b/src/libmime/worker_util.c
diff --git a/src/libserver/CMakeLists.txt b/src/libserver/CMakeLists.txt
new file mode 100644
index 000000000..bd5df18b9
--- /dev/null
+++ b/src/libserver/CMakeLists.txt
@@ -0,0 +1,63 @@
+# Librspamdserver
+SET(LIBRSPAMDSERVERSRC
+ binlog.c
+ buffer.c
+ cfg_utils.c
+ cfg_rcl.c
+ dkim.c
+ dns.c
+ dynamic_cfg.c
+ events.c
+ html.c
+ proxy.c
+ roll_history.c
+ settings.c
+ spf.c
+ statfile.c
+ statfile_sync.c
+ symbols_cache.c
+ task.c
+ url.c)
+SET(TOKENIZERSSRC ../tokenizers/tokenizers.c
+ ../tokenizers/osb.c)
+
+SET(CLASSIFIERSSRC ../classifiers/classifiers.c
+ ../classifiers/bayes.c
+ ../classifiers/winnow.c)
+
+# Librspamd-server
+
+#IF(WITH_DB)
+# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_bdb.c)
+#ENDIF(WITH_DB)
+#IF(WITH_SQLITE)
+# LIST(APPEND LIBRSPAMDSERVERSRC kvstorage_sqlite.c)
+#ENDIF(WITH_SQLITE)
+
+ADD_LIBRARY(rspamd-server ${LINK_TYPE} ${LIBRSPAMDSERVERSRC} ${TOKENIZERSSRC} ${CLASSIFIERSSRC})
+IF(NOT DEBIAN_BUILD)
+SET_TARGET_PROPERTIES(rspamd-server PROPERTIES VERSION ${RSPAMD_VERSION})
+ENDIF(NOT DEBIAN_BUILD)
+SET_TARGET_PROPERTIES(rspamd-server PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB")
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-lua)
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-json)
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-cdb)
+TARGET_LINK_LIBRARIES(rspamd-server rspamd-util)
+TARGET_LINK_LIBRARIES(rspamd-server rdns)
+IF(CMAKE_COMPILER_IS_GNUCC)
+SET_TARGET_PROPERTIES(rspamd-server PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+IF(WITH_DB)
+ TARGET_LINK_LIBRARIES(rspamd-server db)
+ENDIF(WITH_DB)
+
+IF(OPENSSL_FOUND)
+ TARGET_LINK_LIBRARIES(rspamd-server ${OPENSSL_LIBRARIES})
+ENDIF(OPENSSL_FOUND)
+
+IF(NO_SHARED MATCHES "OFF")
+ INSTALL(TARGETS rspamd-server
+ LIBRARY DESTINATION ${LIBDIR}
+ PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
+ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
diff --git a/src/binlog.c b/src/libserver/binlog.c
index f085a7de0..f085a7de0 100644
--- a/src/binlog.c
+++ b/src/libserver/binlog.c
diff --git a/src/binlog.h b/src/libserver/binlog.h
index 9e1a786d3..9e1a786d3 100644
--- a/src/binlog.h
+++ b/src/libserver/binlog.h
diff --git a/src/buffer.c b/src/libserver/buffer.c
index 864f2fad6..864f2fad6 100644
--- a/src/buffer.c
+++ b/src/libserver/buffer.c
diff --git a/src/buffer.h b/src/libserver/buffer.h
index 5ed42bfb3..5ed42bfb3 100644
--- a/src/buffer.h
+++ b/src/libserver/buffer.h
diff --git a/src/cfg_file.h b/src/libserver/cfg_file.h
index 6ecb441fd..6ecb441fd 100644
--- a/src/cfg_file.h
+++ b/src/libserver/cfg_file.h
diff --git a/src/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 37b554dec..37b554dec 100644
--- a/src/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
diff --git a/src/cfg_rcl.h b/src/libserver/cfg_rcl.h
index 99839d1ea..99839d1ea 100644
--- a/src/cfg_rcl.h
+++ b/src/libserver/cfg_rcl.h
diff --git a/src/cfg_utils.c b/src/libserver/cfg_utils.c
index 2ca846ebd..2ca846ebd 100644
--- a/src/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
diff --git a/src/dkim.c b/src/libserver/dkim.c
index c7c8a35e1..c7c8a35e1 100644
--- a/src/dkim.c
+++ b/src/libserver/dkim.c
diff --git a/src/dkim.h b/src/libserver/dkim.h
index 29ec479b7..29ec479b7 100644
--- a/src/dkim.h
+++ b/src/libserver/dkim.h
diff --git a/src/dns.c b/src/libserver/dns.c
index e20cca9df..e20cca9df 100644
--- a/src/dns.c
+++ b/src/libserver/dns.c
diff --git a/src/dns.h b/src/libserver/dns.h
index 26ae71387..26ae71387 100644
--- a/src/dns.h
+++ b/src/libserver/dns.h
diff --git a/src/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index 7f5e8530d..7f5e8530d 100644
--- a/src/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
diff --git a/src/dynamic_cfg.h b/src/libserver/dynamic_cfg.h
index b65d7aa9a..b65d7aa9a 100644
--- a/src/dynamic_cfg.h
+++ b/src/libserver/dynamic_cfg.h
diff --git a/src/events.c b/src/libserver/events.c
index 85843fd05..85843fd05 100644
--- a/src/events.c
+++ b/src/libserver/events.c
diff --git a/src/events.h b/src/libserver/events.h
index 6728288eb..6728288eb 100644
--- a/src/events.h
+++ b/src/libserver/events.h
diff --git a/src/html.c b/src/libserver/html.c
index 028c54f6c..028c54f6c 100644
--- a/src/html.c
+++ b/src/libserver/html.c
diff --git a/src/html.h b/src/libserver/html.h
index 3ea758e60..3ea758e60 100644
--- a/src/html.h
+++ b/src/libserver/html.h
diff --git a/src/proxy.c b/src/libserver/proxy.c
index 67c7665b8..67c7665b8 100644
--- a/src/proxy.c
+++ b/src/libserver/proxy.c
diff --git a/src/proxy.h b/src/libserver/proxy.h
index c505fe83d..c505fe83d 100644
--- a/src/proxy.h
+++ b/src/libserver/proxy.h
diff --git a/src/roll_history.c b/src/libserver/roll_history.c
index 504f8ae3b..504f8ae3b 100644
--- a/src/roll_history.c
+++ b/src/libserver/roll_history.c
diff --git a/src/roll_history.h b/src/libserver/roll_history.h
index 1dff93a4f..1dff93a4f 100644
--- a/src/roll_history.h
+++ b/src/libserver/roll_history.h
diff --git a/src/settings.c b/src/libserver/settings.c
index c3292c8ab..c3292c8ab 100644
--- a/src/settings.c
+++ b/src/libserver/settings.c
diff --git a/src/settings.h b/src/libserver/settings.h
index 361700094..361700094 100644
--- a/src/settings.h
+++ b/src/libserver/settings.h
diff --git a/src/spf.c b/src/libserver/spf.c
index 12f1513d4..12f1513d4 100644
--- a/src/spf.c
+++ b/src/libserver/spf.c
diff --git a/src/spf.h b/src/libserver/spf.h
index 94c613e42..94c613e42 100644
--- a/src/spf.h
+++ b/src/libserver/spf.h
diff --git a/src/statfile.c b/src/libserver/statfile.c
index 4c1cc13fb..4c1cc13fb 100644
--- a/src/statfile.c
+++ b/src/libserver/statfile.c
diff --git a/src/statfile.h b/src/libserver/statfile.h
index 5786c4927..5786c4927 100644
--- a/src/statfile.h
+++ b/src/libserver/statfile.h
diff --git a/src/statfile_sync.c b/src/libserver/statfile_sync.c
index 6b545af17..6b545af17 100644
--- a/src/statfile_sync.c
+++ b/src/libserver/statfile_sync.c
diff --git a/src/statfile_sync.h b/src/libserver/statfile_sync.h
index b3abb8b91..b3abb8b91 100644
--- a/src/statfile_sync.h
+++ b/src/libserver/statfile_sync.h
diff --git a/src/symbols_cache.c b/src/libserver/symbols_cache.c
index dfca57c66..dfca57c66 100644
--- a/src/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
diff --git a/src/symbols_cache.h b/src/libserver/symbols_cache.h
index bb2100fc1..bb2100fc1 100644
--- a/src/symbols_cache.h
+++ b/src/libserver/symbols_cache.h
diff --git a/src/task.c b/src/libserver/task.c
index f389793dd..f389793dd 100644
--- a/src/task.c
+++ b/src/libserver/task.c
diff --git a/src/task.h b/src/libserver/task.h
index f8f7c89e3..f8f7c89e3 100644
--- a/src/task.h
+++ b/src/libserver/task.h
diff --git a/src/url.c b/src/libserver/url.c
index c4313e8a9..c4313e8a9 100644
--- a/src/url.c
+++ b/src/libserver/url.c
diff --git a/src/url.h b/src/libserver/url.h
index 60535ba5c..60535ba5c 100644
--- a/src/url.h
+++ b/src/libserver/url.h
diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt
new file mode 100644
index 000000000..2a5ab46c5
--- /dev/null
+++ b/src/libutil/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Librspamd-util
+SET(LIBRSPAMDUTILSRC aio_event.c
+ bloom.c
+ diff.c
+ fstring.c
+ fuzzy.c
+ hash.c
+ http.c
+ logger.c
+ map.c
+ memcached.c
+ mem_pool.c
+ printf.c
+ radix.c
+ rrd.c
+ trie.c
+ upstream.c
+ util.c)
+# Rspamdutil
+ADD_LIBRARY(rspamd-util ${LINK_TYPE} ${LIBRSPAMDUTILSRC})
+IF(CMAKE_COMPILER_IS_GNUCC)
+SET_TARGET_PROPERTIES(rspamd-util PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+
+TARGET_LINK_LIBRARIES(rspamd-util ${RSPAMD_REQUIRED_LIBRARIES})
+TARGET_LINK_LIBRARIES(rspamd-util pcre)
+TARGET_LINK_LIBRARIES(rspamd-util ucl)
+TARGET_LINK_LIBRARIES(rspamd-util ottery)
+TARGET_LINK_LIBRARIES(rspamd-util rspamd-http-parser)
+TARGET_LINK_LIBRARIES(rspamd-util event)
+TARGET_LINK_LIBRARIES(rspamd-util xxhash)
+IF(OPENSSL_FOUND)
+ TARGET_LINK_LIBRARIES(rspamd-util ${OPENSSL_LIBRARIES})
+ENDIF(OPENSSL_FOUND)
+
+IF(NOT DEBIAN_BUILD)
+SET_TARGET_PROPERTIES(rspamd-util PROPERTIES VERSION ${RSPAMD_VERSION})
+ENDIF(NOT DEBIAN_BUILD)
+
+IF(GLIB_COMPAT)
+ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/contrib/lgpl")
+ TARGET_LINK_LIBRARIES(rspamd-util glibadditions)
+ENDIF(GLIB_COMPAT)
+
+IF(NO_SHARED MATCHES "OFF")
+ INSTALL(TARGETS rspamd-util
+ LIBRARY DESTINATION ${LIBDIR}
+ PUBLIC_HEADER DESTINATION include)
+ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
diff --git a/src/aio_event.c b/src/libutil/aio_event.c
index ccda37083..ccda37083 100644
--- a/src/aio_event.c
+++ b/src/libutil/aio_event.c
diff --git a/src/aio_event.h b/src/libutil/aio_event.h
index 45f6015de..45f6015de 100644
--- a/src/aio_event.h
+++ b/src/libutil/aio_event.h
diff --git a/src/bloom.c b/src/libutil/bloom.c
index f857d2e49..f857d2e49 100644
--- a/src/bloom.c
+++ b/src/libutil/bloom.c
diff --git a/src/bloom.h b/src/libutil/bloom.h
index 380143c80..380143c80 100644
--- a/src/bloom.h
+++ b/src/libutil/bloom.h
diff --git a/src/diff.c b/src/libutil/diff.c
index 4038d8680..4038d8680 100644
--- a/src/diff.c
+++ b/src/libutil/diff.c
diff --git a/src/diff.h b/src/libutil/diff.h
index cea5e5d4a..cea5e5d4a 100644
--- a/src/diff.h
+++ b/src/libutil/diff.h
diff --git a/src/fstring.c b/src/libutil/fstring.c
index 098824101..098824101 100644
--- a/src/fstring.c
+++ b/src/libutil/fstring.c
diff --git a/src/fstring.h b/src/libutil/fstring.h
index bd680e365..bd680e365 100644
--- a/src/fstring.h
+++ b/src/libutil/fstring.h
diff --git a/src/fuzzy.c b/src/libutil/fuzzy.c
index 7e8a01ce3..7e8a01ce3 100644
--- a/src/fuzzy.c
+++ b/src/libutil/fuzzy.c
diff --git a/src/fuzzy.h b/src/libutil/fuzzy.h
index c226c5765..c226c5765 100644
--- a/src/fuzzy.h
+++ b/src/libutil/fuzzy.h
diff --git a/src/hash.c b/src/libutil/hash.c
index 3bb381651..3bb381651 100644
--- a/src/hash.c
+++ b/src/libutil/hash.c
diff --git a/src/hash.h b/src/libutil/hash.h
index c5d4639af..c5d4639af 100644
--- a/src/hash.h
+++ b/src/libutil/hash.h
diff --git a/src/http.c b/src/libutil/http.c
index 491468352..491468352 100644
--- a/src/http.c
+++ b/src/libutil/http.c
diff --git a/src/http.h b/src/libutil/http.h
index 8af4429c6..8af4429c6 100644
--- a/src/http.h
+++ b/src/libutil/http.h
diff --git a/src/logger.c b/src/libutil/logger.c
index 01814d24d..01814d24d 100644
--- a/src/logger.c
+++ b/src/libutil/logger.c
diff --git a/src/logger.h b/src/libutil/logger.h
index b0766b938..b0766b938 100644
--- a/src/logger.h
+++ b/src/libutil/logger.h
diff --git a/src/map.c b/src/libutil/map.c
index 703622585..703622585 100644
--- a/src/map.c
+++ b/src/libutil/map.c
diff --git a/src/map.h b/src/libutil/map.h
index 1f34cdcc0..1f34cdcc0 100644
--- a/src/map.h
+++ b/src/libutil/map.h
diff --git a/src/mem_pool.c b/src/libutil/mem_pool.c
index 8f1105add..8f1105add 100644
--- a/src/mem_pool.c
+++ b/src/libutil/mem_pool.c
diff --git a/src/mem_pool.h b/src/libutil/mem_pool.h
index f759ed60a..f759ed60a 100644
--- a/src/mem_pool.h
+++ b/src/libutil/mem_pool.h
diff --git a/src/memcached.c b/src/libutil/memcached.c
index e4c9be9d2..e4c9be9d2 100644
--- a/src/memcached.c
+++ b/src/libutil/memcached.c
diff --git a/src/memcached.h b/src/libutil/memcached.h
index 098e26eea..098e26eea 100644
--- a/src/memcached.h
+++ b/src/libutil/memcached.h
diff --git a/src/printf.c b/src/libutil/printf.c
index d72ec95c8..d72ec95c8 100644
--- a/src/printf.c
+++ b/src/libutil/printf.c
diff --git a/src/printf.h b/src/libutil/printf.h
index a4e03791d..a4e03791d 100644
--- a/src/printf.h
+++ b/src/libutil/printf.h
diff --git a/src/radix.c b/src/libutil/radix.c
index 1a05db178..1a05db178 100644
--- a/src/radix.c
+++ b/src/libutil/radix.c
diff --git a/src/radix.h b/src/libutil/radix.h
index 4cc2873c7..4cc2873c7 100644
--- a/src/radix.h
+++ b/src/libutil/radix.h
diff --git a/src/rrd.c b/src/libutil/rrd.c
index a0e21eaed..a0e21eaed 100644
--- a/src/rrd.c
+++ b/src/libutil/rrd.c
diff --git a/src/rrd.h b/src/libutil/rrd.h
index ff6902894..ff6902894 100644
--- a/src/rrd.h
+++ b/src/libutil/rrd.h
diff --git a/src/trie.c b/src/libutil/trie.c
index 394c4e939..394c4e939 100644
--- a/src/trie.c
+++ b/src/libutil/trie.c
diff --git a/src/trie.h b/src/libutil/trie.h
index 2792ee4a5..2792ee4a5 100644
--- a/src/trie.h
+++ b/src/libutil/trie.h
diff --git a/src/upstream.c b/src/libutil/upstream.c
index f82d3ba50..f82d3ba50 100644
--- a/src/upstream.c
+++ b/src/libutil/upstream.c
diff --git a/src/upstream.h b/src/libutil/upstream.h
index da0a00013..da0a00013 100644
--- a/src/upstream.h
+++ b/src/libutil/upstream.h
diff --git a/src/util.c b/src/libutil/util.c
index 03b38e087..03b38e087 100644
--- a/src/util.c
+++ b/src/libutil/util.c
diff --git a/src/util.h b/src/libutil/util.h
index 0605fe87d..0605fe87d 100644
--- a/src/util.h
+++ b/src/libutil/util.h