Ignore:
Timestamp:
02/27/14 11:11:58 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
47a52f4
Parents:
7c53dd2
Message:

Couple new features for PCDM
1) Add option to require that the user type in the username instead of just selecting one from a list (does not recognize "root" or "toor", I made sure of that)
2) Move the backend system user detection to using "getent" after conversation with john @ ixsystems. That should properly pick up LDAP/ActiveDirectory users as well, whereas "pw" might not.

File:
1 edited

Legend:

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

    r7af9bd1 rae41693  
    471471  bool usepw = true; //for testing purposes 
    472472  if(usepw){ 
    473     //Use "pw" to get all possible users 
     473    //Use "getent" to get all possible users 
    474474    QProcess p; 
    475475    p.setProcessChannelMode(QProcess::MergedChannels); 
     
    477477      env.insert("MM_CHARSET","UTF-8"); 
    478478    p.setProcessEnvironment(env); 
    479     p.start("pw usershow -a"); 
     479    p.start("getent passwd"); 
    480480    while(p.state()==QProcess::Starting || p.state() == QProcess::Running){ 
    481481      p.waitForFinished(200); 
     
    488488    bool bad = FALSE; 
    489489    // "nologin" as their shell 
    490     if(uList[i].section(":",9,9).contains("nologin")){bad=TRUE;} 
     490    if(uList[i].section(":",6,6).contains("nologin")){bad=TRUE;} 
    491491    // "nonexistent" as their user directory 
    492     else if(uList[i].section(":",8,8).contains("nonexistent")){bad=TRUE;} 
     492    else if(uList[i].section(":",5,5).contains("nonexistent")){bad=TRUE;} 
    493493    // uid > 1000 
    494494    else if(uList[i].section(":",2,2).toInt() < 1000){bad=TRUE;} 
     
    499499      //Add this user to the lists if it is good 
    500500      usernameList << uList[i].section(":",0,0).simplified(); 
    501       displaynameList << uList[i].section(":",7,7).simplified(); 
    502       homedirList << uList[i].section(":",8,8).simplified(); 
    503       usershellList << uList[i].section(":",9,9).simplified(); 
     501      displaynameList << uList[i].section(":",4,4).simplified(); 
     502      homedirList << uList[i].section(":",5,5).simplified(); 
     503      usershellList << uList[i].section(":",6,6).simplified(); 
    504504    } 
    505505   } 
Note: See TracChangeset for help on using the changeset viewer.