aboutsummaryrefslogtreecommitdiff
path: root/loginutils/su.c
AgeCommit message (Collapse)Author
2020-12-02libbb: rename run_shell() to exec_shell()Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29libbb: bb_do_delay(3) -> pause_after_failed_login(), and stop looping thereDenys Vlasenko
function old new delta pause_after_failed_login - 9 +9 vlock_main 358 353 -5 sulogin_main 252 247 -5 su_main 484 479 -5 passwd_main 936 931 -5 login_main 967 962 -5 bb_do_delay 68 - -68 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/5 up/down: 9/-93) Total: -84 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13fix "loginutils/Config.in:319 error: Overlong line"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13libbb: make check_password() also return CHECKPASS_PW_HAS_EMPTY_PASSWORDDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13su: FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTYDenys Vlasenko
When this feature is enabled, blank passwords are not accepted by su unless the user is on a secure TTY defined in /etc/securetty. This resembles the default PAM configuration of some Linux distros which specify the nullok_secure option for pam_unix.so. Based on patch by Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10Big cleanup in config help and descriptionDenys Vlasenko
Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-03su: expand help; simplify passing of -c CMD to run_shell()Denys Vlasenko
Also, added a comment about bug 9401 (TIOCSTI input injection). function old new delta packed_usage 30909 30932 +23 su_main 470 487 +17 sulogin_main 260 258 -2 run_applet_and_exit 681 678 -3 run_shell 166 126 -40 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19loginutils/*: convert to new-style "one file" appletsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16su: add a delay if the password is incorrectRomain Naour
Signed-off-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-19sulogin: use common password-checking routine.Denys Vlasenko
This needed some extensions correct_passwd() function, which got renamed ask_and_check_password() to better describe what it does. function old new delta ask_and_check_password_extended - 215 +215 ask_and_check_password - 12 +12 vlock_main 394 397 +3 sulogin_main 494 326 -168 correct_password 207 - -207 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 1/1 up/down: 230/-375) Total: -145 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-12su: do not change to home dir unless -lPascal Bellard
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-06libbb/login/su: do not sanitize shell name twiceDenys Vlasenko
function old new delta setup_environment 191 205 +14 login_main 1002 987 -15 su_main 474 458 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 14/-31) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-31su: document -l in --help text. Closes bug 2761Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-30su: suppress "warning: unused variable 'user_buf'"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-27*: s/"/bin/sh"/DEFAULT_SHELL, run_shell() API fix, remove unneeded strdupLadislav Michl
function old new delta run_shell 157 166 +9 su_main 477 470 -7 sulogin_main 515 503 -12 Signed-off-by: Ladislav Michl <Ladislav.Michl@seznam.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26su: move restricted_shell into su.c (the only user)Denys Vlasenko
function old new delta su_main 448 468 +20 buffer_fill_and_print 179 196 +17 scriptreplay_main 205 208 +3 localcmd 275 277 +2 hash_find 233 234 +1 devmem_main 469 463 -6 install_main 724 716 -8 setusershell 11 - -11 find_pair 187 169 -18 restricted_shell 49 - -49 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 5/3 up/down: 43/-92) Total: -49 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26setup_environment(): eliminate one parameterDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-09a few more GCC-isms removedDenys Vlasenko
text data bss dec hex filename 824641 458 6956 832055 cb237 busybox_old 824631 458 6956 832045 cb22d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-21*: mass renaming of USE_XXXX to IF_XXXXDenis Vlasenko
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
2008-12-23libbb: introduce and use xmalloc_ttyname (-32 in bss).Denis Vlasenko
ash: small code shrink text data bss dec hex filename 793669 504 7524 801697 c3ba1 busybox_old 793659 504 7492 801655 c3b77 busybox_unstripped
2008-12-03libbb: introduce and use xgetpwnam. ~ -150 bytes.Denis Vlasenko
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-03-17*: shrink by using [f]open_or_warn_stdin where appropriateDenis Vlasenko
function old new delta lsattr_main 62 143 +81 open_or_warn_stdin - 36 +36 fclose_if_not_stdin 20 47 +27 xfopen_stdin - 20 +20 tac_main 336 356 +20 cksum_main 249 259 +10 bb_argv_dash - 8 +8 su_main 448 455 +7 cmp_main 630 633 +3 passwd_main 1072 1074 +2 uudecode_main 317 315 -2 text_yank 110 108 -2 handle_incoming_and_exit 2653 2651 -2 flags 5 1 -4 write_leases 235 230 -5 fopen_or_warn_stdin 48 42 -6 fold_main 648 642 -6 static.argv_dash 8 - -8 sum_main 142 128 -14 tail_main 1237 1221 -16 sed_main 711 695 -16 cmp_xfopen_input 17 - -17 bb_cat 113 96 -17 catv_main 328 306 -22 strings_main 457 434 -23 hash_file 298 274 -24 sum_file 353 325 -28 sort_main 904 859 -45 expand_main 736 686 -50 cut_main 1116 1065 -51 md5_sha1_sum_main 549 493 -56 lsattr_args 90 - -90 read_stduu 408 255 -153 ------------------------------------------------------------------------------ (add/remove: 3/3 grow/shrink: 7/20 up/down: 214/-657) Total: -443 bytes text data bss dec hex filename 797417 658 7428 805503 c4a7f busybox_old 796973 658 7428 805059 c48c3 busybox_unstripped
2008-03-17dos2unix: tiny shrinkDenis Vlasenko
login,su: fix setup_environment() so that it works as intended (parameter names were a bit misleading) fdisk: shrink help text: shrink function old new delta login_main 1658 1701 +43 setup_environment 206 203 -3 dos_compatible_flag 4 1 -3 dos2unix_main 383 375 -8 get_boot 1724 1702 -22 fdisk_main 2949 2889 -60 packed_usage 24250 23948 -302 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/6 up/down: 43/-398) Total: -355 bytes text data bss dec hex filename 798768 661 7428 806857 c4fc9 busybox_old 798327 658 7428 806413 c4e0d busybox_unstripped
2007-10-11add -fvisibility=hidden to CC flags, mark XXX_main functionsDenis Vlasenko
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-09-10setup_environment: code shrinkDenis Vlasenko
run_shell: mark as NORETURN setup_environment, run_shell: add usage comments login: add FIXME :( function old new delta UNSPEC_print 64 66 +2 sulogin_main 509 506 -3 mkfs_minix_main 3070 3067 -3 login_main 1615 1612 -3 su_main 461 448 -13 setup_environment 261 206 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/5 up/down: 2/-77) Total: -75 bytes text data bss dec hex filename 772578 1051 10724 784353 bf7e1 busybox_old 772502 1051 10724 784277 bf795 busybox_unstripped
2007-08-18don't pass argc in getopt32, it's superfluousDenis Vlasenko
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes text data bss dec hex filename 773469 1058 11092 785619 bfcd3 busybox_old 772644 1058 11092 784794 bf99a busybox_unstripped
2007-05-26usage.c: remove reference to busybox.hDenis Vlasenko
*: s/include "busybox.h"/include "libbb.h"
2007-02-03suppress warnings about easch <applet>_main() havingDenis Vlasenko
no preceding prototype
2007-01-29preparatory patch for -Wwrite-strings #3Denis Vlasenko
2006-12-23su: fix typo: "argv -= optind" should be +=Denis Vlasenko
2006-12-19- rename SU_SYSLOG to FEATURE_SU_SYSLOGBernhard Reutner-Fischer
2006-12-19su: make /etc/shells check configurableDenis Vlasenko
ash: missing ';'
2006-12-16inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]Denis Vlasenko
2006-10-03bb_applet_name -> applet_nameDenis Vlasenko
2006-10-03getopt_ulflags -> getopt32.Denis Vlasenko
It is impossible to formulate sane ABI based on size of ulong because it can be 32-bit or 64-bit. Basically it means that you cannot portably use more that 32 option chars in one call anyway... Make it explicit.
2006-09-23correct_password: undo whitespace damage.Denis Vlasenko
vlock + correct_password: fix incorrect line breaks in messages.
2006-09-13- fix copy'n paste errors that got introduced when switching to the shorter ↵Bernhard Reutner-Fischer
boilerplate. No object code changes.
2006-09-07getty, sulogin: convert to using bb_msg for syslog outputDenis Vlasenko
2006-08-03Remove bb_ prefixes from xfuncs.c (and a few other places), consolidateRob Landley
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
2006-07-15Comment tweak from tito.Rob Landley
2006-07-10Patch from Tito to make syslog configurable and remove #ifdefs. FurtherRob Landley
cleanups by me.
2006-06-14- minor size tweakBernhard Reutner-Fischer
text data bss dec hex filename 613 0 0 613 265 loginutils/su.o.orig 605 0 0 605 25d loginutils/su.o
2006-05-27Consolidate #include <sys/time.h> so libbb.h does it.Rob Landley
2006-01-19- Document -m, -c, -s and provide a default shell for standalone build.Bernhard Reutner-Fischer
- Wrap overlong lines plus a few whitespace fixes. - add GPL header.