From: Victor Julien Date: Tue, 28 Oct 2014 09:41:32 +0000 (+0100) Subject: smtp: register file truncate callback X-Git-Tag: suricata-2.1beta2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08b06bac3f8d155c3398f9881445d863cf04f781;p=thirdparty%2Fsuricata.git smtp: register file truncate callback Tag files as truncated from this callback so storing/logging displays the correct info. --- diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index 4c414b4ea9..51d9730baa 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1314,6 +1314,16 @@ static FileContainer *SMTPStateGetFiles(void *state, uint8_t direction) } } +static void SMTPStateTruncate(void *state, uint8_t direction) +{ + FileContainer *fc = SMTPStateGetFiles(state, direction); + if (fc != NULL) { + SCLogDebug("truncating stream, closing files in %s direction (container %p)", + direction & STREAM_TOCLIENT ? "STREAM_TOCLIENT" : "STREAM_TOSERVER", fc); + FileTruncateAllOpenFiles(fc); + } +} + /** * \brief Register the SMTP Protocol parser. */ @@ -1351,6 +1361,7 @@ void RegisterSMTPParsers(void) AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateGetTx); AppLayerParserRegisterGetStateProgressCompletionStatus(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateGetAlstateProgressCompletionStatus); + AppLayerParserRegisterTruncateFunc(IPPROTO_TCP, ALPROTO_SMTP, SMTPStateTruncate); } else { SCLogInfo("Parsed disabled for %s protocol. Protocol detection" "still on.", proto_name);