SYMBOL_TYPE_FINE = (1 << 7)
};
+/**
+ * Abstract structure for saving callback data for symbols
+ */
+struct rspamd_abstract_callback_data {
+ guint64 magic;
+ char data[];
+};
+
/**
* Creates new cache structure
* @return
{NULL, NULL}
};
+static const guint64 rspamd_lua_callback_magic = 0x32c118af1e3263c7ULL;
+
struct rspamd_config *
lua_check_config (lua_State * L, gint pos)
{
}
struct lua_callback_data {
+ guint64 magic;
+ lua_State *L;
+ gchar *symbol;
+
union {
gchar *name;
gint ref;
} callback;
gboolean cb_is_ref;
- lua_State *L;
- gchar *symbol;
};
/*
cd =
rspamd_mempool_alloc (cfg->cfg_pool,
sizeof (struct lua_callback_data));
+ cd->magic = rspamd_lua_callback_magic;
+
if (lua_type (L, 2) == LUA_TSTRING) {
cd->callback.name = rspamd_mempool_strdup (cfg->cfg_pool,
luaL_checkstring (L, 2));
cd->callback.ref = luaL_ref (L, LUA_REGISTRYINDEX);
cd->cb_is_ref = TRUE;
}
+
cd->L = L;
cfg->post_filters = g_list_prepend (cfg->post_filters, cd);
rspamd_mempool_add_destructor (cfg->cfg_pool,
cd =
rspamd_mempool_alloc (cfg->cfg_pool,
sizeof (struct lua_callback_data));
+ cd->magic = rspamd_lua_callback_magic;
+
if (lua_type (L, 2) == LUA_TSTRING) {
cd->callback.name = rspamd_mempool_strdup (cfg->cfg_pool,
luaL_checkstring (L, 2));
cd = rspamd_mempool_alloc0 (cfg->cfg_pool,
sizeof (struct lua_callback_data));
+ cd->magic = rspamd_lua_callback_magic;
cd->cb_is_ref = TRUE;
cd->callback.ref = ref;
cd->L = L;
#include "libutil/map.h"
#include "lua/lua_common.h"
+static const guint64 rspamd_regexp_cb_magic = 0xca9d9649fc3e2659ULL;
+
struct regexp_module_item {
+ guint64 magic;
struct rspamd_expression *expr;
const gchar *symbol;
struct ucl_lua_funcdata *lua_function;
cur_item = rspamd_mempool_alloc0 (regexp_module_ctx->regexp_pool,
sizeof (struct regexp_module_item));
cur_item->symbol = ucl_object_key (value);
+ cur_item->magic = rspamd_regexp_cb_magic;
+
if (!read_regexp_expression (regexp_module_ctx->regexp_pool,
cur_item, ucl_object_key (value),
ucl_obj_tostring (value), cfg)) {
/* Just a lua function */
cur_item = rspamd_mempool_alloc0 (regexp_module_ctx->regexp_pool,
sizeof (struct regexp_module_item));
+ cur_item->magic = rspamd_regexp_cb_magic;
cur_item->symbol = ucl_object_key (value);
cur_item->lua_function = ucl_object_toclosure (value);
+
rspamd_symbols_cache_add_symbol (cfg->cache,
cur_item->symbol,
0,
cur_item = rspamd_mempool_alloc0 (regexp_module_ctx->regexp_pool,
sizeof (struct regexp_module_item));
cur_item->symbol = ucl_object_key (value);
+ cur_item->magic = rspamd_regexp_cb_magic;
+
if (!read_regexp_expression (regexp_module_ctx->regexp_pool,
cur_item, ucl_object_key (value),
ucl_obj_tostring (elt), cfg)) {
cur_item = rspamd_mempool_alloc0 (
regexp_module_ctx->regexp_pool,
sizeof (struct regexp_module_item));
+ cur_item->magic = rspamd_regexp_cb_magic;
cur_item->symbol = ucl_object_key (value);
cur_item->lua_function = ucl_object_toclosure (value);
}
#include "unix-std.h"
static struct surbl_ctx *surbl_module_ctx = NULL;
+static const guint64 rspamd_surbl_cb_magic = 0xe09b8536f80de0d1ULL;
static void surbl_test_url (struct rspamd_task *task, void *user_data);
static void surbl_dns_callback (struct rdns_reply *reply, gpointer arg);
#define WHITELIST_ERROR 0
#define CONVERSION_ERROR 1
#define DUPLICATE_ERROR 1
+
GQuark
surbl_error_quark (void)
{
"definition");
continue;
}
+
new_suffix = rspamd_mempool_alloc0 (surbl_module_ctx->surbl_pool,
sizeof (struct suffix_item));
+ new_suffix->magic = rspamd_surbl_cb_magic;
new_suffix->suffix = rspamd_mempool_strdup (
surbl_module_ctx->surbl_pool,
ucl_obj_tostring (cur));
};
struct suffix_item {
+ guint64 magic;
const gchar *suffix;
const gchar *symbol;
guint32 options;