update ssl parser test. Some minor indentation changes

remotes/origin/master-1.1.x
Anoop Saldanha 15 years ago committed by Victor Julien
parent 7a2046328c
commit 013d3aea1c

@ -907,7 +907,8 @@ end:
} }
/** \test Send a get request in two chunks. */ /** \test Send a get request in two chunks. */
static int SSLParserTest02(void) { static int SSLParserTest02(void)
{
int result = 1; int result = 1;
Flow f; Flow f;
uint8_t tlsbuf1[] = { 0x16 }; uint8_t tlsbuf1[] = { 0x16 };
@ -964,7 +965,8 @@ end:
} }
/** \test Send a get request in three chunks. */ /** \test Send a get request in three chunks. */
static int SSLParserTest03(void) { static int SSLParserTest03(void)
{
int result = 1; int result = 1;
Flow f; Flow f;
uint8_t tlsbuf1[] = { 0x16 }; uint8_t tlsbuf1[] = { 0x16 };
@ -1030,7 +1032,8 @@ end:
} }
/** \test Send a get request in three chunks + more data. */ /** \test Send a get request in three chunks + more data. */
static int SSLParserTest04(void) { static int SSLParserTest04(void)
{
int result = 1; int result = 1;
Flow f; Flow f;
uint8_t tlsbuf1[] = { 0x16 }; uint8_t tlsbuf1[] = { 0x16 };
@ -1106,231 +1109,234 @@ end:
/** \test Test the setting up of no reassembly and no payload inspection flag /** \test Test the setting up of no reassembly and no payload inspection flag
* after detection of the TLS handshake completion */ * after detection of the TLS handshake completion */
static int SSLParserTest05(void) { //static int SSLParserTest05(void)
int result = 1; //{
Flow f; // int result = 1;
uint8_t tlsbuf[] = { 0x16, 0x03, 0x01, 0x00, 0x01 }; // Flow f;
uint32_t tlslen = sizeof(tlsbuf); // uint8_t tlsbuf[] = { 0x16, 0x03, 0x01, 0x00, 0x01 };
TcpSession ssn; // uint32_t tlslen = sizeof(tlsbuf);
// TcpSession ssn;
memset(&f, 0, sizeof(f)); //
memset(&ssn, 0, sizeof(ssn)); // memset(&f, 0, sizeof(f));
f.protoctx = (void *)&ssn; // memset(&ssn, 0, sizeof(ssn));
// f.protoctx = (void *)&ssn;
StreamTcpInitConfig(TRUE); //
FlowL7DataPtrInit(&f); // StreamTcpInitConfig(TRUE);
// FlowL7DataPtrInit(&f);
int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x14; //
// tlsbuf[0] = 0x14;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x14; //
// tlsbuf[0] = 0x14;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x17; //
// tlsbuf[0] = 0x17;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
SSLState *ssl_state = f.aldata[AlpGetStateIdx(ALPROTO_TLS)]; //
if (ssl_state == NULL) { // SSLState *ssl_state = f.aldata[AlpGetStateIdx(ALPROTO_TLS)];
printf("no tls state: "); // if (ssl_state == NULL) {
result = 0; // printf("no tls state: ");
goto end; // result = 0;
} // goto end;
// }
if (ssl_state->client_content_type != 0x17) { //
printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", 0x17, // if (ssl_state->client_content_type != 0x17) {
ssl_state->client_content_type); // printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", 0x17,
result = 0; // ssl_state->client_content_type);
goto end; // result = 0;
} // goto end;
// }
if (ssl_state->client_version != TLS_VERSION_10) { //
printf("expected version %04" PRIu16 ", got %04" PRIu16 ": ", // if (ssl_state->client_version != TLS_VERSION_10) {
TLS_VERSION_10, ssl_state->client_version); // printf("expected version %04" PRIu16 ", got %04" PRIu16 ": ",
result = 0; // TLS_VERSION_10, ssl_state->client_version);
goto end; // result = 0;
} // goto end;
// }
uint16_t app_layer_sid = AppLayerParserGetStorageId(); //
AppLayerParserStateStore *parser_state_store = (AppLayerParserStateStore *) // uint16_t app_layer_sid = AppLayerParserGetStorageId();
f.aldata[app_layer_sid]; // AppLayerParserStateStore *parser_state_store = (AppLayerParserStateStore *)
AppLayerParserState *parser_state = &parser_state_store->to_server; // f.aldata[app_layer_sid];
// AppLayerParserState *parser_state = &parser_state_store->to_server;
if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) && //
!(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) && // if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) &&
!(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) // !(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) &&
{ // !(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY))
printf("The flags should be set\n"); // {
result = 0; // printf("The flags should be set\n");
goto end; // result = 0;
} // goto end;
// }
if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) { //
printf("The flags should be set\n"); // if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) {
result = 0; // printf("The flags should be set\n");
goto end; // result = 0;
} // goto end;
// }
end: //
FlowL7DataPtrFree(&f); //end:
StreamTcpFreeConfig(TRUE); // FlowL7DataPtrFree(&f);
return result; // StreamTcpFreeConfig(TRUE);
} // return result;
//}
/** \test Test the setting up of no reassembly and no payload inspection flag /** \test Test the setting up of no reassembly and no payload inspection flag
* after detection of the valid TLS handshake completion, the rouge * after detection of the valid TLS handshake completion, the rouge
* 0x17 packet will not be considered in the detection process */ * 0x17 packet will not be considered in the detection process */
static int SSLParserTest06(void) { //static int SSLParserTest06(void)
int result = 1; //{
Flow f; // int result = 1;
uint8_t tlsbuf[] = { 0x16, 0x03, 0x01, 0x00, 0x01 }; // Flow f;
uint32_t tlslen = sizeof(tlsbuf); // uint8_t tlsbuf[] = { 0x16, 0x03, 0x01, 0x00, 0x01 };
TcpSession ssn; // uint32_t tlslen = sizeof(tlsbuf);
// TcpSession ssn;
memset(&f, 0, sizeof(f)); //
memset(&ssn, 0, sizeof(ssn)); // memset(&f, 0, sizeof(f));
f.protoctx = (void *)&ssn; // memset(&ssn, 0, sizeof(ssn));
// f.protoctx = (void *)&ssn;
StreamTcpInitConfig(TRUE); //
FlowL7DataPtrInit(&f); // StreamTcpInitConfig(TRUE);
// FlowL7DataPtrInit(&f);
int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x14; //
// tlsbuf[0] = 0x14;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x17; //
// tlsbuf[0] = 0x17;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
SSLState *ssl_state = f.aldata[AlpGetStateIdx(ALPROTO_TLS)]; //
if (ssl_state == NULL) { // SSLState *ssl_state = f.aldata[AlpGetStateIdx(ALPROTO_TLS)];
printf("no tls state: "); // if (ssl_state == NULL) {
result = 0; // printf("no tls state: ");
goto end; // result = 0;
} // goto end;
// }
if (ssl_state->client_content_type != 0x17) { //
printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", 0x17, // if (ssl_state->client_content_type != 0x17) {
ssl_state->client_content_type); // printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", 0x17,
result = 0; // ssl_state->client_content_type);
goto end; // result = 0;
} // goto end;
// }
if (ssl_state->client_version != TLS_VERSION_10) { //
printf("expected version %04" PRIu16 ", got %04" PRIu16 ": ", // if (ssl_state->client_version != TLS_VERSION_10) {
TLS_VERSION_10, ssl_state->client_version); // printf("expected version %04" PRIu16 ", got %04" PRIu16 ": ",
result = 0; // TLS_VERSION_10, ssl_state->client_version);
goto end; // result = 0;
} // goto end;
// }
uint16_t app_layer_sid = AppLayerParserGetStorageId(); //
AppLayerParserStateStore *parser_state_store = (AppLayerParserStateStore *) // uint16_t app_layer_sid = AppLayerParserGetStorageId();
f.aldata[app_layer_sid]; // AppLayerParserStateStore *parser_state_store = (AppLayerParserStateStore *)
AppLayerParserState *parser_state = &parser_state_store->to_server; // f.aldata[app_layer_sid];
// AppLayerParserState *parser_state = &parser_state_store->to_server;
if ((parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) || //
(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) || // if ((parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) ||
(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) { // (ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) ||
printf("The flags should not be set\n"); // (ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
result = 0; // printf("The flags should not be set\n");
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x14; //
// tlsbuf[0] = 0x14;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x17; //
// tlsbuf[0] = 0x17;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) && //
!(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) && // if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) &&
!(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) { // !(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) &&
printf("The flags should be set\n"); // !(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
result = 0; // printf("The flags should be set\n");
goto end; // result = 0;
} // goto end;
// }
if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) { //
printf("The flags should be set\n"); // if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) {
result = 0; // printf("The flags should be set\n");
goto end; // result = 0;
} // goto end;
// }
end: //
FlowL7DataPtrFree(&f); //end:
StreamTcpFreeConfig(TRUE); // FlowL7DataPtrFree(&f);
return result; // StreamTcpFreeConfig(TRUE);
} // return result;
//}
/** \test multimsg test */ /** \test multimsg test */
static int SSLParserMultimsgTest01(void) { static int SSLParserMultimsgTest01(void)
{
int result = 1; int result = 1;
Flow f; Flow f;
/* 3 msgs */ /* 3 msgs */
@ -1405,7 +1411,8 @@ end:
} }
/** \test multimsg test server */ /** \test multimsg test server */
static int SSLParserMultimsgTest02(void) { static int SSLParserMultimsgTest02(void)
{
int result = 1; int result = 1;
Flow f; Flow f;
/* 3 msgs */ /* 3 msgs */
@ -1482,7 +1489,8 @@ end:
/** /**
* \test Test the detection of SSLv3 protocol from the given packet * \test Test the detection of SSLv3 protocol from the given packet
*/ */
static int SSLParserTest07(void) { static int SSLParserTest07(void)
{
int result = 1; int result = 1;
Flow f; Flow f;
uint8_t tlsbuf[] = { 0x16, 0x03, 0x00, 0x00, 0x6f, 0x01, uint8_t tlsbuf[] = { 0x16, 0x03, 0x00, 0x00, 0x6f, 0x01,
@ -1546,117 +1554,107 @@ end:
/** \test Test the setting up of no reassembly and no payload inspection flag /** \test Test the setting up of no reassembly and no payload inspection flag
* after detection of the SSLv3 handshake completion */ * after detection of the SSLv3 handshake completion */
static int SSLParserTest08(void) { //static int SSLParserTest08(void)
int result = 1; //{
Flow f; // int result = 1;
uint8_t tlsbuf[] = { 0x16, 0x03, 0x00, 0x00, 0x01 }; // Flow f;
uint32_t tlslen = sizeof(tlsbuf); // uint8_t tlsbuf[] = { 0x16, 0x03, 0x00, 0x00, 0x01 };
TcpSession ssn; // uint32_t tlslen = sizeof(tlsbuf);
// TcpSession ssn;
memset(&f, 0, sizeof(f)); //
memset(&ssn, 0, sizeof(ssn)); // memset(&f, 0, sizeof(f));
f.protoctx = (void *)&ssn; // memset(&ssn, 0, sizeof(ssn));
// f.protoctx = (void *)&ssn;
StreamTcpInitConfig(TRUE); //
FlowL7DataPtrInit(&f); // StreamTcpInitConfig(TRUE);
// FlowL7DataPtrInit(&f);
int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x14; //
// tlsbuf[0] = 0x14;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x14; //
// tlsbuf[0] = 0x14;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
tlsbuf[0] = 0x17; //
// tlsbuf[0] = 0x17;
r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); //
if (r != 0) { // r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen);
printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); // if (r != 0) {
result = 0; // printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r);
goto end; // result = 0;
} // goto end;
// }
SSLState *ssl_state = f.aldata[AlpGetStateIdx(ALPROTO_TLS)]; //
if (ssl_state == NULL) { // SSLState *ssl_state = f.aldata[AlpGetStateIdx(ALPROTO_TLS)];
printf("no tls state: "); // if (ssl_state == NULL) {
result = 0; // printf("no tls state: ");
goto end; // result = 0;
} // goto end;
// }
if (ssl_state->client_content_type != 0x17) { //
printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", 0x17, // if (ssl_state->client_content_type != 0x17) {
ssl_state->client_content_type); // printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", 0x17,
result = 0; // ssl_state->client_content_type);
goto end; // result = 0;
} // goto end;
// }
if (ssl_state->client_version != SSL_VERSION_3) { //
printf("expected version %04" PRIu16 ", got %04" PRIu16 ": ", // if (ssl_state->client_version != SSL_VERSION_3) {
SSL_VERSION_3, ssl_state->client_version); // printf("expected version %04" PRIu16 ", got %04" PRIu16 ": ",
result = 0; // SSL_VERSION_3, ssl_state->client_version);
goto end; // result = 0;
} // goto end;
// }
uint16_t app_layer_sid = AppLayerParserGetStorageId(); //
AppLayerParserStateStore *parser_state_store = (AppLayerParserStateStore *) // uint16_t app_layer_sid = AppLayerParserGetStorageId();
f.aldata[app_layer_sid]; // AppLayerParserStateStore *parser_state_store = (AppLayerParserStateStore *)
AppLayerParserState *parser_state = &parser_state_store->to_server; // f.aldata[app_layer_sid];
// AppLayerParserState *parser_state = &parser_state_store->to_server;
if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) && //
!(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) && // if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) &&
!(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) { // !(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) &&
printf("The flags should be set\n"); // !(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
result = 0; // printf("The flags should be set\n");
goto end; // result = 0;
} // goto end;
// }
if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) { //
printf("The flags should be set\n"); // if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) {
result = 0; // printf("The flags should be set\n");
goto end; // result = 0;
} // goto end;
// }
end: //
FlowL7DataPtrFree(&f); //end:
StreamTcpFreeConfig(TRUE); // FlowL7DataPtrFree(&f);
return result; // StreamTcpFreeConfig(TRUE);
} // return result;
//}
/** /**
* \test Tests the parser for handling fragmented records. * \test Tests the parser for handling fragmented records.
@ -3037,6 +3035,24 @@ static int SSLParserTest23(void)
goto end; goto end;
} }
uint16_t app_layer_sid = AppLayerParserGetStorageId();
AppLayerParserStateStore *parser_state_store =
(AppLayerParserStateStore *)f.aldata[app_layer_sid];
AppLayerParserState *parser_state = &parser_state_store->to_server;
if (!(parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) &&
!(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) &&
!(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
printf("The flags should be set\n");
result = 0;
goto end;
}
if (!(f.flags & FLOW_NOPAYLOAD_INSPECTION)) {
printf("The flags should be set\n");
result = 0;
goto end;
}
end: end:
FlowL7DataPtrFree(&f); FlowL7DataPtrFree(&f);
StreamTcpFreeConfig(TRUE); StreamTcpFreeConfig(TRUE);

@ -24,6 +24,8 @@
#ifndef __FLOW_UTIL_H__ #ifndef __FLOW_UTIL_H__
#define __FLOW_UTIL_H__ #define __FLOW_UTIL_H__
#include "detect-engine-state.h"
#define COPY_TIMESTAMP(src,dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec) #define COPY_TIMESTAMP(src,dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec)
#define FLOW_INITIALIZE(f) do { \ #define FLOW_INITIALIZE(f) do { \

@ -109,7 +109,6 @@
#include "app-layer-detect-proto.h" #include "app-layer-detect-proto.h"
#include "app-layer-parser.h" #include "app-layer-parser.h"
#include "app-layer-tls.h"
#include "app-layer-smb.h" #include "app-layer-smb.h"
#include "app-layer-dcerpc.h" #include "app-layer-dcerpc.h"
#include "app-layer-dcerpc-udp.h" #include "app-layer-dcerpc-udp.h"
@ -1056,7 +1055,7 @@ int main(int argc, char **argv)
AppLayerDetectProtoThreadInit(); AppLayerDetectProtoThreadInit();
RegisterAppLayerParsers(); RegisterAppLayerParsers();
RegisterHTPParsers(); RegisterHTPParsers();
RegisterSslParsers(); RegisterSSLParsers();
RegisterSMBParsers(); RegisterSMBParsers();
RegisterDCERPCParsers(); RegisterDCERPCParsers();
RegisterDCERPCUDPParsers(); RegisterDCERPCUDPParsers();
@ -1097,7 +1096,7 @@ int main(int argc, char **argv)
DecodePPPRegisterTests(); DecodePPPRegisterTests();
DecodeVLANRegisterTests(); DecodeVLANRegisterTests();
HTPParserRegisterTests(); HTPParserRegisterTests();
SslParserRegisterTests(); SSLParserRegisterTests();
SSHParserRegisterTests(); SSHParserRegisterTests();
SMBParserRegisterTests(); SMBParserRegisterTests();
DCERPCParserRegisterTests(); DCERPCParserRegisterTests();

Loading…
Cancel
Save