Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/loginutils/su.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/loginutils/su.c
r3232 r3621 5 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 6 */ 7 //config:config SU 8 //config: bool "su" 9 //config: default y 10 //config: select FEATURE_SYSLOG 11 //config: help 12 //config: su is used to become another user during a login session. 13 //config: Invoked without a username, su defaults to becoming the super user. 14 //config: 15 //config: Note that Busybox binary must be setuid root for this applet to 16 //config: work properly. 17 //config: 18 //config:config FEATURE_SU_SYSLOG 19 //config: bool "Enable su to write to syslog" 20 //config: default y 21 //config: depends on SU 22 //config: 23 //config:config FEATURE_SU_CHECKS_SHELLS 24 //config: bool "Enable su to check user's shell to be listed in /etc/shells" 25 //config: depends on SU 26 //config: default y 7 27 8 #include "libbb.h" 9 #include <syslog.h> 28 //applet:/* Needs to be run by root or be suid root - needs to change uid and gid: */ 29 //applet:IF_SU(APPLET(su, BB_DIR_BIN, BB_SUID_REQUIRE)) 30 31 //kbuild:lib-$(CONFIG_SU) += su.o 10 32 11 33 //usage:#define su_trivial_usage … … 17 39 //usage: "\n -c CMD Command to pass to 'sh -c'" 18 40 //usage: "\n -s SH Shell to use instead of user's default" 41 42 #include "libbb.h" 43 #include <syslog.h> 19 44 20 45 #if ENABLE_FEATURE_SU_CHECKS_SHELLS … … 94 119 pw = xgetpwnam(opt_username); 95 120 96 if (cur_uid == 0 || correct_password(pw)) {121 if (cur_uid == 0 || ask_and_check_password(pw) > 0) { 97 122 if (ENABLE_FEATURE_SU_SYSLOG) 98 123 syslog(LOG_NOTICE, "%c %s %s:%s", … … 102 127 syslog(LOG_NOTICE, "%c %s %s:%s", 103 128 '-', tty, old_user, opt_username); 129 bb_do_delay(LOGIN_FAIL_DELAY); 104 130 bb_error_msg_and_die("incorrect password"); 105 131 }
Note:
See TracChangeset
for help on using the changeset viewer.