Skip to content

Commit e15bbac

Browse files
committed
Merge pull request #31 from gwroblew/remotes/trunk
IIS version improvements
2 parents 54245c9 + c53e743 commit e15bbac

24 files changed

+8894
-1756
lines changed

apache2/Makefile.win

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,18 @@ all: $(DLL)
5252

5353
dll: $(DLL)
5454

55-
mod_security2_config.h: mod_security2_config.hw
56-
@type mod_security2_config.hw > modsecurity_config.h
57-
5855
.c.obj:
5956
$(CC) $(CFLAGS) -c $< -Fo$@
6057

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

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

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

7168
clean:
72-
del $(OBJS) $(DLL) *.dll *.lib *.pdb *.idb *.ilk *.exp *.res *.rc *.bin mod_security2_config.h *.manifest
69+
del $(OBJS) $(DLL) *.dll *.lib *.pdb *.idb *.ilk *.exp *.res *.rc *.bin *.manifest

apache2/modsecurity_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* so this is here to prevent that by removing them.
33
*/
44

5+
#ifndef WIN32
6+
57
/* Undefine all these so there are no conflicts */
68
#undef PACKAGE
79
#undef PACKAGE_BUGREPORT
@@ -22,3 +24,5 @@
2224
#undef PACKAGE_TARNAME
2325
#undef PACKAGE_URL
2426
#undef PACKAGE_VERSION
27+
28+
#endif

apache2/msc_release.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
/* Apache Module Defines */
5252
#ifdef VERSION_IIS
53-
#define MODSEC_MODULE_NAME "ModSecurity for IIS (Beta)"
53+
#define MODSEC_MODULE_NAME "ModSecurity for IIS (RC)"
5454
#else
5555
#ifdef VERSION_NGINX
5656
#define MODSEC_MODULE_NAME "ModSecurity for nginx (Beta)"

apache2/msc_util.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,26 @@ char *log_escape(apr_pool_t *mp, const char *text) {
12061206
}
12071207

12081208
char *log_escape_nq(apr_pool_t *mp, const char *text) {
1209+
#ifdef VERSION_IIS
1210+
int l = 0;
1211+
1212+
// this is a workaround for unknown bug that causes 'text' sometimes to lack zero-termination
1213+
//
1214+
__try
1215+
{
1216+
l = text ? strlen(text) : 0;
1217+
}
1218+
__except(EXCEPTION_EXECUTE_HANDLER)
1219+
{
1220+
l = -1;
1221+
}
1222+
if(l < 0)
1223+
return _log_escape(mp, "BUG: see log_escape_nq()", 24, 0, 0, 0);
1224+
1225+
return _log_escape(mp, (const unsigned char *)text, l, 0, 0, 0);
1226+
#else
12091227
return _log_escape(mp, (const unsigned char *)text, text ? strlen(text) : 0, 0, 0, 0);
1228+
#endif
12101229
}
12111230

12121231
char *log_escape_ex(apr_pool_t *mp, const char *text, unsigned long int text_length) {

iis/Makefile.win

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ all: $(DLL)
5757

5858
dll: $(DLL)
5959

60-
..\apache2\mod_security2_config.h: ..\apache2\mod_security2_config.hw
61-
@type ..\apache2\mod_security2_config.hw > ..\apache2\modsecurity_config.h
62-
6360
$(OBJS1): ..\apache2\$*.c
6461
$(CC) $(CFLAGS) -c ..\apache2\$*.c -Fo$@
6562

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

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

0 commit comments

Comments
 (0)