Ignore:
Timestamp:
03/14/14 10:23:18 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.2, releng/10.0.3
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-backend.cpp

    rae41693 rfdf420c  
    9292QString Backend::getDisplayNameFromUsername(QString username){ 
    9393  int i = usernameList.indexOf(username); 
    94   return displaynameList[i];   
     94  if(i==-1){ i = displaynameList.indexOf(username); } //make sure it was not a display name passed in 
     95  if(i==-1){ return ""; } 
     96  else{ 
     97    return displaynameList[i];   
     98  } 
    9599} 
    96100 
     
    250254  if(!mainDir.exists("pcdm.conf.sample")){ QFile::copy(":samples/pcdm.conf",base+"/pcdm.conf.sample"); }  
    251255  //Check for the PCDM runtime directory 
    252   mainDir.cd("/var/db/pcdm"); 
    253   if(!mainDir.exists()){ mainDir.mkdir("/var/db/pcdm"); } 
     256  mainDir.cd(DBDIR); 
     257  if(!mainDir.exists()){ mainDir.mkpath(DBDIR); } 
    254258} 
    255259 
     
    260264  } 
    261265  //return the value 
    262   return lastUser; 
     266  QString user = getDisplayNameFromUsername(lastUser); 
     267  return user; 
    263268} 
    264269 
     
    274279 
    275280void Backend::saveLoginInfo(QString user, QString desktop){ 
    276   writeSystemLastLogin(user,desktop); //save the system file (/usr/local/share/PCDM/.lastlogin) 
     281  writeSystemLastLogin(user,desktop); //save the system file (DBDIR/lastlogin) 
    277282  writeUserLastDesktop(user,desktop); //save the user file (~/.lastlogin) 
    278283} 
     
    285290    keyvariant = ""; 
    286291  //Read the current inputs file and overwrite default values 
    287   QFile file("/var/db/pcdm/defaultInputs"); 
     292  QFile file(DBDIR+"defaultInputs"); 
    288293  bool goodFile=false; 
    289294  if(file.exists()){ 
     
    309314 
    310315void Backend::saveDefaultSysEnvironment(QString lang, QString keymodel, QString keylayout, QString keyvariant){ 
    311   QFile file("/var/db/pcdm/defaultInputs"); 
     316  QFile file(DBDIR+"defaultInputs"); 
    312317  //Make sure the containing directory exists 
    313   if(!QFile::exists("/var/db/pcdm")){ 
     318  if(!QFile::exists(DBDIR)){ 
    314319    QDir dir; 
    315     dir.mkpath("/var/db/pcdm"); 
     320    dir.mkpath(DBDIR); 
    316321  } 
    317322  //Now save the file 
     
    541546 
    542547void Backend::readSystemLastLogin(){ 
    543     if(!QFile::exists("/usr/local/share/PCDM/.lastlogin")){ 
     548    if(!QFile::exists(DBDIR+"lastlogin")){ 
    544549      lastUser.clear(); 
    545550      Backend::log("PCDM: No previous login data found"); 
    546551    }else{ 
    547552      //Load the previous login data 
    548       QFile file("/usr/local/share/PCDM/.lastlogin"); 
     553      QFile file(DBDIR+"lastlogin"); 
    549554      if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ 
    550555        Backend::log("PCDM: Unable to open previous login data file");     
     
    559564 
    560565void Backend::writeSystemLastLogin(QString user, QString desktop){ 
    561   QFile file1("/usr/local/share/PCDM/.lastlogin"); 
     566  QFile file1(DBDIR+"lastlogin"); 
    562567  if(!file1.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)){ 
    563568    Backend::log("PCDM: Unable to save last login data to system directory");      
Note: See TracChangeset for help on using the changeset viewer.