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

@ -737,7 +737,10 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)])
#even if we are using an installed htp lib we still need to gen Makefiles inside of htp
AC_CONFIG_SUBDIRS([libhtp])
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
AC_ARG_ENABLE(cuda,

@ -1697,7 +1697,7 @@ end:
/** \test
*/
int HTPParserTest07(void) {
int result = 1;
int result = 0;
Flow f;
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 */
@ -1718,9 +1718,12 @@ int HTPParserTest07(void) {
for (u = 0; u < httplen1; u++) {
uint8_t flags = 0;
if (u == 0) flags = STREAM_TOSERVER|STREAM_START;
else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF;
else flags = STREAM_TOSERVER;
if (u == 0)
flags = STREAM_TOSERVER|STREAM_START;
else if (u == (httplen1 - 1))
flags = STREAM_TOSERVER|STREAM_EOF;
else
flags = STREAM_TOSERVER;
r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1);
if (r != 0) {
@ -1738,11 +1741,23 @@ int HTPParserTest07(void) {
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);
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:
FlowL7DataPtrFree(&f);
StreamTcpFreeConfig(TRUE);

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

Loading…
Cancel
Save