output/filedata: trunc file in output again

pull/8426/head
Victor Julien 2 years ago
parent e3e55406a7
commit 355f259b8c

@ -127,13 +127,13 @@ static void CloseFile(const Packet *p, Flow *f, File *file, void *txv)
}
void OutputFiledataLogFfc(ThreadVars *tv, OutputFiledataLoggerThreadData *td, Packet *p,
FileContainer *ffc, void *txv, const uint64_t tx_id, AppLayerTxData *txd,
AppLayerGetFileState files, void *txv, const uint64_t tx_id, AppLayerTxData *txd,
const uint8_t call_flags, const bool file_close, const bool file_trunc, const uint8_t dir)
{
SCLogDebug("ffc %p", ffc);
SCLogDebug("ffc %p", files.fc);
OutputLoggerThreadStore *store = td->store;
for (File *ff = ffc->head; ff != NULL; ff = ff->next) {
for (File *ff = files.fc->head; ff != NULL; ff = ff->next) {
FileApplyTxFlags(txd, dir, ff);
FilePrintFlags(ff);
@ -162,7 +162,7 @@ void OutputFiledataLogFfc(ThreadVars *tv, OutputFiledataLoggerThreadData *td, Pa
* close the logger(s) */
if (FileDataSize(ff) == ff->content_stored && (file_trunc || file_close)) {
if (ff->state < FILE_STATE_CLOSED) {
ff->state = FILE_STATE_TRUNCATED;
FileCloseFilePtr(ff, files.cfg, NULL, 0, FILE_TRUNCATED);
}
file_flags |= OUTPUT_FILEDATA_FLAG_CLOSE;
CallLoggers(tv, store, p, ff, txv, tx_id, NULL, 0, file_flags, dir);
@ -173,7 +173,7 @@ void OutputFiledataLogFfc(ThreadVars *tv, OutputFiledataLoggerThreadData *td, Pa
/* if file needs to be closed or truncated, inform
* loggers */
if ((file_close || file_trunc) && ff->state < FILE_STATE_CLOSED) {
ff->state = FILE_STATE_TRUNCATED;
FileCloseFilePtr(ff, files.cfg, NULL, 0, FILE_TRUNCATED);
}
/* tell the logger we're closing up */

@ -42,7 +42,7 @@ TmEcode OutputFiledataLogThreadInit(ThreadVars *tv, OutputFiledataLoggerThreadDa
TmEcode OutputFiledataLogThreadDeinit(ThreadVars *tv, OutputFiledataLoggerThreadData *thread_data);
void OutputFiledataLogFfc(ThreadVars *tv, OutputFiledataLoggerThreadData *td, Packet *p,
FileContainer *ffc, void *txv, const uint64_t tx_id, AppLayerTxData *txd,
AppLayerGetFileState files, void *txv, const uint64_t tx_id, AppLayerTxData *txd,
const uint8_t call_flags, const bool file_close, const bool file_trunc, const uint8_t dir);
/** filedata logger function pointer type */

@ -194,8 +194,8 @@ static inline void OutputTxLogFiles(ThreadVars *tv, OutputFileLoggerThreadData *
SCLogDebug("tx: calling files: ffc %p head %p file_close %d file_trunc %d", ffc, ffc->head,
file_close, file_trunc);
if (filedata_td && txd->files_opened > txd->files_stored)
OutputFiledataLogFfc(tv, filedata_td, p, ffc, tx, tx_id, txd, packet_dir, file_close,
file_trunc, packet_dir);
OutputFiledataLogFfc(tv, filedata_td, p, app_files, tx, tx_id, txd, packet_dir,
file_close, file_trunc, packet_dir);
if (file_td && txd->files_opened > txd->files_logged)
OutputFileLogFfc(
tv, file_td, p, ffc, tx, tx_id, txd, file_close, file_trunc, packet_dir);
@ -208,8 +208,8 @@ static inline void OutputTxLogFiles(ThreadVars *tv, OutputFileLoggerThreadData *
SCLogDebug("tx: calling for opposing direction files: file_close:%s file_trunc:%s",
file_close ? "true" : "false", file_trunc ? "true" : "false");
if (filedata_td && txd->files_opened > txd->files_stored)
OutputFiledataLogFfc(tv, filedata_td, p, ffc_opposing, tx, tx_id, txd, opposing_dir,
file_close, file_trunc, opposing_dir);
OutputFiledataLogFfc(tv, filedata_td, p, app_files_opposing, tx, tx_id, txd,
opposing_dir, file_close, file_trunc, opposing_dir);
if (file_td && txd->files_opened > txd->files_logged)
OutputFileLogFfc(tv, file_td, p, ffc_opposing, tx, tx_id, txd, file_close, file_trunc,
opposing_dir);

Loading…
Cancel
Save