This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
     new d9195ac85c Make error if remap ACL has more than one @action (#11911) 
(#11924)
d9195ac85c is described below

commit d9195ac85c4958355e5202006d2495989b959652
Author: Masaori Koshiba <[email protected]>
AuthorDate: Tue Jan 7 10:09:15 2025 +0900

    Make error if remap ACL has more than one @action (#11911) (#11924)
    
    For 9.2.x, making Warning instead of Error.
    
    (cherry picked from commit a69662cfde90877ba9bb6049c7ec0f0730abf157)
---
 proxy/http/remap/RemapConfig.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
index 80999fd6ea..747831869e 100644
--- a/proxy/http/remap/RemapConfig.cc
+++ b/proxy/http/remap/RemapConfig.cc
@@ -450,6 +450,7 @@ remap_validate_filter_args(acl_filter_rule **rule_pp, const 
char **argv, int arg
     Debug("url_rewrite", "[validate_filter_args] new acl_filter_rule class was 
created during remap rule processing");
   }
 
+  bool action_flag = false;
   for (i = 0; i < argc; i++) {
     unsigned long ul;
     bool hasarg;
@@ -572,6 +573,13 @@ remap_validate_filter_args(acl_filter_rule **rule_pp, 
const char **argv, int arg
     }
 
     if (ul & REMAP_OPTFLG_ACTION) { /* "action=" option */
+      if (action_flag) {
+        std::string_view err = "Only one @action= is allowed per remap ACL";
+        Debug("url_rewrite", "%s", err.data());
+        // For 9.2.x, making Warning instead of Error for compatibility
+        Warning("%s", err.data());
+      }
+      action_flag = true;
       if (is_inkeylist(argptr, "0", "off", "deny", "disable", nullptr)) {
         rule->allow_flag = 0;
       } else if (is_inkeylist(argptr, "1", "on", "allow", "enable", nullptr)) {

Reply via email to