diff --git a/src/output-filedata.c b/src/output-filedata.c index 7a458737cc..783f50f98a 100644 --- a/src/output-filedata.c +++ b/src/output-filedata.c @@ -225,18 +225,20 @@ static TmEcode OutputFiledataLog(ThreadVars *tv, Packet *p, void *thread_data) SCReturnInt(TM_ECODE_OK); } - const bool file_close_ts = ((p->flags & PKT_PSEUDO_STREAM_END) && - (p->flowflags & FLOW_PKT_TOSERVER)); - const bool file_close_tc = ((p->flags & PKT_PSEUDO_STREAM_END) && - (p->flowflags & FLOW_PKT_TOCLIENT)); const bool file_trunc = StreamTcpReassembleDepthReached(p); - - FileContainer *ffc_ts = AppLayerParserGetFiles(f, STREAM_TOSERVER); - FileContainer *ffc_tc = AppLayerParserGetFiles(f, STREAM_TOCLIENT); - SCLogDebug("ffc_ts %p", ffc_ts); - OutputFiledataLogFfc(tv, op_thread_data, p, ffc_ts, STREAM_TOSERVER, file_close_ts, file_trunc, STREAM_TOSERVER); - SCLogDebug("ffc_tc %p", ffc_tc); - OutputFiledataLogFfc(tv, op_thread_data, p, ffc_tc, STREAM_TOCLIENT, file_close_tc, file_trunc, STREAM_TOCLIENT); + if (p->flowflags & FLOW_PKT_TOSERVER) { + const bool file_close_ts = ((p->flags & PKT_PSEUDO_STREAM_END)); + FileContainer *ffc_ts = AppLayerParserGetFiles(f, STREAM_TOSERVER); + SCLogDebug("ffc_ts %p", ffc_ts); + OutputFiledataLogFfc(tv, op_thread_data, p, ffc_ts, STREAM_TOSERVER, file_close_ts, + file_trunc, STREAM_TOSERVER); + } else { + const bool file_close_tc = ((p->flags & PKT_PSEUDO_STREAM_END)); + FileContainer *ffc_tc = AppLayerParserGetFiles(f, STREAM_TOCLIENT); + SCLogDebug("ffc_tc %p", ffc_tc); + OutputFiledataLogFfc(tv, op_thread_data, p, ffc_tc, STREAM_TOCLIENT, file_close_tc, + file_trunc, STREAM_TOCLIENT); + } return TM_ECODE_OK; }