summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>2015-10-23 09:11:48 -0200
committerLaércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>2015-10-23 09:11:48 -0200
commit805a5f75427fb223a41171a8d1740cd3b05655a3 (patch)
tree31d18c904218ac8281cd92b7a009bcc66d0f2a92
parent485c1077afd33a7c47ff1ee088f4449e28705f15 (diff)
downloadlightdm-805a5f75427fb223a41171a8d1740cd3b05655a3.tar.gz
Don't fail to remove guest account if its home directory can't be removed, so that /etc/passwd won't be polluted.
-rw-r--r--debian/guest-account.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/debian/guest-account.sh b/debian/guest-account.sh
index 46874f35..127d3ced 100644
--- a/debian/guest-account.sh
+++ b/debian/guest-account.sh
@@ -143,7 +143,7 @@ add_account ()
remove_account ()
{
GUEST_USER=${1}
-
+
PWENT=$(getent passwd ${GUEST_USER}) || {
echo "Error: invalid user ${GUEST_USER}"
exit 1
@@ -158,25 +158,25 @@ remove_account ()
GUEST_HOME=$(echo ${PWENT} | cut -f6 -d:)
- if [ ${GUEST_HOME} = ${GUEST_HOME#/tmp/} ]; then
- echo "Error: home directory ${GUEST_HOME} is not in /tmp/."
- exit 1
- fi
-
# kill all remaining processes
if [ -x /bin/loginctl ] || [ -x /usr/bin/loginctl ]; then
loginctl terminate-user ${GUEST_USER} >/dev/null || true
else
- while ps h -u ${GUEST_USER} >/dev/null; do
+ while ps h -u ${GUEST_USER} >/dev/null
+ do
killall -9 -u ${GUEST_USER} || true
- sleep 0.2;
+ sleep 0.2;
done
fi
- umount ${GUEST_HOME} || umount -l ${GUEST_HOME} || true # BindFS mount
- umount ${GUEST_HOME} || umount -l ${GUEST_HOME} || true # union mount
- umount ${GUEST_HOME} || umount -l ${GUEST_HOME} || true # tmpfs mount
- rm -rf ${GUEST_HOME}
+ if [ ${GUEST_HOME} = ${GUEST_HOME#/tmp/} ]; then
+ echo "Warning: home directory ${GUEST_HOME} is not in /tmp/. It won't be removed."
+ else
+ umount ${GUEST_HOME} || umount -l ${GUEST_HOME} || true # BindFS mount
+ umount ${GUEST_HOME} || umount -l ${GUEST_HOME} || true # union mount
+ umount ${GUEST_HOME} || umount -l ${GUEST_HOME} || true # tmpfs mount
+ rm -rf ${GUEST_HOME}
+ fi
# remove leftovers in /tmp
find /tmp -mindepth 1 -maxdepth 1 -uid ${GUEST_UID} -print0 | xargs -0 rm -rf || true