From 1ac6054c23347095e149be3a8b7ce2f98393641c Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 9 Jan 2012 08:44:53 +0100 Subject: [PATCH] Clean up configure check for htp_tx_get_response_headers_raw. Misc changes. --- configure.in | 6 ++---- src/detect-engine-hrhd.c | 8 ++++++-- src/suricata.c | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/configure.in b/configure.in index 3eed6d875c..d1c9ff34d5 100644 --- a/configure.in +++ b/configure.in @@ -845,10 +845,8 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) AC_CHECK_LIB([htp], [htp_config_register_request_uri_normalize],AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Found htp_config_register_request_uri_normalize function in libhtp]) ,,[-lhtp]) ]) - AC_CHECK_LIB([htp], [htp_tx_get_response_headers_raw],[libhtp_raw_response_header_buffer_support_enabled="yes"],[libhtp_raw_response_header_buffer_support_enabled="no"]) - if test "$libhtp_raw_response_header_buffer_support_enabled" = "yes"; then - CFLAGS="${CFLAGS} -D__LIBHTP_026GT_RESPONSE_HEADER_SUPPORT__" - fi + # check for htp_tx_get_response_headers_raw + AC_CHECK_LIB([htp], [htp_tx_get_response_headers_raw],AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Found htp_tx_get_response_headers_raw in libhtp]) ,,[-lhtp]) #even if we are using an installed htp lib we still need to gen Makefiles inside of htp AC_CONFIG_SUBDIRS([libhtp]) diff --git a/src/detect-engine-hrhd.c b/src/detect-engine-hrhd.c index 27e9ab1aeb..9051fd61c5 100644 --- a/src/detect-engine-hrhd.c +++ b/src/detect-engine-hrhd.c @@ -346,14 +346,14 @@ int DetectEngineRunHttpRawHeaderMpm(DetectEngineThreadCtx *det_ctx, Flow *f, (uint8_t *)bstr_ptr(raw_headers), bstr_len(raw_headers)); } -#ifdef __LIBHTP_026GT_RESPONSE_HEADER_SUPPORT__ +#ifdef HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW raw_headers = htp_tx_get_response_headers_raw(tx); if (raw_headers != NULL) { cnt += HttpRawHeaderPatternSearch(det_ctx, (uint8_t *)bstr_ptr(raw_headers), bstr_len(raw_headers)); } -#endif +#endif /* HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW */ } end: @@ -3013,6 +3013,7 @@ end: static int DetectEngineHttpRawHeaderTest28(void) { +#ifdef HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW TcpSession ssn; Packet *p1 = NULL; Packet *p2 = NULL; @@ -3128,6 +3129,9 @@ end: UTHFreePackets(&p1, 1); UTHFreePackets(&p2, 1); return result; +#else + return 1; +#endif } static int DetectEngineHttpRawHeaderTest29(void) diff --git a/src/suricata.c b/src/suricata.c index b3f58d97bf..789f82fa84 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -529,6 +529,9 @@ void SCPrintBuildInfo(void) { #ifdef HAVE_HTP_URI_NORMALIZE_HOOK strlcat(features, "HAVE_HTP_URI_NORMALIZE_HOOK ", sizeof(features)); #endif +#ifdef HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW + strlcat(features, "HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW ", sizeof(features)); +#endif #ifdef PCRE_HAVE_JIT strlcat(features, "PCRE_JIT ", sizeof(features)); #endif