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

Loading…
Cancel
Save