BUG/MINOR: cli/server: Don't crash when a server is added with a custom id
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Dec 2021 17:49:44 +0000 (18:49 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 16 Dec 2021 08:43:10 +0000 (09:43 +0100)
commit54b8a825f4102bd56188c48ed0bea8713d7b3955
treee75caa9e74a7e6ba2ca3d223e7552915731a9b38
parent6a692f97e674a80c0e2bda2723fc91268e371811
BUG/MINOR: cli/server: Don't crash when a server is added with a custom id

When a server is dynamically added via the CLI with a custom id, the key
used to insert it in the backend's tree of used names is not initialized.
The server id must be used but it is only used when no custom id is
provided. Thus, with a custom id, HAProxy crashes.

Now, the server id is always used to init this key, to be able to insert the
server in the corresponding tree.

This patch should fix the issue #1481. It must be backported as far as 2.4.

(cherry picked from commit 70f8948364524b83f4763f02ceea884019451e06)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/server.c