EVerest / libevse-security

Apache License 2.0
7 stars 5 forks source link

fix: catch directory not found when iterating over OCSP cache #82

Closed james-ctc closed 3 months ago

james-ctc commented 3 months ago

Describe your changes

The code exceptions when there OCSP cache directory doesn't exist. This fix catches the exception so that an error can be logged rather than terminating EVerest

example error prior to fix:

2024-06-17 10:48:57.318956 [INFO] evse_security:E  :: Found valid leaf: ["/home/james/code/everest/workspace/everest-core/build/dist/etc/everest/certs/client/cso/CPO_CERT_CHAIN.pem"]
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
  what():  filesystem error: directory iterator cannot open directory: No such file or directory [/home/james/code/everest/workspace/everest-core/build/dist/etc/everest/certs/client/cso/ocsp]
2024-06-17 10:48:57.652987 [CRIT] manager         int boot(const boost::program_options::variables_map&) :: Module evse_security (pid: 59760) exited with status: 134. Terminating all modules.
2024-06-17 10:48:57.655044 [INFO] manager          :: SIGTERM of child: api (pid: 59755) succeeded.
...

Issue ticket number and link

Checklist before requesting a review