mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-05 14:03:12 +03:00
Update master to 2.7.3
This commit is contained in:
@@ -73,7 +73,17 @@ standalone_la_LDFLAGS = -no-undefined -module -avoid-version \
|
||||
endif
|
||||
|
||||
install-exec-hook: $(pkglib_LTLIBRARIES)
|
||||
@echo "Removing unused static libraries..."; \
|
||||
@echo "Creating Nginx config file..."; \
|
||||
rm -f ../nginx/modsecurity/config; \
|
||||
echo "ngx_addon_name=ngx_http_modsecurity" >> ../nginx/modsecurity/config; \
|
||||
echo "# HTTP_MODULES=\"\$$HTTP_MODULES ngx_http_modsecurity\"" >> ../nginx/modsecurity/config; \
|
||||
echo "HTTP_HEADERS_FILTER_MODULE=\"ngx_http_modsecurity \$$HTTP_HEADERS_FILTER_MODULE\"" >> ../nginx/modsecurity/config; \
|
||||
echo "NGX_ADDON_SRCS=\"\$$NGX_ADDON_SRCS \$$ngx_addon_dir/ngx_http_modsecurity.c \$$ngx_addon_dir/apr_bucket_nginx.c\"" >> ../nginx/modsecurity/config;\
|
||||
echo "NGX_ADDON_DEPS=\"\$$NGX_ADDON_DEPS\"" >> ../nginx/modsecurity/config; \
|
||||
echo "CORE_LIBS=\"\$$CORE_LIBS \$$ngx_addon_dir/../../standalone/.libs/standalone.a -lapr-1 -laprutil-1 -lxml2 -lm @LUA_LDADD@\"" >> ../nginx/modsecurity/config; \
|
||||
echo "CORE_INCS=\"\$$CORE_INCS /usr/include/apache2 /usr/include/apr-1.0 /usr/include/httpd /usr/include/apr-1 \$$ngx_addon_dir \$$ngx_addon_dir/../../standalone \$$ngx_addon_dir/../../apache2 /usr/include/libxml2 `echo @LUA_CFLAGS@ | cut -d "I" -f3`\"" >> ../nginx/modsecurity/config; \
|
||||
echo "have=REQUEST_EARLY . auto/have" >> ../nginx/modsecurity/config;\
|
||||
echo "Removing unused static libraries..."; \
|
||||
for m in $(pkglib_LTLIBRARIES); do \
|
||||
base=`echo $$m | sed 's/\..*//'`; \
|
||||
rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \
|
||||
|
@@ -1,9 +1,9 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -16,6 +16,23 @@
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -73,6 +90,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(pkglibdir)"
|
||||
LTLIBRARIES = $(pkglib_LTLIBRARIES)
|
||||
standalone_la_DEPENDENCIES =
|
||||
@@ -112,6 +135,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(standalone_la_SOURCES)
|
||||
DIST_SOURCES = $(standalone_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -166,6 +194,7 @@ CURL_VERSION = @CURL_VERSION@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
@@ -200,6 +229,7 @@ LUA_CFLAGS = @LUA_CFLAGS@
|
||||
LUA_LDADD = @LUA_LDADD@
|
||||
LUA_LDFLAGS = @LUA_LDFLAGS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MODSEC_APXS_EXTRA_CFLAGS = @MODSEC_APXS_EXTRA_CFLAGS@
|
||||
MODSEC_EXTRA_CFLAGS = @MODSEC_EXTRA_CFLAGS@
|
||||
@@ -230,6 +260,7 @@ PCRE_CONFIG = @PCRE_CONFIG@
|
||||
PCRE_CPPFLAGS = @PCRE_CPPFLAGS@
|
||||
PCRE_LDADD = @PCRE_LDADD@
|
||||
PCRE_LDFLAGS = @PCRE_LDFLAGS@
|
||||
PCRE_LD_PATH = @PCRE_LD_PATH@
|
||||
PCRE_VERSION = @PCRE_VERSION@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
@@ -246,6 +277,7 @@ abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
@@ -278,7 +310,6 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -386,7 +417,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__aclocal_m4_deps):
|
||||
install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)"
|
||||
@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
@@ -394,6 +424,8 @@ install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
|
||||
}
|
||||
@@ -415,7 +447,7 @@ clean-pkglibLTLIBRARIES:
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
standalone.la: $(standalone_la_OBJECTS) $(standalone_la_DEPENDENCIES)
|
||||
standalone.la: $(standalone_la_OBJECTS) $(standalone_la_DEPENDENCIES) $(EXTRA_standalone_la_DEPENDENCIES)
|
||||
$(standalone_la_LINK) -rpath $(pkglibdir) $(standalone_la_OBJECTS) $(standalone_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
@@ -815,10 +847,15 @@ install-am: all-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
@@ -921,7 +958,17 @@ uninstall-am: uninstall-pkglibLTLIBRARIES
|
||||
|
||||
|
||||
install-exec-hook: $(pkglib_LTLIBRARIES)
|
||||
@echo "Removing unused static libraries..."; \
|
||||
@echo "Creating Nginx config file..."; \
|
||||
rm -f ../nginx/modsecurity/config; \
|
||||
echo "ngx_addon_name=ngx_http_modsecurity" >> ../nginx/modsecurity/config; \
|
||||
echo "# HTTP_MODULES=\"\$$HTTP_MODULES ngx_http_modsecurity\"" >> ../nginx/modsecurity/config; \
|
||||
echo "HTTP_HEADERS_FILTER_MODULE=\"ngx_http_modsecurity \$$HTTP_HEADERS_FILTER_MODULE\"" >> ../nginx/modsecurity/config; \
|
||||
echo "NGX_ADDON_SRCS=\"\$$NGX_ADDON_SRCS \$$ngx_addon_dir/ngx_http_modsecurity.c \$$ngx_addon_dir/apr_bucket_nginx.c\"" >> ../nginx/modsecurity/config;\
|
||||
echo "NGX_ADDON_DEPS=\"\$$NGX_ADDON_DEPS\"" >> ../nginx/modsecurity/config; \
|
||||
echo "CORE_LIBS=\"\$$CORE_LIBS \$$ngx_addon_dir/../../standalone/.libs/standalone.a -lapr-1 -laprutil-1 -lxml2 -lm @LUA_LDADD@\"" >> ../nginx/modsecurity/config; \
|
||||
echo "CORE_INCS=\"\$$CORE_INCS /usr/include/apache2 /usr/include/apr-1.0 /usr/include/httpd /usr/include/apr-1 \$$ngx_addon_dir \$$ngx_addon_dir/../../standalone \$$ngx_addon_dir/../../apache2 /usr/include/libxml2 `echo @LUA_CFLAGS@ | cut -d "I" -f3`\"" >> ../nginx/modsecurity/config; \
|
||||
echo "have=REQUEST_EARLY . auto/have" >> ../nginx/modsecurity/config;\
|
||||
echo "Removing unused static libraries..."; \
|
||||
for m in $(pkglib_LTLIBRARIES); do \
|
||||
base=`echo $$m | sed 's/\..*//'`; \
|
||||
rm -f $(DESTDIR)$(pkglibdir)/$$base.*a; \
|
||||
|
1240
standalone/api.c
1240
standalone/api.c
File diff suppressed because it is too large
Load Diff
@@ -60,12 +60,49 @@ conn_rec *modsecNewConnection();
|
||||
void modsecProcessConnection(conn_rec *c);
|
||||
|
||||
request_rec *modsecNewRequest(conn_rec *connection, directory_config *config);
|
||||
int modsecProcessRequest(request_rec *r);
|
||||
|
||||
int modsecProcessRequestBody(request_rec *r);
|
||||
int modsecProcessRequestHeaders(request_rec *r);
|
||||
|
||||
static inline int modsecProcessRequest(request_rec *r) {
|
||||
int status;
|
||||
status = modsecProcessRequestHeaders(r);
|
||||
if (status != DECLINED) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return modsecProcessRequestBody(r);
|
||||
}
|
||||
|
||||
|
||||
int modsecProcessResponse(request_rec *r);
|
||||
int modsecFinishRequest(request_rec *r);
|
||||
|
||||
void modsecSetLogHook(void *obj, void (*hook)(void *obj, int level, char *str));
|
||||
|
||||
#define NOTE_MSR_BRIGADE_REQUEST "modsecurity-brigade-request"
|
||||
#define NOTE_MSR_BRIGADE_RESPONSE "modsecurity-brigade-response"
|
||||
|
||||
static inline void
|
||||
modsecSetBodyBrigade(request_rec *r, apr_bucket_brigade *b) {
|
||||
apr_table_setn(r->notes, NOTE_MSR_BRIGADE_REQUEST, (char *)b);
|
||||
};
|
||||
|
||||
static inline apr_bucket_brigade *
|
||||
modsecGetBodyBrigade(request_rec *r) {
|
||||
return (apr_bucket_brigade *)apr_table_get(r->notes, NOTE_MSR_BRIGADE_REQUEST);
|
||||
};
|
||||
|
||||
static inline void
|
||||
modsecSetResponseBrigade(request_rec *r, apr_bucket_brigade *b) {
|
||||
apr_table_setn(r->notes, NOTE_MSR_BRIGADE_RESPONSE, (char *)b);
|
||||
};
|
||||
|
||||
static inline apr_bucket_brigade *
|
||||
modsecGetResponseBrigade(request_rec *r) {
|
||||
return (apr_bucket_brigade *)apr_table_get(r->notes, NOTE_MSR_BRIGADE_RESPONSE);
|
||||
};
|
||||
|
||||
void modsecSetReadBody(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos));
|
||||
void modsecSetReadResponse(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length, unsigned int *readcnt, int *is_eos));
|
||||
void modsecSetWriteBody(apr_status_t (*func)(request_rec *r, char *buf, unsigned int length));
|
||||
@@ -73,6 +110,7 @@ void modsecSetWriteResponse(apr_status_t (*func)(request_rec *r, char *buf, unsi
|
||||
void modsecSetDropAction(int (*func)(request_rec *r));
|
||||
|
||||
int modsecIsResponseBodyAccessEnabled(request_rec *r);
|
||||
int modsecIsRequestBodyAccessEnabled(request_rec *r);
|
||||
|
||||
void modsecSetConfigForIISRequestBody(request_rec *r);
|
||||
|
||||
|
@@ -1153,7 +1153,14 @@ ProcessInclude:
|
||||
|
||||
parms->directive = newdir;
|
||||
|
||||
errmsg = invoke_cmd(cmd, parms, mconfig, args);
|
||||
__try
|
||||
{
|
||||
errmsg = invoke_cmd(cmd, parms, mconfig, args);
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
errmsg = "Command failed to execute (check file/folder permissions, syntax, etc.).";
|
||||
}
|
||||
|
||||
if(errmsg != NULL)
|
||||
break;
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
|
||||
char *config_file = NULL;
|
||||
char *url_file = NULL;
|
||||
char *event_files[1024];
|
||||
int event_file_cnt;
|
||||
char *event_file = NULL;
|
||||
@@ -31,6 +32,11 @@ int event_file_blocks[256];
|
||||
|
||||
#define EVENT_FILE_MAX_SIZE (16*1024*1024)
|
||||
|
||||
#define MAX_URLS 4096
|
||||
|
||||
char urls[MAX_URLS][4096];
|
||||
int url_cnt = 0;
|
||||
|
||||
void readeventfile(char *name)
|
||||
{
|
||||
if(event_file == NULL)
|
||||
@@ -119,6 +125,12 @@ void parseargs(int argc, char *argv[])
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if(argv[i][1] == 'u' && i < argc - 1)
|
||||
{
|
||||
url_file = argv[i + 1];
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
@@ -224,7 +236,7 @@ void main(int argc, char *argv[])
|
||||
if(config_file == NULL || argc < 3)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf("standalone.exe -c <config_file> <event_file1> [<event_file2> <event_file3> ...]\n");
|
||||
printf("standalone.exe -c <config_file> [-u <text_file_with_urls>] <event_file1> [<event_file2> <event_file3> ...]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,133 +262,171 @@ void main(int argc, char *argv[])
|
||||
|
||||
modsecInitProcess();
|
||||
|
||||
if(url_file != NULL)
|
||||
{
|
||||
FILE *fr = fopen(url_file, "rb");
|
||||
int i = 0;
|
||||
|
||||
while(fgets(urls[i],4096,fr) != NULL)
|
||||
{
|
||||
urls[i][4095] = 0;
|
||||
|
||||
int l = strlen(urls[i]) - 1;
|
||||
|
||||
if(l < 8)
|
||||
continue;
|
||||
|
||||
while(urls[i][l] == 10 || urls[i][l] == 13)
|
||||
l--;
|
||||
|
||||
urls[i++][l + 1] = 0;
|
||||
}
|
||||
|
||||
url_cnt = i;
|
||||
fclose(fr);
|
||||
}
|
||||
|
||||
for(int i = 0; i < event_file_cnt; i++)
|
||||
{
|
||||
readeventfile(event_files[i]);
|
||||
parseeventfile();
|
||||
if(url_cnt == 0)
|
||||
{
|
||||
urls[0][0] = 0;
|
||||
url_cnt = 1;
|
||||
}
|
||||
|
||||
bodypos = 0;
|
||||
responsepos = 0;
|
||||
for(int ui = 0; ui < url_cnt; ui++)
|
||||
{
|
||||
readeventfile(event_files[i]);
|
||||
parseeventfile();
|
||||
|
||||
c = modsecNewConnection();
|
||||
bodypos = 0;
|
||||
responsepos = 0;
|
||||
|
||||
modsecProcessConnection(c);
|
||||
c = modsecNewConnection();
|
||||
|
||||
r = modsecNewRequest(c, config);
|
||||
modsecProcessConnection(c);
|
||||
|
||||
int j = event_file_blocks['B'];
|
||||
r = modsecNewRequest(c, config);
|
||||
|
||||
if(j < 0)
|
||||
continue;
|
||||
int j = event_file_blocks['B'];
|
||||
|
||||
j++;
|
||||
if(j < 0)
|
||||
continue;
|
||||
|
||||
if(event_file_lines[j][0] == 0)
|
||||
continue;
|
||||
j++;
|
||||
|
||||
char *method = event_file_lines[j];
|
||||
char *url = strchr(method, 32);
|
||||
char *proto = strchr(url + 1, 32);
|
||||
if(event_file_lines[j][0] == 0)
|
||||
continue;
|
||||
|
||||
if(url == NULL || proto == NULL)
|
||||
continue;
|
||||
char *method = event_file_lines[j];
|
||||
char *url = strchr(method, 32);
|
||||
char *proto = strchr(url + 1, 32);
|
||||
|
||||
*url++=0;
|
||||
*proto++=0;
|
||||
if(url == NULL || proto == NULL)
|
||||
continue;
|
||||
|
||||
*url++=0;
|
||||
*proto++=0;
|
||||
|
||||
if(urls[ui][0] != 0)
|
||||
{
|
||||
url = urls[ui];
|
||||
}
|
||||
|
||||
#define SETMETHOD(m) if(strcmp(method,#m) == 0){ r->method = method; r->method_number = M_##m; }
|
||||
|
||||
r->method = "INVALID";
|
||||
r->method_number = M_INVALID;
|
||||
r->method = "INVALID";
|
||||
r->method_number = M_INVALID;
|
||||
|
||||
SETMETHOD(OPTIONS)
|
||||
SETMETHOD(GET)
|
||||
SETMETHOD(POST)
|
||||
SETMETHOD(PUT)
|
||||
SETMETHOD(DELETE)
|
||||
SETMETHOD(TRACE)
|
||||
SETMETHOD(CONNECT)
|
||||
SETMETHOD(MOVE)
|
||||
SETMETHOD(COPY)
|
||||
SETMETHOD(PROPFIND)
|
||||
SETMETHOD(PROPPATCH)
|
||||
SETMETHOD(MKCOL)
|
||||
SETMETHOD(LOCK)
|
||||
SETMETHOD(UNLOCK)
|
||||
SETMETHOD(OPTIONS)
|
||||
SETMETHOD(GET)
|
||||
SETMETHOD(POST)
|
||||
SETMETHOD(PUT)
|
||||
SETMETHOD(DELETE)
|
||||
SETMETHOD(TRACE)
|
||||
SETMETHOD(CONNECT)
|
||||
SETMETHOD(MOVE)
|
||||
SETMETHOD(COPY)
|
||||
SETMETHOD(PROPFIND)
|
||||
SETMETHOD(PROPPATCH)
|
||||
SETMETHOD(MKCOL)
|
||||
SETMETHOD(LOCK)
|
||||
SETMETHOD(UNLOCK)
|
||||
|
||||
r->protocol = proto;
|
||||
r->protocol = proto;
|
||||
|
||||
while(event_file_lines[++j][0] != 0)
|
||||
{
|
||||
char *value = strchr(event_file_lines[j], ':');
|
||||
while(event_file_lines[++j][0] != 0)
|
||||
{
|
||||
char *value = strchr(event_file_lines[j], ':');
|
||||
|
||||
if(value == NULL)
|
||||
break;
|
||||
if(value == NULL)
|
||||
break;
|
||||
|
||||
*value++ = 0;
|
||||
*value++ = 0;
|
||||
|
||||
while(*value <=32 && *value != 0)
|
||||
value++;
|
||||
while(*value <=32 && *value != 0)
|
||||
value++;
|
||||
|
||||
apr_table_setn(r->headers_in, event_file_lines[j], value);
|
||||
}
|
||||
apr_table_setn(r->headers_in, event_file_lines[j], value);
|
||||
}
|
||||
|
||||
r->content_encoding = apr_table_get(r->headers_in, "Content-Encoding");
|
||||
r->content_type = apr_table_get(r->headers_in, "Content-Type");
|
||||
r->hostname = apr_table_get(r->headers_in, "Host");
|
||||
r->path_info = url;
|
||||
r->content_encoding = apr_table_get(r->headers_in, "Content-Encoding");
|
||||
r->content_type = apr_table_get(r->headers_in, "Content-Type");
|
||||
r->hostname = apr_table_get(r->headers_in, "Host");
|
||||
r->path_info = url;
|
||||
|
||||
char *query = strchr(url, '?');
|
||||
char *rawurl = url;
|
||||
char *query = strchr(url, '?');
|
||||
char *rawurl = url;
|
||||
|
||||
if(query != NULL)
|
||||
{
|
||||
rawurl = (char *)apr_palloc(r->pool, strlen(url) + 1);
|
||||
strcpy(rawurl, url);
|
||||
*query++ = 0;
|
||||
r->args = query;
|
||||
if(query != NULL)
|
||||
{
|
||||
rawurl = (char *)apr_palloc(r->pool, strlen(url) + 1);
|
||||
strcpy(rawurl, url);
|
||||
*query++ = 0;
|
||||
r->args = query;
|
||||
}
|
||||
|
||||
const char *lng = apr_table_get(r->headers_in, "Content-Languages");
|
||||
|
||||
if(lng != NULL)
|
||||
{
|
||||
r->content_languages = apr_array_make(r->pool, 1, sizeof(const char *));
|
||||
|
||||
*(const char **)apr_array_push(r->content_languages) = lng;
|
||||
}
|
||||
|
||||
r->request_time = apr_time_now();
|
||||
|
||||
r->parsed_uri.scheme = "http";
|
||||
r->parsed_uri.path = r->path_info;
|
||||
r->parsed_uri.hostname = (char *)r->hostname;
|
||||
r->parsed_uri.is_initialized = 1;
|
||||
r->parsed_uri.port = 80;
|
||||
r->parsed_uri.port_str = "80";
|
||||
r->parsed_uri.query = r->args;
|
||||
r->parsed_uri.dns_looked_up = 0;
|
||||
r->parsed_uri.dns_resolved = 0;
|
||||
r->parsed_uri.password = NULL;
|
||||
r->parsed_uri.user = NULL;
|
||||
r->parsed_uri.fragment = NULL;
|
||||
|
||||
r->unparsed_uri = rawurl;
|
||||
r->uri = r->unparsed_uri;
|
||||
|
||||
r->the_request = (char *)apr_palloc(r->pool, strlen(r->method) + 1 + strlen(r->uri) + 1 + strlen(r->protocol) + 1);
|
||||
|
||||
strcpy(r->the_request, r->method);
|
||||
strcat(r->the_request, " ");
|
||||
strcat(r->the_request, r->uri);
|
||||
strcat(r->the_request, " ");
|
||||
strcat(r->the_request, r->protocol);
|
||||
|
||||
apr_table_setn(r->subprocess_env, "UNIQUE_ID", "1");
|
||||
|
||||
modsecProcessRequest(r);
|
||||
modsecProcessResponse(r);
|
||||
modsecFinishRequest(r);
|
||||
}
|
||||
|
||||
const char *lng = apr_table_get(r->headers_in, "Content-Languages");
|
||||
|
||||
if(lng != NULL)
|
||||
{
|
||||
r->content_languages = apr_array_make(r->pool, 1, sizeof(const char *));
|
||||
|
||||
*(const char **)apr_array_push(r->content_languages) = lng;
|
||||
}
|
||||
|
||||
r->request_time = apr_time_now();
|
||||
|
||||
r->parsed_uri.scheme = "http";
|
||||
r->parsed_uri.path = r->path_info;
|
||||
r->parsed_uri.hostname = (char *)r->hostname;
|
||||
r->parsed_uri.is_initialized = 1;
|
||||
r->parsed_uri.port = 80;
|
||||
r->parsed_uri.port_str = "80";
|
||||
r->parsed_uri.query = r->args;
|
||||
r->parsed_uri.dns_looked_up = 0;
|
||||
r->parsed_uri.dns_resolved = 0;
|
||||
r->parsed_uri.password = NULL;
|
||||
r->parsed_uri.user = NULL;
|
||||
r->parsed_uri.fragment = NULL;
|
||||
|
||||
r->unparsed_uri = rawurl;
|
||||
r->uri = r->unparsed_uri;
|
||||
|
||||
r->the_request = (char *)apr_palloc(r->pool, strlen(r->method) + 1 + strlen(r->uri) + 1 + strlen(r->protocol) + 1);
|
||||
|
||||
strcpy(r->the_request, r->method);
|
||||
strcat(r->the_request, " ");
|
||||
strcat(r->the_request, r->uri);
|
||||
strcat(r->the_request, " ");
|
||||
strcat(r->the_request, r->protocol);
|
||||
|
||||
apr_table_setn(r->subprocess_env, "UNIQUE_ID", "1");
|
||||
|
||||
modsecProcessRequest(r);
|
||||
modsecProcessResponse(r);
|
||||
modsecFinishRequest(r);
|
||||
}
|
||||
|
||||
modsecTerminate();
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommandArguments>-c owasp_crs\modsecurity_iis.conf d:\test.dat</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments>-c d:\temp\antixss.conf -u d:\temp\modsec_urls.txt d:\temp\test1.dat</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
|
||||
<LocalDebuggerAttach>false</LocalDebuggerAttach>
|
||||
|
Reference in New Issue
Block a user