diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-22 15:06:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-22 15:06:32 +0100 |
commit | 77d0030eff22ebed1ab4b3a124142b8fff38fb4a (patch) | |
tree | 2362b7031aa32f72ccdd1b40a71534216741f0c8 /src/lua | |
parent | 83dfe58bd168a7446d65a0c2a39a8b5a29f34ad9 (diff) | |
download | rspamd-77d0030eff22ebed1ab4b3a124142b8fff38fb4a.tar.gz rspamd-77d0030eff22ebed1ab4b3a124142b8fff38fb4a.zip |
[Minor] Archives: Distinguish compressed headers and encrypted archives
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 2529b88d6..e58ff17c7 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1171,6 +1171,7 @@ LUA_FUNCTION_DEF (archive, get_type); LUA_FUNCTION_DEF (archive, get_files); LUA_FUNCTION_DEF (archive, get_files_full); LUA_FUNCTION_DEF (archive, is_encrypted); +LUA_FUNCTION_DEF (archive, is_unreadable); LUA_FUNCTION_DEF (archive, get_filename); LUA_FUNCTION_DEF (archive, get_size); @@ -1179,6 +1180,7 @@ static const struct luaL_reg archivelib_m[] = { LUA_INTERFACE_DEF (archive, get_files), LUA_INTERFACE_DEF (archive, get_files_full), LUA_INTERFACE_DEF (archive, is_encrypted), + LUA_INTERFACE_DEF (archive, is_unreadable), LUA_INTERFACE_DEF (archive, get_filename), LUA_INTERFACE_DEF (archive, get_size), {"__tostring", rspamd_lua_class_tostring}, @@ -5936,6 +5938,22 @@ lua_archive_is_encrypted (lua_State *L) } static gint +lua_archive_is_unreadable (lua_State *L) +{ + LUA_TRACE_POINT; + struct rspamd_archive *arch = lua_check_archive (L); + + if (arch != NULL) { + lua_pushboolean (L, (arch->flags & RSPAMD_ARCHIVE_CANNOT_READ) ? true : false); + } + else { + return luaL_error (L, "invalid arguments"); + } + + return 1; +} + +static gint lua_archive_get_size (lua_State *L) { LUA_TRACE_POINT; |