Skip to content

Commit 8efece9

Browse files
tjikkunFelipe Zimmerle
authored andcommitted
don't use sb_handle on apache 2.4
1 parent f813365 commit 8efece9

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

apache2/mod_security2.c

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ int (*modsecDropAction)(request_rec *r) = NULL;
9696
#endif
9797
static int server_limit, thread_limit;
9898

99-
typedef struct {
100-
int child_num;
101-
int thread_num;
102-
} sb_handle;
103-
10499
/* -- Miscellaneous functions -- */
105100

106101
/**
@@ -1435,21 +1430,25 @@ static void modsec_register_operator(const char *name, void *fn_init, void *fn_e
14351430
*/
14361431
static int hook_connection_early(conn_rec *conn)
14371432
{
1438-
sb_handle *sb = conn->sbh;
1439-
int i, j;
1440-
unsigned long int ip_count_r = 0, ip_count_w = 0;
1441-
char *error_msg;
1442-
worker_score *ws_record = NULL;
14431433
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
1444-
ap_sb_handle_t *sbh = NULL;
1434+
ap_sb_handle_t *sbh = conn->sbh;
14451435
char *client_ip = conn->client_ip;
14461436
#else
1437+
sb_handle *sbh = conn->sbh;
14471438
char *client_ip = conn->remote_ip;
14481439
#endif
1440+
int i, j;
1441+
unsigned long int ip_count_r = 0, ip_count_w = 0;
1442+
char *error_msg;
1443+
worker_score *ws_record = NULL;
14491444

1450-
if (sb != NULL && (conn_read_state_limit > 0 || conn_write_state_limit > 0)) {
1445+
if (sbh != NULL && (conn_read_state_limit > 0 || conn_write_state_limit > 0)) {
14511446

1452-
ws_record = &ap_scoreboard_image->servers[sb->child_num][sb->thread_num];
1447+
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
1448+
ws_record = ap_get_scoreboard_worker(sbh);
1449+
#else
1450+
ws_record = ap_get_scoreboard_worker(sbh->child_num, sbh->thread_num);
1451+
#endif
14531452
if (ws_record == NULL)
14541453
return DECLINED;
14551454

@@ -1462,11 +1461,6 @@ static int hook_connection_early(conn_rec *conn)
14621461
for (j = 0; j < thread_limit; ++j) {
14631462

14641463
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
1465-
sbh = conn->sbh;
1466-
if (sbh == NULL) {
1467-
return DECLINED;
1468-
}
1469-
14701464
ws_record = ap_get_scoreboard_worker(sbh);
14711465
#else
14721466
ws_record = ap_get_scoreboard_worker(i, j);

0 commit comments

Comments
 (0)