smtp: use configured FTP ports in probing parser

To allow users to configure more than port 21

Ticket: 6591
pull/14739/head
Philippe Antoine 6 months ago committed by Victor Julien
parent 4feacfb889
commit e982dd50d0

@ -460,6 +460,21 @@ static AppLayerProtoDetectProbingParserPort *AppLayerProtoDetectGetProbingParser
SCReturnPtr(pp_port, "AppLayerProtoDetectProbingParserPort *");
}
bool AppLayerProtoDetectHasProbingParsers(uint8_t ipproto, uint16_t port, AppProto alproto)
{
AppLayerProtoDetectProbingParserPort *p =
AppLayerProtoDetectGetProbingParsers(alpd_ctx.ctx_pp, ipproto, port);
if (p == NULL)
return false;
AppLayerProtoDetectProbingParserElement *dp = p->dp;
while (dp) {
if (dp->alproto == alproto) {
return true;
}
dp = dp->next;
}
return false;
}
/**
* \brief Call the probing expectation to see if there is some for this flow.

@ -198,6 +198,8 @@ void AppLayerRegisterExpectationProto(uint8_t proto, AppProto alproto);
void AppProtoDetectListNames(void);
bool AppLayerProtoDetectHasProbingParsers(uint8_t ipproto, uint16_t port, AppProto alproto);
/***** Unittests *****/
#ifdef UNITTESTS

@ -1684,7 +1684,7 @@ static int SMTPStateGetEventInfoById(
static AppProto SMTPClientProbingParserCheckPort(
const Flow *f, uint8_t direction, const uint8_t *input, uint32_t len, uint8_t *rdir)
{
if (f->dp == 21) {
if (AppLayerProtoDetectHasProbingParsers(IPPROTO_TCP, f->dp, ALPROTO_FTP)) {
return ALPROTO_FAILED;
}
return ALPROTO_SMTP;

Loading…
Cancel
Save