]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: tools: make str2sa_range() validate callers' port specifications
authorWilly Tarreau <w@1wt.eu>
Tue, 15 Sep 2020 09:12:44 +0000 (11:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 20:08:08 +0000 (22:08 +0200)
commit7f96a8474c712b5b8dacd0ce7cf133a98ae39eb0
tree6824f84aa6dadaab285cab6983403f1e560907c7
parent809587635e897022d11cc20a15e30d146fa5880d
MEDIUM: tools: make str2sa_range() validate callers' port specifications

Now str2sa_range() will enforce the caller's port specification passed
using the PA_O_PORT_* flags, and will return an error on failure. For
optional ports, values 0-65535 will be enforced. For mandatory ports,
values 1-65535 are enforced. In case of ranges, it is also verified that
the upper bound is not lower than the lower bound, as this used to result
in empty listeners.

I couldn't find an easy way to test this using VTC since the purpose is
to trigger parse errors, so instead a test file is provided as
tests/ports.cfg with comments about what errors are expected for each
line.
src/check.c
src/tools.c
tests/ports.cfg [new file with mode: 0644]