From: Victor Julien Date: Fri, 9 Dec 2016 18:01:01 +0000 (+0100) Subject: detect-parse: content modifier cleanup X-Git-Tag: suricata-4.0.0-beta1~382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f77978ecafc512b3b2ce597a29f18f4383d7d5;p=thirdparty%2Fsuricata.git detect-parse: content modifier cleanup --- diff --git a/src/detect-http-client-body.c b/src/detect-http-client-body.c index 9e3d2cc7e9..9ec6be6d39 100644 --- a/src/detect-http-client-body.c +++ b/src/detect-http-client-body.c @@ -122,8 +122,7 @@ int DetectHttpClientBodySetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_CLIENT_BODY, g_http_client_body_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } /** diff --git a/src/detect-http-cookie.c b/src/detect-http-cookie.c index 56f38e7bf4..1cc61fe817 100644 --- a/src/detect-http-cookie.c +++ b/src/detect-http-cookie.c @@ -136,8 +136,7 @@ static int DetectHttpCookieSetup(DetectEngineCtx *de_ctx, Signature *s, char *st return DetectEngineContentModifierBufferSetup(de_ctx, s, str, DETECT_AL_HTTP_COOKIE, g_http_cookie_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpCookieSetupCallback(Signature *s) diff --git a/src/detect-http-header.c b/src/detect-http-header.c index af1524f834..55a248b142 100644 --- a/src/detect-http-header.c +++ b/src/detect-http-header.c @@ -140,8 +140,7 @@ int DetectHttpHeaderSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_HEADER, g_http_header_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpHeaderSetupCallback(Signature *s) diff --git a/src/detect-http-hh.c b/src/detect-http-hh.c index 1abaf8a8c2..5e51c7cba9 100644 --- a/src/detect-http-hh.c +++ b/src/detect-http-hh.c @@ -119,8 +119,7 @@ int DetectHttpHHSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_HOST, g_http_host_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpHostSetupCallback(Signature *s) diff --git a/src/detect-http-hrh.c b/src/detect-http-hrh.c index 7c9022e98d..439eaef785 100644 --- a/src/detect-http-hrh.c +++ b/src/detect-http-hrh.c @@ -115,8 +115,7 @@ int DetectHttpHRHSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_RAW_HOST, g_http_raw_host_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpHostRawSetupCallback(Signature *s) diff --git a/src/detect-http-method.c b/src/detect-http-method.c index af703c9a0f..3fa059cb77 100644 --- a/src/detect-http-method.c +++ b/src/detect-http-method.c @@ -119,8 +119,7 @@ static int DetectHttpMethodSetup(DetectEngineCtx *de_ctx, Signature *s, char *st return DetectEngineContentModifierBufferSetup(de_ctx, s, str, DETECT_AL_HTTP_METHOD, g_http_method_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } /** diff --git a/src/detect-http-raw-header.c b/src/detect-http-raw-header.c index e7c122bcd3..b1a03254d7 100644 --- a/src/detect-http-raw-header.c +++ b/src/detect-http-raw-header.c @@ -142,8 +142,7 @@ int DetectHttpRawHeaderSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_RAW_HEADER, g_http_raw_header_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static _Bool DetectHttpRawHeaderValidateCallback(const Signature *s) diff --git a/src/detect-http-raw-uri.c b/src/detect-http-raw-uri.c index 3079f2e878..29f2c69308 100644 --- a/src/detect-http-raw-uri.c +++ b/src/detect-http-raw-uri.c @@ -107,8 +107,7 @@ static int DetectHttpRawUriSetup(DetectEngineCtx *de_ctx, Signature *s, char *ar return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_RAW_URI, g_http_raw_uri_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpRawUriSetupCallback(Signature *s) diff --git a/src/detect-http-server-body.c b/src/detect-http-server-body.c index 9c40d480d2..b2157d8fef 100644 --- a/src/detect-http-server-body.c +++ b/src/detect-http-server-body.c @@ -103,7 +103,7 @@ int DetectHttpServerBodySetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_SERVER_BODY, g_file_data_buffer_id, - ALPROTO_HTTP, NULL); + ALPROTO_HTTP); } /** diff --git a/src/detect-http-stat-code.c b/src/detect-http-stat-code.c index 2749584bb8..8a3b4d4b6e 100644 --- a/src/detect-http-stat-code.c +++ b/src/detect-http-stat-code.c @@ -117,8 +117,7 @@ static int DetectHttpStatCodeSetup(DetectEngineCtx *de_ctx, Signature *s, char * return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_STAT_CODE, g_http_stat_code_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpStatCodeSetupCallback(Signature *s) diff --git a/src/detect-http-stat-msg.c b/src/detect-http-stat-msg.c index c61c665923..d3a916c2b7 100644 --- a/src/detect-http-stat-msg.c +++ b/src/detect-http-stat-msg.c @@ -117,8 +117,7 @@ static int DetectHttpStatMsgSetup(DetectEngineCtx *de_ctx, Signature *s, char *a return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_STAT_MSG, g_http_stat_msg_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpStatMsgSetupCallback(Signature *s) diff --git a/src/detect-http-ua.c b/src/detect-http-ua.c index 625d287550..5e0824dab7 100644 --- a/src/detect-http-ua.c +++ b/src/detect-http-ua.c @@ -116,8 +116,7 @@ int DetectHttpUASetup(DetectEngineCtx *de_ctx, Signature *s, char *arg) return DetectEngineContentModifierBufferSetup(de_ctx, s, arg, DETECT_AL_HTTP_USER_AGENT, g_http_ua_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpUASetupCallback(Signature *s) diff --git a/src/detect-http-uri.c b/src/detect-http-uri.c index 1d6b102785..45acf4a7db 100644 --- a/src/detect-http-uri.c +++ b/src/detect-http-uri.c @@ -110,8 +110,7 @@ int DetectHttpUriSetup(DetectEngineCtx *de_ctx, Signature *s, char *str) return DetectEngineContentModifierBufferSetup(de_ctx, s, str, DETECT_AL_HTTP_URI, g_http_uri_buffer_id, - ALPROTO_HTTP, - NULL); + ALPROTO_HTTP); } static void DetectHttpUriSetupCallback(Signature *s) diff --git a/src/detect-parse.c b/src/detect-parse.c index 5b8b939379..1886ee9081 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -194,10 +194,10 @@ const char *DetectListToString(int list) return "unknown"; } +/** \param arg NULL or empty string */ int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, - Signature *s, const char *arg, - int sm_type, int sm_list, - AppProto alproto, void (*CustomCallback)(Signature *s)) + Signature *s, const char *arg, int sm_type, int sm_list, + AppProto alproto) { SigMatch *sm = NULL; int ret = -1; @@ -263,8 +263,6 @@ int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, } } } - if (CustomCallback != NULL) - CustomCallback(s); s->alproto = alproto; s->flags |= SIG_FLAG_APPLAYER; diff --git a/src/detect-parse.h b/src/detect-parse.h index 9dfe5ac219..15f5092266 100644 --- a/src/detect-parse.h +++ b/src/detect-parse.h @@ -57,9 +57,9 @@ int SigMatchListSMBelongsTo(const Signature *, const SigMatch *); int DetectParseDupSigHashInit(DetectEngineCtx *); void DetectParseDupSigHashFree(DetectEngineCtx *); -int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, - int sm_type, int sm_list, - AppProto alproto, void (*CustomCallback)(Signature *s)); +int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, + Signature *s, const char *arg, int sm_type, int sm_list, + AppProto alproto); const char *DetectListToHumanString(int list); const char *DetectListToString(int list);