diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-04 13:38:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-04 13:38:10 +0100 |
commit | 6c76c1728c81e25be854e36cd9def1d689536b27 (patch) | |
tree | 6c31c5e132be7169704b50670ef7810703124819 /src/libserver | |
parent | 39dfdab80d11c6bc7b10f37d819414358d5249f9 (diff) | |
download | rspamd-6c76c1728c81e25be854e36cd9def1d689536b27.tar.gz rspamd-6c76c1728c81e25be854e36cd9def1d689536b27.zip |
[Minor] Strictly check worker context magic
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/worker_util.c | 8 | ||||
-rw-r--r-- | src/libserver/worker_util.h | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index 4779fd57a..eff39a8b0 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -1472,4 +1472,12 @@ rspamd_worker_hyperscan_ready (struct rspamd_main *rspamd_main, return TRUE; } + +gboolean +rspamd_worker_check_context (gpointer ctx, guint64 magic) +{ + struct rspamd_abstract_worker_ctx *actx = (struct rspamd_abstract_worker_ctx*)ctx; + + return actx->magic == magic; +} #endif
\ No newline at end of file diff --git a/src/libserver/worker_util.h b/src/libserver/worker_util.h index d0966e009..6fbda0b4a 100644 --- a/src/libserver/worker_util.h +++ b/src/libserver/worker_util.h @@ -58,6 +58,14 @@ rspamd_prepare_worker (struct rspamd_worker *worker, const char *name, rspamd_accept_handler hdl); /** + * Should be used to validate context for a worker as in assert like invocation + * @param ctx + * @param magic + * @return + */ +gboolean rspamd_worker_check_context (gpointer ctx, guint64 magic); + +/** * Set special signal handler for a worker */ void rspamd_worker_set_signal_handler (int signo, |