diff --git a/build-files/conf/port-make.conf b/build-files/conf/port-make.conf index 7e54ff0c1..6ed40bde9 100644 --- a/build-files/conf/port-make.conf +++ b/build-files/conf/port-make.conf @@ -79,6 +79,7 @@ jasperserver_SET=XLS k3b_SET=SOX NORMALIZE TRANSCODE kmymoney-kde4_SET=KBANKING OFX kopete_SET=WEBCAM +krdc_SET=FREERDP libreoffice_SET=SYSTRAY libxine_SET=LIBBLURAY VAAPI WAVPACK SMB XVMC libxul_UNSET=ALSA diff --git a/src-qt4/PCDM/src/main.cpp b/src-qt4/PCDM/src/main.cpp index 5d352e957..968f8aac9 100644 --- a/src-qt4/PCDM/src/main.cpp +++ b/src-qt4/PCDM/src/main.cpp @@ -144,11 +144,8 @@ int runSingleSession(int argc, char *argv[]){ w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint); w.setWindowState(Qt::WindowMaximized); //Qt::WindowFullScreen); - //Setup the signals/slots to startup the desktop session - //if(USECLIBS){ QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString)), &desktop,SLOT(setupDesktop(QString,QString,QString))); } - //else{ - QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString,QString)), &desktop,SLOT(loginToXSession(QString,QString,QString,QString)) ); - //} + //Setup the signals/slots to startup the desktop session + QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString,QString)), &desktop,SLOT(loginToXSession(QString,QString,QString,QString)) ); //Setup the signals/slots for return information for the GUI QObject::connect( &desktop, SIGNAL(InvalidLogin()), &w, SLOT(slotLoginFailure()) ); QObject::connect( &desktop, SIGNAL(started()), &w, SLOT(slotLoginSuccess()) ); @@ -159,10 +156,7 @@ int runSingleSession(int argc, char *argv[]){ retCode = a.exec(); } // end of PCDM GUI running //Wait for the desktop session to finish before exiting - //if(USECLIBS){ desktop.startDesktop(); } - //else{ desktop.waitForSessionClosed(); - //} splash.show(); //show the splash screen again //Now wait a couple seconds for things to settle QTime wTime = QTime::currentTime().addSecs(2); @@ -179,8 +173,6 @@ int runSingleSession(int argc, char *argv[]){ //Keep processing events during the wait (for splashscreen) QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } - //set the return code for a shutdown - retCode = -1; //make sure it does not start a new session } //Clean up Code @@ -213,7 +205,8 @@ int main(int argc, char *argv[]) int retCode = runSingleSession(argc,argv); qDebug() << "-- PCDM Session Ended --"; //check for special exit code - if(retCode != 0){ neverquit=FALSE; } + if(retCode == -1){ neverquit=true; } //make sure we go around again at least once + else if(retCode != 0){ neverquit=FALSE; } //Now kill the shild process (whole session) qDebug() << "Exiting child process"; exit(3); diff --git a/src-qt4/PCDM/src/pcdm-backend.cpp b/src-qt4/PCDM/src/pcdm-backend.cpp index 5cc1aade8..27dd20464 100644 --- a/src-qt4/PCDM/src/pcdm-backend.cpp +++ b/src-qt4/PCDM/src/pcdm-backend.cpp @@ -91,7 +91,11 @@ QString Backend::getUsernameFromDisplayname(QString dspname){ QString Backend::getDisplayNameFromUsername(QString username){ int i = usernameList.indexOf(username); - return displaynameList[i]; + if(i==-1){ i = displaynameList.indexOf(username); } //make sure it was not a display name passed in + if(i==-1){ return ""; } + else{ + return displaynameList[i]; + } } QString Backend::getUserHomeDir(QString username){ @@ -249,8 +253,8 @@ void Backend::checkLocalDirs(){ //Check for sample files if(!mainDir.exists("pcdm.conf.sample")){ QFile::copy(":samples/pcdm.conf",base+"/pcdm.conf.sample"); } //Check for the PCDM runtime directory - mainDir.cd("/var/db/pcdm"); - if(!mainDir.exists()){ mainDir.mkdir("/var/db/pcdm"); } + mainDir.cd(DBDIR); + if(!mainDir.exists()){ mainDir.mkpath(DBDIR); } } QString Backend::getLastUser(){ @@ -259,7 +263,8 @@ QString Backend::getLastUser(){ readSystemLastLogin(); } //return the value - return lastUser; + QString user = getDisplayNameFromUsername(lastUser); + return user; } QString Backend::getLastDE(QString user){ @@ -273,7 +278,7 @@ QString Backend::getLastDE(QString user){ } void Backend::saveLoginInfo(QString user, QString desktop){ - writeSystemLastLogin(user,desktop); //save the system file (/usr/local/share/PCDM/.lastlogin) + writeSystemLastLogin(user,desktop); //save the system file (DBDIR/lastlogin) writeUserLastDesktop(user,desktop); //save the user file (~/.lastlogin) } @@ -284,7 +289,7 @@ void Backend::readDefaultSysEnvironment(QString &lang, QString &keymodel, QStrin keylayout = "us"; keyvariant = ""; //Read the current inputs file and overwrite default values - QFile file("/var/db/pcdm/defaultInputs"); + QFile file(DBDIR+"defaultInputs"); bool goodFile=false; if(file.exists()){ if(file.open(QIODevice::ReadOnly | QIODevice::Text) ){ @@ -308,11 +313,11 @@ void Backend::readDefaultSysEnvironment(QString &lang, QString &keymodel, QStrin } void Backend::saveDefaultSysEnvironment(QString lang, QString keymodel, QString keylayout, QString keyvariant){ - QFile file("/var/db/pcdm/defaultInputs"); + QFile file(DBDIR+"defaultInputs"); //Make sure the containing directory exists - if(!QFile::exists("/var/db/pcdm")){ + if(!QFile::exists(DBDIR)){ QDir dir; - dir.mkpath("/var/db/pcdm"); + dir.mkpath(DBDIR); } //Now save the file if(file.open(QIODevice::WriteOnly | QIODevice::Text) ){ @@ -540,12 +545,12 @@ void Backend::readSystemUsers(){ } void Backend::readSystemLastLogin(){ - if(!QFile::exists("/usr/local/share/PCDM/.lastlogin")){ + if(!QFile::exists(DBDIR+"lastlogin")){ lastUser.clear(); Backend::log("PCDM: No previous login data found"); }else{ //Load the previous login data - QFile file("/usr/local/share/PCDM/.lastlogin"); + QFile file(DBDIR+"lastlogin"); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ Backend::log("PCDM: Unable to open previous login data file"); }else{ @@ -558,7 +563,7 @@ void Backend::readSystemLastLogin(){ } void Backend::writeSystemLastLogin(QString user, QString desktop){ - QFile file1("/usr/local/share/PCDM/.lastlogin"); + QFile file1(DBDIR+"lastlogin"); if(!file1.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)){ Backend::log("PCDM: Unable to save last login data to system directory"); }else{ diff --git a/src-qt4/PCDM/src/pcdm-backend.h b/src-qt4/PCDM/src/pcdm-backend.h index b971704fd..67cf954f5 100644 --- a/src-qt4/PCDM/src/pcdm-backend.h +++ b/src-qt4/PCDM/src/pcdm-backend.h @@ -19,6 +19,7 @@ #include "pcbsd-utils.h" #define PCSYSINSTALL QString("/usr/sbin/pc-sysinstall") +#define DBDIR QString("/var/db/pcdm/") class Process : public QProcess { public: diff --git a/src-qt4/PCDM/src/pcdm-xprocess.cpp b/src-qt4/PCDM/src/pcdm-xprocess.cpp index 7199cd2f6..58878d41a 100644 --- a/src-qt4/PCDM/src/pcdm-xprocess.cpp +++ b/src-qt4/PCDM/src/pcdm-xprocess.cpp @@ -48,7 +48,10 @@ void XProcess::loginToXSession(QString username, QString password, QString deskt xde = desktop; xlang = lang; //Now start the login process - startXSession(); + if( !startXSession() ){ + //Could not continue after session changed significantly - close down the session to restart + QCoreApplication::exit(-1); //special code to make sure we are just restarting the PCDM session (not the full X session) + } } bool XProcess::isRunning(){ @@ -68,20 +71,21 @@ void XProcess::waitForSessionClosed(){ */ bool XProcess::startXSession(){ - //disconnect(SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotCleanup()) ); + //Returns TRUE if the session can continue, or FALSE if it needs to be closed down + //Check that the necessary info to start the session is available if( xuser.isEmpty() || xcmd.isEmpty() || xhome.isEmpty() || xde.isEmpty() ){ emit InvalidLogin(); //Make sure the GUI knows that it was a failure - return FALSE; + return true; } //Backend::log("Starting up Desktop environment ("+xcmd+") as user ("+xuser+")"); //Check for PAM username/password validity - if( !pam_checkPW() ){ emit InvalidLogin(); pam_shutdown(); return FALSE; } + if( !pam_checkPW() ){ emit InvalidLogin(); pam_shutdown(); return true; } //Save the current user/desktop as the last login - Backend::saveLoginInfo(Backend::getDisplayNameFromUsername(xuser),xde); + Backend::saveLoginInfo(xuser,xde); // Get the users uid/gid information struct passwd *pw; @@ -91,7 +95,6 @@ bool XProcess::startXSession(){ if (!(pw = getpwnam(xuser.toLatin1()))) { uid = strtol(xuser.toLatin1(), &ok, 10); if (!(pw = getpwuid(uid))) { - emit InvalidLogin(); //Make sure the GUI knows that it was a failure return FALSE; } } @@ -109,14 +112,12 @@ bool XProcess::startXSession(){ //QWidget *wid = new QWidget(); if (setgid(pw->pw_gid) < 0) { qDebug() << "setgid() failed!"; - emit InvalidLogin(); //Make sure the GUI knows that it was a failure return FALSE; } // Setup our other groups if (initgroups(xuser.toLatin1(), pw->pw_gid) < 0) { qDebug() << "initgroups() failed!"; - emit InvalidLogin(); //Make sure the GUI knows that it was a failure setgid(0); return FALSE; } @@ -124,7 +125,6 @@ bool XProcess::startXSession(){ // Lets drop to user privs if (setuid(pw->pw_uid) < 0) { qDebug() << "setuid() failed!"; - emit InvalidLogin(); //Make sure the GUI knows that it was a failure return FALSE; } //Startup the PAM session diff --git a/src-qt4/libpcbsd/utils/netif.cpp b/src-qt4/libpcbsd/utils/netif.cpp index dac6ca93b..4198ed4a6 100644 --- a/src-qt4/libpcbsd/utils/netif.cpp +++ b/src-qt4/libpcbsd/utils/netif.cpp @@ -536,7 +536,9 @@ void NetworkInterface::wifiQuickConnect(QString SSID, QString netKey, QString De } else if ( SecType.contains("WEP") ) { //Set WEP Defaults int WEPIndex = 0; - bool WEPHex = true; //Use Hex WEP key + // Default to plain-text WEP keys.. + // This needs to be fixed to figure it out automatically + bool WEPHex = false; streamout << " key_mgmt=NONE\n"; streamout << " wep_tx_keyidx=" + tmp.setNum(WEPIndex) + "\n"; diff --git a/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp b/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp index 76a0f2414..918afb31d 100644 --- a/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp +++ b/src-qt4/pc-netmanager/src/wificonfig/wificonfigwidgetbase.cpp @@ -164,9 +164,9 @@ void wificonfigwidgetbase::updateWPASupp() streamout << " wep_tx_keyidx=" + tmp.setNum(WEPIndex[curItem]) + "\n"; // Check if we are using a plaintext WEP or not if ( WEPHex[curItem] ) - streamout << " wep_key" + tmp.setNum(WEPIndex[curItem]) + "=\"" + WEPKey[curItem] + "\"\n"; - else streamout << " wep_key" + tmp.setNum(WEPIndex[curItem]) + "=" + WEPKey[curItem] + "\n"; + else + streamout << " wep_key" + tmp.setNum(WEPIndex[curItem]) + "=\"" + WEPKey[curItem] + "\"\n"; } else if (SSIDEncType[curItem] == WPA_ENCRYPTION ) {