From 59a1746be799d846e7c7d374efc7f5f09ab97ce5 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Mon, 3 Nov 2014 19:27:06 -0800 Subject: [PATCH] Using real server signature on status call On Apache platform the server signature can be replaced using the SecServerSignature directive. Status call was using the signature informed by this directive instead of using the original one. As reported at #702. --- apache2/mod_security2.c | 2 +- apache2/modsecurity.h | 1 + apache2/msc_status_engine.c | 6 +----- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apache2/mod_security2.c b/apache2/mod_security2.c index a3bff0a4..7354f60e 100644 --- a/apache2/mod_security2.c +++ b/apache2/mod_security2.c @@ -54,7 +54,7 @@ char DSOLOCAL *chroot_dir = NULL; char DSOLOCAL *new_server_signature = NULL; -static char *real_server_signature = NULL; +char DSOLOCAL *real_server_signature = NULL; char DSOLOCAL *guardianlog_name = NULL; diff --git a/apache2/modsecurity.h b/apache2/modsecurity.h index 3b1badf4..53fc3dda 100644 --- a/apache2/modsecurity.h +++ b/apache2/modsecurity.h @@ -133,6 +133,7 @@ typedef struct msc_parm msc_parm; #define FATAL_ERROR "ModSecurity: Fatal error (memory allocation or unexpected internal error)!" extern DSOLOCAL char *new_server_signature; +extern DSOLOCAL char *real_server_signature; extern DSOLOCAL char *chroot_dir; extern module AP_MODULE_DECLARE_DATA security2_module; diff --git a/apache2/msc_status_engine.c b/apache2/msc_status_engine.c index e901016e..dfd4f90c 100644 --- a/apache2/msc_status_engine.c +++ b/apache2/msc_status_engine.c @@ -349,11 +349,7 @@ int DSOLOCAL msc_beacon_string (char *beacon_string, int beacon_string_max_len) #endif libxml = LIBXML_DOTTED_VERSION; modsec = MODSEC_VERSION; -#ifdef WIN32 - apache = "IIS"; -#else - apache = apache_get_server_version(); -#endif + apache = real_server_signature; /* 6 represents: strlen("(null)") */ beacon_string_len = (modsec ? strlen(modsec) : 6) +