Diffstat (limited to 'core/opie-login/loginapplication.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/opie-login/loginapplication.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/opie-login/loginapplication.cpp b/core/opie-login/loginapplication.cpp index 1facf2d..764b24b 100644 --- a/core/opie-login/loginapplication.cpp +++ b/core/opie-login/loginapplication.cpp | |||
@@ -22,12 +22,20 @@ | |||
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "loginapplication.h" | ||
29 | |||
30 | /* OPIE */ | ||
31 | #include <opie2/odebug.h> | ||
32 | |||
33 | /* QT */ | ||
34 | |||
35 | /* STD */ | ||
28 | #include <pwd.h> | 36 | #include <pwd.h> |
29 | #include <grp.h> | 37 | #include <grp.h> |
30 | #include <unistd.h> | 38 | #include <unistd.h> |
31 | #include <stdlib.h> | 39 | #include <stdlib.h> |
32 | #include <signal.h> | 40 | #include <signal.h> |
33 | #include <sys/stat.h> | 41 | #include <sys/stat.h> |
@@ -39,13 +47,12 @@ extern "C" { | |||
39 | } | 47 | } |
40 | #else | 48 | #else |
41 | #include <crypt.h> | 49 | #include <crypt.h> |
42 | #include <shadow.h> | 50 | #include <shadow.h> |
43 | #endif | 51 | #endif |
44 | 52 | ||
45 | #include "loginapplication.h" | ||
46 | 53 | ||
47 | LoginApplication *lApp; | 54 | LoginApplication *lApp; |
48 | 55 | ||
49 | LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid ) | 56 | LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid ) |
50 | : QPEApplication ( argc, argv, GuiServer ) | 57 | : QPEApplication ( argc, argv, GuiServer ) |
51 | { | 58 | { |
@@ -159,13 +166,13 @@ bool LoginApplication::changeIdentity ( ) | |||
159 | struct passwd *pw = ::getpwnam ( s_username ); | 166 | struct passwd *pw = ::getpwnam ( s_username ); |
160 | if ( !pw ) | 167 | if ( !pw ) |
161 | return false; | 168 | return false; |
162 | 169 | ||
163 | // we are still root at this point - try to run the pre-session script | 170 | // we are still root at this point - try to run the pre-session script |
164 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/pre-session", s_username )) | 171 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/pre-session", s_username )) |
165 | qWarning ( "failed to run $OPIEDIR/share/opie-login/pre-session" ); | 172 | owarn << "failed to run $OPIEDIR/share/opie-login/pre-session" << oendl; |
166 | 173 | ||
167 | bool fail = false; | 174 | bool fail = false; |
168 | fail |= ( ::initgroups ( pw-> pw_name, pw-> pw_gid )); | 175 | fail |= ( ::initgroups ( pw-> pw_name, pw-> pw_gid )); |
169 | ::endgrent ( ); | 176 | ::endgrent ( ); |
170 | fail |= ( ::setgid ( pw-> pw_gid )); | 177 | fail |= ( ::setgid ( pw-> pw_gid )); |
171 | fail |= ( ::setuid ( pw-> pw_uid )); | 178 | fail |= ( ::setuid ( pw-> pw_uid )); |
@@ -184,21 +191,21 @@ bool LoginApplication::changeIdentity ( ) | |||
184 | bool LoginApplication::login ( ) | 191 | bool LoginApplication::login ( ) |
185 | { | 192 | { |
186 | execUserScript ( "HOME", ".opie-session" ); | 193 | execUserScript ( "HOME", ".opie-session" ); |
187 | execUserScript ( "OPIEDIR", "share/opie-login/opie-session" ); | 194 | execUserScript ( "OPIEDIR", "share/opie-login/opie-session" ); |
188 | execUserScript ( "OPIEDIR", "bin/qpe" ); | 195 | execUserScript ( "OPIEDIR", "bin/qpe" ); |
189 | 196 | ||
190 | qWarning ( "failed to start an Opie session" ); | 197 | owarn << "failed to start an Opie session" << oendl; |
191 | return false; | 198 | return false; |
192 | } | 199 | } |
193 | 200 | ||
194 | void LoginApplication::logout ( ) | 201 | void LoginApplication::logout ( ) |
195 | { | 202 | { |
196 | // we are now root again - try to run the post-session script | 203 | // we are now root again - try to run the post-session script |
197 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/post-session" )) | 204 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/post-session" )) |
198 | qWarning ( "failed to run $OPIEDIR/scripts/post-session" ); | 205 | owarn << "failed to run $OPIEDIR/scripts/post-session" << oendl; |
199 | } | 206 | } |
200 | 207 | ||
201 | 208 | ||
202 | static char *buildarg ( const char *base, const char *script ) | 209 | static char *buildarg ( const char *base, const char *script ) |
203 | { | 210 | { |
204 | const char *dir = base ? ::getenv ( base ) : "/"; | 211 | const char *dir = base ? ::getenv ( base ) : "/"; |