From: Vsevolod Stakhov Date: Wed, 11 May 2011 16:55:02 +0000 (+0400) Subject: Fix settings using. X-Git-Tag: 0.3.13~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=389594cb0787aadb717717ca92d602692128153c;p=rspamd.git Fix settings using. Revert genmodules logic. --- diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 2fdf37904..2bb4e028e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -64,9 +64,4 @@ SET_TARGET_PROPERTIES(rspamdserver PROPERTIES LINKER_LANGUAGE C) SET_TARGET_PROPERTIES(rspamdserver PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB") TARGET_LINK_LIBRARIES(rspamdserver rspamd_lua) TARGET_LINK_LIBRARIES(rspamdserver rspamd_json) -TARGET_LINK_LIBRARIES(rspamdserver rspamd_cdb) - -ADD_CUSTOM_TARGET(genmodules - COMMAND ../utils/gen-modules.sh ${PLUGINSSRC} - WORKING_DIRECTORY src) -ADD_DEPENDENCIES(rspamdserver genmodules) \ No newline at end of file +TARGET_LINK_LIBRARIES(rspamdserver rspamd_cdb) \ No newline at end of file diff --git a/src/message.c b/src/message.c index ab2e41206..4f8d4dcc3 100644 --- a/src/message.c +++ b/src/message.c @@ -28,7 +28,6 @@ #include "message.h" #include "cfg_file.h" #include "html.h" -#include "modules.h" #include "images.h" #define RECURSION_LIMIT 30 diff --git a/src/settings.c b/src/settings.c index 8d18880a0..8c13681ef 100644 --- a/src/settings.c +++ b/src/settings.c @@ -329,6 +329,8 @@ static gboolean check_setting (struct worker_task *task, struct rspamd_settings **user_settings, struct rspamd_settings **domain_settings) { gchar *field = NULL, *domain = NULL; + gchar cmp_buf[1024]; + gint len; if (task->deliver_to != NULL) { /* First try to use deliver-to field */ @@ -359,10 +361,17 @@ check_setting (struct worker_task *task, struct rspamd_settings **user_settings, /* First try to search per-user settings */ if (field != NULL) { - *user_settings = g_hash_table_lookup (task->cfg->user_settings, field); + if (*field == '<') { + field ++; + } + len = strcspn (field, ">"); + rspamd_strlcpy (cmp_buf, field, MIN (sizeof (cmp_buf), len + 1)); + *user_settings = g_hash_table_lookup (task->cfg->user_settings, cmp_buf); } if (domain != NULL) { - *domain_settings = g_hash_table_lookup (task->cfg->domain_settings, domain); + len = strcspn (domain, ">"); + rspamd_strlcpy (cmp_buf, domain, MIN (sizeof (cmp_buf), len + 1)); + *domain_settings = g_hash_table_lookup (task->cfg->domain_settings, cmp_buf); } if (*domain_settings != NULL || *user_settings != NULL) {