MINOR: log/backend: prevent "dynamic-cookie-key" use with LOG mode
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 16 Nov 2023 16:16:43 +0000 (17:16 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 18 Nov 2023 10:16:21 +0000 (11:16 +0100)
It doesn't make sense to set "dynamic-cookie-key" inside a log backend,
thus we report a warning to the user and reset the setting.

src/log.c

index e12a43b..bf1c54d 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -922,6 +922,13 @@ static int _postcheck_log_backend_compat(struct proxy *be)
                err_code |= ERR_WARN;
                istfree(&be->server_id_hdr_name);
        }
+       if (be->dyncookie_key) {
+               ha_warning("Cannot set \"dynamic-cookie-key\" with 'mode log' in %s '%s'. It will be ignored.\n",
+                          proxy_type_str(be), be->id);
+
+               err_code |= ERR_WARN;
+               ha_free(&be->dyncookie_key);
+       }
        return err_code;
 }