BUG/MEDIUM: vars: make functions vars_get_by_{name,desc} thread-safe
authorDragan Dosen <ddosen@haproxy.com>
Mon, 22 Feb 2021 16:20:01 +0000 (17:20 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 23 Feb 2021 16:22:46 +0000 (17:22 +0100)
commit14518f2305027dfd537c1be0f88350337b5fba23
treefa338c3e673a3b4ac4cfa174c2504f83c77010a4
parent9e8db138c9e50262f2aae898bbc9b9b0b9a93449
BUG/MEDIUM: vars: make functions vars_get_by_{name,desc} thread-safe

This patch adds a lock to functions vars_get_by_name() and
vars_get_by_desc() to protect accesses to the list of variables.

After the variable is fetched, a sample data is duplicated by using
smp_dup() because the variable may be modified by another thread.

This should be backported to all versions supporting vars along with
"BUG/MINOR: sample: secure convs that accept base64 string and var name
as args" which this patch depends on.
src/vars.c