#! /bin/sh
# Xreset - run as root after session exits

# Reassign ownership of the console to root, this should disallow
# assignment of console output to any random users's xterm
# This is not required if you use PAM, as pam_console should handle it.
#
chown root /dev/console
chmod 622 /dev/console

if [ -f /usr/lib/X11/xdm/sessreg ]; then
  devname=`echo $DISPLAY | /usr/bin/sed -e 's/[:\.]/_/g' | /usr/bin/cut -c1-8`
  exec /usr/lib/X11/xdm/sessreg -d -l xdm/$devname $USER
fi
