Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

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

    r2725 r3232  
    88#include "libbb.h"
    99#include <syslog.h>
     10
     11//usage:#define su_trivial_usage
     12//usage:       "[OPTIONS] [-] [USER]"
     13//usage:#define su_full_usage "\n\n"
     14//usage:       "Run shell under USER (by default, root)\n"
     15//usage:     "\n    -,-l    Clear environment, run shell as login shell"
     16//usage:     "\n    -p,-m   Do not set new $HOME, $SHELL, $USER, $LOGNAME"
     17//usage:     "\n    -c CMD  Command to pass to 'sh -c'"
     18//usage:     "\n    -s SH   Shell to use instead of user's default"
    1019
    1120#if ENABLE_FEATURE_SU_CHECKS_SHELLS
     
    4352    uid_t cur_uid = getuid();
    4453    const char *tty;
     54#if ENABLE_FEATURE_UTMP
    4555    char user_buf[64];
     56#endif
    4657    const char *old_user;
    4758
     
    103114    }
    104115
    105     /* Make sure pw->pw_shell is non-NULL.  It may be NULL when NEW_USER
    106      * is a username that is retrieved via NIS (YP), that doesn't have
    107      * a default shell listed.  */
    108     if (!pw->pw_shell || !pw->pw_shell[0])
    109         pw->pw_shell = (char *)DEFAULT_SHELL;
    110 
    111116#if ENABLE_FEATURE_SU_CHECKS_SHELLS
    112     if (opt_shell && cur_uid != 0 && restricted_shell(pw->pw_shell)) {
     117    if (opt_shell && cur_uid != 0 && pw->pw_shell && restricted_shell(pw->pw_shell)) {
    113118        /* The user being su'd to has a nonstandard shell, and so is
    114119         * probably a uucp account or has restricted access.  Don't
     
    116121         * shell.  */
    117122        bb_error_msg("using restricted shell");
    118         opt_shell = NULL;
     123        opt_shell = NULL; /* ignore -s PROG */
    119124    }
    120125    /* else: user can run whatever he wants via "su -s PROG USER".
     
    127132    setup_environment(opt_shell,
    128133            ((flags & SU_OPT_l) / SU_OPT_l * SETUP_ENV_CLEARENV)
    129             + (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV),
     134            + (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV)
     135            + (!(flags & SU_OPT_l) * SETUP_ENV_NO_CHDIR),
    130136            pw);
    131137    IF_SELINUX(set_current_security_context(NULL);)
Note: See TracChangeset for help on using the changeset viewer.