improve output if set-user-id / set-group-id is set

This commit is contained in:
Patrick Schleizer 2019-12-20 05:37:33 -05:00
parent 6dd6530fa5
commit 66fd31189d
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -30,7 +30,20 @@ add_nosuid_statoverride_entry() {
continue
fi
if test -u "$file_name" || test -g "$file_name"; then
setuid=""
setuid_output=""
if test -u "$file_name" ; then
setuid=true
setuid_output="set-user-id"
fi
setguid=""
setguid_output=""
if test -g "$file_name"; then
setguid=true
setguid_output="set-group-id"
fi
if [ "$setguid" = "true" ] || [ "setguid" = "true" ]; then
string_length_of_existing_mode="${#existing_mode}"
if [ "$string_length_of_existing_mode" = "4" ]; then
new_mode="${existing_mode:1}"
@ -38,7 +51,7 @@ add_nosuid_statoverride_entry() {
new_mode="$existing_mode"
fi
echo "INFO: suid - file_name: '$file_name' | existing_mode: '$existing_mode' | new_mode: '$new_mode'"
echo "INFO: $setuid_output $setguid_output found - file_name: '$file_name' | existing_mode: '$existing_mode' | new_mode: '$new_mode'"
if dpkg-statoverride --list | grep -q "$file_name"; then
if ! dpkg-statoverride --list | grep -q "$owner $group $new_mode $file_name"; then