Skip to content

IIS version improvements #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions apache2/Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,18 @@ all: $(DLL)

dll: $(DLL)

mod_security2_config.h: mod_security2_config.hw
@type mod_security2_config.hw > modsecurity_config.h

.c.obj:
$(CC) $(CFLAGS) -c $< -Fo$@

.cpp.obj:
$(CC) $(CFLAGS) -c $< -Fo$@

$(DLL): mod_security2_config.h $(OBJS)
$(DLL): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -LD $(OBJS) -Fe$(DLL) $(LIBS) /link
IF EXIST $(DLL).manifest $(MT) -manifest $(DLL).manifest -outputresource:$(DLL);2

install: $(DLL)
copy /Y $(DLL) $(APACHE)\modules

clean:
del $(OBJS) $(DLL) *.dll *.lib *.pdb *.idb *.ilk *.exp *.res *.rc *.bin mod_security2_config.h *.manifest
del $(OBJS) $(DLL) *.dll *.lib *.pdb *.idb *.ilk *.exp *.res *.rc *.bin *.manifest
4 changes: 4 additions & 0 deletions apache2/modsecurity_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* so this is here to prevent that by removing them.
*/

#ifndef WIN32

/* Undefine all these so there are no conflicts */
#undef PACKAGE
#undef PACKAGE_BUGREPORT
Expand All @@ -22,3 +24,5 @@
#undef PACKAGE_TARNAME
#undef PACKAGE_URL
#undef PACKAGE_VERSION

#endif
2 changes: 1 addition & 1 deletion apache2/msc_release.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

/* Apache Module Defines */
#ifdef VERSION_IIS
#define MODSEC_MODULE_NAME "ModSecurity for IIS (Beta)"
#define MODSEC_MODULE_NAME "ModSecurity for IIS (RC)"
#else
#ifdef VERSION_NGINX
#define MODSEC_MODULE_NAME "ModSecurity for nginx (Beta)"
Expand Down
19 changes: 19 additions & 0 deletions apache2/msc_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,26 @@ char *log_escape(apr_pool_t *mp, const char *text) {
}

char *log_escape_nq(apr_pool_t *mp, const char *text) {
#ifdef VERSION_IIS
int l = 0;

// this is a workaround for unknown bug that causes 'text' sometimes to lack zero-termination
//
__try
{
l = text ? strlen(text) : 0;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
l = -1;
}
if(l < 0)
return _log_escape(mp, "BUG: see log_escape_nq()", 24, 0, 0, 0);

return _log_escape(mp, (const unsigned char *)text, l, 0, 0, 0);
#else
return _log_escape(mp, (const unsigned char *)text, text ? strlen(text) : 0, 0, 0, 0);
#endif
}

char *log_escape_ex(apr_pool_t *mp, const char *text, unsigned long int text_length) {
Expand Down
5 changes: 1 addition & 4 deletions iis/Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ all: $(DLL)

dll: $(DLL)

..\apache2\mod_security2_config.h: ..\apache2\mod_security2_config.hw
@type ..\apache2\mod_security2_config.hw > ..\apache2\modsecurity_config.h

$(OBJS1): ..\apache2\$*.c
$(CC) $(CFLAGS) -c ..\apache2\$*.c -Fo$@

Expand All @@ -69,7 +66,7 @@ $(OBJS2): ..\standalone\$*.c
.cpp.obj:
$(CC) $(CFLAGS) -c $< -Fo$@

$(DLL): ..\apache2\mod_security2_config.h $(OBJS1) $(OBJS2) $(OBJS3)
$(DLL): $(OBJS1) $(OBJS2) $(OBJS3)
$(LINK) $(LDFLAGS) $(OBJS1) $(OBJS2) $(OBJS3) $(LIBS)
IF EXIST $(DLL).manifest $(MT) -manifest $(DLL).manifest -outputresource:$(DLL);#1

Expand Down
Loading