minor changes in smtp parser decoder wrt direction check loop + add missing ifdef unittests

remotes/origin/master-1.2.x
Anoop Saldanha 13 years ago committed by Victor Julien
parent 3a856fed12
commit 87599bc78d

@ -626,14 +626,16 @@ static int SMTPParse(int direction, Flow *f, SMTPState *state,
state->input_len = input_len;
state->direction = direction;
while (SMTPGetLine(state) >= 0) {
/* toserver */
if (direction == 0) {
/* toserver */
if (direction == 0) {
while (SMTPGetLine(state) >= 0) {
if (SMTPProcessRequest(state, f, pstate) == -1)
return -1;
}
/* toclient */
} else {
/* toclient */
} else {
while (SMTPGetLine(state) >= 0) {
if (SMTPProcessReply(state, f, pstate) == -1)
return -1;
}
@ -778,6 +780,8 @@ void RegisterSMTPParsers(void)
/***************************************Unittests******************************/
#ifdef UNITTESTS
/*
* \test Test STARTTLS.
*/
@ -2932,8 +2936,11 @@ end:
return result;
}
#endif /* UNITTESTS */
void SMTPParserRegisterTests(void)
{
#ifdef UNITTESTS
UtRegisterTest("SMTPParserTest01", SMTPParserTest01, 1);
UtRegisterTest("SMTPParserTest02", SMTPParserTest02, 1);
UtRegisterTest("SMTPParserTest03", SMTPParserTest03, 1);
@ -2945,6 +2952,7 @@ void SMTPParserRegisterTests(void)
UtRegisterTest("SMTPParserTest09", SMTPParserTest09, 1);
UtRegisterTest("SMTPParserTest10", SMTPParserTest10, 1);
UtRegisterTest("SMTPParserTest11", SMTPParserTest11, 1);
#endif /* UNITTESTS */
return;
}

Loading…
Cancel
Save