diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-19 14:21:14 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-19 14:21:14 +0400 |
commit | dec1abd6e4582b74b658db72a7071ce098d1c9e5 (patch) | |
tree | 3349035072faa222d6b62670db8320ce69fe4313 | |
parent | 2703710f1a44f6fcf96524d3a807e566069548c7 (diff) | |
parent | 4b4c9c35fe2347779d9636b71b4e1fb4456802f3 (diff) | |
download | rspamd-dec1abd6e4582b74b658db72a7071ce098d1c9e5.tar.gz rspamd-dec1abd6e4582b74b658db72a7071ce098d1c9e5.zip |
* Merge
-rw-r--r-- | CMakeLists.txt | 41 | ||||
-rw-r--r-- | src/logger.c | 6 | ||||
-rw-r--r-- | src/message.c | 2 | ||||
-rw-r--r-- | src/protocol.c | 4 |
4 files changed, 41 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f7c7ade72..7415cc5bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") /usr/local/lib DOC "Path where the libintl library can be found") LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIBRARY}) + MESSAGE(STATUS "Configuring for FreeBSD") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") @@ -76,6 +77,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") /usr/local/lib DOC "Path where the libintl library can be found") LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIBRARY}) + MESSAGE(STATUS "Configuring for Darwin") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") @@ -87,6 +89,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") ENDIF(NOT ETC_PREFIX) LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) + MESSAGE(STATUS "Configuring for Linux") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") @@ -99,6 +102,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") LIST(APPEND CMAKE_REQUIRED_LIBRARIES dl) LIST(APPEND CMAKE_REQUIRED_LIBRARIES resolv) LIST(APPEND CMAKE_REQUIRED_LIBRARIES m) + MESSAGE(STATUS "Configuring for Solaris") ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") IF(ENABLE_PERL MATCHES "ON") @@ -666,22 +670,47 @@ ENDIF(PERL_EXECUTABLE) # Configs -INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd)") +IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd)") +ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd) INSTALL(FILES conf/2tld.inc RENAME 2tld.inc.orig DESTINATION ${ETC_PREFIX}/rspamd) IF(NOT EXISTS ${ETC_PREFIX}/rspamd/2tld.inc) -INSTALL(FILES conf/2tld.inc DESTINATION ${ETC_PREFIX}/rspamd) + INSTALL(FILES conf/2tld.inc DESTINATION ${ETC_PREFIX}/rspamd) ENDIF(NOT EXISTS ${ETC_PREFIX}/rspamd/2tld.inc) INSTALL(FILES conf/rspamd.xml.sample DESTINATION ${ETC_PREFIX}/) # Lua plugins -INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins)") -INSTALL(DIRECTORY src/plugins/lua DESTINATION ${ETC_PREFIX}/rspamd/plugins PATTERN "*.lua") +IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua)") +ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua) + +FILE(GLOB LUA_PLUGINS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/lua" "${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/lua/*.lua" ) +FOREACH(LUA_PLUGIN IN LISTS LUA_PLUGINS) + GET_FILENAME_COMPONENT(_rp ${LUA_PLUGIN} PATH) + IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp}) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp})") + ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp}) + IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/${_rp}/${LUA_PLUGIN}) + INSTALL(FILES "src/plugins/lua/${LUA_PLUGIN}" DESTINATION ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/lua/${_rp}) + ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/plugins/${_rp}/${LUA_PLUGIN}) +ENDFOREACH(LUA_PLUGIN) # Lua config -INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/lua)") -INSTALL(DIRECTORY conf/lua DESTINATION ${ETC_PREFIX}/rspamd/ PATTERN "*.lua") +IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/lua)") +ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua) +FILE(GLOB_RECURSE LUA_CONFIGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/conf/lua" "${CMAKE_CURRENT_SOURCE_DIR}/conf/lua/*.lua") +FOREACH(LUA_CONF IN LISTS LUA_CONFIGS) + GET_FILENAME_COMPONENT(_rp ${LUA_CONF} PATH) + IF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp})") + ENDIF(NOT IS_DIRECTORY ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}) + IF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}/${LUA_CONF}) + INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}) + ENDIF(NOT EXISTS ${DESTDIR}/${ETC_PREFIX}/rspamd/lua/${_rp}/${LUA_CONF}) +ENDFOREACH(LUA_CONF) # Perl lib IF(PERL_EXECUTABLE) diff --git a/src/logger.c b/src/logger.c index 25839d026..19ea767b8 100644 --- a/src/logger.c +++ b/src/logger.c @@ -485,7 +485,7 @@ file_log_function (const gchar * log_domain, const gchar *function, GLogLevelFla now = time (NULL); tms = localtime (&now); - strftime (timebuf, sizeof (timebuf), "%b %d %H:%M:%S", tms); + strftime (timebuf, sizeof (timebuf), "%F %H:%M:%S", tms); switch (rspamd_log->process_type) { case TYPE_MAIN: cptype = "main"; @@ -510,10 +510,10 @@ file_log_function (const gchar * log_domain, const gchar *function, GLogLevelFla break; } if (function == NULL) { - r = rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "#%P(%s): %s rspamd ", rspamd_log->pid, cptype, timebuf); + r = rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "%s #%P(%s) ", timebuf, rspamd_log->pid, cptype); } else { - r = rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "#%P(%s): %s rspamd %s: ", rspamd_log->pid, cptype, timebuf, function); + r = rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "%s #%P(%s) %s: ", timebuf, rspamd_log->pid, cptype, function); } iov[0].iov_base = tmpbuf; iov[0].iov_len = r; diff --git a/src/message.c b/src/message.c index 834f36f45..f3be3032a 100644 --- a/src/message.c +++ b/src/message.c @@ -767,7 +767,7 @@ process_message (struct worker_task *task) debug_task ("found %d parts in message", task->parts_count); if (task->queue_id == NULL) { - task->queue_id = (char *)g_mime_message_get_message_id (task->message); + task->queue_id = "undef"; } task->message_id = g_mime_message_get_message_id (task->message); if (task->message_id == NULL) { diff --git a/src/protocol.c b/src/protocol.c index 7d26d6c80..f86f25677 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -800,7 +800,7 @@ write_check_reply (struct worker_task *task) cd.task = task; cd.log_buf = logbuf; - cd.log_offset = rspamd_snprintf (logbuf, sizeof (logbuf), "msg ok, id: <%s>, ", task->message_id); + cd.log_offset = rspamd_snprintf (logbuf, sizeof (logbuf), "id: <%s>, qid: <%s>, ", task->message_id, task->queue_id); cd.log_size = sizeof (logbuf); cd.alive = TRUE; @@ -886,7 +886,7 @@ write_process_reply (struct worker_task *task) cd.task = task; cd.log_buf = logbuf; - cd.log_offset = rspamd_snprintf (logbuf, sizeof (logbuf), "msg ok, id: <%s>, ", task->message_id); + cd.log_offset = rspamd_snprintf (logbuf, sizeof (logbuf), "id: <%s>, qid: <%s>, ", task->message_id, task->queue_id); cd.log_size = sizeof (logbuf); cd.alive = TRUE; |