Skip to content

Commit b9e8317

Browse files
committed
allow custom log format to be applied
for messages being logged at startup
1 parent 1f4b951 commit b9e8317

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

apache2/mod_security2.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,39 +105,39 @@ static int server_limit, thread_limit;
105105
*
106106
* \param mp Pointer to memory pool
107107
*/
108-
static void version(apr_pool_t *mp) {
108+
static void version(apr_pool_t *mp, server_rec *s) {
109109
char *pcre_vrs = NULL;
110110

111-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
111+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
112112
"ModSecurity: APR compiled version=\"%s\"; "
113113
"loaded version=\"%s\"", APR_VERSION_STRING, apr_version_string());
114114

115115
if (strstr(apr_version_string(), APR_VERSION_STRING) == NULL) {
116-
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Loaded APR do not match with compiled!");
116+
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, "ModSecurity: Loaded APR do not match with compiled!");
117117
}
118118

119119
pcre_vrs = apr_psprintf(mp,"%d.%d ", PCRE_MAJOR, PCRE_MINOR);
120120

121-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
121+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
122122
"ModSecurity: PCRE compiled version=\"%s\"; "
123123
"loaded version=\"%s\"", pcre_vrs, pcre_version());
124124

125125
if (strstr(pcre_version(),pcre_vrs) == NULL) {
126-
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "ModSecurity: Loaded PCRE do not match with compiled!");
126+
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, "ModSecurity: Loaded PCRE do not match with compiled!");
127127
}
128128

129129
/* Lua version function was removed in current 5.1. Need to check in future versions if it's back */
130130
#if defined(WITH_LUA)
131-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
131+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
132132
"ModSecurity: LUA compiled version=\"%s\"", LUA_VERSION);
133133
#endif /* WITH_LUA */
134134

135135
#ifdef WITH_YAJL
136-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
136+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
137137
"ModSecurity: YAJL compiled version=\"%d.%d.%d\"", YAJL_MAJOR, YAJL_MINOR, YAJL_MICRO);
138138
#endif /* WITH_YAJL */
139139

140-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
140+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
141141
"ModSecurity: LIBXML compiled version=\"%s\"", LIBXML_DOTTED_VERSION);
142142
}
143143

@@ -762,7 +762,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
762762
ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s,
763763
"%s configured.", MODSEC_MODULE_NAME_FULL);
764764

765-
version(mp);
765+
version(mp, s);
766766

767767
/* If we've changed the server signature make note of the original. */
768768
if (new_server_signature != NULL) {
@@ -776,7 +776,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
776776
msc_status_engine_call();
777777
}
778778
else {
779-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
779+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
780780
"ModSecurity: Status engine is currently disabled, enable " \
781781
"it by set SecStatusEngine to On.");
782782
}
@@ -796,14 +796,14 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
796796
{
797797
if (remote_rules_server->amount_of_rules == 1)
798798
{
799-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
799+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
800800
"ModSecurity: Loaded %d rule from: '%s'.",
801801
remote_rules_server->amount_of_rules,
802802
remote_rules_server->uri);
803803
}
804804
else
805805
{
806-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
806+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
807807
"ModSecurity: Loaded %d rules from: '%s'.",
808808
remote_rules_server->amount_of_rules,
809809
remote_rules_server->uri);
@@ -812,7 +812,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
812812
#endif
813813
if (remote_rules_fail_message != NULL)
814814
{
815-
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: " \
815+
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "ModSecurity: " \
816816
"Problems loading external resources: %s",
817817
remote_rules_fail_message);
818818
}

0 commit comments

Comments
 (0)