Fix not using new htp callback when using the bundled htp. Add indication to --build-info. Fix valgrind warning in test and further improve test.

remotes/origin/master-1.1.x
Victor Julien 14 years ago
parent a3e2b35536
commit 36917c7d66

@ -734,10 +734,13 @@ 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])
]) ])
#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"])
AM_CONDITIONAL([HAVE_HTP_URI_NORMALIZE_HOOK], [test "x$enable_non_bundled_htp" = "xno"]) AS_IF([test "x$enable_non_bundled_htp" = "xno"], [
AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
])
# enable CUDA output # enable CUDA output
AC_ARG_ENABLE(cuda, AC_ARG_ENABLE(cuda,

@ -1697,7 +1697,7 @@ end:
/** \test /** \test
*/ */
int HTPParserTest07(void) { int HTPParserTest07(void) {
int result = 1; int result = 0;
Flow f; Flow f;
uint8_t httpbuf1[] = "GET /awstats.pl?/migratemigrate%20=%20| HTTP/1.0\r\n\r\n"; uint8_t httpbuf1[] = "GET /awstats.pl?/migratemigrate%20=%20| HTTP/1.0\r\n\r\n";
uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */ uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */
@ -1718,9 +1718,12 @@ int HTPParserTest07(void) {
for (u = 0; u < httplen1; u++) { for (u = 0; u < httplen1; u++) {
uint8_t flags = 0; uint8_t flags = 0;
if (u == 0) flags = STREAM_TOSERVER|STREAM_START; if (u == 0)
else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; flags = STREAM_TOSERVER|STREAM_START;
else flags = STREAM_TOSERVER; else if (u == (httplen1 - 1))
flags = STREAM_TOSERVER|STREAM_EOF;
else
flags = STREAM_TOSERVER;
r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1);
if (r != 0) { if (r != 0) {
@ -1738,11 +1741,23 @@ int HTPParserTest07(void) {
goto end; goto end;
} }
uint8_t ref[] = "/awstats.pl?/migratemigrate = |";
size_t reflen = sizeof(ref) - 1;
htp_tx_t *tx = list_get(htp_state->connp->conn->transactions, 0); htp_tx_t *tx = list_get(htp_state->connp->conn->transactions, 0);
if (tx != NULL && tx->request_uri_normalized != NULL) { if (tx != NULL && tx->request_uri_normalized != NULL) {
printf("bstr_ptr(tx->request_uri_normalized) %s", bstr_ptr(tx->request_uri_normalized)); if (reflen != bstr_size(tx->request_uri_normalized)) {
goto end;
}
if (memcmp(bstr_ptr(tx->request_uri_normalized), ref,
bstr_size(tx->request_uri_normalized)) != 0)
{
goto end;
}
} }
result = 1;
end: end:
FlowL7DataPtrFree(&f); FlowL7DataPtrFree(&f);
StreamTcpFreeConfig(TRUE); StreamTcpFreeConfig(TRUE);

@ -428,6 +428,9 @@ void SCPrintBuildInfo(void) {
#endif #endif
#ifdef HAVE_LIBNET11 #ifdef HAVE_LIBNET11
strlcat(features, "LIBNET1.1 ", sizeof(features)); strlcat(features, "LIBNET1.1 ", sizeof(features));
#endif
#ifdef HAVE_HTP_URI_NORMALIZE_HOOK
strlcat(features, "HAVE_HTP_URI_NORMALIZE_HOOK ", sizeof(features));
#endif #endif
if (strlen(features) == 0) { if (strlen(features) == 0) {
strlcat(features, "none", sizeof(features)); strlcat(features, "none", sizeof(features));

Loading…
Cancel
Save