]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse-listen: "dynamic-cookie-key" requires TCP or HTTP mode
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 19 Sep 2023 16:37:29 +0000 (18:37 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Oct 2023 13:34:30 +0000 (15:34 +0200)
Prevent the use of the "dynamic-cookie-key" keyword in proxy sections
when TCP or HTTP modes are not set.

src/cfgparse-listen.c

index f8330a6e034b0d8394b1b1d65f29f96d00c18189..0bd1939701b4621cd03722ff77dfd277aa934153 100644 (file)
@@ -676,6 +676,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
                        err_code |= ERR_WARN;
 
+               if (curproxy->mode != PR_MODE_TCP && curproxy->mode != PR_MODE_HTTP) {
+                       ha_alert("parsing [%s:%d] : '%s' requires TCP or HTTP mode.\n",
+                                file, linenum, args[0]);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
+
                if (*(args[1]) == 0) {
                        ha_alert("parsing [%s:%d] : '%s' expects <secret_key> as argument.\n",
                                 file, linenum, args[0]);