diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-10 17:17:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-10 17:17:09 +0100 |
commit | 6e31344466e2558a99cd46bb29abaa37e1faffc6 (patch) | |
tree | ae51cd2a56c252d6f0df6755b76719fe121e81e3 /src/lua | |
parent | c4d3eb4af41a17cf28cb4fbb171d9b70d98259b5 (diff) | |
download | rspamd-6e31344466e2558a99cd46bb29abaa37e1faffc6.tar.gz rspamd-6e31344466e2558a99cd46bb29abaa37e1faffc6.zip |
[Minor] Fix compile warnings
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_common.c | 26 | ||||
-rw-r--r-- | src/lua/lua_cryptobox.c | 20 | ||||
-rw-r--r-- | src/lua/lua_task.c | 4 | ||||
-rw-r--r-- | src/lua/lua_udp.c | 3 | ||||
-rw-r--r-- | src/lua/lua_worker.c | 2 |
5 files changed, 23 insertions, 32 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index bbcec4c1c..d68e8e952 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -253,11 +253,9 @@ rspamd_lua_set_path (lua_State *L, const ucl_object_t *cfg_obj, GHashTable *vars { const gchar *old_path, *additional_path = NULL; const ucl_object_t *opts = NULL; - const gchar *pluginsdir = RSPAMD_PLUGINSDIR, - *rulesdir = RSPAMD_RULESDIR, + const gchar *rulesdir = RSPAMD_RULESDIR, *lualibdir = RSPAMD_LUALIBDIR, - *libdir = RSPAMD_LIBDIR, - *sharedir = RSPAMD_SHAREDIR; + *libdir = RSPAMD_LIBDIR; const gchar *t; gchar path_buf[PATH_MAX]; @@ -290,16 +288,6 @@ rspamd_lua_set_path (lua_State *L, const ucl_object_t *cfg_obj, GHashTable *vars } else { /* Try environment */ - t = getenv ("SHAREDIR"); - if (t) { - sharedir = t; - } - - t = getenv ("PLUGINSDIR"); - if (t) { - pluginsdir = t; - } - t = getenv ("RULESDIR"); if (t) { rulesdir = t; @@ -321,16 +309,6 @@ rspamd_lua_set_path (lua_State *L, const ucl_object_t *cfg_obj, GHashTable *vars } if (vars) { - t = g_hash_table_lookup (vars, "PLUGINSDIR"); - if (t) { - pluginsdir = t; - } - - t = g_hash_table_lookup (vars, "SHAREDIR"); - if (t) { - sharedir = t; - } - t = g_hash_table_lookup (vars, "RULESDIR"); if (t) { rulesdir = t; diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c index 645b2495f..518ae9389 100644 --- a/src/lua/lua_cryptobox.c +++ b/src/lua/lua_cryptobox.c @@ -2321,6 +2321,16 @@ lua_cryptobox_gen_dkim_keypair (lua_State *L) /* Process private key */ rc = i2d_RSAPrivateKey_bio (mbio, r); + + if (rc == 0) { + BIO_free (mbio); + BN_free (e); + RSA_free (r); + EVP_PKEY_free (pk); + + return luaL_error (L, "i2d_RSAPrivateKey_bio failed"); + } + len = BIO_get_mem_data (mbio, &data); b64_data = rspamd_encode_base64 (data, len, -1, &b64_len); @@ -2334,6 +2344,16 @@ lua_cryptobox_gen_dkim_keypair (lua_State *L) /* Process public key */ BIO_reset (mbio); rc = i2d_RSA_PUBKEY_bio (mbio, r); + + if (rc == 0) { + BIO_free (mbio); + BN_free (e); + RSA_free (r); + EVP_PKEY_free (pk); + + return luaL_error (L, "i2d_RSA_PUBKEY_bio failed"); + } + len = BIO_get_mem_data (mbio, &data); b64_data = rspamd_encode_base64 (data, len, -1, &b64_len); diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 2ec6dc29b..b04596ed3 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -3510,6 +3510,7 @@ lua_task_has_from (lua_State *L) } lua_pushboolean (L, ret); + (void)nrcpt; /* Silence warning */ return 1; } @@ -5705,12 +5706,9 @@ lua_task_get_metric_action (lua_State *L) { LUA_TRACE_POINT; struct rspamd_task *task = lua_check_task (L, 1); - struct rspamd_scan_result *metric_res; struct rspamd_action *action; if (task) { - metric_res = task->result; - action = rspamd_check_action_metric (task); lua_pushstring (L, action->name); } diff --git a/src/lua/lua_udp.c b/src/lua/lua_udp.c index b72108c34..5d1fd8c62 100644 --- a/src/lua/lua_udp.c +++ b/src/lua/lua_udp.c @@ -256,11 +256,8 @@ static void lua_udp_io_handler (gint fd, short what, gpointer p) { struct lua_udp_cbdata *cbd = (struct lua_udp_cbdata *)p; - lua_State *L; gssize r; - L = cbd->L; - if (what == EV_TIMEOUT) { if (cbd->sent && cbd->retransmits > 0) { r = lua_try_send_request (cbd); diff --git a/src/lua/lua_worker.c b/src/lua/lua_worker.c index eaf0e02d7..940c6ae4a 100644 --- a/src/lua/lua_worker.c +++ b/src/lua/lua_worker.c @@ -261,9 +261,7 @@ lua_worker_control_fin_session (void *ud) struct rspamd_control_reply rep; struct rspamd_control_cbdata *cbd = (struct rspamd_control_cbdata *)ud; rspamd_mempool_t *pool; - lua_State *L; - L = cbd->L; pool = cbd->pool; memset (&rep, 0, sizeof (rep)); |