@@ -96,11 +96,6 @@ int (*modsecDropAction)(request_rec *r) = NULL;
96
96
#endif
97
97
static int server_limit , thread_limit ;
98
98
99
- typedef struct {
100
- int child_num ;
101
- int thread_num ;
102
- } sb_handle ;
103
-
104
99
/* -- Miscellaneous functions -- */
105
100
106
101
/**
@@ -1435,21 +1430,25 @@ static void modsec_register_operator(const char *name, void *fn_init, void *fn_e
1435
1430
*/
1436
1431
static int hook_connection_early (conn_rec * conn )
1437
1432
{
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 ;
1443
1433
#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 ;
1445
1435
char * client_ip = conn -> client_ip ;
1446
1436
#else
1437
+ sb_handle * sbh = conn -> sbh ;
1447
1438
char * client_ip = conn -> remote_ip ;
1448
1439
#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 ;
1449
1444
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 )) {
1451
1446
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
1453
1452
if (ws_record == NULL )
1454
1453
return DECLINED ;
1455
1454
@@ -1462,11 +1461,6 @@ static int hook_connection_early(conn_rec *conn)
1462
1461
for (j = 0 ; j < thread_limit ; ++ j ) {
1463
1462
1464
1463
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
1465
- sbh = conn -> sbh ;
1466
- if (sbh == NULL ) {
1467
- return DECLINED ;
1468
- }
1469
-
1470
1464
ws_record = ap_get_scoreboard_worker (sbh );
1471
1465
#else
1472
1466
ws_record = ap_get_scoreboard_worker (i , j );
0 commit comments