Ensure that tdm always reacquires root ownership after user listing is complete

This resolves Bug 1402
pull/2/head
Timothy Pearson 11 years ago
parent edf3004ec3
commit 33dc3f2d39

@ -194,8 +194,9 @@ KGreeter::KGreeter( bool framed )
connect( userView, TQT_SIGNAL(doubleClicked( TQListViewItem * )),
TQT_SLOT(accept()) );
}
if (_userCompletion)
if (_userCompletion) {
userList = new TQStringList;
}
sessMenu = new TQPopupMenu( this );
connect( sessMenu, TQT_SIGNAL(activated( int )),
@ -311,10 +312,14 @@ KGreeter::insertUser( const TQImage &default_pix,
return;
}
if (userList)
if (userList) {
userList->append( username );
if (!userView)
}
if (!userView) {
seteuid(0);
setegid(0);
return;
}
int dp = 0, nd = 0;
if (_faceSource == FACE_USER_ONLY ||
@ -333,8 +338,9 @@ KGreeter::insertUser( const TQImage &default_pix,
int fd, ico;
if ((fd = open( fn.data(), O_RDONLY | O_NONBLOCK )) < 0) {
fn.truncate( fn.length() - 5 );
if ((fd = open( fn.data(), O_RDONLY | O_NONBLOCK )) < 0)
if ((fd = open( fn.data(), O_RDONLY | O_NONBLOCK )) < 0) {
continue;
}
ico = 0;
} else
ico = 1;
@ -342,8 +348,7 @@ KGreeter::insertUser( const TQImage &default_pix,
f.open( IO_ReadOnly, fd );
int fs = f.size();
if (fs > (ico ? FILE_LIMIT_ICON : FILE_LIMIT_IMAGE) * 1000) {
LogWarn( "%s exceeds file size limit (%dkB)\n",
fn.data(), ico ? FILE_LIMIT_ICON : FILE_LIMIT_IMAGE );
LogWarn( "%s exceeds file size limit (%dkB)\n", fn.data(), ico ? FILE_LIMIT_ICON : FILE_LIMIT_IMAGE );
continue;
}
TQByteArray fc( fs );
@ -360,8 +365,9 @@ KGreeter::insertUser( const TQImage &default_pix,
}
p = ir.image();
TQSize ns( 48, 48 );
if (p.size() != ns)
if (p.size() != ns) {
p = p.convertDepth( 32 ).smoothScale( ns, TQ_ScaleMin );
}
break;
} while (--nd >= 0);
@ -376,8 +382,9 @@ KGreeter::insertUser( const TQImage &default_pix,
p.load( _faceDir + "/../pics/users/" + randomFace + ".png" );
}
if ( p.isNull() )
if ( p.isNull() ) {
p = default_pix;
}
TQString realname = KStringHandler::from8Bit( ps->pw_gecos );
realname.truncate( realname.find( ',' ) );
@ -436,8 +443,9 @@ KGreeter::insertUsers(int limit_users)
{
struct passwd *ps;
if (!(ps = getpwnam( "nobody" )))
if (!(ps = getpwnam( "nobody" ))) {
return;
}
TQImage default_pix;
if (userView) {

Loading…
Cancel
Save