BUG/MINOR: tcpcheck: Improve LDAP response parsing to fix LDAP check
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 16 Sep 2021 14:01:09 +0000 (16:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 16 Sep 2021 15:24:50 +0000 (17:24 +0200)
commit8a0e5f822b84c984681547eb0e9ee00d8a19ce56
tree075eab61e9c2f6fb087a2fd5a656c034ad8cc065
parentc2afb860f297eb82039d821bd25bdd3cf66abe28
BUG/MINOR: tcpcheck: Improve LDAP response parsing to fix LDAP check

When the LDAP response is parsed, the message length is not properly
decoded. While it works for LDAP servers encoding it on 1 byte, it does not
work for those using a multi-bytes encoding. Among others, Active Directory
servers seems to encode messages or elements length on 4 bytes.

In this patch, we only handle length of BindResponse messages encoded on 1,
2 or 4 bytes. In theory, it may be encoded on any bytes number less than 127
bytes. But it is useless to make this part too complex. It should be ok this
way.

This patch should fix the issue #1390. It should be backported to all stable
versions. While it should be easy to backport it as far as 2.2, the patch
will have to be totally rewritten for lower versions.
reg-tests/checks/ldap-check.vtc
src/tcpcheck.c