From: Victor Julien Date: Mon, 6 Jun 2022 07:59:15 +0000 (+0200) Subject: tests: remove unnecessary flow locks X-Git-Tag: suricata-7.0.0-beta1~496 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84448d3bae2f7e7a23d219dc925c8bd6843367ef;p=thirdparty%2Fsuricata.git tests: remove unnecessary flow locks Added once to satisfy debug validation, but we don't mix unittests and debug validation anymore. sed -i -E '/.*FLOWLOCK_.*LOCK/d' *.c --- diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 3eb2752850..4398e02959 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -3466,15 +3466,12 @@ static int AppLayerProtoDetectTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse( NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3560,15 +3557,12 @@ static int AppLayerProtoDetectTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse( NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3656,15 +3650,12 @@ static int AppLayerProtoDetectTest18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse( NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3748,15 +3739,12 @@ static int AppLayerProtoDetectTest19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_FTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index fc75338373..9f64a05c6a 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -3429,15 +3429,12 @@ static int HTPParserTest01a(void) else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -3490,15 +3487,12 @@ static int HTPParserTest02(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START | STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3559,15 +3553,12 @@ static int HTPParserTest03(void) else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; if (htp_state == NULL) { @@ -3619,14 +3610,11 @@ static int HTPParserTest04(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START | STREAM_EOF, httpbuf1, httplen1); if (r != 0) { - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -3850,15 +3838,12 @@ static int HTPParserTest07(void) else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -3948,16 +3933,13 @@ libhtp:\n\ uint8_t flags = 0; flags = STREAM_TOSERVER|STREAM_START|STREAM_EOF; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk returned %" PRId32 ", expected" " 0: ", r); result = 0; - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -4033,15 +4015,12 @@ libhtp:\n\ uint8_t flags = 0; flags = STREAM_TOSERVER|STREAM_START|STREAM_EOF; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk returned %" PRId32 ", expected" " 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -4107,15 +4086,12 @@ static int HTPParserTest10(void) else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4198,15 +4174,12 @@ static int HTPParserTest11(void) else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4282,15 +4255,12 @@ static int HTPParserTest12(void) else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4369,15 +4339,12 @@ static int HTPParserTest13(void) else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4779,16 +4746,13 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); result = 0; - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5158,15 +5122,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5324,15 +5285,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5460,15 +5418,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5569,15 +5524,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5678,15 +5630,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5788,15 +5737,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5895,15 +5841,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -6003,15 +5946,12 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -6157,24 +6097,18 @@ libhtp:\n\ StreamTcpInitConfig(true); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse( NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 1 again <<<<\n"); - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -6182,14 +6116,11 @@ libhtp:\n\ goto end; } - FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetDecoderEvents(f->alparser); if (decoder_events != NULL) { printf("app events: "); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); result = 1; end: if (alp_tctx != NULL) @@ -6372,15 +6303,12 @@ libhtp:\n\ else if (u == (len - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, (uint8_t *)&httpbuf[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; if (htp_state == NULL) { @@ -6397,16 +6325,13 @@ libhtp:\n\ goto end; } - FLOWLOCK_WRLOCK(f); void *txtmp = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP1, f->alstate, 0); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP1, txtmp); if (decoder_events != NULL) { printf("app events: "); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); result = 1; end: @@ -6456,14 +6381,11 @@ static int HTPParserTest16(void) uint8_t flags = STREAM_TOSERVER|STREAM_START|STREAM_EOF; - FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, flags, (uint8_t *)httpbuf, len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -6482,16 +6404,13 @@ static int HTPParserTest16(void) #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION //these events are disabled during fuzzing as they are too noisy and consume much resource - FLOWLOCK_WRLOCK(f); void *txtmp = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP1, f->alstate, 0); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP1, txtmp); if (decoder_events == NULL) { printf("no app events: "); - FLOWLOCK_UNLOCK(f); goto end; } - FLOWLOCK_UNLOCK(f); if (decoder_events->events[0] != HTTP_DECODER_EVENT_METHOD_DELIM_NON_COMPLIANT) { printf("HTTP_DECODER_EVENT_METHOD_DELIM_NON_COMPLIANT not set: "); diff --git a/src/app-layer-modbus.c b/src/app-layer-modbus.c index 415e950e38..26e9b11206 100644 --- a/src/app-layer-modbus.c +++ b/src/app-layer-modbus.c @@ -282,12 +282,10 @@ static int ModbusParserTest01(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -298,12 +296,10 @@ static int ModbusParserTest01(void) { FAIL_IF_NOT(rs_modbus_message_get_read_request_address(&request) == 0x7890); FAIL_IF_NOT(rs_modbus_message_get_read_request_quantity(&request) == 19); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsRsp, sizeof(readCoilsRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -331,12 +327,10 @@ static int ModbusParserTest02(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, writeMultipleRegistersReq, sizeof(writeMultipleRegistersReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -355,12 +349,10 @@ static int ModbusParserTest02(void) { FAIL_IF_NOT(data[2] == 0x01); FAIL_IF_NOT(data[3] == 0x02); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, writeMultipleRegistersRsp, sizeof(writeMultipleRegistersRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -415,13 +407,11 @@ static int ModbusParserTest03(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readWriteMultipleRegistersReq, sizeof(readWriteMultipleRegistersReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -445,12 +435,10 @@ static int ModbusParserTest03(void) { FAIL_IF_NOT(data[4] == 0x9A); FAIL_IF_NOT(data[5] == 0xBC); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readWriteMultipleRegistersRsp, sizeof(readWriteMultipleRegistersRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -490,12 +478,10 @@ static int ModbusParserTest04(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, forceListenOnlyMode, sizeof(forceListenOnlyMode)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -557,12 +543,10 @@ static int ModbusParserTest05(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidProtocolIdReq, sizeof(invalidProtocolIdReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -630,12 +614,10 @@ static int ModbusParserTest06(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsRsp, sizeof(readCoilsRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -703,13 +685,11 @@ static int ModbusParserTest07(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidLengthWriteMultipleRegistersReq, sizeof(invalidLengthWriteMultipleRegistersReq)); FAIL_IF_NOT(r == 1); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -777,12 +757,10 @@ static int ModbusParserTest08(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -794,12 +772,10 @@ static int ModbusParserTest08(void) { FAIL_IF_NOT(rs_modbus_message_get_read_request_address(&request) == 0x7890); FAIL_IF_NOT(rs_modbus_message_get_read_request_quantity(&request) == 19); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsErrorRsp, sizeof(readCoilsErrorRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -842,7 +818,6 @@ static int ModbusParserTest09(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len - part2_len); FAIL_IF_NOT(r == 1); @@ -850,7 +825,6 @@ static int ModbusParserTest09(void) { r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -866,7 +840,6 @@ static int ModbusParserTest09(void) { part2_len = 10; input = readCoilsRsp; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len - part2_len); FAIL_IF_NOT(r == 1); @@ -874,7 +847,6 @@ static int ModbusParserTest09(void) { r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -911,11 +883,9 @@ static int ModbusParserTest10(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -946,10 +916,8 @@ static int ModbusParserTest10(void) { memcpy(input, readCoilsRsp, sizeof(readCoilsRsp)); memcpy(input + sizeof(readCoilsRsp), writeMultipleRegistersRsp, sizeof(writeMultipleRegistersRsp)); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); SCFree(input); AppLayerParserThreadCtxFree(alp_tctx); @@ -1011,11 +979,9 @@ static int ModbusParserTest11(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -1083,13 +1049,11 @@ static int ModbusParserTest12(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidLengthPDUWriteMultipleRegistersReq, sizeof(invalidLengthPDUWriteMultipleRegistersReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -1130,12 +1094,10 @@ static int ModbusParserTest13(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, maskWriteRegisterReq, sizeof(maskWriteRegisterReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -1147,12 +1109,10 @@ static int ModbusParserTest13(void) { FAIL_IF_NOT(rs_modbus_message_get_and_mask(&request) == 0x00F2); FAIL_IF_NOT(rs_modbus_message_get_or_mask(&request) == 0x0025); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, maskWriteRegisterRsp, sizeof(maskWriteRegisterRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -1180,12 +1140,10 @@ static int ModbusParserTest14(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, writeSingleRegisterReq, sizeof(writeSingleRegisterReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -1197,12 +1155,10 @@ static int ModbusParserTest14(void) { FAIL_IF_NOT(rs_modbus_message_get_write_address(&request) == 0x0001); FAIL_IF_NOT(rs_modbus_message_get_write_data(&request) == 0x0003); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, writeSingleRegisterRsp, sizeof(writeSingleRegisterRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); @@ -1257,12 +1213,10 @@ static int ModbusParserTest15(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidMaskWriteRegisterReq, sizeof(invalidMaskWriteRegisterReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -1277,12 +1231,10 @@ static int ModbusParserTest15(void) { FAIL_IF_NOT(PacketAlertCheck(p, 1)); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, maskWriteRegisterRsp, sizeof(maskWriteRegisterRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); ModbusMessage response = rs_modbus_state_get_tx_response(modbus_state, 0); @@ -1348,13 +1300,11 @@ static int ModbusParserTest16(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidWriteSingleRegisterReq, sizeof(invalidWriteSingleRegisterReq)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); @@ -1374,12 +1324,10 @@ static int ModbusParserTest16(void) { FAIL_IF_NOT(PacketAlertCheck(p, 1)); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, writeSingleRegisterRsp, sizeof(writeSingleRegisterRsp)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF_NOT(rs_modbus_state_get_tx_count(modbus_state) == 1); ModbusMessage response = rs_modbus_state_get_tx_response(modbus_state, 0); @@ -1418,21 +1366,17 @@ static int ModbusParserTest17(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF(f.alstate == NULL); FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsRsp, sizeof(readCoilsRsp)); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH); @@ -1463,19 +1407,15 @@ static int ModbusParserTest18(void) { StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len - part2_len); FAIL_IF(r != 1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH); @@ -1485,19 +1425,15 @@ static int ModbusParserTest18(void) { part2_len = 10; input = readCoilsRsp; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len - part2_len); FAIL_IF(r != 1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH); @@ -1552,13 +1488,11 @@ static int ModbusParserTest19(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidFunctionCode, sizeof(invalidFunctionCode)); FAIL_IF_NOT(r == 0); - FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; FAIL_IF_NULL(modbus_state); diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index e83de0b62e..44706b96e6 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1887,15 +1887,12 @@ static int SMTPParserTest01(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -1907,15 +1904,12 @@ static int SMTPParserTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -1923,30 +1917,24 @@ static int SMTPParserTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_STARTTLS || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -1954,15 +1942,12 @@ static int SMTPParserTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2232,15 +2217,12 @@ static int SMTPParserTest02(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -2252,15 +2234,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2268,30 +2247,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2299,30 +2272,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2330,30 +2297,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4, request4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_DATA || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2361,15 +2322,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply4, reply4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2377,15 +2335,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_1, request5_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2394,15 +2349,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_2, request5_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2411,15 +2363,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_3, request5_3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2428,15 +2377,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_4, request5_4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2445,15 +2391,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_5, request5_5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_DATA_MODE || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { @@ -2461,30 +2404,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply5, reply5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request6, request6_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2492,30 +2429,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply6, reply6_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request7, request7_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2523,30 +2454,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply7, reply7_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request8, request8_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_DATA || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2554,15 +2479,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply8, reply8_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2570,15 +2492,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_1, request9_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2587,15 +2506,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_2, request9_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2604,15 +2520,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_3, request9_3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2621,15 +2534,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_4, request9_4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -2638,15 +2548,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_5, request9_5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_DATA_MODE || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { @@ -2654,30 +2561,24 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply9, reply9_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request10, request10_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2685,15 +2586,12 @@ static int SMTPParserTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply10, reply10_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); @@ -2813,15 +2711,12 @@ static int SMTPParserTest03(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -2833,15 +2728,12 @@ static int SMTPParserTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -2849,15 +2741,12 @@ static int SMTPParserTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_PIPELINING_SERVER)) { @@ -2865,15 +2754,12 @@ static int SMTPParserTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 3 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->cmds[1] != SMTP_COMMAND_OTHER_CMD || @@ -2885,15 +2771,12 @@ static int SMTPParserTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE | @@ -2956,15 +2839,12 @@ static int SMTPParserTest04(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -2976,15 +2856,12 @@ static int SMTPParserTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -3101,15 +2978,12 @@ static int SMTPParserTest05(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3121,15 +2995,12 @@ static int SMTPParserTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -3137,15 +3008,12 @@ static int SMTPParserTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_PIPELINING_SERVER)) { @@ -3153,15 +3021,12 @@ static int SMTPParserTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_STARTTLS || smtp_state->parser_state != @@ -3170,15 +3035,12 @@ static int SMTPParserTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_PIPELINING_SERVER)) { @@ -3193,15 +3055,12 @@ static int SMTPParserTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != @@ -3210,15 +3069,12 @@ static int SMTPParserTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_PIPELINING_SERVER)) { @@ -3388,15 +3244,12 @@ static int SMTPParserTest06(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3408,15 +3261,12 @@ static int SMTPParserTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -3424,30 +3274,24 @@ static int SMTPParserTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -3455,30 +3299,24 @@ static int SMTPParserTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -3486,30 +3324,24 @@ static int SMTPParserTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state\n"); goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4, request4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_BDAT || smtp_state->parser_state != @@ -3519,15 +3351,12 @@ static int SMTPParserTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5, request5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE) || @@ -3536,15 +3365,12 @@ static int SMTPParserTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request6, request6_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN || smtp_state->bdat_chunk_len != 51 || smtp_state->bdat_chunk_idx != 51) { @@ -3625,16 +3451,13 @@ static int SMTPParserTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER | STREAM_START, request1, request1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); smtp_state = f.alstate; if (smtp_state == NULL) { @@ -3650,16 +3473,13 @@ static int SMTPParserTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT | STREAM_TOCLIENT, reply1, reply1_len); if (r == 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3769,16 +3589,13 @@ static int SMTPParserTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER | STREAM_START, request1, request1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); smtp_state = f.alstate; if (smtp_state == NULL) { @@ -3794,15 +3611,12 @@ static int SMTPParserTest13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3812,15 +3626,12 @@ static int SMTPParserTest13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -4031,16 +3842,13 @@ static int SMTPParserTest14(void) StreamTcpInitConfig(true); SMTPTestInitConfig(); - FLOWLOCK_WRLOCK(&f); /* Welcome reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -4052,15 +3860,12 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -4068,39 +3873,32 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* EHLO Reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } if ((smtp_state->helo_len != 7) || strncmp("boo.com", (char *)smtp_state->helo, 7)) { printf("incorrect parsing of HELO field '%s' (%d)\n", smtp_state->helo, smtp_state->helo_len); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { printf("smtp parser in inconsistent state l.%d\n", __LINE__); goto end; } - FLOWLOCK_WRLOCK(&f); /* MAIL FROM Request */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -4108,13 +3906,11 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* MAIL FROM Reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -4123,27 +3919,22 @@ static int SMTPParserTest14(void) printf("incorrect parsing of MAIL FROM field '%s' (%d)\n", smtp_state->curr_tx->mail_from, smtp_state->curr_tx->mail_from_len); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state l.%d\n", __LINE__); goto end; } - FLOWLOCK_WRLOCK(&f); /* RCPT TO Request */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -4151,16 +3942,13 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* RCPT TO Reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state l.%d\n", __LINE__); @@ -4173,16 +3961,13 @@ static int SMTPParserTest14(void) smtp_config.mime_config.decode_quoted_printable = true; MimeDecSetConfig(&smtp_config.mime_config); - FLOWLOCK_WRLOCK(&f); /* DATA request */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4, request4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_DATA || @@ -4191,16 +3976,13 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* Data reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply4, reply4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN | SMTP_PARSER_STATE_COMMAND_DATA_MODE)) { @@ -4208,16 +3990,13 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* DATA message */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4_msg, request4_msg_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->curr_tx->mime_state == NULL || @@ -4228,16 +4007,13 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* DATA . request */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4_end, request4_end_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_DATA_MODE || @@ -4288,32 +4064,26 @@ static int SMTPParserTest14(void) } } - FLOWLOCK_WRLOCK(&f); /* DATA . reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply4_end, reply4_end_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state l.%d\n", __LINE__); goto end; } - FLOWLOCK_WRLOCK(&f); /* QUIT Request */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5, request5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || smtp_state->cmds[0] != SMTP_COMMAND_OTHER_CMD || smtp_state->parser_state != SMTP_PARSER_STATE_FIRST_REPLY_SEEN) { @@ -4321,16 +4091,13 @@ static int SMTPParserTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); /* QUIT Reply */ r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply5, reply5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); if (smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || smtp_state->parser_state != (SMTP_PARSER_STATE_FIRST_REPLY_SEEN)) { printf("smtp parser in inconsistent state l.%d\n", __LINE__); diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 4f48cd1ad4..6ccc1c94e5 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -3148,10 +3148,8 @@ static int SSLParserTest01(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_EOF, tlsbuf, tlslen); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3188,16 +3186,12 @@ static int SSLParserTest02(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3236,22 +3230,16 @@ static int SSLParserTest03(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3292,28 +3280,20 @@ static int SSLParserTest04(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3614,10 +3594,8 @@ static int SSLParserMultimsgTest01(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3679,10 +3657,8 @@ static int SSLParserMultimsgTest02(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf1, tlslen1); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3729,10 +3705,8 @@ static int SSLParserTest07(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3897,16 +3871,12 @@ static int SSLParserTest09(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -3960,16 +3930,12 @@ static int SSLParserTest10(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4022,16 +3988,12 @@ static int SSLParserTest11(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4089,22 +4051,16 @@ static int SSLParserTest12(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf3, buf3_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4167,28 +4123,20 @@ static int SSLParserTest13(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf3, buf3_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf4, buf4_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4234,16 +4182,12 @@ static int SSLParserTest14(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4280,10 +4224,8 @@ static int SSLParserTest15(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r == 0); AppLayerParserThreadCtxFree(alp_tctx); @@ -4317,10 +4259,8 @@ static int SSLParserTest16(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r == 0); AppLayerParserThreadCtxFree(alp_tctx); @@ -4354,10 +4294,8 @@ static int SSLParserTest17(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r == 0); AppLayerParserThreadCtxFree(alp_tctx); @@ -4397,16 +4335,12 @@ static int SSLParserTest18(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4444,10 +4378,8 @@ static int SSLParserTest19(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -4485,10 +4417,8 @@ static int SSLParserTest20(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r == 0); AppLayerParserThreadCtxFree(alp_tctx); @@ -4523,10 +4453,8 @@ static int SSLParserTest21(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_EOF, buf, buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *app_state = f.alstate; @@ -4573,10 +4501,8 @@ static int SSLParserTest22(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT | STREAM_EOF, buf, buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *app_state = f.alstate; @@ -4859,11 +4785,9 @@ static int SSLParserTest23(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_START, chello_buf, chello_buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *app_state = f.alstate; @@ -4877,10 +4801,8 @@ static int SSLParserTest23(void) FAIL_IF((app_state->flags & SSL_AL_FLAG_SSL_CLIENT_HS) == 0); FAIL_IF((app_state->flags & SSL_AL_FLAG_SSL_NO_SESSION_ID) == 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, shello_buf, shello_buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); FAIL_IF(app_state->server_connp.content_type != SSLV3_HANDSHAKE_PROTOCOL); @@ -4892,11 +4814,9 @@ static int SSLParserTest23(void) FAIL_IF((app_state->flags & SSL_AL_FLAG_SSL_NO_SESSION_ID) == 0); FAIL_IF((app_state->flags & SSL_AL_FLAG_STATE_SERVER_HELLO) == 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_change_cipher_spec_buf, client_change_cipher_spec_buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); /* with multiple records the client content type hold the type from the last @@ -4911,11 +4831,9 @@ static int SSLParserTest23(void) FAIL_IF((app_state->flags & SSL_AL_FLAG_CLIENT_CHANGE_CIPHER_SPEC) == 0); FAIL_IF((app_state->flags & SSL_AL_FLAG_CHANGE_CIPHER_SPEC) == 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_change_cipher_spec_buf, server_change_cipher_spec_buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); /* with multiple records the serve content type hold the type from the last @@ -4933,10 +4851,8 @@ static int SSLParserTest23(void) FAIL_IF((app_state->flags & SSL_AL_FLAG_SERVER_CHANGE_CIPHER_SPEC) == 0); FAIL_IF((app_state->flags & SSL_AL_FLAG_CHANGE_CIPHER_SPEC) == 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, toserver_app_data_buf, toserver_app_data_buf_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); FAIL_IF(app_state->client_connp.content_type != SSLV3_APPLICATION_PROTOCOL); @@ -5001,16 +4917,12 @@ static int SSLParserTest24(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -5359,11 +5271,9 @@ static int SSLParserTest25(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, client_hello_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -5372,21 +5282,17 @@ static int SSLParserTest25(void) FAIL_IF(ssl_state->client_connp.bytes_processed != 0); FAIL_IF(ssl_state->client_connp.hs_bytes_processed != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello_certificate_done, server_hello_certificate_done_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); FAIL_IF(ssl_state->client_connp.bytes_processed != 0); FAIL_IF(ssl_state->client_connp.hs_bytes_processed != 0); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_key_exchange_cipher_enc_hs, client_key_exchange_cipher_enc_hs_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); AppLayerParserThreadCtxFree(alp_tctx); @@ -5504,11 +5410,9 @@ static int SSLParserTest26(void) StreamTcpInitConfig(true); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, client_hello_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); SSLState *ssl_state = f.alstate; @@ -5517,11 +5421,9 @@ static int SSLParserTest26(void) FAIL_IF((ssl_state->flags & SSL_AL_FLAG_STATE_CLIENT_HELLO) == 0); FAIL_IF_NULL(ssl_state->client_connp.session_id); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello_change_cipher_spec, server_hello_change_cipher_spec_len); - FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); FAIL_IF((ssl_state->flags & SSL_AL_FLAG_SERVER_CHANGE_CIPHER_SPEC) == 0); diff --git a/src/detect-dce-stub-data.c b/src/detect-dce-stub-data.c index ababb7926b..a89ac47b33 100644 --- a/src/detect-dce-stub-data.c +++ b/src/detect-dce-stub-data.c @@ -697,16 +697,13 @@ static int DetectDceStubDataTestParse02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -724,16 +721,13 @@ static int DetectDceStubDataTestParse02(void) goto end; /* do detect */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -744,16 +738,13 @@ static int DetectDceStubDataTestParse02(void) if (PacketAlertCheck(p, 1)) goto end; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_EOF, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1441,16 +1432,13 @@ static int DetectDceStubDataTestParse04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1461,31 +1449,25 @@ static int DetectDceStubDataTestParse04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); /* request1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request1, dcerpc_request1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1496,16 +1478,13 @@ static int DetectDceStubDataTestParse04(void) goto end; /* response1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response1, dcerpc_response1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1516,16 +1495,13 @@ static int DetectDceStubDataTestParse04(void) goto end; /* request2 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request2, dcerpc_request2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1536,16 +1512,13 @@ static int DetectDceStubDataTestParse04(void) goto end; /* response2 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response2, dcerpc_response2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1555,16 +1528,13 @@ static int DetectDceStubDataTestParse04(void) if (PacketAlertCheck(p, 1) || PacketAlertCheck(p, 2) || PacketAlertCheck(p, 3)) goto end; /* request3 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request3, dcerpc_request3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1575,16 +1545,13 @@ static int DetectDceStubDataTestParse04(void) goto end; /* response3 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT | STREAM_EOF, dcerpc_response3, dcerpc_response3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1759,16 +1726,13 @@ static int DetectDceStubDataTestParse05(void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* request1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_request1, dcerpc_request1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1785,16 +1749,13 @@ static int DetectDceStubDataTestParse05(void) goto end; /* response1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response1, dcerpc_response1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1805,16 +1766,13 @@ static int DetectDceStubDataTestParse05(void) goto end; /* request2 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request2, dcerpc_request2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1825,16 +1783,13 @@ static int DetectDceStubDataTestParse05(void) goto end; /* response2 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response2, dcerpc_response2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1845,16 +1800,13 @@ static int DetectDceStubDataTestParse05(void) goto end; /* request3 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request3, dcerpc_request3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1865,16 +1817,13 @@ static int DetectDceStubDataTestParse05(void) goto end; /* response3 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT | STREAM_EOF, dcerpc_response3, dcerpc_response3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; diff --git a/src/detect-dns-query.c b/src/detect-dns-query.c index 60ff3b5843..9c688cd8b2 100644 --- a/src/detect-dns-query.c +++ b/src/detect-dns-query.c @@ -330,15 +330,12 @@ static int DetectDnsQueryTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; FAIL_IF_NULL(dns_state); @@ -456,15 +453,12 @@ static int DetectDnsQueryTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf1, sizeof(buf1)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; FAIL_IF_NULL(dns_state); @@ -481,15 +475,12 @@ static int DetectDnsQueryTest02(void) FAIL; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOCLIENT, buf2, sizeof(buf2)); if (r != 0) { printf("toserver client 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -503,15 +494,12 @@ static int DetectDnsQueryTest02(void) FAIL; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf3, sizeof(buf3)); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p3); @@ -594,15 +582,12 @@ static int DetectDnsQueryTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; FAIL_IF_NULL(dns_state); @@ -684,15 +669,12 @@ static int DetectDnsQueryTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; FAIL_IF_NULL(dns_state); @@ -819,15 +801,12 @@ static int DetectDnsQueryTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf1, sizeof(buf1)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; FAIL_IF_NULL(dns_state); @@ -844,15 +823,12 @@ static int DetectDnsQueryTest05(void) FAIL; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOCLIENT, buf2, sizeof(buf2)); if (r != 0) { printf("toserver client 1 returned %" PRId32 ", expected 0\n", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -870,15 +846,12 @@ static int DetectDnsQueryTest05(void) FAIL; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf3, sizeof(buf3)); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p3); diff --git a/src/detect-engine-dcepayload.c b/src/detect-engine-dcepayload.c index a4dd805eda..a44fb75e42 100644 --- a/src/detect-engine-dcepayload.c +++ b/src/detect-engine-dcepayload.c @@ -133,16 +133,13 @@ static int DcePayloadTest15(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -250,16 +247,13 @@ static int DcePayloadTest16(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -367,16 +361,13 @@ static int DcePayloadTest17(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -484,16 +475,13 @@ static int DcePayloadTest18(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -601,16 +589,13 @@ static int DcePayloadTest19(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -718,16 +703,13 @@ static int DcePayloadTest20(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { diff --git a/src/detect-ftpbounce.c b/src/detect-ftpbounce.c index e948c442bd..bdb3397427 100644 --- a/src/detect-ftpbounce.c +++ b/src/detect-ftpbounce.c @@ -336,13 +336,11 @@ static int DetectFtpbounceTestALMatch02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v,(void *)de_ctx,(void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -351,7 +349,6 @@ static int DetectFtpbounceTestALMatch02(void) if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -360,7 +357,6 @@ static int DetectFtpbounceTestALMatch02(void) if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -369,11 +365,9 @@ static int DetectFtpbounceTestALMatch02(void) if (r != 0) { SCLogDebug("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { @@ -480,13 +474,11 @@ static int DetectFtpbounceTestALMatch03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v,(void *)de_ctx,(void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -495,7 +487,6 @@ static int DetectFtpbounceTestALMatch03(void) if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -504,7 +495,6 @@ static int DetectFtpbounceTestALMatch03(void) if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -513,10 +503,8 @@ static int DetectFtpbounceTestALMatch03(void) if (r != 0) { SCLogDebug("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { diff --git a/src/detect-lua.c b/src/detect-lua.c index cc189d4afb..b94f19f931 100644 --- a/src/detect-lua.c +++ b/src/detect-lua.c @@ -1236,15 +1236,12 @@ static int LuaMatchTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -1260,14 +1257,11 @@ static int LuaMatchTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogDebug("inspecting p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1397,15 +1391,12 @@ static int LuaMatchTest01a(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -1421,14 +1412,11 @@ static int LuaMatchTest01a(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogDebug("inspecting p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2089,15 +2077,12 @@ static int LuaMatchTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2113,14 +2098,11 @@ static int LuaMatchTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2244,15 +2226,12 @@ static int LuaMatchTest04a(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2268,14 +2247,11 @@ static int LuaMatchTest04a(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2392,15 +2368,12 @@ static int LuaMatchTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2416,14 +2389,11 @@ static int LuaMatchTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2540,15 +2510,12 @@ static int LuaMatchTest05a(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2564,14 +2531,11 @@ static int LuaMatchTest05a(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2693,15 +2657,12 @@ static int LuaMatchTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2717,14 +2678,11 @@ static int LuaMatchTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2846,15 +2804,12 @@ static int LuaMatchTest06a(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2870,14 +2825,11 @@ static int LuaMatchTest06a(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-pcre.c b/src/detect-pcre.c index f20b216247..d7df02b367 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -1753,7 +1753,6 @@ static int DetectPcreTxBodyChunksTest01(void) AppLayerHtpEnableRequestBodyCallback(); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, httpbuf1, httplen1); FAIL_IF(r != 0); @@ -1805,7 +1804,6 @@ static int DetectPcreTxBodyChunksTest01(void) if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); - FLOWLOCK_UNLOCK(&f); StreamTcpFreeConfig(true); FLOW_DESTROY(&f); UTHFreePacket(p); @@ -1869,61 +1867,49 @@ static int DetectPcreTxBodyChunksTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf4, httplen4); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(!(PacketAlertCheck(p, 1))); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf5, httplen5); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf6, httplen6); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1932,10 +1918,8 @@ static int DetectPcreTxBodyChunksTest02(void) SCLogDebug("sending data chunk 7"); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf7, httplen7); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2038,61 +2022,49 @@ static int DetectPcreTxBodyChunksTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf4, httplen4); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(!(PacketAlertCheck(p, 1))); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf5, httplen5); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf6, httplen6); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2101,10 +2073,8 @@ static int DetectPcreTxBodyChunksTest03(void) SCLogDebug("sending data chunk 7"); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf7, httplen7); FAIL_IF(r != 0); - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-quic-cyu-hash.c b/src/detect-quic-cyu-hash.c index b2a8a0f1fe..010a115610 100644 --- a/src/detect-quic-cyu-hash.c +++ b/src/detect-quic-cyu-hash.c @@ -385,15 +385,12 @@ static int DetectQuicCyuHashTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_QUIC, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); quic_state = f.alstate; FAIL_IF_NULL(quic_state); diff --git a/src/detect-quic-cyu-string.c b/src/detect-quic-cyu-string.c index 5f44f707fa..9fa8d4d822 100644 --- a/src/detect-quic-cyu-string.c +++ b/src/detect-quic-cyu-string.c @@ -344,15 +344,12 @@ static int DetectQuicCyuStringTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_QUIC, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); FAIL; } - FLOWLOCK_UNLOCK(&f); quic_state = f.alstate; FAIL_IF_NULL(quic_state); diff --git a/src/detect-template-rust-buffer.c b/src/detect-template-rust-buffer.c index 8b401f4b68..dda9647180 100644 --- a/src/detect-template-rust-buffer.c +++ b/src/detect-template-rust-buffer.c @@ -176,10 +176,8 @@ static int DetectTemplateRustBufferTest(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TEMPLATE_RUST, STREAM_TOSERVER, request, sizeof(request)); - FLOWLOCK_UNLOCK(&f); /* Check that we have app-layer state. */ FAIL_IF_NULL(f.alstate); diff --git a/src/detect-urilen.c b/src/detect-urilen.c index a8a16554c8..ba44ef66ed 100644 --- a/src/detect-urilen.c +++ b/src/detect-urilen.c @@ -689,15 +689,12 @@ static int DetectUrilenSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); HtpState *htp_state = f.alstate; if (htp_state == NULL) { diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 3b8b7c3afa..107437714a 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -3264,7 +3264,6 @@ static int StreamTcpReassembleInlineTest01(void) p->tcph->th_seq = htonl(12); p->flow = &f; - FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -3280,7 +3279,6 @@ static int StreamTcpReassembleInlineTest01(void) ssn.client.next_seq = 17; ret = 1; end: - FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -3316,7 +3314,6 @@ static int StreamTcpReassembleInlineTest02(void) p->tcph->th_seq = htonl(12); p->flow = &f; - FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -3337,7 +3334,6 @@ static int StreamTcpReassembleInlineTest02(void) ssn.client.next_seq = 22; ret = 1; end: - FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -3377,7 +3373,6 @@ static int StreamTcpReassembleInlineTest03(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -3400,7 +3395,6 @@ static int StreamTcpReassembleInlineTest03(void) p->tcph->th_seq = htonl(17); ret = 1; end: - FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -3440,7 +3434,6 @@ static int StreamTcpReassembleInlineTest04(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -3463,7 +3456,6 @@ static int StreamTcpReassembleInlineTest04(void) p->tcph->th_seq = htonl(17); ret = 1; end: - FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -3552,7 +3544,6 @@ static int StreamTcpReassembleInlineTest09(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -3583,7 +3574,6 @@ static int StreamTcpReassembleInlineTest09(void) ret = 1; end: - FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -3632,7 +3622,6 @@ static int StreamTcpReassembleInlineTest10(void) p->flow = f; p->flowflags = FLOW_PKT_TOSERVER; - FLOWLOCK_WRLOCK(f); if (StreamTcpUTAddSegmentWithPayload(&tv, ra_ctx, &ssn.client, 2, stream_payload1, 2) == -1) { printf("failed to add segment 1: "); goto end; @@ -3674,7 +3663,6 @@ end: UTHFreePacket(p); StreamTcpUTClearSession(&ssn); StreamTcpUTDeinit(ra_ctx); - FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } diff --git a/src/tests/app-layer-htp-file.c b/src/tests/app-layer-htp-file.c index 869c04944b..6f7891c80d 100644 --- a/src/tests/app-layer-htp-file.c +++ b/src/tests/app-layer-htp-file.c @@ -1,4 +1,3 @@ - /* Copyright (C) 2019 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of diff --git a/src/tests/detect-http-cookie.c b/src/tests/detect-http-cookie.c index f1caa4674d..93b0ac8b6b 100644 --- a/src/tests/detect-http-cookie.c +++ b/src/tests/detect-http-cookie.c @@ -102,16 +102,13 @@ static int DetectEngineHttpCookieTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -197,16 +194,13 @@ static int DetectEngineHttpCookieTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -292,16 +286,13 @@ static int DetectEngineHttpCookieTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -387,16 +378,13 @@ static int DetectEngineHttpCookieTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -482,16 +470,13 @@ static int DetectEngineHttpCookieTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -577,16 +562,13 @@ static int DetectEngineHttpCookieTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -672,16 +654,13 @@ static int DetectEngineHttpCookieTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -767,16 +746,13 @@ static int DetectEngineHttpCookieTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -862,16 +838,13 @@ static int DetectEngineHttpCookieTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -958,16 +931,13 @@ static int DetectEngineHttpCookieTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1054,16 +1024,13 @@ static int DetectEngineHttpCookieTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1150,16 +1117,13 @@ static int DetectEngineHttpCookieTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1246,16 +1210,13 @@ static int DetectEngineHttpCookieTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1342,16 +1303,13 @@ static int DetectEngineHttpCookieTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1438,16 +1396,13 @@ static int DetectEngineHttpCookieTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1534,16 +1489,13 @@ static int DetectEngineHttpCookieTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1630,16 +1582,13 @@ static int DetectEngineHttpCookieTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1915,16 +1864,13 @@ static int DetectHttpCookieSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2014,16 +1960,13 @@ static int DetectHttpCookieSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2107,16 +2050,13 @@ static int DetectHttpCookieSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2201,16 +2141,13 @@ static int DetectHttpCookieSigTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2295,16 +2232,13 @@ static int DetectHttpCookieSigTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2390,15 +2324,12 @@ static int DetectHttpCookieSigTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2482,16 +2413,13 @@ static int DetectHttpCookieSigTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2593,16 +2521,13 @@ static int DetectHttpCookieSigTest08(void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* request */ - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf_request, httpbuf_request_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2617,16 +2542,13 @@ static int DetectHttpCookieSigTest08(void) } /* response */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf_response, httpbuf_response_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2729,16 +2651,13 @@ static int DetectHttpCookieSigTest09(void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* request */ - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf_request, httpbuf_request_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2753,16 +2672,13 @@ static int DetectHttpCookieSigTest09(void) } /* response */ - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf_response, httpbuf_response_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/tests/detect-http-header.c b/src/tests/detect-http-header.c index a741c2cab0..c4baf937a1 100644 --- a/src/tests/detect-http-header.c +++ b/src/tests/detect-http-header.c @@ -184,16 +184,13 @@ static int DetectHttpHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -385,16 +382,13 @@ static int DetectHttpHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -411,16 +405,13 @@ static int DetectHttpHeaderTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -512,16 +503,13 @@ static int DetectHttpHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -538,16 +526,13 @@ static int DetectHttpHeaderTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -638,16 +623,13 @@ static int DetectHttpHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -664,16 +646,13 @@ static int DetectHttpHeaderTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -756,16 +735,13 @@ static int DetectHttpHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -854,16 +830,13 @@ static int DetectHttpHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -953,16 +926,13 @@ static int DetectHttpHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1349,16 +1319,13 @@ static int DetectHttpHeaderTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1433,16 +1400,13 @@ static int DetectHttpHeaderTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1517,16 +1481,13 @@ static int DetectHttpHeaderTest30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1629,16 +1590,13 @@ static int DetectEngineHttpHeaderTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1722,16 +1680,13 @@ static int DetectEngineHttpHeaderTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1815,16 +1770,13 @@ static int DetectEngineHttpHeaderTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1908,16 +1860,13 @@ static int DetectEngineHttpHeaderTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2001,16 +1950,13 @@ static int DetectEngineHttpHeaderTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2094,16 +2040,13 @@ static int DetectEngineHttpHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2187,16 +2130,13 @@ static int DetectEngineHttpHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2280,16 +2220,13 @@ static int DetectEngineHttpHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2373,16 +2310,13 @@ static int DetectEngineHttpHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2466,16 +2400,13 @@ static int DetectEngineHttpHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2559,16 +2490,13 @@ static int DetectEngineHttpHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2652,16 +2580,13 @@ static int DetectEngineHttpHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2745,16 +2670,13 @@ static int DetectEngineHttpHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2838,16 +2760,13 @@ static int DetectEngineHttpHeaderTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2931,16 +2850,13 @@ static int DetectEngineHttpHeaderTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3024,16 +2940,13 @@ static int DetectEngineHttpHeaderTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3117,16 +3030,13 @@ static int DetectEngineHttpHeaderTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3218,16 +3128,13 @@ static int DetectEngineHttpHeaderTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3244,16 +3151,13 @@ static int DetectEngineHttpHeaderTest20(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3340,16 +3244,13 @@ static int DetectEngineHttpHeaderTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3366,16 +3267,13 @@ static int DetectEngineHttpHeaderTest21(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3462,16 +3360,13 @@ static int DetectEngineHttpHeaderTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3488,16 +3383,13 @@ static int DetectEngineHttpHeaderTest22(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3584,16 +3476,13 @@ static int DetectEngineHttpHeaderTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3610,16 +3499,13 @@ static int DetectEngineHttpHeaderTest23(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3706,16 +3592,13 @@ static int DetectEngineHttpHeaderTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3732,16 +3615,13 @@ static int DetectEngineHttpHeaderTest24(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3828,16 +3708,13 @@ static int DetectEngineHttpHeaderTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3854,16 +3731,13 @@ static int DetectEngineHttpHeaderTest25(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3950,16 +3824,13 @@ static int DetectEngineHttpHeaderTest26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3976,16 +3847,13 @@ static int DetectEngineHttpHeaderTest26(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4072,16 +3940,13 @@ static int DetectEngineHttpHeaderTest27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4098,16 +3963,13 @@ static int DetectEngineHttpHeaderTest27(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4198,16 +4060,13 @@ static int DetectEngineHttpHeaderTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4224,16 +4083,13 @@ static int DetectEngineHttpHeaderTest28(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4321,16 +4177,13 @@ static int DetectEngineHttpHeaderTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4347,16 +4200,13 @@ static int DetectEngineHttpHeaderTest29(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4478,16 +4328,13 @@ static int DetectEngineHttpHeaderTest30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4504,16 +4351,13 @@ static int DetectEngineHttpHeaderTest30(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4597,16 +4441,13 @@ static int DetectEngineHttpHeaderTest31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4697,16 +4538,13 @@ static int DetectEngineHttpHeaderTest32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect-http-host.c b/src/tests/detect-http-host.c index bbae987e2a..60b437ca16 100644 --- a/src/tests/detect-http-host.c +++ b/src/tests/detect-http-host.c @@ -98,16 +98,13 @@ static int DetectEngineHttpHHTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -197,16 +194,13 @@ static int DetectEngineHttpHHTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -296,16 +290,13 @@ static int DetectEngineHttpHHTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -395,16 +386,13 @@ static int DetectEngineHttpHHTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -494,16 +482,13 @@ static int DetectEngineHttpHHTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -593,16 +578,13 @@ static int DetectEngineHttpHHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -692,16 +674,13 @@ static int DetectEngineHttpHHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -791,16 +770,13 @@ static int DetectEngineHttpHHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -890,16 +866,13 @@ static int DetectEngineHttpHHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -990,16 +963,13 @@ static int DetectEngineHttpHHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1090,16 +1060,13 @@ static int DetectEngineHttpHHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1190,16 +1157,13 @@ static int DetectEngineHttpHHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1290,16 +1254,13 @@ static int DetectEngineHttpHHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1390,16 +1351,13 @@ static int DetectEngineHttpHHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1490,16 +1448,13 @@ static int DetectEngineHttpHHTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1590,16 +1545,13 @@ static int DetectEngineHttpHHTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1690,16 +1642,13 @@ static int DetectEngineHttpHHTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1785,16 +1734,13 @@ static int DetectEngineHttpHHTest18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1880,16 +1826,13 @@ static int DetectEngineHttpHHTest19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1975,16 +1918,13 @@ static int DetectEngineHttpHHTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2069,16 +2009,13 @@ static int DetectEngineHttpHHTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2163,16 +2100,13 @@ static int DetectEngineHttpHHTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2257,16 +2191,13 @@ static int DetectEngineHttpHHTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2352,16 +2283,13 @@ static int DetectEngineHttpHHTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2447,16 +2375,13 @@ static int DetectEngineHttpHHTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2697,16 +2622,13 @@ static int DetectHttpHHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2801,16 +2723,13 @@ static int DetectHttpHHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2826,15 +2745,12 @@ static int DetectHttpHHTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2922,16 +2838,13 @@ static int DetectHttpHHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2948,16 +2861,13 @@ static int DetectHttpHHTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3050,16 +2960,13 @@ static int DetectHttpHHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3076,16 +2983,13 @@ static int DetectHttpHHTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3178,16 +3082,13 @@ static int DetectHttpHHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3204,16 +3105,13 @@ static int DetectHttpHHTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ @@ -3296,16 +3194,13 @@ static int DetectHttpHHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3392,16 +3287,13 @@ static int DetectHttpHHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3489,16 +3381,13 @@ static int DetectHttpHHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3594,15 +3483,12 @@ static int DetectHttpHHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3612,14 +3498,11 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3629,14 +3512,11 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3646,14 +3526,11 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3663,14 +3540,11 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3682,14 +3556,11 @@ static int DetectHttpHHTest14(void) SCLogDebug("sending data chunk 7"); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -4574,16 +4445,13 @@ static int DetectHttpHRHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4678,16 +4546,13 @@ static int DetectHttpHRHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4703,15 +4568,12 @@ static int DetectHttpHRHTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4799,16 +4661,13 @@ static int DetectHttpHRHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4825,16 +4684,13 @@ static int DetectHttpHRHTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4927,16 +4783,13 @@ static int DetectHttpHRHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4953,16 +4806,13 @@ static int DetectHttpHRHTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5055,16 +4905,13 @@ static int DetectHttpHRHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5081,16 +4928,13 @@ static int DetectHttpHRHTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5172,16 +5016,13 @@ static int DetectHttpHRHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5268,16 +5109,13 @@ static int DetectHttpHRHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5365,16 +5203,13 @@ static int DetectHttpHRHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5470,15 +5305,12 @@ static int DetectHttpHRHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -5488,14 +5320,11 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -5505,14 +5334,11 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -5522,14 +5348,11 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -5539,14 +5362,11 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -5558,14 +5378,11 @@ static int DetectHttpHRHTest14(void) SCLogDebug("sending data chunk 7"); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -6344,16 +6161,13 @@ static int DetectHttpHRHTest37(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6370,16 +6184,13 @@ static int DetectHttpHRHTest37(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6458,16 +6269,13 @@ static int DetectEngineHttpHRHTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6553,16 +6361,13 @@ static int DetectEngineHttpHRHTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6648,16 +6453,13 @@ static int DetectEngineHttpHRHTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6743,16 +6545,13 @@ static int DetectEngineHttpHRHTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6838,16 +6637,13 @@ static int DetectEngineHttpHRHTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6933,16 +6729,13 @@ static int DetectEngineHttpHRHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7028,16 +6821,13 @@ static int DetectEngineHttpHRHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7123,16 +6913,13 @@ static int DetectEngineHttpHRHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7218,16 +7005,13 @@ static int DetectEngineHttpHRHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7314,16 +7098,13 @@ static int DetectEngineHttpHRHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7410,16 +7191,13 @@ static int DetectEngineHttpHRHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7506,16 +7284,13 @@ static int DetectEngineHttpHRHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7602,16 +7377,13 @@ static int DetectEngineHttpHRHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7698,16 +7470,13 @@ static int DetectEngineHttpHRHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7794,16 +7563,13 @@ static int DetectEngineHttpHRHTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7890,16 +7656,13 @@ static int DetectEngineHttpHRHTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7986,16 +7749,13 @@ static int DetectEngineHttpHRHTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8077,16 +7837,13 @@ static int DetectEngineHttpHRHTest18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8168,16 +7925,13 @@ static int DetectEngineHttpHRHTest19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8259,16 +8013,13 @@ static int DetectEngineHttpHRHTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8349,16 +8100,13 @@ static int DetectEngineHttpHRHTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8439,16 +8187,13 @@ static int DetectEngineHttpHRHTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8529,16 +8274,13 @@ static int DetectEngineHttpHRHTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8620,16 +8362,13 @@ static int DetectEngineHttpHRHTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8711,16 +8450,13 @@ static int DetectEngineHttpHRHTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect-http-method.c b/src/tests/detect-http-method.c index 44e1f01f68..44ee21f21c 100644 --- a/src/tests/detect-http-method.c +++ b/src/tests/detect-http-method.c @@ -97,16 +97,13 @@ static int DetectEngineHttpMethodTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -191,16 +188,13 @@ static int DetectEngineHttpMethodTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -285,16 +279,13 @@ static int DetectEngineHttpMethodTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -379,16 +370,13 @@ static int DetectEngineHttpMethodTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -473,16 +461,13 @@ static int DetectEngineHttpMethodTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -567,16 +552,13 @@ static int DetectEngineHttpMethodTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -661,16 +643,13 @@ static int DetectEngineHttpMethodTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -755,16 +734,13 @@ static int DetectEngineHttpMethodTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -849,16 +825,13 @@ static int DetectEngineHttpMethodTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -944,16 +917,13 @@ static int DetectEngineHttpMethodTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1039,16 +1009,13 @@ static int DetectEngineHttpMethodTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1134,16 +1101,13 @@ static int DetectEngineHttpMethodTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1229,16 +1193,13 @@ static int DetectEngineHttpMethodTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1324,16 +1285,13 @@ static int DetectEngineHttpMethodTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1419,16 +1377,13 @@ static int DetectEngineHttpMethodTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1514,16 +1469,13 @@ static int DetectEngineHttpMethodTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1609,16 +1561,13 @@ static int DetectEngineHttpMethodTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1972,15 +1921,12 @@ static int DetectHttpMethodSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2075,15 +2021,12 @@ static int DetectHttpMethodSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2170,15 +2113,12 @@ static int DetectHttpMethodSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2266,15 +2206,12 @@ static int DetectHttpMethodSigTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect-http-raw-header.c b/src/tests/detect-http-raw-header.c index 1809787fdb..484bd5757b 100644 --- a/src/tests/detect-http-raw-header.c +++ b/src/tests/detect-http-raw-header.c @@ -143,16 +143,13 @@ static int DetectEngineHttpRawHeaderTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -236,16 +233,13 @@ static int DetectEngineHttpRawHeaderTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -329,16 +323,13 @@ static int DetectEngineHttpRawHeaderTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -422,16 +413,13 @@ static int DetectEngineHttpRawHeaderTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -515,16 +503,13 @@ static int DetectEngineHttpRawHeaderTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -608,16 +593,13 @@ static int DetectEngineHttpRawHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -701,16 +683,13 @@ static int DetectEngineHttpRawHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -794,16 +773,13 @@ static int DetectEngineHttpRawHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -887,16 +863,13 @@ static int DetectEngineHttpRawHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -980,16 +953,13 @@ static int DetectEngineHttpRawHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1073,16 +1043,13 @@ static int DetectEngineHttpRawHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1166,16 +1133,13 @@ static int DetectEngineHttpRawHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1259,16 +1223,13 @@ static int DetectEngineHttpRawHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1352,16 +1313,13 @@ static int DetectEngineHttpRawHeaderTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1445,16 +1403,13 @@ static int DetectEngineHttpRawHeaderTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1538,16 +1493,13 @@ static int DetectEngineHttpRawHeaderTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1631,16 +1583,13 @@ static int DetectEngineHttpRawHeaderTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1820,16 +1769,13 @@ static int DetectEngineHttpRawHeaderTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1846,16 +1792,13 @@ static int DetectEngineHttpRawHeaderTest21(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1942,16 +1885,13 @@ static int DetectEngineHttpRawHeaderTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1968,16 +1908,13 @@ static int DetectEngineHttpRawHeaderTest22(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2064,16 +2001,13 @@ static int DetectEngineHttpRawHeaderTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2090,16 +2024,13 @@ static int DetectEngineHttpRawHeaderTest23(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2186,16 +2117,13 @@ static int DetectEngineHttpRawHeaderTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2212,16 +2140,13 @@ static int DetectEngineHttpRawHeaderTest24(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2308,16 +2233,13 @@ static int DetectEngineHttpRawHeaderTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2334,16 +2256,13 @@ static int DetectEngineHttpRawHeaderTest25(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2430,16 +2349,13 @@ static int DetectEngineHttpRawHeaderTest26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2456,16 +2372,13 @@ static int DetectEngineHttpRawHeaderTest26(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2550,16 +2463,13 @@ static int DetectEngineHttpRawHeaderTest27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2576,16 +2486,13 @@ static int DetectEngineHttpRawHeaderTest27(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2676,16 +2583,13 @@ static int DetectEngineHttpRawHeaderTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2702,16 +2606,13 @@ static int DetectEngineHttpRawHeaderTest28(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2802,16 +2703,13 @@ static int DetectEngineHttpRawHeaderTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2828,16 +2726,13 @@ static int DetectEngineHttpRawHeaderTest29(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2955,16 +2850,13 @@ static int DetectEngineHttpRawHeaderTest31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3064,16 +2956,13 @@ static int DetectEngineHttpRawHeaderTest32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3090,16 +2979,13 @@ static int DetectEngineHttpRawHeaderTest32(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3336,16 +3222,13 @@ static int DetectHttpRawHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3442,16 +3325,13 @@ static int DetectHttpRawHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3468,16 +3348,13 @@ static int DetectHttpRawHeaderTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3567,16 +3444,13 @@ static int DetectHttpRawHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3593,16 +3467,13 @@ static int DetectHttpRawHeaderTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3693,16 +3564,13 @@ static int DetectHttpRawHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3719,16 +3587,13 @@ static int DetectHttpRawHeaderTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3819,16 +3684,13 @@ static int DetectHttpRawHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3845,16 +3707,13 @@ static int DetectHttpRawHeaderTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3937,16 +3796,13 @@ static int DetectHttpRawHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4035,16 +3891,13 @@ static int DetectHttpRawHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4134,16 +3987,13 @@ static int DetectHttpRawHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect-http-server-body.c b/src/tests/detect-http-server-body.c index b84b37c553..5f797b1cda 100644 --- a/src/tests/detect-http-server-body.c +++ b/src/tests/detect-http-server-body.c @@ -221,16 +221,13 @@ static int DetectEngineHttpServerBodyTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -247,16 +244,13 @@ static int DetectEngineHttpServerBodyTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -341,27 +335,21 @@ static int DetectEngineHttpServerBodyTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -461,16 +449,13 @@ static int DetectEngineHttpServerBodyTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -487,27 +472,21 @@ static int DetectEngineHttpServerBodyTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -598,16 +577,13 @@ static int DetectEngineHttpServerBodyTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -624,16 +600,13 @@ static int DetectEngineHttpServerBodyTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -724,16 +697,13 @@ static int DetectEngineHttpServerBodyTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -750,16 +720,13 @@ static int DetectEngineHttpServerBodyTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -850,16 +817,13 @@ static int DetectEngineHttpServerBodyTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -876,16 +840,13 @@ static int DetectEngineHttpServerBodyTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -976,16 +937,13 @@ static int DetectEngineHttpServerBodyTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1002,16 +960,13 @@ static int DetectEngineHttpServerBodyTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1102,16 +1057,13 @@ static int DetectEngineHttpServerBodyTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1128,16 +1080,13 @@ static int DetectEngineHttpServerBodyTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1229,16 +1178,13 @@ static int DetectEngineHttpServerBodyTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1255,16 +1201,13 @@ static int DetectEngineHttpServerBodyTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1356,16 +1299,13 @@ static int DetectEngineHttpServerBodyTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1382,16 +1322,13 @@ static int DetectEngineHttpServerBodyTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1483,16 +1420,13 @@ static int DetectEngineHttpServerBodyTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1509,16 +1443,13 @@ static int DetectEngineHttpServerBodyTest11(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1610,16 +1541,13 @@ static int DetectEngineHttpServerBodyTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1636,16 +1564,13 @@ static int DetectEngineHttpServerBodyTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1737,16 +1662,13 @@ static int DetectEngineHttpServerBodyTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1763,16 +1685,13 @@ static int DetectEngineHttpServerBodyTest13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1864,16 +1783,13 @@ static int DetectEngineHttpServerBodyTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1890,16 +1806,13 @@ static int DetectEngineHttpServerBodyTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1991,16 +1904,13 @@ static int DetectEngineHttpServerBodyTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2017,16 +1927,13 @@ static int DetectEngineHttpServerBodyTest15(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2143,16 +2050,13 @@ libhtp:\n\ SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2169,16 +2073,13 @@ libhtp:\n\ goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2188,16 +2089,13 @@ libhtp:\n\ goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3068,16 +2966,13 @@ static int DetectEngineHttpServerBodyFileDataTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3094,16 +2989,13 @@ static int DetectEngineHttpServerBodyFileDataTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3195,16 +3087,13 @@ static int DetectEngineHttpServerBodyFileDataTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3221,16 +3110,13 @@ static int DetectEngineHttpServerBodyFileDataTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3326,16 +3212,13 @@ static int DetectEngineHttpServerBodyFileDataTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3352,16 +3235,13 @@ static int DetectEngineHttpServerBodyFileDataTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5584,13 +5464,11 @@ static int DetectHttpServerBodyTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START | STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, @@ -5598,10 +5476,8 @@ static int DetectHttpServerBodyTest06(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5704,12 +5580,10 @@ static int DetectHttpServerBodyTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -5717,10 +5591,8 @@ static int DetectHttpServerBodyTest07(void) http_buf2, http_len2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5736,15 +5608,12 @@ static int DetectHttpServerBodyTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5840,16 +5709,13 @@ static int DetectHttpServerBodyTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5858,16 +5724,13 @@ static int DetectHttpServerBodyTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -5877,16 +5740,13 @@ static int DetectHttpServerBodyTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5986,16 +5846,13 @@ static int DetectHttpServerBodyTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6004,16 +5861,13 @@ static int DetectHttpServerBodyTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -6023,13 +5877,11 @@ static int DetectHttpServerBodyTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -6038,10 +5890,8 @@ static int DetectHttpServerBodyTest09(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6141,16 +5991,13 @@ static int DetectHttpServerBodyTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6159,16 +6006,13 @@ static int DetectHttpServerBodyTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -6178,13 +6022,11 @@ static int DetectHttpServerBodyTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -6193,10 +6035,8 @@ static int DetectHttpServerBodyTest10(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6292,16 +6132,13 @@ static int DetectHttpServerBodyTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6310,16 +6147,13 @@ static int DetectHttpServerBodyTest11(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -6329,16 +6163,13 @@ static int DetectHttpServerBodyTest11(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6434,16 +6265,13 @@ static int DetectHttpServerBodyTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6452,16 +6280,13 @@ static int DetectHttpServerBodyTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -6471,16 +6296,13 @@ static int DetectHttpServerBodyTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6564,13 +6386,11 @@ static int DetectHttpServerBodyTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START | STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, @@ -6578,10 +6398,8 @@ static int DetectHttpServerBodyTest13(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6689,12 +6507,10 @@ static int DetectHttpServerBodyTest14(void) SCLogDebug("add chunk 1"); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -6703,10 +6519,8 @@ static int DetectHttpServerBodyTest14(void) r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SCLogDebug("inspect chunk 1"); @@ -6720,11 +6534,9 @@ static int DetectHttpServerBodyTest14(void) SCLogDebug("add chunk 3"); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -6734,10 +6546,8 @@ static int DetectHttpServerBodyTest14(void) NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SCLogDebug("inspect chunk 4"); @@ -6856,22 +6666,18 @@ static int DetectHttpServerBodyTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -6885,11 +6691,9 @@ static int DetectHttpServerBodyTest15(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -6897,10 +6701,8 @@ static int DetectHttpServerBodyTest15(void) NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -7763,13 +7565,11 @@ static int DetectHttpServerBodyFileDataTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -7778,10 +7578,8 @@ static int DetectHttpServerBodyFileDataTest02(void) if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7797,15 +7595,12 @@ static int DetectHttpServerBodyFileDataTest02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7901,16 +7696,13 @@ static int DetectHttpServerBodyFileDataTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7919,16 +7711,13 @@ static int DetectHttpServerBodyFileDataTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -7938,16 +7727,13 @@ static int DetectHttpServerBodyFileDataTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ @@ -8048,16 +7834,13 @@ static int DetectHttpServerBodyFileDataTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8066,16 +7849,13 @@ static int DetectHttpServerBodyFileDataTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -8085,13 +7865,11 @@ static int DetectHttpServerBodyFileDataTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -8100,10 +7878,8 @@ static int DetectHttpServerBodyFileDataTest04(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -8203,16 +7979,13 @@ static int DetectHttpServerBodyFileDataTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8221,16 +7994,13 @@ static int DetectHttpServerBodyFileDataTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -8240,13 +8010,11 @@ static int DetectHttpServerBodyFileDataTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -8255,10 +8023,8 @@ static int DetectHttpServerBodyFileDataTest05(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -8354,16 +8120,13 @@ static int DetectHttpServerBodyFileDataTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8372,16 +8135,13 @@ static int DetectHttpServerBodyFileDataTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -8391,16 +8151,13 @@ static int DetectHttpServerBodyFileDataTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -8496,16 +8253,13 @@ static int DetectHttpServerBodyFileDataTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8514,16 +8268,13 @@ static int DetectHttpServerBodyFileDataTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -8533,16 +8284,13 @@ static int DetectHttpServerBodyFileDataTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -8626,13 +8374,11 @@ static int DetectHttpServerBodyFileDataTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START | STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, @@ -8640,10 +8386,8 @@ static int DetectHttpServerBodyFileDataTest08(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -8749,22 +8493,18 @@ static int DetectHttpServerBodyFileDataTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -8774,11 +8514,9 @@ static int DetectHttpServerBodyFileDataTest09(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -8786,10 +8524,8 @@ static int DetectHttpServerBodyFileDataTest09(void) NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -8906,22 +8642,18 @@ static int DetectHttpServerBodyFileDataTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -8931,11 +8663,9 @@ static int DetectHttpServerBodyFileDataTest10(void) } p->alerts.cnt = 0; - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } @@ -8943,10 +8673,8 @@ static int DetectHttpServerBodyFileDataTest10(void) NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/tests/detect-http-stat-code.c b/src/tests/detect-http-stat-code.c index 55585c83e0..a2c693fd9e 100644 --- a/src/tests/detect-http-stat-code.c +++ b/src/tests/detect-http-stat-code.c @@ -105,16 +105,13 @@ static int DetectEngineHttpStatCodeTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -131,16 +128,13 @@ static int DetectEngineHttpStatCodeTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -225,27 +219,21 @@ static int DetectEngineHttpStatCodeTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -345,16 +333,13 @@ static int DetectEngineHttpStatCodeTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -371,27 +356,21 @@ static int DetectEngineHttpStatCodeTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -482,16 +461,13 @@ static int DetectEngineHttpStatCodeTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -508,16 +484,13 @@ static int DetectEngineHttpStatCodeTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -608,16 +581,13 @@ static int DetectEngineHttpStatCodeTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -634,16 +604,13 @@ static int DetectEngineHttpStatCodeTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -734,16 +701,13 @@ static int DetectEngineHttpStatCodeTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -760,16 +724,13 @@ static int DetectEngineHttpStatCodeTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -860,16 +821,13 @@ static int DetectEngineHttpStatCodeTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -886,16 +844,13 @@ static int DetectEngineHttpStatCodeTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -986,16 +941,13 @@ static int DetectEngineHttpStatCodeTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1012,16 +964,13 @@ static int DetectEngineHttpStatCodeTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1113,16 +1062,13 @@ static int DetectEngineHttpStatCodeTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1139,16 +1085,13 @@ static int DetectEngineHttpStatCodeTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1240,16 +1183,13 @@ static int DetectEngineHttpStatCodeTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1266,16 +1206,13 @@ static int DetectEngineHttpStatCodeTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1367,16 +1304,13 @@ static int DetectEngineHttpStatCodeTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1393,16 +1327,13 @@ static int DetectEngineHttpStatCodeTest11(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1494,16 +1425,13 @@ static int DetectEngineHttpStatCodeTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1520,16 +1448,13 @@ static int DetectEngineHttpStatCodeTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1621,16 +1546,13 @@ static int DetectEngineHttpStatCodeTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1647,16 +1569,13 @@ static int DetectEngineHttpStatCodeTest13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1748,16 +1667,13 @@ static int DetectEngineHttpStatCodeTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1774,16 +1690,13 @@ static int DetectEngineHttpStatCodeTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1875,16 +1788,13 @@ static int DetectEngineHttpStatCodeTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1901,16 +1811,13 @@ static int DetectEngineHttpStatCodeTest15(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2094,22 +2001,18 @@ static int DetectHttpStatCodeSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2202,13 +2105,11 @@ static int DetectHttpStatCodeSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -2216,10 +2117,8 @@ static int DetectHttpStatCodeSigTest02(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2318,13 +2217,11 @@ static int DetectHttpStatCodeSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -2332,10 +2229,8 @@ static int DetectHttpStatCodeSigTest03(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2434,13 +2329,11 @@ static int DetectHttpStatCodeSigTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -2448,10 +2341,8 @@ static int DetectHttpStatCodeSigTest04(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect-http-stat-msg.c b/src/tests/detect-http-stat-msg.c index 9834368b88..6346a0276c 100644 --- a/src/tests/detect-http-stat-msg.c +++ b/src/tests/detect-http-stat-msg.c @@ -105,16 +105,13 @@ static int DetectEngineHttpStatMsgTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -131,16 +128,13 @@ static int DetectEngineHttpStatMsgTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -225,27 +219,21 @@ static int DetectEngineHttpStatMsgTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -345,16 +333,13 @@ static int DetectEngineHttpStatMsgTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -371,27 +356,21 @@ static int DetectEngineHttpStatMsgTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -482,16 +461,13 @@ static int DetectEngineHttpStatMsgTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -508,16 +484,13 @@ static int DetectEngineHttpStatMsgTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -608,16 +581,13 @@ static int DetectEngineHttpStatMsgTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -634,16 +604,13 @@ static int DetectEngineHttpStatMsgTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -734,16 +701,13 @@ static int DetectEngineHttpStatMsgTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -760,16 +724,13 @@ static int DetectEngineHttpStatMsgTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -860,16 +821,13 @@ static int DetectEngineHttpStatMsgTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -886,16 +844,13 @@ static int DetectEngineHttpStatMsgTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -986,16 +941,13 @@ static int DetectEngineHttpStatMsgTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1012,16 +964,13 @@ static int DetectEngineHttpStatMsgTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1113,16 +1062,13 @@ static int DetectEngineHttpStatMsgTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1139,16 +1085,13 @@ static int DetectEngineHttpStatMsgTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1240,16 +1183,13 @@ static int DetectEngineHttpStatMsgTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1266,16 +1206,13 @@ static int DetectEngineHttpStatMsgTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1367,16 +1304,13 @@ static int DetectEngineHttpStatMsgTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1393,16 +1327,13 @@ static int DetectEngineHttpStatMsgTest11(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1494,16 +1425,13 @@ static int DetectEngineHttpStatMsgTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1520,16 +1448,13 @@ static int DetectEngineHttpStatMsgTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1621,16 +1546,13 @@ static int DetectEngineHttpStatMsgTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1647,16 +1569,13 @@ static int DetectEngineHttpStatMsgTest13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1748,16 +1667,13 @@ static int DetectEngineHttpStatMsgTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1774,16 +1690,13 @@ static int DetectEngineHttpStatMsgTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1875,16 +1788,13 @@ static int DetectEngineHttpStatMsgTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1901,16 +1811,13 @@ static int DetectEngineHttpStatMsgTest15(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2092,13 +1999,11 @@ static int DetectHttpStatMsgSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -2106,10 +2011,8 @@ static int DetectHttpStatMsgSigTest01(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2200,13 +2103,11 @@ static int DetectHttpStatMsgSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -2214,10 +2115,8 @@ static int DetectHttpStatMsgSigTest02(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2312,13 +2211,11 @@ static int DetectHttpStatMsgSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } @@ -2326,10 +2223,8 @@ static int DetectHttpStatMsgSigTest03(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect-http-uri.c b/src/tests/detect-http-uri.c index 76b117603a..b6a5ca9ede 100644 --- a/src/tests/detect-http-uri.c +++ b/src/tests/detect-http-uri.c @@ -89,15 +89,12 @@ static int UriTestSig01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -113,15 +110,12 @@ static int UriTestSig01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -211,15 +205,12 @@ static int UriTestSig02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -235,15 +226,12 @@ static int UriTestSig02(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -333,15 +321,12 @@ static int UriTestSig03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -357,15 +342,12 @@ static int UriTestSig03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -455,15 +437,12 @@ static int UriTestSig04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -479,15 +458,12 @@ static int UriTestSig04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -577,15 +553,12 @@ static int UriTestSig05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -601,15 +574,12 @@ static int UriTestSig05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -699,15 +669,12 @@ static int UriTestSig06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -723,15 +690,12 @@ static int UriTestSig06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -821,15 +785,12 @@ static int UriTestSig07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -845,15 +806,12 @@ static int UriTestSig07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -943,15 +901,12 @@ static int UriTestSig08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -967,15 +922,12 @@ static int UriTestSig08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1065,15 +1017,12 @@ static int UriTestSig09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1089,15 +1038,12 @@ static int UriTestSig09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1188,15 +1134,12 @@ static int UriTestSig12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1212,15 +1155,12 @@ static int UriTestSig12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1310,15 +1250,12 @@ static int UriTestSig13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1334,15 +1271,12 @@ static int UriTestSig13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1433,15 +1367,12 @@ static int UriTestSig14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1457,15 +1388,12 @@ static int UriTestSig14(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1556,15 +1484,12 @@ static int UriTestSig15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1580,15 +1505,12 @@ static int UriTestSig15(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1765,15 +1687,12 @@ static int UriTestSig17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1861,15 +1780,12 @@ static int UriTestSig18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1958,15 +1874,12 @@ static int UriTestSig19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2054,15 +1967,12 @@ static int UriTestSig20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2149,15 +2059,12 @@ static int UriTestSig21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2244,15 +2151,12 @@ static int UriTestSig22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2338,15 +2242,12 @@ static int UriTestSig23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2432,15 +2333,12 @@ static int UriTestSig24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2526,15 +2424,12 @@ static int UriTestSig25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2620,15 +2515,12 @@ static int UriTestSig26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2714,15 +2606,12 @@ static int UriTestSig27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2842,15 +2731,12 @@ static int UriTestSig28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2935,15 +2821,12 @@ static int UriTestSig29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3028,15 +2911,12 @@ static int UriTestSig30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3121,15 +3001,12 @@ static int UriTestSig31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3214,15 +3091,12 @@ static int UriTestSig32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3305,15 +3179,12 @@ static int UriTestSig33(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3396,15 +3267,12 @@ static int UriTestSig34(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3487,15 +3355,12 @@ static int UriTestSig35(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3578,15 +3443,12 @@ static int UriTestSig36(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3669,15 +3531,12 @@ static int UriTestSig37(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3760,15 +3619,12 @@ static int UriTestSig38(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4739,16 +4595,13 @@ static int DetectEngineHttpRawUriTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4765,16 +4618,13 @@ static int DetectEngineHttpRawUriTest01(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -4865,16 +4715,13 @@ static int DetectEngineHttpRawUriTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4976,16 +4823,13 @@ static int DetectEngineHttpRawUriTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5002,16 +4846,13 @@ static int DetectEngineHttpRawUriTest03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5106,16 +4947,13 @@ static int DetectEngineHttpRawUriTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5132,16 +4970,13 @@ static int DetectEngineHttpRawUriTest04(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5235,16 +5070,13 @@ static int DetectEngineHttpRawUriTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5261,16 +5093,13 @@ static int DetectEngineHttpRawUriTest05(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5364,16 +5193,13 @@ static int DetectEngineHttpRawUriTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5390,16 +5216,13 @@ static int DetectEngineHttpRawUriTest06(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5493,16 +5316,13 @@ static int DetectEngineHttpRawUriTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5519,16 +5339,13 @@ static int DetectEngineHttpRawUriTest07(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5622,16 +5439,13 @@ static int DetectEngineHttpRawUriTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5648,16 +5462,13 @@ static int DetectEngineHttpRawUriTest08(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5752,16 +5563,13 @@ static int DetectEngineHttpRawUriTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5778,16 +5586,13 @@ static int DetectEngineHttpRawUriTest09(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -5882,16 +5687,13 @@ static int DetectEngineHttpRawUriTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -5908,16 +5710,13 @@ static int DetectEngineHttpRawUriTest10(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6012,16 +5811,13 @@ static int DetectEngineHttpRawUriTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6038,16 +5834,13 @@ static int DetectEngineHttpRawUriTest11(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6142,16 +5935,13 @@ static int DetectEngineHttpRawUriTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6168,16 +5958,13 @@ static int DetectEngineHttpRawUriTest12(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6272,16 +6059,13 @@ static int DetectEngineHttpRawUriTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6298,16 +6082,13 @@ static int DetectEngineHttpRawUriTest13(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6402,16 +6183,13 @@ static int DetectEngineHttpRawUriTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6428,16 +6206,13 @@ static int DetectEngineHttpRawUriTest14(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6532,16 +6307,13 @@ static int DetectEngineHttpRawUriTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6558,16 +6330,13 @@ static int DetectEngineHttpRawUriTest15(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6662,16 +6431,13 @@ static int DetectEngineHttpRawUriTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6688,16 +6454,13 @@ static int DetectEngineHttpRawUriTest16(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6792,16 +6555,13 @@ static int DetectEngineHttpRawUriTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6818,16 +6578,13 @@ static int DetectEngineHttpRawUriTest21(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -6922,16 +6679,13 @@ static int DetectEngineHttpRawUriTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -6948,16 +6702,13 @@ static int DetectEngineHttpRawUriTest22(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7052,16 +6803,13 @@ static int DetectEngineHttpRawUriTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7078,16 +6826,13 @@ static int DetectEngineHttpRawUriTest23(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7182,16 +6927,13 @@ static int DetectEngineHttpRawUriTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7208,16 +6950,13 @@ static int DetectEngineHttpRawUriTest24(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7312,16 +7051,13 @@ static int DetectEngineHttpRawUriTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7338,16 +7074,13 @@ static int DetectEngineHttpRawUriTest25(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7442,16 +7175,13 @@ static int DetectEngineHttpRawUriTest26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7468,16 +7198,13 @@ static int DetectEngineHttpRawUriTest26(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7572,16 +7299,13 @@ static int DetectEngineHttpRawUriTest27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7598,16 +7322,13 @@ static int DetectEngineHttpRawUriTest27(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7702,16 +7423,13 @@ static int DetectEngineHttpRawUriTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7728,16 +7446,13 @@ static int DetectEngineHttpRawUriTest28(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -7819,15 +7534,12 @@ static int DetectEngineHttpRawUriTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -7913,15 +7625,12 @@ static int DetectEngineHttpRawUriTest30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/tests/detect.c b/src/tests/detect.c index 167821bb14..3445459dfd 100644 --- a/src/tests/detect.c +++ b/src/tests/detect.c @@ -423,15 +423,12 @@ static int SigTest07 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -512,15 +509,12 @@ static int SigTest08 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -603,15 +597,12 @@ static int SigTest09 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -686,15 +677,12 @@ static int SigTest10 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -4531,15 +4519,12 @@ static int SigTestDropFlow02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4662,15 +4647,12 @@ static int SigTestDropFlow03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4708,15 +4690,12 @@ static int SigTestDropFlow03(void) goto end; } - FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse( NULL, alp_tctx, &f, ALPROTO_HTTP1, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - FLOWLOCK_UNLOCK(&f); goto end; } - FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2);