aboutsummaryrefslogtreecommitdiff
path: root/loginutils/vlock.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /loginutils/vlock.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
Major coreutils update.
Diffstat (limited to 'loginutils/vlock.c')
-rw-r--r--loginutils/vlock.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/loginutils/vlock.c b/loginutils/vlock.c
index 18f4b9407..7abf120d9 100644
--- a/loginutils/vlock.c
+++ b/loginutils/vlock.c
@@ -29,6 +29,7 @@
29 * It now works with md5, sha1, etc passwords. */ 29 * It now works with md5, sha1, etc passwords. */
30 30
31#include <stdio.h> 31#include <stdio.h>
32#include <stdlib.h>
32#include <sys/vt.h> 33#include <sys/vt.h>
33#include <signal.h> 34#include <signal.h>
34#include <string.h> 35#include <string.h>
@@ -96,26 +97,26 @@ extern int vlock_main(int argc, char **argv)
96 struct termios term; 97 struct termios term;
97 98
98 if (argc > 2) { 99 if (argc > 2) {
99 show_usage(); 100 bb_show_usage();
100 } 101 }
101 102
102 if (argc == 2) { 103 if (argc == 2) {
103 if (strncmp(argv[1], "-a", 2)) { 104 if (strncmp(argv[1], "-a", 2)) {
104 show_usage(); 105 bb_show_usage();
105 } else { 106 } else {
106 o_lock_all = 1; 107 o_lock_all = 1;
107 } 108 }
108 } 109 }
109 110
110 if ((pw = getpwuid(getuid())) == NULL) { 111 if ((pw = getpwuid(getuid())) == NULL) {
111 error_msg_and_die("no password for uid %d\n", getuid()); 112 bb_error_msg_and_die("no password for uid %d\n", getuid());
112 } 113 }
113#ifdef CONFIG_FEATURE_SHADOWPASSWDS 114#ifdef CONFIG_FEATURE_SHADOWPASSWDS
114 if ((strcmp(pw->pw_passwd, "x") == 0) 115 if ((strcmp(pw->pw_passwd, "x") == 0)
115 || (strcmp(pw->pw_passwd, "*") == 0)) { 116 || (strcmp(pw->pw_passwd, "*") == 0)) {
116 117
117 if ((spw = getspuid(getuid())) == NULL) { 118 if ((spw = getspuid(getuid())) == NULL) {
118 error_msg_and_die("could not read shadow password for uid %d: %s\n", 119 bb_error_msg_and_die("could not read shadow password for uid %d: %s\n",
119 getuid(), strerror(errno)); 120 getuid(), strerror(errno));
120 } 121 }
121 if (spw->sp_pwdp) { 122 if (spw->sp_pwdp) {
@@ -124,7 +125,7 @@ extern int vlock_main(int argc, char **argv)
124 } 125 }
125#endif /* CONFIG_FEATURE_SHADOWPASSWDS */ 126#endif /* CONFIG_FEATURE_SHADOWPASSWDS */
126 if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*') { 127 if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*') {
127 error_msg_and_die("Account disabled for uid %d\n", getuid()); 128 bb_error_msg_and_die("Account disabled for uid %d\n", getuid());
128 } 129 }
129 130
130 /* we no longer need root privs */ 131 /* we no longer need root privs */
@@ -132,11 +133,11 @@ extern int vlock_main(int argc, char **argv)
132 setgid(getgid()); 133 setgid(getgid());
133 134
134 if ((vfd = open("/dev/tty", O_RDWR)) < 0) { 135 if ((vfd = open("/dev/tty", O_RDWR)) < 0) {
135 error_msg_and_die("/dev/tty"); 136 bb_error_msg_and_die("/dev/tty");
136 }; 137 };
137 138
138 if (ioctl(vfd, VT_GETMODE, &vtm) < 0) { 139 if (ioctl(vfd, VT_GETMODE, &vtm) < 0) {
139 error_msg_and_die("/dev/tty"); 140 bb_error_msg_and_die("/dev/tty");
140 }; 141 };
141 142
142 /* mask a bunch of signals */ 143 /* mask a bunch of signals */