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> | | |||
24 | #include <QCommandLineParser> | 23 | #include <QCommandLineParser> | ||
25 | #include <QSessionManager> | 24 | #include <QSessionManager> | ||
26 | 25 | | |||
27 | #include <iostream> | 26 | #include <iostream> | ||
28 | 27 | | |||
29 | #include <signal.h> | 28 | #include <signal.h> | ||
30 | 29 | | |||
31 | #include "greeterapp.h" | 30 | #include "greeterapp.h" | ||
32 | 31 | | |||
33 | #include <config-kscreenlocker.h> | 32 | #include <config-kscreenlocker.h> | ||
33 | #include <kscreenlocker_greet_logging.h> | ||||
34 | | ||||
34 | #if HAVE_SYS_PRCTL_H | 35 | #if HAVE_SYS_PRCTL_H | ||
35 | #include <sys/prctl.h> | 36 | #include <sys/prctl.h> | ||
36 | #endif | 37 | #endif | ||
37 | #if HAVE_SYS_PROCCTL_H | 38 | #if HAVE_SYS_PROCCTL_H | ||
38 | #include <unistd.h> | 39 | #include <unistd.h> | ||
39 | #include <sys/procctl.h> | 40 | #include <sys/procctl.h> | ||
40 | #endif | 41 | #endif | ||
41 | #if HAVE_SECCOMP | 42 | #if HAVE_SECCOMP | ||
Show All 9 Lines | 47 | { | |||
51 | 52 | | |||
52 | switch(signum) | 53 | switch(signum) | ||
53 | { | 54 | { | ||
54 | case SIGTERM: | 55 | case SIGTERM: | ||
55 | // exit gracefully to not leave behind screensaver processes (bug#224200) | 56 | // exit gracefully to not leave behind screensaver processes (bug#224200) | ||
56 | // return exit code 1 to indicate that a valid password was not entered, | 57 | // return exit code 1 to indicate that a valid password was not entered, | ||
57 | // to prevent circumventing the password input by sending a SIGTERM | 58 | // to prevent circumventing the password input by sending a SIGTERM | ||
58 | 59 | | |||
59 | qDebug() << "Greeter received SIGTERM. Will exit with error."; | 60 | qCDebug(KSCREENLOCKER_GREET) << "Greeter received SIGTERM. Will exit with error."; | ||
60 | instance->exit(1); | 61 | instance->exit(1); | ||
61 | break; | 62 | break; | ||
62 | case SIGUSR1: | 63 | case SIGUSR1: | ||
63 | qDebug() << "Greeter received SIGUSR1. Will lock immediately."; | 64 | qCDebug(KSCREENLOCKER_GREET) << "Greeter received SIGUSR1. Will lock immediately."; | ||
64 | instance->lockImmediately(); | 65 | instance->lockImmediately(); | ||
65 | break; | 66 | break; | ||
66 | } | 67 | } | ||
67 | } | 68 | } | ||
68 | 69 | | |||
69 | int main(int argc, char* argv[]) | 70 | int main(int argc, char* argv[]) | ||
70 | { | 71 | { | ||
71 | // disable ptrace on the greeter | 72 | // disable ptrace on the greeter | ||
72 | #if HAVE_PR_SET_DUMPABLE | 73 | #if HAVE_PR_SET_DUMPABLE | ||
73 | prctl(PR_SET_DUMPABLE, 0); | 74 | prctl(PR_SET_DUMPABLE, 0); | ||
74 | #endif | 75 | #endif | ||
75 | #if HAVE_PROC_TRACE_CTL | 76 | #if HAVE_PROC_TRACE_CTL | ||
76 | int mode = PROC_TRACE_CTL_DISABLE; | 77 | int mode = PROC_TRACE_CTL_DISABLE; | ||
77 | procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode); | 78 | procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode); | ||
78 | #endif | 79 | #endif | ||
79 | 80 | | |||
80 | qDebug() << "Greeter is starting up."; | 81 | qCDebug(KSCREENLOCKER_GREET) << "Greeter is starting up."; | ||
81 | 82 | | |||
82 | KLocalizedString::setApplicationDomain("kscreenlocker_greet"); | 83 | KLocalizedString::setApplicationDomain("kscreenlocker_greet"); | ||
83 | 84 | | |||
84 | // explicitly disable input methods as it makes it impossible to unlock, see BUG 306932 | 85 | // explicitly disable input methods as it makes it impossible to unlock, see BUG 306932 | ||
85 | // but explicitly set on screen keyboard such as maliit is allowed | 86 | // but explicitly set on screen keyboard such as maliit is allowed | ||
86 | if (!qEnvironmentVariableIsSet("QT_IM_MODULE") || (qEnvironmentVariableIsSet("QT_IM_MODULE") && qgetenv("QT_IM_MODULE") != QByteArrayLiteral("maliit"))) { | 87 | if (!qEnvironmentVariableIsSet("QT_IM_MODULE") || (qEnvironmentVariableIsSet("QT_IM_MODULE") && qgetenv("QT_IM_MODULE") != QByteArrayLiteral("maliit"))) { | ||
87 | qputenv("QT_IM_MODULE", QByteArrayLiteral("qtvirtualkeyboard")); | 88 | qputenv("QT_IM_MODULE", QByteArrayLiteral("qtvirtualkeyboard")); | ||
88 | } | 89 | } | ||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |