* In fact, headers are just packed, but we assume it as
* encrypted to distinguish from the normal archives
*/
- arch->flags |= RSPAMD_ARCHIVE_ENCRYPTED;
+ msg_debug_archive ("7zip: encoded header, needs to be uncompressed");
+ arch->flags |= RSPAMD_ARCHIVE_CANNOT_READ;
p = NULL; /* Cannot get anything useful */
break;
case kArchiveProperties:
enum rspamd_archive_flags {
RSPAMD_ARCHIVE_ENCRYPTED = (1u << 0u),
+ RSPAMD_ARCHIVE_CANNOT_READ = (1u << 1u),
};
enum rspamd_archive_file_flags {
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);
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},
return 1;
}
+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)
{
if ext and settings.archive_exceptions[ext] then
check = false
logger.debugm("mime_types", task, "skip checking of %s as archive, %s is whitelisted",
- filename, ext)
+ filename, ext)
end
end
local arch = p:get_archive()
if arch:is_encrypted() then
- task:insert_result(settings['symbol_encrypted_archive'], 1.0, filename)
+ task:insert_result(settings.symbol_encrypted_archive, 1.0, filename)
+ task:insert_result('MIME_TRACE', 0.0,
+ string.format("%s:%s", p:get_id(), '-'))
+ elseif arch:is_unreadable() then
+ task:insert_result(settings.symbol_encrypted_archive, 0.5, {
+ 'compressed header',
+ filename,
+ })
task:insert_result('MIME_TRACE', 0.0,
string.format("%s:%s", p:get_id(), '-'))
end