Skip to content

Commit b838c10

Browse files
committed
Emit connector version in error log
While here, fixed msc_set_connector_info() to use consistent version string. This fixes owasp-modsecurity#85.
1 parent 312f029 commit b838c10

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: src/ngx_http_modsecurity_common.h

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
MODSECURITY_NGINX_MINOR MODSECURITY_NGINX_PATCHLEVEL \
5555
MODSECURITY_NGINX_TAG_NUM
5656

57+
#define MODSECURITY_NGINX_WHOAMI "ModSecurity-nginx v" \
58+
MODSECURITY_NGINX_VERSION
59+
5760
typedef struct {
5861
ngx_str_t name;
5962
ngx_str_t value;

Diff for: src/ngx_http_modsecurity_module.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ ngx_http_modsecurity_create_main_conf(ngx_conf_t *cf)
496496
{
497497
ngx_http_modsecurity_conf_t *conf;
498498

499+
ngx_log_error(NGX_LOG_NOTICE, cf->log, 0, MODSECURITY_NGINX_WHOAMI);
500+
499501
/* ngx_pcalloc already sets all of this scructure to zeros. */
500502
conf = ngx_http_modsecurity_create_conf(cf);
501503

@@ -515,7 +517,7 @@ ngx_http_modsecurity_create_main_conf(ngx_conf_t *cf)
515517
}
516518

517519
/* Provide our connector information to LibModSecurity */
518-
msc_set_connector_info(conf->modsec, "ModSecurity-nginx v0.1.1-beta");
520+
msc_set_connector_info(conf->modsec, MODSECURITY_NGINX_WHOAMI);
519521
msc_set_log_cb(conf->modsec, ngx_http_modsecurity_log);
520522

521523
return conf;

0 commit comments

Comments
 (0)