Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/loginutils/su.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/loginutils/su.c

    r3232 r3621  
    55 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    66 */
     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
    727
    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
    1032
    1133//usage:#define su_trivial_usage
     
    1739//usage:     "\n    -c CMD  Command to pass to 'sh -c'"
    1840//usage:     "\n    -s SH   Shell to use instead of user's default"
     41
     42#include "libbb.h"
     43#include <syslog.h>
    1944
    2045#if ENABLE_FEATURE_SU_CHECKS_SHELLS
     
    94119    pw = xgetpwnam(opt_username);
    95120
    96     if (cur_uid == 0 || correct_password(pw)) {
     121    if (cur_uid == 0 || ask_and_check_password(pw) > 0) {
    97122        if (ENABLE_FEATURE_SU_SYSLOG)
    98123            syslog(LOG_NOTICE, "%c %s %s:%s",
     
    102127            syslog(LOG_NOTICE, "%c %s %s:%s",
    103128                '-', tty, old_user, opt_username);
     129        bb_do_delay(LOGIN_FAIL_DELAY);
    104130        bb_error_msg_and_die("incorrect password");
    105131    }
Note: See TracChangeset for help on using the changeset viewer.