Changeset View
Changeset View
Standalone View
Standalone View
greeter/main.cpp
Show All 14 Lines | |||||
15 | 15 | | |||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | *********************************************************************/ | 18 | *********************************************************************/ | ||
19 | #include <KLocalizedString> | 19 | #include <KLocalizedString> | ||
20 | #include <KQuickAddons/QtQuickSettings> | 20 | #include <KQuickAddons/QtQuickSettings> | ||
21 | 21 | | |||
22 | #include <QDateTime> | 22 | #include <QDateTime> | ||
23 | #include <QDebug> | ||||
23 | #include <QCommandLineParser> | 24 | #include <QCommandLineParser> | ||
24 | #include <QSessionManager> | 25 | #include <QSessionManager> | ||
25 | 26 | | |||
26 | #include <iostream> | 27 | #include <iostream> | ||
27 | 28 | | |||
28 | #include <signal.h> | 29 | #include <signal.h> | ||
29 | 30 | | |||
30 | #include "greeterapp.h" | 31 | #include "greeterapp.h" | ||
Show All 18 Lines | 49 | if (!instance) | |||
49 | return; | 50 | return; | ||
50 | 51 | | |||
51 | switch(signum) | 52 | switch(signum) | ||
52 | { | 53 | { | ||
53 | case SIGTERM: | 54 | case SIGTERM: | ||
54 | // exit gracefully to not leave behind screensaver processes (bug#224200) | 55 | // exit gracefully to not leave behind screensaver processes (bug#224200) | ||
55 | // return exit code 1 to indicate that a valid password was not entered, | 56 | // return exit code 1 to indicate that a valid password was not entered, | ||
56 | // to prevent circumventing the password input by sending a SIGTERM | 57 | // to prevent circumventing the password input by sending a SIGTERM | ||
58 | | ||||
59 | qDebug() << "Greeter received SIGTERM. Will exit with error."; | ||||
57 | instance->exit(1); | 60 | instance->exit(1); | ||
58 | break; | 61 | break; | ||
59 | case SIGUSR1: | 62 | case SIGUSR1: | ||
63 | qDebug() << "Greeter received SIGUSR1. Will lock immediately."; | ||||
60 | instance->lockImmediately(); | 64 | instance->lockImmediately(); | ||
61 | break; | 65 | break; | ||
62 | } | 66 | } | ||
63 | } | 67 | } | ||
64 | 68 | | |||
65 | int main(int argc, char* argv[]) | 69 | int main(int argc, char* argv[]) | ||
66 | { | 70 | { | ||
67 | // disable ptrace on the greeter | 71 | // disable ptrace on the greeter | ||
68 | #if HAVE_PR_SET_DUMPABLE | 72 | #if HAVE_PR_SET_DUMPABLE | ||
69 | prctl(PR_SET_DUMPABLE, 0); | 73 | prctl(PR_SET_DUMPABLE, 0); | ||
70 | #endif | 74 | #endif | ||
71 | #if HAVE_PROC_TRACE_CTL | 75 | #if HAVE_PROC_TRACE_CTL | ||
72 | int mode = PROC_TRACE_CTL_DISABLE; | 76 | int mode = PROC_TRACE_CTL_DISABLE; | ||
73 | procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode); | 77 | procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode); | ||
74 | #endif | 78 | #endif | ||
75 | 79 | | |||
80 | qDebug() << "Greeter is starting up."; | ||||
81 | | ||||
76 | KLocalizedString::setApplicationDomain("kscreenlocker_greet"); | 82 | KLocalizedString::setApplicationDomain("kscreenlocker_greet"); | ||
77 | 83 | | |||
78 | // explicitly disable input methods as it makes it impossible to unlock, see BUG 306932 | 84 | // explicitly disable input methods as it makes it impossible to unlock, see BUG 306932 | ||
79 | // but explicitly set on screen keyboard such as maliit is allowed | 85 | // but explicitly set on screen keyboard such as maliit is allowed | ||
80 | if (!qEnvironmentVariableIsSet("QT_IM_MODULE") || (qEnvironmentVariableIsSet("QT_IM_MODULE") && qgetenv("QT_IM_MODULE") != QByteArrayLiteral("maliit"))) { | 86 | if (!qEnvironmentVariableIsSet("QT_IM_MODULE") || (qEnvironmentVariableIsSet("QT_IM_MODULE") && qgetenv("QT_IM_MODULE") != QByteArrayLiteral("maliit"))) { | ||
81 | qputenv("QT_IM_MODULE", QByteArrayLiteral("qtvirtualkeyboard")); | 87 | qputenv("QT_IM_MODULE", QByteArrayLiteral("qtvirtualkeyboard")); | ||
82 | } | 88 | } | ||
83 | 89 | | |||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |