1 From 68fca4cd55e7bf6075eb1ccd303ae57a7ec1b8da Mon Sep 17 00:00:00 2001
2 From: Jeremie Koenig <jk@jk.fr.eu.org>
3 Date: Thu, 29 Jul 2010 04:29:52 +0200
4 Subject: [PATCH 12/12] vlock: disable linux console calls on other systems
6 Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 loginutils/Config.src | 1 -
10 loginutils/vlock.c | 15 +++++++++++++--
11 2 files changed, 13 insertions(+), 3 deletions(-)
13 diff --git a/loginutils/Config.src b/loginutils/Config.src
14 index 6ec2893..5d497c4 100644
15 --- a/loginutils/Config.src
16 +++ b/loginutils/Config.src
17 @@ -295,7 +295,6 @@ config SULOGIN
21 - depends on PLATFORM_LINUX
24 Build the "vlock" applet which allows you to lock (virtual) terminals.
25 diff --git a/loginutils/vlock.c b/loginutils/vlock.c
26 index 85f489c..59aeb54 100644
27 --- a/loginutils/vlock.c
28 +++ b/loginutils/vlock.c
30 /* Fixed by Erik Andersen to do passwords the tinylogin way...
31 * It now works with md5, sha1, etc passwords. */
39 static void release_vt(int signo UNUSED_PARAM)
41 /* If -a, param is 0, which means:
42 @@ -30,14 +32,17 @@ static void acquire_vt(int signo UNUSED_PARAM)
43 /* ACK to kernel that switch to console is successful */
44 ioctl(STDIN_FILENO, VT_RELDISP, VT_ACKACQ);
48 int vlock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
49 int vlock_main(int argc UNUSED_PARAM, char **argv)
53 + struct vt_mode ovtm;
57 - struct vt_mode ovtm;
60 pw = xgetpwuid(getuid());
61 @@ -55,6 +60,7 @@ int vlock_main(int argc UNUSED_PARAM, char **argv)
66 /* We will use SIGUSRx for console switch control: */
68 signal_SA_RESTART_empty_mask(SIGUSR1, release_vt);
69 @@ -62,12 +68,14 @@ int vlock_main(int argc UNUSED_PARAM, char **argv)
75 /* Revert stdin/out to our controlling tty
76 * (or die if we have none) */
77 xmove_fd(xopen(CURRENT_TTY, O_RDWR), STDIN_FILENO);
78 xdup2(STDIN_FILENO, STDOUT_FILENO);
81 xioctl(STDIN_FILENO, VT_GETMODE, &vtm);
83 /* "console switches are controlled by us, not kernel!" */
84 @@ -75,6 +83,7 @@ int vlock_main(int argc UNUSED_PARAM, char **argv)
87 ioctl(STDIN_FILENO, VT_SETMODE, &vtm);
90 tcgetattr(STDIN_FILENO, &oterm);
92 @@ -95,7 +104,9 @@ int vlock_main(int argc UNUSED_PARAM, char **argv)
93 puts("Password incorrect");
97 ioctl(STDIN_FILENO, VT_SETMODE, &ovtm);
99 tcsetattr_stdin_TCSANOW(&oterm);
100 fflush_stdout_and_exit(EXIT_SUCCESS);