diff --git a/src/tests/detect-tls-cert-fingerprint.c b/src/tests/detect-tls-cert-fingerprint.c index e2ec3d5f26..2231d48743 100644 --- a/src/tests/detect-tls-cert-fingerprint.c +++ b/src/tests/detect-tls-cert-fingerprint.c @@ -307,7 +307,6 @@ static int DetectTlsFingerprintTest02(void) DetectEngineCtx *de_ctx = DetectEngineCtxInit(); FAIL_IF_NULL(de_ctx); - de_ctx->mpm_matcher = mpm_default_matcher; de_ctx->flags |= DE_QUIET; @@ -321,47 +320,41 @@ static int DetectTlsFingerprintTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, - STREAM_TOSERVER, client_hello, - sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); + UTHFreePacket(p1); + UTHFreePacket(p2); + UTHFreePacket(p3); + FLOW_DESTROY(&f); + AppLayerParserThreadCtxFree(alp_tctx); DetectEngineThreadCtxDeinit(&tv, det_ctx); SigGroupCleanup(de_ctx); DetectEngineCtxFree(de_ctx); StreamTcpFreeConfig(true); - FLOW_DESTROY(&f); - UTHFreePacket(p1); - UTHFreePacket(p2); - UTHFreePacket(p3); - + StatsThreadCleanup(&tv); PASS; } diff --git a/src/tests/detect-tls-cert-issuer.c b/src/tests/detect-tls-cert-issuer.c index feaa70b3d6..5d51970817 100644 --- a/src/tests/detect-tls-cert-issuer.c +++ b/src/tests/detect-tls-cert-issuer.c @@ -320,52 +320,41 @@ static int DetectTlsIssuerTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, - STREAM_TOSERVER, client_hello, - sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); - if (alp_tctx != NULL) - AppLayerParserThreadCtxFree(alp_tctx); - if (det_ctx != NULL) - DetectEngineThreadCtxDeinit(&tv, det_ctx); - if (de_ctx != NULL) - SigGroupCleanup(de_ctx); - if (de_ctx != NULL) - DetectEngineCtxFree(de_ctx); - - StreamTcpFreeConfig(true); - FLOW_DESTROY(&f); UTHFreePacket(p1); UTHFreePacket(p2); UTHFreePacket(p3); + FLOW_DESTROY(&f); + AppLayerParserThreadCtxFree(alp_tctx); + DetectEngineThreadCtxDeinit(&tv, det_ctx); + SigGroupCleanup(de_ctx); + DetectEngineCtxFree(de_ctx); + StreamTcpFreeConfig(true); + StatsThreadCleanup(&tv); PASS; } diff --git a/src/tests/detect-tls-cert-serial.c b/src/tests/detect-tls-cert-serial.c index 119d94a7eb..286a3e7cd2 100644 --- a/src/tests/detect-tls-cert-serial.c +++ b/src/tests/detect-tls-cert-serial.c @@ -318,52 +318,42 @@ static int DetectTlsSerialTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, - STREAM_TOSERVER, client_hello, - sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); - if (alp_tctx != NULL) - AppLayerParserThreadCtxFree(alp_tctx); - if (det_ctx != NULL) - DetectEngineThreadCtxDeinit(&tv, det_ctx); - if (de_ctx != NULL) - SigGroupCleanup(de_ctx); - if (de_ctx != NULL) - DetectEngineCtxFree(de_ctx); - - StreamTcpFreeConfig(true); - FLOW_DESTROY(&f); UTHFreePacket(p1); UTHFreePacket(p2); UTHFreePacket(p3); + FLOW_DESTROY(&f); + + AppLayerParserThreadCtxFree(alp_tctx); + DetectEngineThreadCtxDeinit(&tv, det_ctx); + SigGroupCleanup(de_ctx); + DetectEngineCtxFree(de_ctx); + StreamTcpFreeConfig(true); + StatsThreadCleanup(&tv); PASS; } diff --git a/src/tests/detect-tls-cert-subject.c b/src/tests/detect-tls-cert-subject.c index 2df23eb7f6..16f2ac4893 100644 --- a/src/tests/detect-tls-cert-subject.c +++ b/src/tests/detect-tls-cert-subject.c @@ -320,52 +320,41 @@ static int DetectTlsSubjectTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, - STREAM_TOSERVER, client_hello, - sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); - if (alp_tctx != NULL) - AppLayerParserThreadCtxFree(alp_tctx); - if (det_ctx != NULL) - DetectEngineThreadCtxDeinit(&tv, det_ctx); - if (de_ctx != NULL) - SigGroupCleanup(de_ctx); - if (de_ctx != NULL) - DetectEngineCtxFree(de_ctx); - - StreamTcpFreeConfig(true); - FLOW_DESTROY(&f); UTHFreePacket(p1); UTHFreePacket(p2); UTHFreePacket(p3); + FLOW_DESTROY(&f); + AppLayerParserThreadCtxFree(alp_tctx); + DetectEngineThreadCtxDeinit(&tv, det_ctx); + SigGroupCleanup(de_ctx); + DetectEngineCtxFree(de_ctx); + StreamTcpFreeConfig(true); + StatsThreadCleanup(&tv); PASS; } diff --git a/src/tests/detect-tls-cert-validity.c b/src/tests/detect-tls-cert-validity.c index bf100b93d9..07cfff92cf 100644 --- a/src/tests/detect-tls-cert-validity.c +++ b/src/tests/detect-tls-cert-validity.c @@ -671,7 +671,6 @@ static int ValidityTestDetect01(void) DetectEngineCtx *de_ctx = DetectEngineCtxInit(); FAIL_IF_NULL(de_ctx); - de_ctx->flags |= DE_QUIET; Signature *s = DetectEngineAppendSig(de_ctx, "alert tls any any -> any any " @@ -687,37 +686,30 @@ static int ValidityTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, - STREAM_TOSERVER, client_hello, - sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); FAIL_IF(PacketAlertCheck(p1, 2)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); FAIL_IF(PacketAlertCheck(p2, 2)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); FAIL_IF_NOT(PacketAlertCheck(p3, 2)); @@ -1014,34 +1006,28 @@ static int ExpiredTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, - client_hello, sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); UTHFreePacket(p1); @@ -1322,34 +1308,28 @@ static int ValidTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, - client_hello, sizeof(client_hello)); - + int r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); FAIL_IF(r != 0); ssl_state = f.alstate; FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); UTHFreePacket(p1); diff --git a/src/tests/detect-tls-certs.c b/src/tests/detect-tls-certs.c index 19b5436dd9..4d2f4def2d 100644 --- a/src/tests/detect-tls-certs.c +++ b/src/tests/detect-tls-certs.c @@ -303,7 +303,6 @@ static int DetectTlsCertsTest02(void) DetectEngineCtx *de_ctx = DetectEngineCtxInit(); FAIL_IF_NULL(de_ctx); - de_ctx->mpm_matcher = mpm_default_matcher; de_ctx->flags |= DE_QUIET; @@ -325,35 +324,32 @@ static int DetectTlsCertsTest02(void) FAIL_IF_NULL(ssl_state); SigMatchSignatures(&tv, de_ctx, det_ctx, p1); - FAIL_IF(PacketAlertCheck(p1, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - server_hello, sizeof(server_hello)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p2); - FAIL_IF(PacketAlertCheck(p2, 1)); - r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, - certificate, sizeof(certificate)); - + r = AppLayerParserParse( + NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); FAIL_IF(r != 0); SigMatchSignatures(&tv, de_ctx, det_ctx, p3); - FAIL_IF_NOT(PacketAlertCheck(p3, 1)); - AppLayerParserThreadCtxFree(alp_tctx); - DetectEngineThreadCtxDeinit(&tv, det_ctx); - DetectEngineCtxFree(de_ctx); - StreamTcpFreeConfig(true); - FLOW_DESTROY(&f); + UTHFreePacket(p1); UTHFreePacket(p2); UTHFreePacket(p3); + FLOW_DESTROY(&f); + AppLayerParserThreadCtxFree(alp_tctx); + DetectEngineThreadCtxDeinit(&tv, det_ctx); + DetectEngineCtxFree(de_ctx); + StreamTcpFreeConfig(true); + StatsThreadCleanup(&tv); PASS; }