Merge in SNORT/snort3 from ~OTORUBAR/snort3:file_cache_fix to master
Squashed commit of the following:
commit
b3d0034c497eab42dd06bcb41f2746f7357e937f
Author: otorubar <otorubar@cisco.com>
Date: Thu Nov 7 13:59:03 2024 -0800
file_api: add helper methods to unset filename and reset sha
bool is_new_context = false;
FileContext* file = get_file_context(pending_file_id, false, is_new_context);
- if ((file == nullptr) or (file->verdict != FILE_VERDICT_PENDING))
+ if ((file == nullptr) or
+ ((file->verdict != FILE_VERDICT_PENDING) and (file->is_cacheable())))
{
FILE_DEBUG(file_trace, DEFAULT_TRACE_OPTION_ID, TRACE_ERROR_LEVEL, p,
"handle_retransmit:context is null or verdict not pending, returning\n");
file_name.assign(name, name_size);
}
+void FileInfo::unset_file_name()
+{
+ file_name_set = false;
+}
+
+ void FileInfo::reset_sha()
+ {
+ if (sha256)
+ {
+ delete [] sha256;
+ sha256 = nullptr;
+ file_state.sig_state = FILE_SIG_PROCESSING;
+ }
+ }
+
void FileInfo::set_url(const char* url_name, uint32_t url_size)
{
if (url_name and url_size)
const std::string& get_url() const;
const std::string& get_host_name() const;
+ void unset_file_name();
+ void reset_sha();
// Whether file name has been set (could be empty file name)
bool is_file_name_set() const { return file_name_set; }
bool is_url_set() const { return url_set; }