bkctld-check-incs: Protect jail_config_epoch
Test if `incs_policy_file` exists before using it. Fixes #43.
This commit is contained in:
parent
a41eb2a218
commit
c27cb81b57
|
@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* tests: clean jail configuration after each test
|
* tests: clean jail configuration after each test
|
||||||
|
* bkctld-check-incs: Protect `jail_config_epoch`
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ for jail_name in $("${LIBDIR}/bkctld-list"); do
|
||||||
# Today in ISO format
|
# Today in ISO format
|
||||||
today_iso=$(date +"%Y-%m-%d")
|
today_iso=$(date +"%Y-%m-%d")
|
||||||
|
|
||||||
|
if [ -n "${incs_policy_file}" ]; then
|
||||||
# get jail last configuration date
|
# get jail last configuration date
|
||||||
jail_config_epoch=$(date --date "$(stat -c %y ${incs_policy_file})" +"%s")
|
jail_config_epoch=$(date --date "$(stat -c %y ${incs_policy_file})" +"%s")
|
||||||
|
|
||||||
if [ -n "${incs_policy_file}" ]; then
|
|
||||||
# loop for each line in jail configuration
|
# loop for each line in jail configuration
|
||||||
for line in $(cat ${incs_policy_file}); do
|
for line in $(cat ${incs_policy_file}); do
|
||||||
# inc date in ISO format
|
# inc date in ISO format
|
||||||
|
|
Loading…
Reference in a new issue