From: maxtors Date: Fri, 17 Apr 2015 08:37:21 +0000 (+0200) Subject: Added new WebDAV http methods. X-Git-Tag: suricata-2.1beta4~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7658fd4f474323df7451cb6dfb516342aa0ae48;p=thirdparty%2Fsuricata.git Added new WebDAV http methods. Added more WebDAV functions. A complete list of what http methods libhtp can handle can be found at: https://github.com/OISF/libhtp/blob/0.5.x/htp/htp_core.h#L260. So now the methods array reflects these available functions. The comments have also been changed to reflect the desired style. --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index af313587bb..1c1380bb12 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -2658,7 +2658,9 @@ static int HTPRegisterPatternsForProtocolDetection(void) { char *methods[] = { "GET", "PUT", "POST", "HEAD", "TRACE", "OPTIONS", "CONNECT", "DELETE", "PATCH", "PROPFIND", "PROPPATCH", "MKCOL", - "COPY", "MOVE", "LOCK", "UNLOCK", NULL}; + "COPY", "MOVE", "LOCK", "UNLOCK", "CHECKOUT", "UNCHECKOUT", "CHECKIN", + "UPDATE", "LABEL", "REPORT", "MKWORKSPACE", "MKACTIVITY", "MERGE", + "INVALID", "VERSION-CONTROL", "BASELINE-CONTROL", NULL}; char *spacings[] = { "|20|", "|09|", NULL }; char *versions[] = { "HTTP/0.9", "HTTP/1.0", "HTTP/1.1", NULL }; @@ -2668,16 +2670,17 @@ static int HTPRegisterPatternsForProtocolDetection(void) int register_result; char method_buffer[32] = ""; - // Loop through all the methods ands spacings and register the patterns + /* Loop through all the methods ands spacings and register the patterns */ for (methods_pos = 0; methods[methods_pos]; methods_pos++) { for (spacings_pos = 0; spacings[spacings_pos]; spacings_pos++) { - // Combine the method name and the spacing + /* Combine the method name and the spacing */ snprintf(method_buffer, sizeof(method_buffer), "%s%s", methods[methods_pos], spacings[spacings_pos]); - // Register the new method+spacing pattern - // 3 is subtracted from the length since the spacing is hex typed as |xx| - // but the pattern matching should only be one char. + /* Register the new method+spacing pattern + * 3 is subtracted from the length since the spacing is hex typed as |xx| + * but the pattern matching should only be one char + */ register_result = AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, method_buffer, strlen(method_buffer)-3, 0, STREAM_TOSERVER); if (register_result < 0) { @@ -2686,7 +2689,7 @@ static int HTPRegisterPatternsForProtocolDetection(void) } } - // Loop through all the http verions patterns that are TO_CLIENT + /* Loop through all the http verions patterns that are TO_CLIENT */ for (versions_pos = 0; versions[versions_pos]; versions_pos++) { register_result = AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, versions[versions_pos], strlen(versions[versions_pos]),