}
}
-int FileCache::store_verdict(Flow* flow, FileInfo* file, int64_t timeout, bool &cache_full)
+int FileCache::store_verdict(Flow* flow, FileInfo* file, int64_t timeout, bool &cache_full, bool is_cacheable)
{
assert(file);
uint64_t file_id = file->get_file_id();
publish_file_cache_event(flow, file, cache_expire);
*((FileInfo*)(file_got)) = *file;
+ if (file != file_got and not is_cacheable)
+ file_got->set_not_cacheable();
+
if (FILE_VERDICT_PENDING == file->verdict and file != file_got)
{
if (file->get_file_data() and !file_got->get_file_data())
if (resume)
policy->log_file_action(flow, file_ctx, FILE_RESUME_BLOCK);
- else if (store_verdict(flow, file_ctx, lookup_timeout, cache_full) != 0)
+ else if (store_verdict(flow, file_ctx, lookup_timeout, cache_full, file_ctx->is_cacheable()) != 0)
{
if (cache_full)
{
file_ctx->log_file_event(flow, policy);
policy->log_file_action(flow, file_ctx, FILE_RESUME_BLOCK);
}
- else if (file_ctx->is_cacheable())
+ else if (bool is_cacheable = file_ctx->is_cacheable())
{
- if (store_verdict(flow, file_ctx, block_timeout, cache_full) != 0)
+ if (store_verdict(flow, file_ctx, block_timeout, cache_full, is_cacheable) != 0)
{
if (PacketTracer::is_active())
{
snort::FileContext* get_file(snort::Flow*, uint64_t file_id, bool to_create,
int64_t timeout, bool using_cache_entry, bool &cache_full, int64_t& cache_expire);
FileVerdict check_verdict(snort::Packet*, snort::FileInfo*, snort::FilePolicyBase*,const uint8_t* current_data, uint32_t current_data_len);
- int store_verdict(snort::Flow*, snort::FileInfo*, int64_t timeout, bool &cache_full);
+ int store_verdict(snort::Flow*, snort::FileInfo*, int64_t timeout, bool &cache_full, bool is_cacheable);
void publish_file_cache_event(snort::Flow* flow, snort::FileInfo* file, int64_t timeout);
/* The hash table of expected files */
PacketTracer::restart_timer();
context = find_main_file_context(position, direction, file_index);
+ FileCache* file_cache = FileService::get_file_cache();
+ if (file_cache)
+ {
+ FileContext *cached_context = file_cache->get_file(flow, file_index, false, false);
+ if (cached_context and not cached_context->is_cacheable())
+ context->set_not_cacheable();
+ }
set_current_file_context(context);
context->set_weak_file_name((const char*)fname, name_size);