Commit f9d841d
committed
public_key: Fix crash when no OS CA certificates are found
When no OS CA certificate bundle can be found, for example on a
minimal system where none of the default paths exist, or when the
configured path is an empty directory, pubkey_os_cacerts:get/0 is
supposed to raise a descriptive {failed_load_cacerts, Reason} error.
Instead it crashed with a function_clause error in the internal error
conversion helper, masking the real problem:
** exception error: no function clause matching
pubkey_os_cacerts:conv_error_reason(no_cacerts_found)
This can also be triggered indirectly through httpc's default
verify_peer setup (httpc:ssl_verify_host_options/1).
format_error/2 had the same gap, so error formatting would have
crashed in the same way instead of producing a message.
Add the missing no_cacerts_found clauses so that the intended
{failed_load_cacerts, no_cacerts_found} error is raised and formatted
properly, and extend the cacerts_load test case to cover this.1 parent 7a0217a commit f9d841d
2 files changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| |||
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
| 320 | + | |
| 321 | + | |
319 | 322 | | |
320 | 323 | | |
321 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2250 | 2250 | | |
2251 | 2251 | | |
2252 | 2252 | | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
2253 | 2272 | | |
2254 | 2273 | | |
2255 | 2274 | | |
| |||
0 commit comments