@@ -560,11 +560,13 @@ static char *fpm_conf_set_array(zval *key, zval *value, void **config, int conve
560
560
}
561
561
562
562
memset (kv , 0 , sizeof (* kv ));
563
- kv -> key = strdup (Z_STRVAL_P (key ));
563
+ if (key ) {
564
+ kv -> key = strdup (Z_STRVAL_P (key ));
564
565
565
- if (!kv -> key ) {
566
- free (kv );
567
- return "fpm_conf_set_array: strdup(key) failed" ;
566
+ if (!kv -> key ) {
567
+ free (kv );
568
+ return "fpm_conf_set_array: strdup(key) failed" ;
569
+ }
568
570
}
569
571
570
572
if (convert_to_bool ) {
@@ -669,6 +671,11 @@ int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc) /* {{{ */
669
671
free (wpc -> apparmor_hat );
670
672
#endif
671
673
674
+ for (kv = wpc -> access_suppress_paths ; kv ; kv = kv_next ) {
675
+ kv_next = kv -> next ;
676
+ free (kv -> value );
677
+ free (kv );
678
+ }
672
679
for (kv = wpc -> php_values ; kv ; kv = kv_next ) {
673
680
kv_next = kv -> next ;
674
681
free (kv -> key );
@@ -1503,11 +1510,24 @@ static void fpm_conf_ini_parser_array(zval *name, zval *key, zval *value, void *
1503
1510
char * err = NULL ;
1504
1511
void * config ;
1505
1512
1506
- if (!* Z_STRVAL_P (key )) {
1507
- zlog (ZLOG_ERROR , "[%s:%d] Misspelled array ?" , ini_filename , ini_lineno );
1513
+ if (zend_string_equals_literal (Z_STR_P (name ), "access.suppress_path" )) {
1514
+ if (!(* Z_STRVAL_P (key ) == '\0' )) {
1515
+ zlog (ZLOG_ERROR , "[%s:%d] Keys provided to field 'access.suppress_path' are ignored" , ini_filename , ini_lineno );
1516
+ * error = 1 ;
1517
+ }
1518
+ if (!(* Z_STRVAL_P (value )) || (* Z_STRVAL_P (value ) != '/' )) {
1519
+ zlog (ZLOG_ERROR , "[%s:%d] Values provided to field 'access.suppress_path' must begin with '/'" , ini_filename , ini_lineno );
1520
+ * error = 1 ;
1521
+ }
1522
+ if (* error ) {
1523
+ return ;
1524
+ }
1525
+ } else if (!* Z_STRVAL_P (key )) {
1526
+ zlog (ZLOG_ERROR , "[%s:%d] You must provide a key for field '%s'" , ini_filename , ini_lineno , Z_STRVAL_P (name ));
1508
1527
* error = 1 ;
1509
1528
return ;
1510
1529
}
1530
+
1511
1531
if (!current_wp || !current_wp -> config ) {
1512
1532
zlog (ZLOG_ERROR , "[%s:%d] Array are not allowed in the global section" , ini_filename , ini_lineno );
1513
1533
* error = 1 ;
@@ -1539,6 +1559,10 @@ static void fpm_conf_ini_parser_array(zval *name, zval *key, zval *value, void *
1539
1559
config = (char * )current_wp -> config + WPO (php_admin_values );
1540
1560
err = fpm_conf_set_array (key , value , & config , 1 );
1541
1561
1562
+ } else if (zend_string_equals_literal (Z_STR_P (name ), "access.suppress_path" )) {
1563
+ config = (char * )current_wp -> config + WPO (access_suppress_paths );
1564
+ err = fpm_conf_set_array (NULL , value , & config , 0 );
1565
+
1542
1566
} else {
1543
1567
zlog (ZLOG_ERROR , "[%s:%d] unknown directive '%s'" , ini_filename , ini_lineno , Z_STRVAL_P (name ));
1544
1568
* error = 1 ;
@@ -1747,6 +1771,9 @@ static void fpm_conf_dump(void) /* {{{ */
1747
1771
zlog (ZLOG_NOTICE , "\tping.response = %s" , STR2STR (wp -> config -> ping_response ));
1748
1772
zlog (ZLOG_NOTICE , "\taccess.log = %s" , STR2STR (wp -> config -> access_log ));
1749
1773
zlog (ZLOG_NOTICE , "\taccess.format = %s" , STR2STR (wp -> config -> access_format ));
1774
+ for (kv = wp -> config -> access_suppress_paths ; kv ; kv = kv -> next ) {
1775
+ zlog (ZLOG_NOTICE , "\taccess.suppress_path[] = %s" , kv -> value );
1776
+ }
1750
1777
zlog (ZLOG_NOTICE , "\tslowlog = %s" , STR2STR (wp -> config -> slowlog ));
1751
1778
zlog (ZLOG_NOTICE , "\trequest_slowlog_timeout = %ds" , wp -> config -> request_slowlog_timeout );
1752
1779
zlog (ZLOG_NOTICE , "\trequest_slowlog_trace_depth = %d" , wp -> config -> request_slowlog_trace_depth );
0 commit comments