Enable http raw response header inspection only if libhtp supports raw response header buffering which should be available post 0.2.6

remotes/origin/master-1.2.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent 9c4954ff42
commit 4acd5a04e6

@ -845,6 +845,11 @@ 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_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
#even if we are using an installed htp lib we still need to gen Makefiles inside of htp #even if we are using an installed htp lib we still need to gen Makefiles inside of htp
AC_CONFIG_SUBDIRS([libhtp]) AC_CONFIG_SUBDIRS([libhtp])
AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"]) AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"])

@ -346,12 +346,14 @@ int DetectEngineRunHttpRawHeaderMpm(DetectEngineThreadCtx *det_ctx, Flow *f,
(uint8_t *)bstr_ptr(raw_headers), (uint8_t *)bstr_ptr(raw_headers),
bstr_len(raw_headers)); bstr_len(raw_headers));
} }
#ifdef __LIBHTP_026GT_RESPONSE_HEADER_SUPPORT__
raw_headers = htp_tx_get_response_headers_raw(tx); raw_headers = htp_tx_get_response_headers_raw(tx);
if (raw_headers != NULL) { if (raw_headers != NULL) {
cnt += HttpRawHeaderPatternSearch(det_ctx, cnt += HttpRawHeaderPatternSearch(det_ctx,
(uint8_t *)bstr_ptr(raw_headers), (uint8_t *)bstr_ptr(raw_headers),
bstr_len(raw_headers)); bstr_len(raw_headers));
} }
#endif
} }
end: end:
@ -407,12 +409,15 @@ int DetectEngineInspectHttpRawHeader(DetectEngineCtx *de_ctx,
if (tx == NULL) if (tx == NULL)
continue; continue;
bstr *raw_headers; bstr *raw_headers = NULL;
if (flags & STREAM_TOSERVER) { if (flags & STREAM_TOSERVER) {
raw_headers = htp_tx_get_request_headers_raw(tx); raw_headers = htp_tx_get_request_headers_raw(tx);
} else { }
#ifdef __LIBHTP_026GT_RESPONSE_HEADER_SUPPORT__
else {
raw_headers = htp_tx_get_response_headers_raw(tx); raw_headers = htp_tx_get_response_headers_raw(tx);
} }
#endif
if (raw_headers == NULL) if (raw_headers == NULL)
continue; continue;

Loading…
Cancel
Save