@@ -14,6 +14,11 @@ SET(RSPAMD_VERSION_MAJOR 1) | |||
SET(RSPAMD_VERSION_MINOR 2) | |||
SET(RSPAMD_VERSION_PATCH 0) | |||
# Keep two digits all the time | |||
SET(RSPAMD_VERSION_MAJOR_NUM ${RSPAMD_VERSION_MAJOR}0) | |||
SET(RSPAMD_VERSION_MINOR_NUM ${RSPAMD_VERSION_MINOR}0) | |||
SET(RSPAMD_VERSION_PATCH_NUM ${RSPAMD_VERSION_PATCH}0) | |||
IF(GIT_ID) | |||
SET(GIT_VERSION 1) | |||
SET(RSPAMD_ID "${GIT_ID}") |
@@ -184,11 +184,13 @@ | |||
#define RSPAMD_PREFIX "${CMAKE_INSTALL_PREFIX}" | |||
#ifdef GIT_VERSION | |||
#if defined(GIT_VERSION) && GIT_VERSION == 1 | |||
# define RVERSION "${RSPAMD_VERSION}" | |||
# define RID "${RSPAMD_ID}" | |||
# define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}${RSPAMD_ID}ULL | |||
#else | |||
# define RVERSION "${RSPAMD_VERSION}" | |||
# define RSPAMD_VERSION_NUM 0x${RSPAMD_VERSION_MAJOR_NUM}${RSPAMD_VERSION_MINOR_NUM}${RSPAMD_VERSION_PATCH_NUM}0000000ULL | |||
# define RID "release" | |||
#endif | |||
@@ -109,7 +109,8 @@ worker_t controller_worker = { | |||
TRUE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
/* | |||
* Worker's context |
@@ -56,7 +56,8 @@ worker_t fuzzy_worker = { | |||
FALSE, /* Unique */ | |||
FALSE, /* Threaded */ | |||
FALSE, /* Non killable */ | |||
SOCK_DGRAM /* UDP socket */ | |||
SOCK_DGRAM, /* UDP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
/* For evtimer */ |
@@ -36,7 +36,8 @@ worker_t hs_helper_worker = { | |||
TRUE, /* Unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
static const gdouble default_max_time = 1.0; |
@@ -42,7 +42,8 @@ worker_t http_proxy_worker = { | |||
FALSE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER | |||
}; | |||
struct rspamd_http_upstream { |
@@ -37,7 +37,8 @@ worker_t lmtp_worker = { | |||
TRUE, /* Has socket */ | |||
FALSE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE /* Killable */ | |||
TRUE, /* Killable */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
#ifndef HAVE_SA_SIGINFO |
@@ -46,7 +46,8 @@ worker_t lua_worker = { | |||
FALSE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
/* |
@@ -39,7 +39,8 @@ module_t chartable_module = { | |||
chartable_module_init, | |||
chartable_module_config, | |||
chartable_module_reconfig, | |||
NULL | |||
NULL, | |||
RSPAMD_MODULE_VER | |||
}; | |||
struct chartable_ctx { |
@@ -83,7 +83,8 @@ module_t dkim_module = { | |||
dkim_module_init, | |||
dkim_module_config, | |||
dkim_module_reconfig, | |||
NULL | |||
NULL, | |||
RSPAMD_MODULE_VER | |||
}; | |||
static void |
@@ -151,7 +151,8 @@ module_t fuzzy_check_module = { | |||
fuzzy_check_module_init, | |||
fuzzy_check_module_config, | |||
fuzzy_check_module_reconfig, | |||
fuzzy_attach_controller | |||
fuzzy_attach_controller, | |||
RSPAMD_MODULE_VER | |||
}; | |||
static void |
@@ -73,7 +73,8 @@ module_t surbl_module = { | |||
surbl_module_init, | |||
surbl_module_config, | |||
surbl_module_reconfig, | |||
NULL | |||
NULL, | |||
RSPAMD_MODULE_VER | |||
}; | |||
static void |
@@ -96,6 +96,40 @@ struct module_ctx { | |||
gboolean enabled; /**< true if module is enabled in configuration */ | |||
}; | |||
#ifndef WITH_HYPERSCAN | |||
#define RSPAMD_FEATURE_HYPERSCAN "0" | |||
#else | |||
#define RSPAMD_FEATURE_HYPERSCAN "1" | |||
#endif | |||
#ifndef WITH_PCRE2 | |||
#define RSPAMD_FEATURE_PCRE2 "0" | |||
#else | |||
#define RSPAMD_FEATURE_PCRE2 "1" | |||
#endif | |||
#ifndef WITH_FANN | |||
#define RSPAMD_FEATURE_FANN "0" | |||
#else | |||
#define RSPAMD_FEATURE_FANN "1" | |||
#endif | |||
#ifndef WITH_SNOWBALL | |||
#define RSPAMD_FEATURE_SNOWBALL "0" | |||
#else | |||
#define RSPAMD_FEATURE_SNOWBALL "1" | |||
#endif | |||
#define RSPAMD_FEATURES \ | |||
RSPAMD_FEATURE_HYPERSCAN RSPAMD_FEATURE_PCRE2 \ | |||
RSPAMD_FEATURE_FANN RSPAMD_FEATURE_SNOWBALL | |||
#define RSPAMD_MODULE_VER \ | |||
0x1, /* Module version */ \ | |||
RSPAMD_VERSION_NUM, /* Rspamd version */ \ | |||
RSPAMD_FEATURES /* Compilation features */ \ | |||
#define RSPAMD_WORKER_VER \ | |||
0x1, /* Worker version */ \ | |||
RSPAMD_VERSION_NUM, /* Rspamd version */ \ | |||
RSPAMD_FEATURES /* Compilation features */ \ | |||
/** | |||
* Module | |||
*/ | |||
@@ -106,6 +140,9 @@ typedef struct module_s { | |||
int (*module_reconfig_func)(struct rspamd_config *cfg); | |||
int (*module_attach_controller_func)(struct module_ctx *ctx, | |||
GHashTable *custom_commands); | |||
guint module_version; | |||
guint64 rspamd_version; | |||
const gchar *rspamd_features; | |||
} module_t; | |||
typedef struct worker_s { | |||
@@ -117,6 +154,9 @@ typedef struct worker_s { | |||
gboolean threaded; | |||
gboolean killable; | |||
gint listen_type; | |||
guint module_version; | |||
guint64 rspamd_version; | |||
const gchar *rspamd_features; | |||
} worker_t; | |||
struct pidfh; |
@@ -51,7 +51,8 @@ worker_t smtp_worker = { | |||
FALSE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
static gboolean |
@@ -47,7 +47,8 @@ worker_t smtp_proxy_worker = { | |||
FALSE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
struct smtp_proxy_ctx { |
@@ -50,7 +50,8 @@ worker_t normal_worker = { | |||
FALSE, /* Non unique */ | |||
FALSE, /* Non threaded */ | |||
TRUE, /* Killable */ | |||
SOCK_STREAM /* TCP socket */ | |||
SOCK_STREAM, /* TCP socket */ | |||
RSPAMD_WORKER_VER /* Version info */ | |||
}; | |||
#define msg_err_ctx(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL, \ |