-rw-r--r-- | core/opie-login/main.cpp | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 3f1077c..b76d2c7 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -73,12 +73,15 @@ int main ( int argc, char **argv ) | |||
73 | return 1; | 73 | return 1; |
74 | } | 74 | } |
75 | if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and | 75 | /*! |
76 | ::setuid ( 0 ); // messes up things like config files | 76 | * @bug |
77 | 77 | * Qte does not really like being set UID root. This is | |
78 | //struct rlimit rl; | 78 | * largely because we do almost everything on config files |
79 | //::getrlimit ( RLIMIT_NOFILE, &rl ); | 79 | * in root context. So if you even want to use opie-login |
80 | 80 | * you are in for a world of hurt unless someone at least | |
81 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) | 81 | * scrubs the settings area and the PIM apps to make sure that |
82 | // ::close ( i ); | 82 | * they are covered regarding perms and users. |
83 | */ | ||
84 | if ( ::getuid ( ) != 0 ) | ||
85 | ::setuid ( 0 ); | ||
83 | 86 | ||
84 | ::setpgid ( 0, 0 ); | 87 | ::setpgid ( 0, 0 ); |
@@ -95,5 +98,6 @@ int main ( int argc, char **argv ) | |||
95 | c.setGroup( "autologin" ); | 98 | c.setGroup( "autologin" ); |
96 | QString entry = c.readEntry( "user", "" ); | 99 | QString entry = c.readEntry( "user", "" ); |
97 | if ( !entry.isEmpty() ) autolog = ::strdup( (const char*) entry ); | 100 | if ( !entry.isEmpty() ) |
101 | autolog = ::strdup( (const char*) entry ); | ||
98 | 102 | ||
99 | while ( true ) { | 103 | while ( true ) { |
@@ -108,5 +112,6 @@ int main ( int argc, char **argv ) | |||
108 | time_t started = ::time ( 0 ); | 112 | time_t started = ::time ( 0 ); |
109 | 113 | ||
110 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } | 114 | while ( ::waitpid ( child, &status, 0 ) < 0 ) |
115 | ; | ||
111 | 116 | ||
112 | LoginApplication::logout ( ); | 117 | LoginApplication::logout ( ); |
@@ -181,5 +186,4 @@ int main ( int argc, char **argv ) | |||
181 | 186 | ||
182 | if ( autolog && !userExited ) { | 187 | if ( autolog && !userExited ) { |
183 | |||
184 | QWSServer::setDesktopBackground( QImage() ); | 188 | QWSServer::setDesktopBackground( QImage() ); |
185 | ODevice::inst()->setDisplayStatus( true ); | 189 | ODevice::inst()->setDisplayStatus( true ); |
@@ -187,5 +191,4 @@ int main ( int argc, char **argv ) | |||
187 | LoginApplication::setLoginAs( autolog ); | 191 | LoginApplication::setLoginAs( autolog ); |
188 | 192 | ||
189 | |||
190 | if ( LoginApplication::changeIdentity ( )) | 193 | if ( LoginApplication::changeIdentity ( )) |
191 | ::exit ( LoginApplication::login ( )); | 194 | ::exit ( LoginApplication::login ( )); |
@@ -246,4 +249,5 @@ public: | |||
246 | break; | 249 | break; |
247 | case 2: | 250 | case 2: |
251 | default: | ||
248 | // We're going to suspend the whole machine | 252 | // We're going to suspend the whole machine |
249 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | 253 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { |
@@ -256,6 +260,4 @@ public: | |||
256 | } | 260 | } |
257 | 261 | ||
258 | private: | ||
259 | public: | ||
260 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) | 262 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) |
261 | { | 263 | { |
@@ -290,4 +292,5 @@ public: | |||
290 | if ( m_backlight_forcedoff && bright != -2 ) | 292 | if ( m_backlight_forcedoff && bright != -2 ) |
291 | return ; | 293 | return ; |
294 | |||
292 | if ( bright == -2 ) { | 295 | if ( bright == -2 ) { |
293 | // Toggle between off and on | 296 | // Toggle between off and on |
@@ -306,5 +309,4 @@ public: | |||
306 | private: | 309 | private: |
307 | bool m_lcd_status; | 310 | bool m_lcd_status; |
308 | |||
309 | int m_backlight_bright; | 311 | int m_backlight_bright; |
310 | bool m_backlight_forcedoff; | 312 | bool m_backlight_forcedoff; |
@@ -321,5 +323,6 @@ int login_main ( int argc, char **argv, pid_t ppid ) | |||
321 | 323 | ||
322 | if ( QWSServer::mouseHandler() && | 324 | if ( QWSServer::mouseHandler() && |
323 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 325 | QWSServer::mouseHandler()-> inherits("QCalibratedMouseHandler") ) |
326 | { | ||
324 | if ( !QFile::exists ( "/etc/pointercal" )) { | 327 | if ( !QFile::exists ( "/etc/pointercal" )) { |
325 | // Make sure calibration widget starts on top. | 328 | // Make sure calibration widget starts on top. |
@@ -336,8 +339,8 @@ int login_main ( int argc, char **argv, pid_t ppid ) | |||
336 | saver-> restore ( ); | 339 | saver-> restore ( ); |
337 | 340 | ||
338 | |||
339 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 341 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
340 | app-> setMainWidget ( lw ); | 342 | app-> setMainWidget ( lw ); |
341 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 343 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), |
344 | app-> desktop ( )-> height ( )); | ||
342 | lw-> show ( ); | 345 | lw-> show ( ); |
343 | 346 | ||
@@ -347,15 +350,14 @@ int login_main ( int argc, char **argv, pid_t ppid ) | |||
347 | if ( app-> changeIdentity ( )) { | 350 | if ( app-> changeIdentity ( )) { |
348 | app-> login ( ); | 351 | app-> login ( ); |
349 | |||
350 | // if login succeeds, it never comes back | 352 | // if login succeeds, it never comes back |
351 | 353 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), | |
352 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); | 354 | LoginWindowImpl::tr( "Could not start Opie." )); |
353 | rc = 1; | 355 | rc = 1; |
354 | } | 356 | } |
355 | else { | 357 | else { |
356 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 358 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), |
359 | LoginWindowImpl::tr( "Could not switch to new user identity" )); | ||
357 | rc = 2; | 360 | rc = 2; |
358 | } | 361 | } |
359 | |||
360 | } | 362 | } |
361 | return rc; | 363 | return rc; |