From: Victor Julien Date: Mon, 4 Sep 2017 19:03:56 +0000 (+0200) Subject: template: fix setup detect script X-Git-Tag: suricata-4.0.1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7783847467dee6c0a8bb34d555fac2cbac5141d4;p=thirdparty%2Fsuricata.git template: fix setup detect script --- diff --git a/scripts/setup-app-layer-detect.sh b/scripts/setup-app-layer-detect.sh index 8127370962..c420e7086b 100755 --- a/scripts/setup-app-layer-detect.sh +++ b/scripts/setup-app-layer-detect.sh @@ -7,15 +7,16 @@ set -e function usage() { cat < +usage: $0 This script will provision content inspection for app-layer decoded buffers. Examples: - $0 DNP3 - $0 Gopher + $0 Gopher Buffer + $0 DNP3 Buffer + $0 Http Etag EOF } @@ -35,110 +36,33 @@ function copy_template_file() { echo "Creating ${dst}." sed -e '/TEMPLATE_START_REMOVE/,/TEMPLATE_END_REMOVE/d' \ + -e "s/TEMPLATE_BUFFER/${protoname_upper}_${buffername_upper}/g" \ -e "s/TEMPLATE/${protoname_upper}/g" \ + -e "s/template-buffer/${protoname_lower}-${buffername_lower}/g" \ -e "s/template/${protoname_lower}/g" \ + -e "s/TemplateBuffer/${protoname}${buffername}/g" \ -e "s/Template/${protoname}/g" \ > ${dst} < ${src} } function copy_templates() { - detect_h_dst="src/detect-${protoname_lower}-buffer.h" - detect_c_dst="src/detect-${protoname_lower}-buffer.c" - detect_engine_h_dst="src/detect-engine-${protoname_lower}.h" - detect_engine_c_dst="src/detect-engine-${protoname_lower}.c" + detect_h_dst="src/detect-${protoname_lower}-${buffername_lower}.h" + detect_c_dst="src/detect-${protoname_lower}-${buffername_lower}.c" fail_if_exists ${detect_h_dst} fail_if_exists ${detect_c_dst} - fail_if_exists ${detect_engine_h_dst} - fail_if_exists ${detect_engine_c_dst} copy_template_file "src/detect-template-buffer.h" ${detect_h_dst} copy_template_file "src/detect-template-buffer.c" ${detect_c_dst} - copy_template_file "src/detect-engine-template.h" ${detect_engine_h_dst} - copy_template_file "src/detect-engine-template.c" ${detect_engine_c_dst} } function patch_makefile_am() { filename="src/Makefile.am" echo "Patching ${filename}." ed -s ${filename} > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null <