#! /bin/sh
#
# This script is run as root after the user logs in.
# If this script exits with a return code other than 0, the user's
# session will not be started.

if grep -q ^obey-nologin /etc/X11/config
then
  if [ -f /etc/nologin ]
  then
    xmessage -file /etc/nologin -geometry 640x480
    exit 1
  fi
fi

# Insert a utmp entry for the session
if grep -q ^use-sessreg /etc/X11/config
then
  sessreg -a -l $DISPLAY -u /var/log/utmp -x /etc/X11/xdm/Xservers $USER
fi

exit 0
