diff options
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_cfg_file.c | 3 | ||||
-rw-r--r-- | src/lua/lua_classifier.c | 1 | ||||
-rw-r--r-- | src/lua/lua_config.c | 4 | ||||
-rw-r--r-- | src/lua/lua_cryptobox.c | 4 | ||||
-rw-r--r-- | src/lua/lua_dns.c | 1 | ||||
-rw-r--r-- | src/lua/lua_fann.c | 2 | ||||
-rw-r--r-- | src/lua/lua_http.c | 6 | ||||
-rw-r--r-- | src/lua/lua_map.c | 2 | ||||
-rw-r--r-- | src/lua/lua_mempool.c | 3 | ||||
-rw-r--r-- | src/lua/lua_mimepart.c | 2 | ||||
-rw-r--r-- | src/lua/lua_redis.c | 1 | ||||
-rw-r--r-- | src/lua/lua_regexp.c | 1 | ||||
-rw-r--r-- | src/lua/lua_rsa.c | 13 | ||||
-rw-r--r-- | src/lua/lua_sqlite3.c | 1 | ||||
-rw-r--r-- | src/lua/lua_task.c | 14 | ||||
-rw-r--r-- | src/lua/lua_tcp.c | 4 | ||||
-rw-r--r-- | src/lua/lua_upstream.c | 2 | ||||
-rw-r--r-- | src/lua/lua_url.c | 4 | ||||
-rw-r--r-- | src/lua/lua_util.c | 4 | ||||
-rw-r--r-- | src/lua/lua_xmlrpc.c | 2 |
20 files changed, 14 insertions, 60 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c index acf7e32b1..2e46f91fc 100644 --- a/src/lua/lua_cfg_file.c +++ b/src/lua/lua_cfg_file.c @@ -16,9 +16,8 @@ #include "lua_common.h" #include "expression.h" #include "composites.h" -#include "unix-std.h" + #ifdef HAVE_SYS_UTSNAME_H -#include <sys/utsname.h> #endif /* diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c index 871433124..cab488e84 100644 --- a/src/lua/lua_classifier.c +++ b/src/lua/lua_classifier.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "cfg_file.h" /* Classifier methods */ LUA_FUNCTION_DEF (classifier, get_statfiles); diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index e6e66b900..3179c29fc 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -18,7 +18,6 @@ #include "libutil/expression.h" #include "libserver/composites.h" #include "lua/lua_map.h" -#include "monitored.h" #include "utlist.h" #include <math.h> @@ -682,8 +681,7 @@ lua_check_monitored (lua_State * L, gint pos) static gint lua_config_get_api_version (lua_State *L) { - lua_pushinteger (L, RSPAMD_LUA_API_VERSION); - return 1; + return luaL_error (L, "obsolete function"); } static gint diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c index 5e8cec08c..0e28e52bb 100644 --- a/src/lua/lua_cryptobox.c +++ b/src/lua/lua_cryptobox.c @@ -27,11 +27,7 @@ */ #include "lua_common.h" -#include "cryptobox.h" -#include "keypair.h" #include "unix-std.h" -#include <openssl/evp.h> -#include <openssl/hmac.h> struct rspamd_lua_cryptobox_hash { rspamd_cryptobox_hash_state_t *h; diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c index 22acbe4d3..6dab3c285 100644 --- a/src/lua/lua_dns.c +++ b/src/lua/lua_dns.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "dns.h" #include "utlist.h" diff --git a/src/lua/lua_fann.c b/src/lua/lua_fann.c index 884a40293..7315de7ad 100644 --- a/src/lua/lua_fann.c +++ b/src/lua/lua_fann.c @@ -14,7 +14,7 @@ * limitations under the License. */ #include "lua_common.h" -#include "util.h" + #ifdef WITH_FANN #include <fann.h> #endif diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 31b0b3be3..1cc10f48e 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -14,11 +14,7 @@ * limitations under the License. */ #include "lua_common.h" -#include "dns.h" -#include "http.h" #include "http_private.h" -#include "utlist.h" -#include "libcryptobox/keypair.h" #include "unix-std.h" /*** @@ -181,7 +177,7 @@ lua_http_finish_handler (struct rspamd_http_connection *conn, /* Error */ lua_pushnil (cbd->L); /* Reply code */ - lua_pushinteger (cbd->L, msg->code); + lua_pushnumber (cbd->L, msg->code); /* Body */ body = rspamd_http_message_get_body (msg, &body_len); diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c index c0ce00609..40b2ecedc 100644 --- a/src/lua/lua_map.c +++ b/src/lua/lua_map.c @@ -17,8 +17,6 @@ #include "lua_common.h" #include "libutil/map.h" #include "libutil/map_private.h" -#include "libutil/radix.h" -#include "lua/lua_map.h" /*** * This module is used to manage rspamd maps and map like objects diff --git a/src/lua/lua_mempool.c b/src/lua/lua_mempool.c index 8fe8b5cc3..569fe0eb6 100644 --- a/src/lua/lua_mempool.c +++ b/src/lua/lua_mempool.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "mem_pool.h" /*** * @module rspamd_mempool @@ -236,7 +235,7 @@ lua_mempool_suggest_size (lua_State *L) struct memory_pool_s *mempool = rspamd_lua_check_mempool (L, 1); if (mempool) { - lua_pushinteger (L, rspamd_mempool_suggest_size ()); + lua_pushnumber (L, rspamd_mempool_suggest_size ()); return 0; } else { diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c index 8a9fb85e1..21640aab5 100644 --- a/src/lua/lua_mimepart.c +++ b/src/lua/lua_mimepart.c @@ -675,7 +675,7 @@ lua_mimepart_get_length (lua_State * L) return 1; } - lua_pushinteger (L, part->parsed_data.len); + lua_pushnumber (L, part->parsed_data.len); return 1; } diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 4a0a1cfd9..c75ca4cfb 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "dns.h" #include "utlist.h" #include "contrib/hiredis/hiredis.h" diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c index 1640f8023..a35ec96b5 100644 --- a/src/lua/lua_regexp.c +++ b/src/lua/lua_regexp.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "regexp.h" /*** * @module rspamd_regexp diff --git a/src/lua/lua_rsa.c b/src/lua/lua_rsa.c index 659eaecd2..91cdf497d 100644 --- a/src/lua/lua_rsa.c +++ b/src/lua/lua_rsa.c @@ -21,12 +21,10 @@ #include "lua_common.h" #include "unix-std.h" - -#ifdef HAVE_OPENSSL #include <openssl/err.h> +#include <openssl/pem.h> #include <openssl/sha.h> #include <openssl/rsa.h> -#include <openssl/pem.h> LUA_FUNCTION_DEF (rsa_pubkey, load); LUA_FUNCTION_DEF (rsa_pubkey, create); @@ -693,12 +691,3 @@ luaopen_rsa (lua_State * L) lua_settop (L, 0); } - -#else -void -luaopen_rsa (lua_State * L) -{ - msg_info ("this rspamd version is not linked against openssl, therefore no " - "RSA support is available"); -} -#endif diff --git a/src/lua/lua_sqlite3.c b/src/lua/lua_sqlite3.c index e15673702..97b112ac4 100644 --- a/src/lua/lua_sqlite3.c +++ b/src/lua/lua_sqlite3.c @@ -14,7 +14,6 @@ * limitations under the License. */ #include "lua_common.h" -#include "util.h" #include "sqlite_utils.h" /*** diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index f4d7f9dd6..711708335 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -15,19 +15,11 @@ */ #include "lua_common.h" #include "message.h" -#include "protocol.h" -#include "filter.h" -#include "dns.h" -#include "util.h" #include "images.h" #include "archives.h" -#include "cfg_file.h" -#include "email_addr.h" #include "utlist.h" -#include "cryptobox.h" #include "unix-std.h" #include "libmime/smtp_parsers.h" -#include "contrib/uthash/utlist.h" #include <math.h> /*** @@ -2582,7 +2574,7 @@ lua_task_get_helo (lua_State *L) if (task) { if (task->helo != NULL) { - lua_pushstring (L, (gchar *)task->helo); + lua_pushstring (L, task->helo); return 1; } else { @@ -3998,7 +3990,7 @@ lua_image_get_size (lua_State *L) struct rspamd_image *img = lua_check_image (L); if (img != NULL) { - lua_pushinteger (L, img->data->len); + lua_pushnumber (L, img->data->len); } else { return luaL_error (L, "invalid arguments"); @@ -4124,7 +4116,7 @@ lua_archive_get_size (lua_State *L) struct rspamd_archive *arch = lua_check_archive (L); if (arch != NULL) { - lua_pushinteger (L, arch->size); + lua_pushnumber (L, arch->size); } else { return luaL_error (L, "invalid arguments"); diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 21a357400..ed8330e81 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -14,9 +14,7 @@ * limitations under the License. */ #include "lua_common.h" -#include "dns.h" #include "utlist.h" -#include "ref.h" #include "unix-std.h" /*** @@ -875,7 +873,7 @@ lua_tcp_arg_toiovec (lua_State *L, gint pos, struct lua_tcp_cbdata *cbd, vec->iov_base = g_malloc (len); dtor = g_slice_alloc0 (sizeof (*dtor)); dtor->dtor = g_free; - dtor->data = (void *)vec->iov_base; + dtor->data = vec->iov_base; LL_PREPEND (cbd->dtors, dtor); memcpy (vec->iov_base, str, len); vec->iov_len = len; diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c index fe4697758..84d112ef1 100644 --- a/src/lua/lua_upstream.c +++ b/src/lua/lua_upstream.c @@ -15,8 +15,6 @@ */ #include "config.h" #include "lua_common.h" -#include "upstream.h" -#include "cfg_file.h" /*** diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c index abbbef512..9b69267a4 100644 --- a/src/lua/lua_url.c +++ b/src/lua/lua_url.c @@ -112,7 +112,7 @@ lua_url_get_length (lua_State *L) struct rspamd_lua_url *url = lua_check_url (L, 1); if (url != NULL) { - lua_pushinteger (L, url->url->urllen); + lua_pushnumber (L, url->url->urllen); } else { lua_pushnil (L); @@ -697,7 +697,7 @@ lua_url_table_inserter (struct rspamd_url *url, gsize start_offset, lua_url = lua_newuserdata (L, sizeof (struct rspamd_lua_url)); rspamd_lua_setclass (L, "rspamd{url}", -1); lua_url->url = url; - lua_pushinteger (L, n + 1); + lua_pushnumber (L, n + 1); lua_pushlstring (L, url->string, url->urllen); lua_settable (L, -3); } diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c index 3ca34b4cc..af24558e4 100644 --- a/src/lua/lua_util.c +++ b/src/lua/lua_util.c @@ -14,12 +14,8 @@ * limitations under the License. */ #include "lua_common.h" -#include "task.h" -#include "rspamd.h" #include "html.h" -#include "cfg_rcl.h" #include "tokenizers/tokenizers.h" -#include "libserver/url.h" #include "unix-std.h" #include "contrib/zstd/zstd.h" #include "libmime/email_addr.h" diff --git a/src/lua/lua_xmlrpc.c b/src/lua/lua_xmlrpc.c index 8ae7370e9..27d944712 100644 --- a/src/lua/lua_xmlrpc.c +++ b/src/lua/lua_xmlrpc.c @@ -391,7 +391,7 @@ xmlrpc_text (GMarkupParseContext *context, case 12: /* Push integer value */ num = strtoul (text, NULL, 10); - lua_pushinteger (ud->L, num); + lua_pushnumber (ud->L, num); break; case 13: /* Push integer value */ |