Changeset 6449f61


Ignore:
Timestamp:
11/04/13 14:04:44 (9 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
b6cbe03
Parents:
7257d51
Message:

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.

Location:
src-qt4/PCDM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/PCDMd

    r7257d51 r6449f61  
    3636# Allow Auto-Login the first time PCDM starts 
    3737touch /tmp/.PCDMAutoLogin 
    38 # Make sure the authorization file exists 
    39 setenv XAUTHORITY ${PCDMAUTHFILE} #Set the auth file location 
    40 touch ${PCDMAUTHFILE} #Create the authorication file 
    41 xauth add :0 MIT-MAGIC-COOKIE-1 1234567890 #Add a default entry to the file (will randomize it later) 
    4238# Now start the X Server 
    4339while [ ! -e /var/run/nologin ]; do 
    4440  /usr/local/bin/pc-checkxdisplay 
    45  
     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) 
    4648  if [ -n "$vnccmd" ] ; then 
    4749    # Start VNC 
  • src-qt4/PCDM/src/main.cpp

    r65d5ce2 r6449f61  
    173173  if(runonce){ neverquit = FALSE; } 
    174174  qDebug() << " -- PCDM Session Starting..."; 
    175   system("xauth -f "+TMPAUTHFILE.toUtf8()+" generate :0 ."); //Using MIT-MAGIC-COOKIE-1 protocol 
    176   //MIT-MAGIC-COOKIE-1 is good enough for our purposes since it is a single-user graphical system with no XDMCP 
    177175  int sid = -1; 
    178176  int pid = fork(); 
     
    200198  if(QFile::exists("/var/run/nologin")){ neverquit = FALSE; }  
    201199 } 
    202  system("xauth -f "+TMPAUTHFILE.toUtf8()+" remove :0"); 
    203200 return 0; 
    204201} 
  • src-qt4/PCDM/src/pcdm-xprocess.cpp

    ref8b856 r6449f61  
    9595  // Get the environment before we drop priv 
    9696  QProcessEnvironment environ = QProcessEnvironment::systemEnvironment(); //current environment 
    97  
     97  //Now allow this user access to the Xserver 
     98  QString xhostcmd = "xhost si:localuser:"+xuser; 
     99  system(xhostcmd.toUtf8()); 
     100   
    98101  //QWidget *wid = new QWidget(); 
    99102  if (setgid(pw->pw_gid) < 0) { 
     
    164167 
    165168void XProcess::slotCleanup(int exitCode, QProcess::ExitStatus status){ 
    166   pam_shutdown(); //make sure that PAM shuts down properly       
     169  pam_shutdown(); //make sure that PAM shuts down properly 
     170  //Now remove this user's access to the Xserver 
     171  QString xhostcmd = "xhost -si:localuser:"+xuser; 
     172  system(xhostcmd.toUtf8()); 
    167173} 
    168174 
Note: See TracChangeset for help on using the changeset viewer.