aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/Config.in2
-rw-r--r--loginutils/su.c15
-rw-r--r--scripts/defconfig2
3 files changed, 10 insertions, 9 deletions
diff --git a/loginutils/Config.in b/loginutils/Config.in
index 56778b241..03a638c00 100644
--- a/loginutils/Config.in
+++ b/loginutils/Config.in
@@ -161,7 +161,7 @@ config SU
161 Note that Busybox binary must be setuid root for this applet to 161 Note that Busybox binary must be setuid root for this applet to
162 work properly. 162 work properly.
163 163
164config SU_SYSLOG 164config FEATURE_SU_SYSLOG
165 bool "Enable su to write to syslog" 165 bool "Enable su to write to syslog"
166 default y 166 default y
167 depends on SU 167 depends on SU
diff --git a/loginutils/su.c b/loginutils/su.c
index 25b85920a..133f6ed63 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -8,6 +8,9 @@
8#include "busybox.h" 8#include "busybox.h"
9#include <syslog.h> 9#include <syslog.h>
10 10
11#define SU_OPT_mp (3)
12#define SU_OPT_l (4)
13
11int su_main(int argc, char **argv) 14int su_main(int argc, char **argv)
12{ 15{
13 unsigned flags; 16 unsigned flags;
@@ -22,8 +25,6 @@ int su_main(int argc, char **argv)
22 flags = getopt32(argc, argv, "mplc:s:", &opt_command, &opt_shell); 25 flags = getopt32(argc, argv, "mplc:s:", &opt_command, &opt_shell);
23 argc -= optind; 26 argc -= optind;
24 argv -= optind; 27 argv -= optind;
25#define SU_OPT_mp (3)
26#define SU_OPT_l (4)
27 28
28 if (argc && LONE_DASH(argv[0])) { 29 if (argc && LONE_DASH(argv[0])) {
29 flags |= SU_OPT_l; 30 flags |= SU_OPT_l;
@@ -38,7 +39,7 @@ int su_main(int argc, char **argv)
38 argv++; 39 argv++;
39 } 40 }
40 41
41 if (ENABLE_SU_SYSLOG) { 42 if (ENABLE_FEATURE_SU_SYSLOG) {
42 /* The utmp entry (via getlogin) is probably the best way to identify 43 /* The utmp entry (via getlogin) is probably the best way to identify
43 the user, especially if someone su's from a su-shell. 44 the user, especially if someone su's from a su-shell.
44 But getlogin can fail -- usually due to lack of utmp entry. 45 But getlogin can fail -- usually due to lack of utmp entry.
@@ -49,7 +50,7 @@ int su_main(int argc, char **argv)
49 } 50 }
50 51
51 pw = getpwnam(opt_username); 52 pw = getpwnam(opt_username);
52 if (!pw) 53 if (!pw)
53 bb_error_msg_and_die("unknown id: %s", opt_username); 54 bb_error_msg_and_die("unknown id: %s", opt_username);
54 55
55 /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER 56 /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
@@ -59,17 +60,17 @@ int su_main(int argc, char **argv)
59 pw->pw_shell = (char *)DEFAULT_SHELL; 60 pw->pw_shell = (char *)DEFAULT_SHELL;
60 61
61 if ((cur_uid == 0) || correct_password(pw)) { 62 if ((cur_uid == 0) || correct_password(pw)) {
62 if (ENABLE_SU_SYSLOG) 63 if (ENABLE_FEATURE_SU_SYSLOG)
63 syslog(LOG_NOTICE, "%c %s %s:%s", 64 syslog(LOG_NOTICE, "%c %s %s:%s",
64 '+', tty, old_user, opt_username); 65 '+', tty, old_user, opt_username);
65 } else { 66 } else {
66 if (ENABLE_SU_SYSLOG) 67 if (ENABLE_FEATURE_SU_SYSLOG)
67 syslog(LOG_NOTICE, "%c %s %s:%s", 68 syslog(LOG_NOTICE, "%c %s %s:%s",
68 '-', tty, old_user, opt_username); 69 '-', tty, old_user, opt_username);
69 bb_error_msg_and_die("incorrect password"); 70 bb_error_msg_and_die("incorrect password");
70 } 71 }
71 72
72 if (ENABLE_FEATURE_CLEAN_UP && ENABLE_SU_SYSLOG) { 73 if (ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_SU_SYSLOG) {
73 closelog(); 74 closelog();
74 free(old_user); 75 free(old_user);
75 } 76 }
diff --git a/scripts/defconfig b/scripts/defconfig
index 102c21a5f..61aca8792 100644
--- a/scripts/defconfig
+++ b/scripts/defconfig
@@ -340,7 +340,7 @@ CONFIG_LOGIN_SCRIPTS=y
340CONFIG_FEATURE_SECURETTY=y 340CONFIG_FEATURE_SECURETTY=y
341CONFIG_PASSWD=y 341CONFIG_PASSWD=y
342CONFIG_SU=y 342CONFIG_SU=y
343CONFIG_SU_SYSLOG=y 343CONFIG_FEATURE_SU_SYSLOG=y
344CONFIG_SULOGIN=y 344CONFIG_SULOGIN=y
345CONFIG_VLOCK=y 345CONFIG_VLOCK=y
346 346