ソースを参照

[Web] Fail2ban: Only write regex filters if not empty

andryyy 5 年 前
コミット
bf62f31b9e
1 ファイル変更3 行追加1 行削除
  1. 3 1
      data/web/inc/functions.fail2ban.inc.php

+ 3 - 1
data/web/inc/functions.fail2ban.inc.php

@@ -129,7 +129,9 @@ function fail2ban($_action, $_data = null) {
               $regex_array[$rule_id] = $regex;
               $regex_array[$rule_id] = $regex;
               $rule_id++;
               $rule_id++;
             }
             }
-            $redis->Set('F2B_REGEX', json_encode($regex_array, JSON_UNESCAPED_SLASHES));
+            if (!empty($regex_array)) {
+              $redis->Set('F2B_REGEX', json_encode($regex_array, JSON_UNESCAPED_SLASHES));
+            }
           }
           }
           else {
           else {
             $_SESSION['return'][] = array(
             $_SESSION['return'][] = array(