Eduardo Silva e1bfffc4f6 x509_crt: handle properly broken links when looking for certificates
On non-windows environments, when loading certificates from a given
path through mbedtls_x509_crt_parse_path() function, if a symbolic
link is found and is broken (meaning the target file don't exists),
the function is returning MBEDTLS_ERR_X509_FILE_IO_ERROR which is
not honoring the default behavior of just skip the bad certificate file
and increase the counter of wrong files.

The problem have been raised many times in our open source project
called Fluent Bit which depends on MbedTLS:

https://github.com/fluent/fluent-bit/issues/843#issuecomment-486388209

The expected behavior is that if a simple certificate cannot be processed,
it should just be skipped.

This patch implements a workaround with lstat(2) and stat(2) to determinate
first if the entry found in the directory is a symbolic link or not, if is
a simbolic link, do a proper stat(2) for the target file, otherwise process
normally. Upon find a broken symbolic link it will increase the counter of
not processed certificates.

Signed-off-by: Eduardo Silva <eduardo@treaure-data.com>
2022-07-20 14:36:12 +01:00
..
2021-03-10 12:52:37 +00:00
2021-06-28 09:24:07 +01:00
2021-08-19 09:55:41 +01:00
2022-05-06 10:55:10 +02:00
2022-07-12 10:51:55 +01:00
2021-06-17 21:46:29 +02:00
2021-09-27 16:22:08 +02:00
2021-08-19 09:31:55 +01:00
2021-06-28 09:24:07 +01:00
2021-03-29 14:20:18 +01:00
2021-03-29 14:20:18 +01:00
2021-04-07 12:45:35 +01:00
2021-06-16 10:34:25 +02:00
2021-03-10 12:52:37 +00:00
2021-06-28 09:24:07 +01:00
2021-06-08 16:45:41 +02:00
2021-04-15 11:19:47 +01:00
2022-05-12 09:45:03 +01:00
2022-07-01 16:43:25 +01:00
2021-09-08 22:04:13 +05:30
2020-11-25 13:10:50 +01:00
2021-12-06 07:50:27 +01:00
2021-08-19 09:31:55 +01:00
2021-08-19 09:31:55 +01:00
2022-07-15 14:38:38 +08:00
2022-03-29 17:43:56 +02:00