Ignore:
Timestamp:
03/14/14 10:23:18 (4 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.2
Children:
bf6b163
Parents:
370de21
Message:

Small update to PCDM:
1) Clean up session management/restarts (in case login fails during all the PAM or user/group changes)
2) Update the location of the lastlogin file (/var/db/pcdm/lastlogin), and make sure it is getting saved/loaded properly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/src/pcdm-xprocess.cpp

    ra51a897 rfdf420c  
    4949  xlang = lang; 
    5050  //Now start the login process 
    51   startXSession(); 
     51  if( !startXSession() ){ 
     52    //Could not continue after session changed significantly - close down the session to restart 
     53    QCoreApplication::exit(-1); //special code to make sure we are just restarting the PCDM session (not the full X session) 
     54  } 
    5255} 
    5356 
     
    6972 
    7073bool XProcess::startXSession(){ 
    71   //disconnect(SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotCleanup()) ); 
     74  //Returns TRUE if the session can continue, or FALSE if it needs to be closed down 
     75 
    7276  //Check that the necessary info to start the session is available 
    7377  if( xuser.isEmpty() || xcmd.isEmpty() || xhome.isEmpty() || xde.isEmpty() ){ 
    7478    emit InvalidLogin();  //Make sure the GUI knows that it was a failure 
    75     return FALSE; 
     79    return true; 
    7680  } 
    7781  //Backend::log("Starting up Desktop environment ("+xcmd+") as user ("+xuser+")"); 
    7882   
    7983  //Check for PAM username/password validity 
    80   if( !pam_checkPW() ){ emit InvalidLogin(); pam_shutdown(); return FALSE; } 
     84  if( !pam_checkPW() ){ emit InvalidLogin(); pam_shutdown(); return true; } 
    8185 
    8286 
    8387  //Save the current user/desktop as the last login 
    84   Backend::saveLoginInfo(Backend::getDisplayNameFromUsername(xuser),xde); 
     88  Backend::saveLoginInfo(xuser,xde); 
    8589 
    8690  // Get the users uid/gid information 
     
    9296      uid = strtol(xuser.toLatin1(), &ok, 10); 
    9397      if (!(pw = getpwuid(uid))) { 
    94           emit InvalidLogin();  //Make sure the GUI knows that it was a failure 
    9598          return FALSE; 
    9699      } 
     
    110113  if (setgid(pw->pw_gid) < 0) { 
    111114      qDebug() << "setgid() failed!"; 
    112       emit InvalidLogin();  //Make sure the GUI knows that it was a failure 
    113115      return FALSE; 
    114116  } 
     
    117119  if (initgroups(xuser.toLatin1(), pw->pw_gid) < 0) { 
    118120      qDebug() << "initgroups() failed!"; 
    119       emit InvalidLogin();  //Make sure the GUI knows that it was a failure 
    120121      setgid(0); 
    121122      return FALSE; 
     
    125126  if (setuid(pw->pw_uid) < 0) { 
    126127      qDebug() << "setuid() failed!"; 
    127       emit InvalidLogin();  //Make sure the GUI knows that it was a failure 
    128128      return FALSE; 
    129129  } 
Note: See TracChangeset for help on using the changeset viewer.