]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: ssl: reintroduce ERR_GET_LIB(ret) == ERR_LIB_PEM in ssl_sock_load_pem_into_ckch()
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 15 Nov 2022 16:12:03 +0000 (17:12 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 15 Nov 2022 17:24:17 +0000 (18:24 +0100)
commit78c7a06e4fc1214b40845e6a61073e558fd6a02b
tree7bcb9b07c2cb6806e745b1bfdb14c25c74f80d93
parent45fed2c7a6bb762d5a52b9355cedde15d6f7cd3b
MINOR: ssl: reintroduce ERR_GET_LIB(ret) == ERR_LIB_PEM in ssl_sock_load_pem_into_ckch()

Commit 432cd1a ("MEDIUM: ssl: be stricter about chain error") removed
the ERR_GET_LIB(ret) != ERR_LIB_PEM to be stricter about errors.

However, PEM_R_NO_START_LINE is better be checked with ERR_LIB_PEM.
So this patch complete the previous one.

The original problem was that the condition was wrongly inversed. This
original code from openssl:

  if (ERR_GET_LIB(err) == ERR_LIB_PEM &&
      ERR_GET_REASON(err) == PEM_R_NO_START_LINE)

became:

  if (ret && (ERR_GET_LIB(ret) != ERR_LIB_PEM &&
              ERR_GET_REASON(ret) != PEM_R_NO_START_LINE))

instead of:

  if (ret && !(ERR_GET_LIB(ret) == ERR_LIB_PEM &&
               ERR_GET_REASON(ret) == PEM_R_NO_START_LINE))

This must not be backported as it will break a lot of setup. That's too
bad because a lot of errors are lost. Not marked as a bug because of the
breakage it could cause on working setups.
src/ssl_ckch.c