From f64b5544afc43003d9b79216a92bad7069078c15 Mon Sep 17 00:00:00 2001 From: brenosilva Date: Mon, 11 Apr 2011 18:34:47 +0000 Subject: [PATCH] Move version() to mod_security2 --- apache2/mod_security2.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/apache2/mod_security2.c b/apache2/mod_security2.c index 7f0ecc72..9b2ff120 100644 --- a/apache2/mod_security2.c +++ b/apache2/mod_security2.c @@ -68,6 +68,43 @@ typedef struct { /* -- Miscellaneous functions -- */ +/* +* \brief Print informations from used libraries +* +* \param mp Pointer to memory pool +*/ +void version(apr_pool_t *mp) { + char *pcre_vrs = NULL; + + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, + "ModSecurity: APR compiled version=\"%s\"; " + "loaded version=\"%s\"", APR_VERSION_STRING, apr_version_string()); + + if (strstr(apr_version_string(),APR_VERSION_STRING) == NULL) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Loaded APR do not match with compiled!"); + } + + pcre_vrs = apr_psprintf(mp,"%d.%d", PCRE_MAJOR, PCRE_MINOR); + + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, + "ModSecurity: PCRE compiled version=\"%s\"; " + "loaded version=\"%s\"", pcre_vrs, pcre_version()); + + if (strstr(pcre_version(),pcre_vrs) == NULL) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Loaded PCRE do not match with compiled!"); + } + + /* Lua version function was removed in current 5.1. Need to check in future versions if it's back */ +#if defined(WITH_LUA) + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, + "ModSecurity: LUA compiled version=\"%s\"",LUA_VERSION); +#endif /* WITH_LUA */ + + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, + "ModSecurity: LIBXML compiled version=\"%s\"",LIBXML_DOTTED_VERSION); +} + + /** * Intercepts transaction, using the method specified * in the structure itself. MUST return an HTTP status code,