mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-02-13 07:41:27 -05:00
Make the main field count check in permission-hardener a bit more elegant
This commit is contained in:
parent
895c0f541f
commit
93ebf176c5
@ -410,13 +410,14 @@ load_state() {
|
||||
|
||||
IFS=' ' read -r -a field_list <<< "${line}"
|
||||
|
||||
if (( ${#field_list[@]} != 2 )) \
|
||||
&& (( ${#field_list[@]} != 4 )) \
|
||||
&& (( ${#field_list[@]} != 5 )); then
|
||||
exit_code=200
|
||||
log error "Line contains an invalid number of fields: '${line}'" >&2
|
||||
exit "${exit_code}"
|
||||
fi
|
||||
case "${#field_list[@]}" in
|
||||
2|4|5) true;;
|
||||
*)
|
||||
exit_code=200
|
||||
log error "Line contains an invalid number of fields: '${line}'" >&2
|
||||
exit "${exit_code}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Strip trailing slash if appropriate
|
||||
field_list[0]="${field_list[0]%/}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user