From: Willy Tarreau Date: Tue, 15 Sep 2026 14:37:58 +0000 (+0200) Subject: BUG/MINOR: cfgparse-listen: always reject extra arguments to "persist" X-Git-Tag: v3.5-dev9~161 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=405848889ab758eea46ff19f890e7b4ad7234a84;p=haproxy.git BUG/MINOR: cfgparse-listen: always reject extra arguments to "persist" The check for extra arguments was placed inside the "if" block which parses "persist rdp-cookie()", so "persist rdp-cookie foo" was silently accepted. Let's move it to the beginning of the keyword's processing so that it covers all the cases. This must NOT be backported since it makes the config parser stricter. --- diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 08acb5dfd..e51d193dd 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -1107,6 +1107,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->email_alert.flags |= PR_EMAIL_ALERT_SET; }/* end else if (!strcmp(args[0], "email-alert")) */ else if (strcmp(args[0], "persist") == 0) { /* persist */ + if (alertif_too_many_args(1, file, linenum, args, &err_code)) + goto out; if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : missing persist method.\n", file, linenum); @@ -1123,9 +1125,6 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) beg = args[1] + 11; end = strchr(beg, ')'); - if (alertif_too_many_args(1, file, linenum, args, &err_code)) - goto out; - if (!end || end == beg) { ha_alert("parsing [%s:%d] : persist rdp-cookie(name)' requires an rdp cookie name.\n", file, linenum);