source: src-qt4/PCDM/PCDMd @ 6449f61

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 6449f61 was 6449f61, checked in by Ken Moore <ken@…>, 11 months ago

Add in the xhost authentication routine when logging in a user. This will allow the user access to the display. Also fix the authorization file cleanup between sessions of PCDM.

  • Property mode set to 100755
File size: 1.6 KB
Line 
1#!/bin/sh
2# Login daemon for PCDM
3# This starts the main PCDM UI appropriately
4#------------------------------------
5
6PCDMCONF="/usr/local/etc/pcdm.conf"
7PCDMAUTHFILE="/tmp/.PCDMAuth"
8
9XOPTS=""
10grep -q "^ENABLE_TCP_LISTEN=TRUE" ${PCDMCONF}
11if [ $? -ne 0 ]; then
12  XOPTS="-nolisten tcp" 
13fi
14
15#See if VNC support is enabled for logging in to this system
16grep -q "^ALLOW_REMOTE_LOGIN=TRUE" ${PCDMCONF}
17if [ $? -eq 0 ]; then
18   # Setup default vnc server opts
19   vncopts="-forever "
20   grep -q "^REMOTE_SHARED_SCREEN=TRUE" ${PCDMCONF}
21   if [ $? -eq 0 ] ; then
22     vncopts="-shared "
23   else
24     vncopts="-nevershared "
25   fi
26   if [ -e "/usr/local/etc/vncpass" ] ; then
27     vnccmd="x11vnc -display :0 $vncopts -passwdfile /usr/local/etc/vncpass -loop"
28   else
29     echo "WARNING: VNC enabled but no password in /usr/local/etc/vncpass!"
30     sleep 5
31   fi
32
33fi
34
35
36# Allow Auto-Login the first time PCDM starts
37touch /tmp/.PCDMAutoLogin
38# Now start the X Server
39while [ ! -e /var/run/nologin ]; do
40  /usr/local/bin/pc-checkxdisplay
41  # Make sure the authorization file does not exist
42  if [ -f ${PCDMAUTHFILE} ]; then
43    rm ${PCDMAUTHFILE}
44  fi
45  setenv XAUTHORITY ${PCDMAUTHFILE} #Set the auth file location
46  touch ${PCDMAUTHFILE} #Create the (empty) authorization file
47  xauth add :0 MIT-MAGIC-COOKIE-1 1234567890 #Add a default entry to the file (will randomize it later)
48  if [ -n "$vnccmd" ] ; then
49    # Start VNC
50    (sleep 10 ; $vnccmd >/var/log/vncserver 2>/var/log/vncserver) &
51  fi
52  xinit /usr/local/bin/PCDM-session -once -- :0 +extension SECURITY -auth ${PCDMAUTHFILE} $XOPTS
53done
Note: See TracBrowser for help on using the repository browser.