/usr/lib/games/slashem/recover-all is in slashem-common 0.0.7E7F3-9.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/bin/sh
set -e
cd /var/games/slashem
for file in *.0; do
# Note "$file" is always explicitly quoted to avoid attack.
# If there are no files, then "$file" = "*.0", which doesn't
# exist, so we skip once through this loop and exit.
# Also, the way this is written, some of the files may
# disappear before we look at them.
# Also check -L--there shouldn't be any symlinks, but if there
# are, we aren't going to process them.
if [ -f "$file" ] && [ ! -L "$file" ]; then
# Use 'find' to reliably determine the file's owner user name.
owner="$(find "$file" -maxdepth 0 -printf '%u')"
# Refuse to recover root's slashem files.
if [ "xroot" = "x$owner" ]; then
echo "Ignoring root's slashem unrecovered save file."
else
echo "Recovering slashem save files owned by $owner: "
# "$owner" is explicitly quoted to avoid attack.
# In particular, if the "find" command above fails,
# so will the 'su' command below.
# There really isn't a good safe way to pass a filename to
# a child shell through 'su -c', so instead we use a helper
# script running as the user which recovers everything
# owned by that user. This avoids the issue of quoting
# filenames passed through the shell entirely.
su --shell=/bin/sh -c /usr/lib/games/slashem/recover-helper "$owner"
fi
fi
done
|