summaryrefslogtreecommitdiffstats
path: root/tdm/kfrontend
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-25 08:33:19 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-25 08:33:19 -0500
commit33dc3f2d3960e4a7e5d51b00a6e511a7e326d36f (patch)
treebe988e54837755cc53c672714ab8ef2a38477b4e /tdm/kfrontend
parentedf3004ec3bd7bf7d2d1c3074281ce22188f3e35 (diff)
downloadtdebase-33dc3f2d3960e4a7e5d51b00a6e511a7e326d36f.tar.gz
tdebase-33dc3f2d3960e4a7e5d51b00a6e511a7e326d36f.zip
Ensure that tdm always reacquires root ownership after user listing is complete
This resolves Bug 1402
Diffstat (limited to 'tdm/kfrontend')
-rw-r--r--tdm/kfrontend/kgreeter.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/tdm/kfrontend/kgreeter.cpp b/tdm/kfrontend/kgreeter.cpp
index 9bcf60eb5..bffcc5d6d 100644
--- a/tdm/kfrontend/kgreeter.cpp
+++ b/tdm/kfrontend/kgreeter.cpp
@@ -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) {