slackware-current/patches/source/polkit/doinst.sh
Patrick J Volkerding 477bd290fa Sat Mar 12 20:57:35 UTC 2022
patches/packages/polkit-0.120-x86_64-3_slack15.0.txz:  Rebuilt.
  Patched to fix a security issue where an unprivileged user could cause a
  denial of service due to process file descriptor exhaustion.
  Thanks to marav.
  For more information, see:
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-4115
  (* Security fix *)
2022-03-13 13:29:55 +01:00

32 lines
943 B
Bash

config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
if [ -r etc/pam.d/polkit-1.new ]; then
config etc/pam.d/polkit-1.new
fi
# Make sure the polkitd user and group exist:
if ! grep -q "^polkitd:" etc/passwd ; then
echo "polkitd:x:87:87:PolicyKit daemon owner:/var/lib/polkit:/bin/false" >> etc/passwd
fi
if ! grep -q "^polkitd:" etc/group ; then
echo "polkitd:x:87:" >> etc/group
fi
# Remove obsolete rules:
rm -f etc/polkit-1/localauthority/50-local.d/*.pkla{,.new}
rm -f etc/polkit-1/rules.d/*.pkla{,.new}
# Remove obsolete directory:
rmdir etc/polkit-1/localauthority/50-local.d 2> /dev/null
rmdir etc/polkit-1/localauthority 2> /dev/null