mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-02-13 07:21:25 -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}"
|
IFS=' ' read -r -a field_list <<< "${line}"
|
||||||
|
|
||||||
if (( ${#field_list[@]} != 2 )) \
|
case "${#field_list[@]}" in
|
||||||
&& (( ${#field_list[@]} != 4 )) \
|
2|4|5) true;;
|
||||||
&& (( ${#field_list[@]} != 5 )); then
|
*)
|
||||||
exit_code=200
|
exit_code=200
|
||||||
log error "Line contains an invalid number of fields: '${line}'" >&2
|
log error "Line contains an invalid number of fields: '${line}'" >&2
|
||||||
exit "${exit_code}"
|
exit "${exit_code}"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Strip trailing slash if appropriate
|
# Strip trailing slash if appropriate
|
||||||
field_list[0]="${field_list[0]%/}"
|
field_list[0]="${field_list[0]%/}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user