summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/main.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index 9c40fc4..d95a59b 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -1,115 +1,116 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
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#define _GNU_SOURCE 28#define _GNU_SOURCE
29 29
30#include <sys/types.h> 30#include <sys/types.h>
31#include <time.h> 31#include <time.h>
32#include <sys/time.h> 32#include <sys/time.h>
33#include <sys/resource.h> 33#include <sys/resource.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <syslog.h> 35#include <syslog.h>
36#include <sys/wait.h> 36#include <sys/wait.h>
37#include <stdio.h> 37#include <stdio.h>
38#include <stdlib.h> 38#include <stdlib.h>
39#include <signal.h> 39#include <signal.h>
40#include <getopt.h> 40#include <getopt.h>
41#include <string.h> 41#include <string.h>
42 42
43#include <qpe/qpeapplication.h> 43#include <qpe/qpeapplication.h>
44#include <qpe/qcopenvelope_qws.h> 44#include <qpe/qcopenvelope_qws.h>
45#include <qpe/qpestyle.h> 45#include <qpe/qpestyle.h>
46#include <qpe/power.h> 46#include <qpe/power.h>
47#include <qpe/config.h> 47#include <qpe/config.h>
48 48
49#include <opie/odevice.h> 49#include <opie/odevice.h>
50 50
51#include <qwindowsystem_qws.h> 51#include <qwindowsystem_qws.h>
52#include <qwsmouse_qws.h>
52#include <qmessagebox.h> 53#include <qmessagebox.h>
53#include <qlabel.h> 54#include <qlabel.h>
54#include <qtimer.h> 55#include <qtimer.h>
55#include <qfile.h> 56#include <qfile.h>
56 57
57#include "loginapplication.h" 58#include "loginapplication.h"
58#include "loginwindowimpl.h" 59#include "loginwindowimpl.h"
59#include "calibrate.h" 60#include "calibrate.h"
60 61
61using namespace Opie; 62using namespace Opie;
62 63
63int login_main ( int argc, char **argv, pid_t ppid ); 64int login_main ( int argc, char **argv, pid_t ppid );
64void sigterm ( int sig ); 65void sigterm ( int sig );
65void sigint ( int sig ); 66void sigint ( int sig );
66void exit_closelog ( ); 67void exit_closelog ( );
67 68
68static struct option long_options [] = { 69static struct option long_options [] = {
69 { "autologin", 1, 0, 'a' }, 70 { "autologin", 1, 0, 'a' },
70 { 0, 0, 0, 0 } 71 { 0, 0, 0, 0 }
71}; 72};
72 73
73 74
74int main ( int argc, char **argv ) 75int main ( int argc, char **argv )
75{ 76{
76 pid_t ppid = ::getpid ( ); 77 pid_t ppid = ::getpid ( );
77 78
78 if ( ::geteuid ( ) != 0 ) { 79 if ( ::geteuid ( ) != 0 ) {
79 ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); 80 ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] );
80 return 1; 81 return 1;
81 } 82 }
82 if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and 83 if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and
83 ::setuid ( 0 ); // messes up things like config files 84 ::setuid ( 0 ); // messes up things like config files
84 85
85 char *autolog = 0; 86 char *autolog = 0;
86 int c; 87 int c;
87 while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) { 88 while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) {
88 switch ( c ) { 89 switch ( c ) {
89 case 'a': 90 case 'a':
90 autolog = optarg; 91 autolog = optarg;
91 break; 92 break;
92 default: 93 default:
93 ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] ); 94 ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] );
94 return 2; 95 return 2;
95 } 96 }
96 } 97 }
97 98
98 //struct rlimit rl; 99 //struct rlimit rl;
99 //::getrlimit ( RLIMIT_NOFILE, &rl ); 100 //::getrlimit ( RLIMIT_NOFILE, &rl );
100 101
101 //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) 102 //for ( unsigned int i = 0; i < rl. rlim_cur; i++ )
102 // ::close ( i ); 103 // ::close ( i );
103 104
104 ::setpgid ( 0, 0 ); 105 ::setpgid ( 0, 0 );
105 ::setsid ( ); 106 ::setsid ( );
106 107
107 ::signal ( SIGTERM, sigterm ); 108 ::signal ( SIGTERM, sigterm );
108 ::signal ( SIGINT, sigterm ); 109 ::signal ( SIGINT, sigterm );
109 110
110 ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); 111 ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV );
111 ::atexit ( exit_closelog ); 112 ::atexit ( exit_closelog );
112 113
113 while ( true ) { 114 while ( true ) {
114 pid_t child = ::fork ( ); 115 pid_t child = ::fork ( );
115 116