aboutsummaryrefslogtreecommitdiff
path: root/loginutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2025-08-124-11/+48
|\
| * cryptpw: fix detection of crypt algo from salt (was broken if default isn't DES)Denys Vlasenko2025-07-191-5/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | The symptom is: "cryptpw ... implicit" testsuite tests were failing if CONFIG_FEATURE_DEFAULT_PASSWD_ALGO is not "des". function old new delta cryptpw_main 223 283 +60 pw_encrypt 974 975 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sulogin: set ^C to SIG_DFL before execing the shellDenys Vlasenko2025-07-181-3/+6
| | | | | | | | | | | | | | function old new delta sulogin_main 331 340 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * password applets: update help textDenys Vlasenko2025-07-181-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb.h: increase MAX_PW_SALT_LENDenys Vlasenko2025-07-171-2/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add yescrypt password hashing supportDenys Vlasenko2025-07-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems to work, but not at all optimized for size. The extra copy of sha256 code need to be removed. The yescrypt code in libbb/yescrypt/* is adapted from libxcrypt-4.4.38 with minimal edits, hopefully making it easier to track backports by resetting the tree to this commit, then comparing changes in upstream libxcrypt to the tree. function old new delta blockmix_xor_save - 7050 +7050 static.blockmix_xor - 6475 +6475 blockmix - 3390 +3390 SHA256_Transform - 3083 +3083 yescrypt_kdf_body - 1724 +1724 PBKDF2_SHA256 - 1003 +1003 smix1 - 960 +960 yescrypt_r - 890 +890 salsa20 - 804 +804 smix - 790 +790 smix2 - 659 +659 blockmix_salsa8_xor - 601 +601 yescrypt_kdf - 479 +479 blockmix_salsa8 - 415 +415 Krnd - 256 +256 _HMAC_SHA256_Init - 213 +213 _SHA256_Update - 198 +198 _SHA256_Final - 195 +195 decode64_uint32 - 166 +166 encode64 - 153 +153 decode64 - 136 +136 libcperciva_HMAC_SHA256_Buf - 132 +132 SHA256_Pad_Almost - 131 +131 salsa20_simd_unshuffle - 101 +101 salsa20_simd_shuffle - 101 +101 yes_crypt - 90 +90 libcperciva_SHA256_Buf - 86 +86 crypt_make_rand64encoded - 85 +85 static.atoi64_partial - 77 +77 alloc_region - 72 +72 ascii64 - 65 +65 PAD - 64 +64 _HMAC_SHA256_Final - 55 +55 static.cpu_to_be32_vect - 51 +51 free_region - 47 +47 libcperciva_SHA256_Init - 37 +37 yescrypt_init_local - 34 +34 crypt_make_pw_salt 92 125 +33 initial_state - 32 +32 .rodata 105771 105803 +32 atoi64 - 25 +25 explicit_bzero - 22 +22 pw_encrypt 920 941 +21 yescrypt_free_local - 9 +9 crypt_make_salt 85 - -85 ------------------------------------------------------------------------------ (add/remove: 43/1 grow/shrink: 3/0 up/down: 31042/-85) Total: 30957 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: retry when command needs elevated privilegesRon Yorston2025-02-031-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some installer programs have an entry in their manifest to indicate that they need elevated privileges. The shell in busybox-w32 was unable to run such programs. When a program fails to run with ERROR_ELEVATION_REQUIRED, try again using ShellExecuteEx() with the 'runas' verb to give it elevated privileges. Adds 272-288 bytes. (GitHub issue #481)
* | su: note that test mode implies -W in usage messageRon Yorston2024-08-081-1/+1
| | | | | | | | | | | | Saves 8-16 bytes (GitHub issue #438)
* | su: add test modeRon Yorston2024-08-071-19/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Testing some uses of 'su' can be challenging because any errors appear in the new console window which may close as a result. Add the '-t' option to enable test mode. This starts a new shell using ShellExecuteEx(), but without elevated privileges and a new console. All other options and arguments are handled much as before, though some differences in behaviour are to be expected due to the lack of elevated privilege. Adds 80-96 bytes. (GitHub issue #438)
* | su: use correct option when cmd.exe is used as shellRon Yorston2024-08-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Most Unix shells (and PowerShell) use the '-c' option to specify commands to execute. cmd.exe uses '/c' instead. Detect when cmd.exe is the 'shell' being used with 'su -s' and adjust the command option to suit. Adds 48-56 bytes. (GitHub issue #438)
* | su: allow an alternative shell to be selectedRon Yorston2024-08-041-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the '-s' option to allow an alternative shell to be given. No PATH search is performed for the shell, so an absolute or relative path to a suitable executable must be provided. Certain features are only available when the built-in shell is used: - The '-N' option, which allows the console window to remain open when the shell exits. - The fix which allows the current directory to be retained despite the efforts of ShellExecute() to change it. - The friendly message in the console title. Adds 128 bytes. (GitHub issue #438)
* | su: detect inability to raise privilegeRon Yorston2024-08-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | When privilege has been dropped by the 'drop' applet, the 'su' applet is unable to raise it again because ShellExecuteEx() thinks it unnecessary. Detect this situation, report an error and return exit code 2. Costs 72-112 bytes. (GitHub issue #437)
* | su: free all allocated memoryRon Yorston2024-03-081-14/+18
| | | | | | | | | | | | Ensure memory is freed even on early exit. Saves 0-16 bytes.
* | su: handle restricted disk driversRon Yorston2024-03-071-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain tools which allow disk image files and RAM disks to be mounted were found to lack a feature used to implement realpath(3). This resulted in a segfault in the 'su' applet when it was run in such a virtual filesystem. 'su' uses realpath(3) to canonicalise the current directory. This is only really required to handle network shares mapped to a drive letter. (GitHub issue #148) - If the call to realpath(3) fails for some reason fall back to using the current directory determined by calling getcwd(3). - If getcwd(3) fails simply don't pass any directory to the shell being started by 'su'. Also, ensure all allocated memory is freed, if required. (GitHub issue #389) Adds 16-32 bytes.
* | win32: convert exit codesRon Yorston2023-09-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two utility functions to convert Windows process exit codes. - exit_code_to_wait_status() converts to a POSIX wait status. This is used in ash and the implementations of system(3) and mingw_wait3(). - exit_code_to_posix() converts to a POSIX exit code. (Not that POSIX has much to say about them.) As a result it's possible for more applets to report when child processes are killed as if by a signal. 'time', 'drop' and 'su -W', for example. Adds 64-80 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2023-07-1310-19/+19
|\|
| * Update applet size estimatesDenys Vlasenko2023-07-1010-13/+13
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: code shrink: introduce and use [_]exit_FAILURE()Denys Vlasenko2023-06-152-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta exit_FAILURE - 7 +7 _exit_FAILURE - 7 +7 run 198 199 +1 restore_state_and_exit 114 115 +1 xbsd_write_bootstrap 399 397 -2 vfork_compressor 209 207 -2 sig_handler 12 10 -2 serial_ctl 154 152 -2 parse_args 1169 1167 -2 onintr 21 19 -2 make_new_session 493 491 -2 login_main 988 986 -2 gotsig 35 33 -2 do_iplink 1315 1313 -2 addgroup_main 397 395 -2 inetd_main 1911 1908 -3 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/12 up/down: 16/-25) Total: -9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | su: fix usage messageFRP-5007-g82accfc19Ron Yorston2023-05-281-1/+1
| |
* | su: add option to keep console open on shell exitRon Yorston2023-05-021-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The '-N' option keeps the console window open after the elevated shell exits. Previously this was achieved by passing the '-s' option along with '-c'. Recent changes allow scripts to be run without using '-c' so a new mechanism is required. su passes the '-N' flag to the shell. This causes the shell to issue a prompt and wait for user input when it exits. Costs 200-204 bytes.
* | su: add option to wait for shell exit codeRon Yorston2023-05-021-3/+27
| | | | | | | | | | | | | | The '-W' option causes su to wait for the elevated shell to terminate and returns its exit code. Costs 144 bytes.
* | su: pass additional arguments to shRon Yorston2023-04-261-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The real su allows a command file to be run, with arguments given on the command line. Similarly it allows the script run with '-c' to take arguments. In fact, any arguments can be passed to sh. Permit the same in the Windows implementation. For compatibility this requires a user name to be specified, even though we only support elevation. The user name must be 'root'. Also, ensure the '-c' command is properly quoted. Adds 144-152 bytes. (GitHub PR #317)
* | Merge busybox into mergeRon Yorston2022-02-093-8/+12
|\| | | | | | | | | | | | | | | Fix conflicts in reset and ash. Redefine the new safe_read_key() as a reference to read_key(). Disable SHA256_HWACCEL.
| * libbb: invert the meaning of SETUP_ENV_NO_CHDIR -> SETUP_ENV_CHDIRDenys Vlasenko2022-01-133-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | Double negatives are hard to grok. function old new delta login_main 986 988 +2 su_main 474 470 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-4) Total: -2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge busybox into mergeRon Yorston2022-01-132-9/+43
|\| | | | | | | | | | | | | Fix merge conflicts in coreutils/ls.c and shell/ash.c. Update config files to turn off SHA1_HWACCEL. It uses non-portable assembler.
| * sulogin: util-linux does not say "normal startup" on Ctrl-DDenys Vlasenko2022-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | function old new delta sulogin_main 341 331 -10 .rodata 104327 104312 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25) Total: -25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sulogin: start _login_ shell only with -pDenys Vlasenko2022-01-131-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Also, shorten/eliminate messages to be closer to util-linux. function old new delta packed_usage 34233 34238 +5 sulogin_main 340 341 +1 .rodata 104380 104327 -53 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 6/-53) Total: -47 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: ^C with SIG_INGed SIGINT should not exit the shellDenys Vlasenko2022-01-132-1/+8
| | | | | | | | | | | | | | function old new delta __pgetc 501 522 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sulogin: increase util-linux compatibilityDenys Vlasenko2022-01-121-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Change to root's HOME. Set some envvars. Steal ctty if necessary and possible. function old new delta sulogin_main 240 340 +100 setup_environment 225 233 +8 su_main 479 474 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 108/-5) Total: 103 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge busybox into mergeRon Yorston2022-01-063-5/+5
|\| | | | | | | | | | | Fix merge conflict in miscutils/less.c. Use exit_SUCCESS() where possible.
| * libbb: code shrink: introduce and use [_]exit_SUCCESS()Denys Vlasenko2022-01-052-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta exit_SUCCESS - 7 +7 _exit_SUCCESS - 7 +7 run_pipe 1562 1567 +5 pseudo_exec_argv 399 400 +1 finish 86 87 +1 start_stop_daemon_main 1109 1107 -2 shutdown_on_signal 38 36 -2 runsv_main 1662 1660 -2 redirect 1070 1068 -2 read_line 79 77 -2 pause_and_low_level_reboot 54 52 -2 list_i2c_busses_and_exit 483 481 -2 less_exit 12 10 -2 identify 4123 4121 -2 grep_file 1161 1159 -2 getty_main 1519 1517 -2 fsck_minix_main 2681 2679 -2 free_session 132 130 -2 fdisk_main 4739 4737 -2 clean_up_and_exit 53 51 -2 bsd_select 1566 1564 -2 bb_daemonize_or_rexec 198 196 -2 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/17 up/down: 21/-34) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: factor out fflush_stdout_and_exit(EXIT_SUCCESS)Denys Vlasenko2022-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta fflush_stdout_and_exit_SUCCESS - 7 +7 xxd_main 890 888 -2 vlock_main 353 351 -2 uuencode_main 318 316 -2 uniq_main 427 425 -2 uname_main 250 248 -2 sort_main 853 851 -2 shuf_main 500 498 -2 route_main 238 236 -2 readlink_main 113 111 -2 nice_main 156 154 -2 last_main 957 955 -2 ipcs_main 960 958 -2 env_main 209 207 -2 chrt_main 464 462 -2 cal_main 921 919 -2 baseNUM_main 650 648 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/16 up/down: 7/-32) Total: -25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-06-281-1/+1
|\|
| * *: more --help tweaksDenys Vlasenko2021-06-151-1/+1
| | | | | | | | | | | | | | function old new delta packed_usage 33552 33541 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-05-141-3/+13
|\|
| * login: permit change expired password wit PAMMario Abajo2021-05-071-0/+3
| | | | | | | | | | Signed-off-by: Mario Abajo <marioabajo@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * login: implement LOGIN_TIMEOUTDenys Vlasenko2021-03-191-3/+10
| | | | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 33559 33598 +39 login_main 953 986 +33 .rodata 103161 103175 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 86/0) Total: 86 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-02-051-3/+3
|\|
| * cryptpw: typo in usage messageRon Yorston2021-02-021-3/+3
| | | | | | | | | | | | | | '[-p N]' should be '[-P N]' in the trivial usage message. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-01-148-38/+22
|\|
| * randomconfig fixesDenys Vlasenko2020-12-291-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tweak help textsDenys Vlasenko2020-12-161-9/+1
| | | | | | | | | | | | | | function old new delta packed_usage 33650 33605 -45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text: replace [OPTIONS] with actual options (if not too long)Denys Vlasenko2020-12-131-9/+1
| | | | | | | | | | | | | | function old new delta packed_usage 33620 33665 +45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text tweaksDenys Vlasenko2020-12-131-1/+1
| | | | | | | | | | | | | | function old new delta packed_usage 33547 33545 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: exec_login_shell() - new functionDenys Vlasenko2020-12-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | function old new delta exec_login_shell - 12 +12 sulogin_main 247 240 -7 login_main 960 953 -7 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 12/-14) Total: -2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: rename run_shell() to exec_shell()Denys Vlasenko2020-12-023-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * login: log to syslog every bad password, not only 3rdDenys Vlasenko2020-12-021-4/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * use write_str() functions where appropriateDenys Vlasenko2020-11-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | function old new delta chat_main 1300 1295 -5 finalize_tty_attrs 80 70 -10 getty_main 1538 1519 -19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-34) Total: -34 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: introduce and use sleep1()Denys Vlasenko2020-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sleep1 - 9 +9 run_shutdown_and_kill_processes 97 95 -2 restore_state_and_exit 116 114 -2 reread_partition_table 67 65 -2 flush_buffer_cache 80 78 -2 chat_main 1302 1300 -2 timeout_main 310 307 -3 telnet_main 1235 1232 -3 stop_handler 86 83 -3 process_action 1078 1075 -3 nbdclient_main 1185 1182 -3 init_main 789 786 -3 getty_main 1541 1538 -3 do_time 410 407 -3 runsv_main 1682 1677 -5 pause_and_low_level_reboot 59 54 -5 inetd_main 1917 1911 -6 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/16 up/down: 9/-50) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: bb_do_delay(3) -> pause_after_failed_login(), and stop looping thereDenys Vlasenko2020-11-295-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>