~ubuntu-branches/ubuntu/raring/suricata/raring

« back to all changes in this revision

Viewing changes to src/detect-http-method.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2012-12-14 00:02:51 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20121214000251-3326bvmr1x6ofsy5
Tags: 1.4-1
* Imported Upstream version 1.4
* Enable Jansson and LuaJIT support, and add libjansson-dev libluajit-5.1-dev
  to build-deps
* Add python to recommends, for the suricatasc script
* Create /var/run/suricata directory when starting daemon

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
#include "app-layer.h"
56
56
 
57
 
#include <htp/htp.h>
58
57
#include "app-layer-htp.h"
59
58
#include "detect-http-method.h"
60
59
#include "stream-tcp.h"
69
68
 */
70
69
void DetectHttpMethodRegister(void) {
71
70
    sigmatch_table[DETECT_AL_HTTP_METHOD].name = "http_method";
 
71
    sigmatch_table[DETECT_AL_HTTP_METHOD].desc = "content modifier to match only on the HTTP method-buffer";
 
72
    sigmatch_table[DETECT_AL_HTTP_METHOD].url = "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/HTTP-keywords#http_method";
72
73
    sigmatch_table[DETECT_AL_HTTP_METHOD].Match = NULL;
73
74
    sigmatch_table[DETECT_AL_HTTP_METHOD].AppLayerMatch = NULL;
74
75
    sigmatch_table[DETECT_AL_HTTP_METHOD].alproto = ALPROTO_HTTP;
103
104
 
104
105
    if (s->sm_lists_tail[DETECT_SM_LIST_PMATCH] == NULL) {
105
106
        SCLogError(SC_ERR_HTTP_METHOD_NEEDS_PRECEEDING_CONTENT, "http_method "
106
 
                "modifies preceeding \"content\", but none was found");
 
107
                "modifies preceding \"content\", but none was found");
107
108
        SCReturnInt(-1);
108
109
    }
109
110
 
111
112
                                               DETECT_CONTENT, s->sm_lists_tail[DETECT_SM_LIST_PMATCH]);
112
113
    if (sm == NULL) {
113
114
        SCLogError(SC_ERR_HTTP_METHOD_NEEDS_PRECEEDING_CONTENT, "http_method "
114
 
                "modifies preceeding \"content\", but none was found");
 
115
                "modifies preceding \"content\", but none was found");
115
116
        SCReturnInt(-1);
116
117
    }
117
118
 
129
130
        goto error;
130
131
    }
131
132
 
132
 
    if (cd->flags & DETECT_CONTENT_WITHIN || cd->flags & DETECT_CONTENT_DISTANCE) {
 
133
    if ((cd->flags & DETECT_CONTENT_WITHIN) || (cd->flags & DETECT_CONTENT_DISTANCE)) {
133
134
        SigMatch *pm =  SigMatchGetLastSMFromLists(s, 4,
134
135
                                                   DETECT_CONTENT, sm->prev,
135
136
                                                   DETECT_PCRE, sm->prev);
152
153
                                        s->sm_lists_tail[DETECT_SM_LIST_HMDMATCH]);
153
154
        if (pm == NULL) {
154
155
            SCLogError(SC_ERR_HTTP_METHOD_RELATIVE_MISSING, "http_method with "
155
 
                    "a distance or within requires preceeding http_method "
 
156
                    "a distance or within requires preceding http_method "
156
157
                    "content, but none was found");
157
158
            goto error;
158
159
        }