Skip to content

Commit a447c92

Browse files
committed
applayer: remove complex unittest
as it is now covered by the suricata-verify test dcerpc-request-http-response.
1 parent 8f400c6 commit a447c92

File tree

1 file changed

+0
-120
lines changed

1 file changed

+0
-120
lines changed

src/app-layer.c

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,125 +2356,6 @@ static int AppLayerTest07(void)
23562356
PASS;
23572357
}
23582358

2359-
/**
2360-
* \test SMB -> HTTP/1.1
2361-
*/
2362-
static int AppLayerTest08(void)
2363-
{
2364-
TEST_START;
2365-
2366-
/* full request */
2367-
uint8_t request[] = { 0x05, 0x00, 0x54, 0x20, 0x00, 0x01, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68,
2368-
0x74, 0x6d, 0x6c, 0x20, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x0d, 0x0a, 0x48,
2369-
0x6f, 0x73, 0x74, 0x3a, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x0d,
2370-
0x0a, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x41, 0x70,
2371-
0x61, 0x63, 0x68, 0x65, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x2f, 0x32, 0x2e, 0x33, 0x0d, 0x0a,
2372-
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a, 0x0d, 0x0a };
2373-
tcph.th_ack = htonl(1);
2374-
tcph.th_seq = htonl(1);
2375-
tcph.th_flags = TH_PUSH | TH_ACK;
2376-
p->flowflags = FLOW_PKT_TOSERVER;
2377-
p->payload_len = sizeof(request);
2378-
p->payload = request;
2379-
FAIL_IF(StreamTcpPacket(&tv, p, stt, &pq) == -1);
2380-
FAIL_IF(StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(&ssn->server));
2381-
FAIL_IF(StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(&ssn->client));
2382-
FAIL_IF(f.alproto != ALPROTO_UNKNOWN);
2383-
FAIL_IF(f.alproto_ts != ALPROTO_UNKNOWN);
2384-
FAIL_IF(f.alproto_tc != ALPROTO_UNKNOWN);
2385-
FAIL_IF(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED);
2386-
FAIL_IF(FLOW_IS_PM_DONE(&f, STREAM_TOSERVER));
2387-
FAIL_IF(FLOW_IS_PP_DONE(&f, STREAM_TOSERVER));
2388-
FAIL_IF(FLOW_IS_PM_DONE(&f, STREAM_TOCLIENT));
2389-
FAIL_IF(FLOW_IS_PP_DONE(&f, STREAM_TOCLIENT));
2390-
FAIL_IF(ssn->data_first_seen_dir != STREAM_TOSERVER);
2391-
2392-
/* full response - request ack */
2393-
uint8_t response[] = {
2394-
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31,
2395-
0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0x0d,
2396-
0x0a, 0x44, 0x61, 0x74, 0x65, 0x3a, 0x20, 0x46,
2397-
0x72, 0x69, 0x2c, 0x20, 0x32, 0x33, 0x20, 0x53,
2398-
0x65, 0x70, 0x20, 0x32, 0x30, 0x31, 0x31, 0x20,
2399-
0x30, 0x36, 0x3a, 0x32, 0x39, 0x3a, 0x33, 0x39,
2400-
0x20, 0x47, 0x4d, 0x54, 0x0d, 0x0a, 0x53, 0x65,
2401-
0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x41, 0x70,
2402-
0x61, 0x63, 0x68, 0x65, 0x2f, 0x32, 0x2e, 0x32,
2403-
0x2e, 0x31, 0x35, 0x20, 0x28, 0x55, 0x6e, 0x69,
2404-
0x78, 0x29, 0x20, 0x44, 0x41, 0x56, 0x2f, 0x32,
2405-
0x0d, 0x0a, 0x4c, 0x61, 0x73, 0x74, 0x2d, 0x4d,
2406-
0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x3a,
2407-
0x20, 0x54, 0x68, 0x75, 0x2c, 0x20, 0x30, 0x34,
2408-
0x20, 0x4e, 0x6f, 0x76, 0x20, 0x32, 0x30, 0x31,
2409-
0x30, 0x20, 0x31, 0x35, 0x3a, 0x30, 0x34, 0x3a,
2410-
0x34, 0x36, 0x20, 0x47, 0x4d, 0x54, 0x0d, 0x0a,
2411-
0x45, 0x54, 0x61, 0x67, 0x3a, 0x20, 0x22, 0x61,
2412-
0x62, 0x38, 0x39, 0x36, 0x35, 0x2d, 0x32, 0x63,
2413-
0x2d, 0x34, 0x39, 0x34, 0x33, 0x62, 0x37, 0x61,
2414-
0x37, 0x66, 0x37, 0x66, 0x38, 0x30, 0x22, 0x0d,
2415-
0x0a, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d,
2416-
0x52, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x3a, 0x20,
2417-
0x62, 0x79, 0x74, 0x65, 0x73, 0x0d, 0x0a, 0x43,
2418-
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x4c,
2419-
0x65, 0x6e, 0x67, 0x74, 0x68, 0x3a, 0x20, 0x34,
2420-
0x34, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
2421-
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63,
2422-
0x6c, 0x6f, 0x73, 0x65, 0x0d, 0x0a, 0x43, 0x6f,
2423-
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79,
2424-
0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74,
2425-
0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x0d, 0x0a, 0x58,
2426-
0x2d, 0x50, 0x61, 0x64, 0x3a, 0x20, 0x61, 0x76,
2427-
0x6f, 0x69, 0x64, 0x20, 0x62, 0x72, 0x6f, 0x77,
2428-
0x73, 0x65, 0x72, 0x20, 0x62, 0x75, 0x67, 0x0d,
2429-
0x0a, 0x0d, 0x0a, 0x3c, 0x68, 0x74, 0x6d, 0x6c,
2430-
0x3e, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c,
2431-
0x68, 0x31, 0x3e, 0x49, 0x74, 0x20, 0x77, 0x6f,
2432-
0x72, 0x6b, 0x73, 0x21, 0x3c, 0x2f, 0x68, 0x31,
2433-
0x3e, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e,
2434-
0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e };
2435-
tcph.th_ack = htonl(88);
2436-
tcph.th_seq = htonl(1);
2437-
tcph.th_flags = TH_PUSH | TH_ACK;
2438-
p->flowflags = FLOW_PKT_TOCLIENT;
2439-
p->payload_len = sizeof(response);
2440-
p->payload = response;
2441-
FAIL_IF(StreamTcpPacket(&tv, p, stt, &pq) == -1);
2442-
FAIL_IF(StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(&ssn->server));
2443-
FAIL_IF(!StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(&ssn->client));
2444-
FAIL_IF(f.alproto != ALPROTO_DCERPC);
2445-
FAIL_IF(f.alproto_ts != ALPROTO_DCERPC);
2446-
FAIL_IF(f.alproto_tc != ALPROTO_UNKNOWN);
2447-
FAIL_IF(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED);
2448-
FAIL_IF(!FLOW_IS_PM_DONE(&f, STREAM_TOSERVER));
2449-
FAIL_IF(FLOW_IS_PP_DONE(&f, STREAM_TOSERVER));
2450-
FAIL_IF(FLOW_IS_PM_DONE(&f, STREAM_TOCLIENT));
2451-
FAIL_IF(FLOW_IS_PP_DONE(&f, STREAM_TOCLIENT));
2452-
FAIL_IF(ssn->data_first_seen_dir != APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER);
2453-
2454-
/* response ack */
2455-
tcph.th_ack = htonl(328);
2456-
tcph.th_seq = htonl(88);
2457-
tcph.th_flags = TH_ACK;
2458-
p->flowflags = FLOW_PKT_TOSERVER;
2459-
p->payload_len = 0;
2460-
p->payload = NULL;
2461-
FAIL_IF(StreamTcpPacket(&tv, p, stt, &pq) == -1);
2462-
FAIL_IF(!StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(&ssn->server));
2463-
FAIL_IF(!StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(&ssn->client));
2464-
FAIL_IF(f.alproto != ALPROTO_DCERPC);
2465-
FAIL_IF(f.alproto_ts != ALPROTO_DCERPC);
2466-
FAIL_IF(f.alproto_tc != ALPROTO_HTTP1);
2467-
FAIL_IF(!(ssn->flags & STREAMTCP_FLAG_APP_LAYER_DISABLED));
2468-
FAIL_IF(!FLOW_IS_PM_DONE(&f, STREAM_TOSERVER));
2469-
FAIL_IF(FLOW_IS_PP_DONE(&f, STREAM_TOSERVER));
2470-
FAIL_IF(!FLOW_IS_PM_DONE(&f, STREAM_TOCLIENT));
2471-
FAIL_IF(FLOW_IS_PP_DONE(&f, STREAM_TOCLIENT));
2472-
FAIL_IF(ssn->data_first_seen_dir != APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER);
2473-
2474-
TEST_END;
2475-
PASS;
2476-
}
2477-
24782359
/**
24792360
* \test RUBBISH(TC - PM and PP NOT DONE) ->
24802361
* RUBBISH(TC - PM and PP DONE) ->
@@ -2961,7 +2842,6 @@ void AppLayerUnittestsRegister(void)
29612842
UtRegisterTest("AppLayerTest05", AppLayerTest05);
29622843
UtRegisterTest("AppLayerTest06", AppLayerTest06);
29632844
UtRegisterTest("AppLayerTest07", AppLayerTest07);
2964-
UtRegisterTest("AppLayerTest08", AppLayerTest08);
29652845
UtRegisterTest("AppLayerTest09", AppLayerTest09);
29662846
UtRegisterTest("AppLayerTest10", AppLayerTest10);
29672847
UtRegisterTest("AppLayerTest11", AppLayerTest11);

0 commit comments

Comments
 (0)