mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-01-27 08:17:19 -05:00
refactoring
This commit is contained in:
parent
bfee6b60cb
commit
4f65b0fc1e
@ -56,7 +56,7 @@ add_statoverride_entry() {
|
|||||||
fi
|
fi
|
||||||
done < <( stat -c "%n %a %U %G" "${fso%/}/"** )
|
done < <( stat -c "%n %a %U %G" "${fso%/}/"** )
|
||||||
else
|
else
|
||||||
echo_wrapper dpkg-statoverride --add --update "$owner" "$group" "$mode" "${fso%/}"
|
echo_wrapper dpkg-statoverride --add --update "$owner" "$group" "$mode_from_config" "${fso%/}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ set_file_perms() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! read -r fso mode owner group capability <<< "$line" ; then
|
if ! read -r fso mode_from_config owner group capability <<< "$line" ; then
|
||||||
exit_code=201
|
exit_code=201
|
||||||
echo "ERROR: cannot parse line: $line" >&2
|
echo "ERROR: cannot parse line: $line" >&2
|
||||||
continue
|
continue
|
||||||
@ -90,14 +90,14 @@ set_file_perms() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
nosuid=""
|
nosuid=""
|
||||||
if [ "$mode" = "nosuid" ]; then
|
if [ "$mode_from_config" = "nosuid" ]; then
|
||||||
nosuid="true"
|
nosuid="true"
|
||||||
elif ! seq -w 000 4777 | grep -qw "$mode"; then
|
elif ! seq -w 000 4777 | grep -qw "$mode_from_config"; then
|
||||||
echo "ERROR: Mode '$mode' is invalid!" >&2
|
echo "ERROR: Mode '$mode_from_config' is invalid!" >&2
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! "$mode" = "nosuid" ]; then
|
if [ ! "$mode_from_config" = "nosuid" ]; then
|
||||||
if ! getent passwd | grep -q "^${owner}:"; then
|
if ! getent passwd | grep -q "^${owner}:"; then
|
||||||
echo "ERROR: User '$owner' does not exist!" >&2
|
echo "ERROR: User '$owner' does not exist!" >&2
|
||||||
continue
|
continue
|
||||||
@ -114,7 +114,7 @@ set_file_perms() {
|
|||||||
if dpkg-statoverride --list | grep -q "${fso%/}"; then
|
if dpkg-statoverride --list | grep -q "${fso%/}"; then
|
||||||
## If there is an entry for the fso, but the owner/group/mode do not
|
## If there is an entry for the fso, but the owner/group/mode do not
|
||||||
## match, we remove and re-add the entry to update it.
|
## match, we remove and re-add the entry to update it.
|
||||||
if ! dpkg-statoverride --list | grep -q "$owner $group ${mode:1} ${fso%/}"; then
|
if ! dpkg-statoverride --list | grep -q "$owner $group ${mode_from_config:1} ${fso%/}"; then
|
||||||
echo_wrapper dpkg-statoverride --remove "${fso}"
|
echo_wrapper dpkg-statoverride --remove "${fso}"
|
||||||
add_statoverride_entry
|
add_statoverride_entry
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user