-rw-r--r-- | core/opie-login/loginapplication.cpp | 5 | ||||
-rw-r--r-- | core/opie-login/loginapplication.h | 5 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 11 |
3 files changed, 14 insertions, 7 deletions
diff --git a/core/opie-login/loginapplication.cpp b/core/opie-login/loginapplication.cpp index 103d63b..8d86a71 100644 --- a/core/opie-login/loginapplication.cpp +++ b/core/opie-login/loginapplication.cpp | |||
@@ -44,10 +44,11 @@ extern "C" { | |||
44 | 44 | ||
45 | LoginApplication *lApp; | 45 | LoginApplication *lApp; |
46 | 46 | ||
47 | LoginApplication::LoginApplication ( int &argc, char **argv ) | 47 | LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid ) |
48 | : QPEApplication ( argc, argv, GuiServer ) | 48 | : QPEApplication ( argc, argv, GuiServer ) |
49 | { | 49 | { |
50 | lApp = this; | 50 | lApp = this; |
51 | m_parentpid = parentpid; | ||
51 | } | 52 | } |
52 | 53 | ||
53 | const char *LoginApplication::s_username = 0; | 54 | const char *LoginApplication::s_username = 0; |
@@ -216,5 +217,5 @@ QStringList LoginApplication::allUsers ( ) | |||
216 | void LoginApplication::quitToConsole ( ) | 217 | void LoginApplication::quitToConsole ( ) |
217 | { | 218 | { |
218 | QPEApplication::quit ( ); | 219 | QPEApplication::quit ( ); |
219 | ::kill ( ::getppid ( ), SIGTERM ); | 220 | ::kill ( m_parentpid, SIGTERM ); |
220 | } | 221 | } |
diff --git a/core/opie-login/loginapplication.h b/core/opie-login/loginapplication.h index 062c088..4e7cf79 100644 --- a/core/opie-login/loginapplication.h +++ b/core/opie-login/loginapplication.h | |||
@@ -39,7 +39,7 @@ struct pam_response; | |||
39 | 39 | ||
40 | class LoginApplication : public QPEApplication { | 40 | class LoginApplication : public QPEApplication { |
41 | public: | 41 | public: |
42 | LoginApplication ( int &argc, char **argv ); | 42 | LoginApplication ( int &argc, char **argv, pid_t parentpid ); |
43 | 43 | ||
44 | static bool checkPassword ( const char *user, const char *password ); | 44 | static bool checkPassword ( const char *user, const char *password ); |
45 | 45 | ||
@@ -60,6 +60,9 @@ private: | |||
60 | static int pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ); | 60 | static int pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ); |
61 | static const char *s_pam_password; | 61 | static const char *s_pam_password; |
62 | #endif | 62 | #endif |
63 | |||
64 | private: | ||
65 | pid_t m_parentpid; | ||
63 | }; | 66 | }; |
64 | 67 | ||
65 | extern LoginApplication *lApp; | 68 | extern LoginApplication *lApp; |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 579a93a..674829d 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -60,7 +60,7 @@ | |||
60 | 60 | ||
61 | using namespace Opie; | 61 | using namespace Opie; |
62 | 62 | ||
63 | int login_main ( int argc, char **argv ); | 63 | int login_main ( int argc, char **argv, pid_t ppid ); |
64 | void sigterm ( int sig ); | 64 | void sigterm ( int sig ); |
65 | void exit_closelog ( ); | 65 | void exit_closelog ( ); |
66 | 66 | ||
@@ -72,6 +72,9 @@ static struct option long_options [] = { | |||
72 | 72 | ||
73 | int main ( int argc, char **argv ) | 73 | int main ( int argc, char **argv ) |
74 | { | 74 | { |
75 | pid_t ppid = ::getpid ( ); | ||
76 | |||
77 | |||
75 | if ( ::geteuid ( ) != 0 ) { | 78 | if ( ::geteuid ( ) != 0 ) { |
76 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); | 79 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); |
77 | return 1; | 80 | return 1; |
@@ -183,7 +186,7 @@ int main ( int argc, char **argv ) | |||
183 | ::exit ( 0 ); | 186 | ::exit ( 0 ); |
184 | } | 187 | } |
185 | else | 188 | else |
186 | ::exit ( login_main ( argc, argv )); | 189 | ::exit ( login_main ( argc, argv, ppid )); |
187 | } | 190 | } |
188 | } | 191 | } |
189 | return 0; | 192 | return 0; |
@@ -302,10 +305,10 @@ private: | |||
302 | 305 | ||
303 | 306 | ||
304 | 307 | ||
305 | int login_main ( int argc, char **argv ) | 308 | int login_main ( int argc, char **argv, pid_t ppid ) |
306 | { | 309 | { |
307 | QWSServer::setDesktopBackground( QImage() ); | 310 | QWSServer::setDesktopBackground( QImage() ); |
308 | LoginApplication *app = new LoginApplication ( argc, argv ); | 311 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
309 | 312 | ||
310 | app-> setFont ( QFont ( "Helvetica", 10 )); | 313 | app-> setFont ( QFont ( "Helvetica", 10 )); |
311 | app-> setStyle ( new QPEStyle ( )); | 314 | app-> setStyle ( new QPEStyle ( )); |