Skip to content

Commit efef989

Browse files
author
Felipe Zimmerle
committed
Renames Sec{Read|Write}StateLimits
The Sec{Read|Write}StateLimits are filters related to the connections, when the server did not know yet which vhost the request goes to. This means that once those configrations are set it will be applied to entire server. This patch just renames the Sec{Read|Write}StateLimits to SecConn{Read|Write}StateLimits to make it more clear to the user. SecConnectionEngine was also renamed to SecConnEngine.
1 parent 48d85c7 commit efef989

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

apache2/apache2_config.c

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ char *parser_conn_limits_operator(apr_pool_t *mp, const char *p2,
17051705
}
17061706
else {
17071707
return apr_psprintf(mp, "ModSecurity: Invalid operator for " \
1708-
"SecReadStateLimit: %s, expected operators: @ipMatch, @ipMatchF " \
1708+
"SecConnReadStateLimit: %s, expected operators: @ipMatch, @ipMatchF " \
17091709
"or @ipMatchFromFile with or without !", p2);
17101710
}
17111711

@@ -1726,7 +1726,7 @@ char *parser_conn_limits_operator(apr_pool_t *mp, const char *p2,
17261726

17271727

17281728
/**
1729-
* \brief Add SecReadStateLimit configuration option
1729+
* \brief Add SecConnReadStateLimit configuration option
17301730
*
17311731
* \param cmd Pointer to configuration data
17321732
* \param _dcfg Pointer to directory configuration
@@ -1747,7 +1747,7 @@ static const char *cmd_conn_read_state_limit(cmd_parms *cmd, void *_dcfg,
17471747
limit = strtol(p1, NULL, 10);
17481748
if ((limit == LONG_MAX) || (limit == LONG_MIN) || (limit <= 0)) {
17491749
return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for " \
1750-
"SecReadStateLimit: %s", p1);
1750+
"SecConnReadStateLimit: %s", p1);
17511751
}
17521752

17531753
if (p2 != NULL) {
@@ -1764,8 +1764,18 @@ static const char *cmd_conn_read_state_limit(cmd_parms *cmd, void *_dcfg,
17641764
return NULL;
17651765
}
17661766

1767+
static const char *cmd_read_state_limit(cmd_parms *cmd, void *_dcfg,
1768+
const char *p1, const char *p2)
1769+
{
1770+
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool,
1771+
"SecReadStateLimit is depricated, use SecConnReadStateLimit " \
1772+
"instead.");
1773+
1774+
return cmd_conn_read_state_limit(cmd, _dcfg, p1, p2);
1775+
}
1776+
17671777
/**
1768-
* \brief Add SecWriteStateLimit configuration option
1778+
* \brief Add SecConnWriteStateLimit configuration option
17691779
*
17701780
* \param cmd Pointer to configuration data
17711781
* \param _dcfg Pointer to directory configuration
@@ -1786,7 +1796,7 @@ static const char *cmd_conn_write_state_limit(cmd_parms *cmd, void *_dcfg,
17861796
limit = strtol(p1, NULL, 10);
17871797
if ((limit == LONG_MAX) || (limit == LONG_MIN) || (limit <= 0)) {
17881798
return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for " \
1789-
"SecWriteStateLimit: %s", p1);
1799+
"SecConnWriteStateLimit: %s", p1);
17901800
}
17911801

17921802
if (p2 != NULL) {
@@ -1802,6 +1812,16 @@ static const char *cmd_conn_write_state_limit(cmd_parms *cmd, void *_dcfg,
18021812

18031813
return NULL;
18041814
}
1815+
static const char *cmd_write_state_limit(cmd_parms *cmd, void *_dcfg,
1816+
const char *p1, const char *p2)
1817+
{
1818+
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, cmd->pool,
1819+
"SecWriteStateLimit is depricated, use SecConnWriteStateLimit " \
1820+
"instead.");
1821+
1822+
return cmd_conn_write_state_limit(cmd, _dcfg, p1, p2);
1823+
}
1824+
18051825

18061826

18071827
static const char *cmd_request_body_inmemory_limit(cmd_parms *cmd, void *_dcfg,
@@ -2163,7 +2183,7 @@ static const char *cmd_sever_conn_filters_engine(cmd_parms *cmd, void *_dcfg,
21632183
else
21642184
{
21652185
return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for " \
2166-
"SecConnectionEngine: %s", p1);
2186+
"SecConnEngine: %s", p1);
21672187
}
21682188

21692189
return NULL;
@@ -3308,21 +3328,37 @@ const command_rec module_directives[] = {
33083328
),
33093329

33103330
AP_INIT_TAKE12 (
3311-
"SecReadStateLimit",
3331+
"SecConnReadStateLimit",
33123332
cmd_conn_read_state_limit,
33133333
NULL,
33143334
CMD_SCOPE_ANY,
33153335
"maximum number of threads in READ_BUSY state per ip address"
33163336
),
33173337

33183338
AP_INIT_TAKE12 (
3319-
"SecWriteStateLimit",
3339+
"SecReadStateLimit",
3340+
cmd_read_state_limit,
3341+
NULL,
3342+
CMD_SCOPE_ANY,
3343+
"maximum number of threads in READ_BUSY state per ip address"
3344+
),
3345+
3346+
AP_INIT_TAKE12 (
3347+
"SecConnWriteStateLimit",
33203348
cmd_conn_write_state_limit,
33213349
NULL,
33223350
CMD_SCOPE_ANY,
33233351
"maximum number of threads in WRITE_BUSY state per ip address"
33243352
),
33253353

3354+
AP_INIT_TAKE12 (
3355+
"SecWriteStateLimit",
3356+
cmd_write_state_limit,
3357+
NULL,
3358+
CMD_SCOPE_ANY,
3359+
"maximum number of threads in WRITE_BUSY state per ip address"
3360+
),
3361+
33263362
AP_INIT_TAKE1 (
33273363
"SecRequestBodyInMemoryLimit",
33283364
cmd_request_body_inmemory_limit,
@@ -3438,7 +3474,7 @@ const command_rec module_directives[] = {
34383474
),
34393475

34403476
AP_INIT_TAKE1 (
3441-
"SecConnectionEngine",
3477+
"SecConnEngine",
34423478
cmd_sever_conn_filters_engine,
34433479
NULL,
34443480
CMD_SCOPE_ANY,

0 commit comments

Comments
 (0)