aboutsummaryrefslogtreecommitdiff
path: root/libbb
AgeCommit message (Collapse)Author
2017-07-15copyfd: guard use of munmap() with #if (windows builds need this)Johannes Schindelin
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14libbb: hide getnetbyaddr() inside "#if ENABLE_FEATURE_ETC_NETWORKS" blockDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14xxd: allow "-" as file name meaning stdinDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14libbb/dump: allow skipping over stdin tooDenys Vlasenko
function old new delta next 294 265 -29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14libbb/dump: fix a few broken commits and shrink codeDenys Vlasenko
function old new delta next 310 294 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14libbb: safe_write should not return EINTRDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14cat: fix "cat -An" ignoring -n; make numbering go througn all filesDenys Vlasenko
function old new delta cat_main 418 428 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-10libbb: do not die if setgid/setuid(real_id) on startup failsDenys Vlasenko
Based on a patch from Steven McDonald <steven@steven-mcdonald.id.au>: This makes 'unshare --user' work correctly in the case where the user's shell is provided by busybox itself. 'unshare --user' creates a new user namespace without any uid mappings. As a result, /bin/busybox is setuid nobody:nogroup within the namespace, as that is the only user. However, since no uids are mapped, attempting to call setgid/setuid fails, even though this would do nothing: $ unshare --user ./busybox.broken ash ash: setgid: Invalid argument 'unshare --map-root-user' still works, but because Linux only allows uid/gid mappings to be set up once, creating a root mapping makes such a namespace useless for creating multi-user containers. With this patch, setgid and setuid will not be called in the case where they would do nothing, which is always the case inside a new user namespace because all uids are effectively mapped to nobody: $ id -u 1000 $ ls -lh busybox.fixed -rwsr-xr-x 1 root root 826.2K May 21 00:33 busybox.fixed $ unshare --user ./busybox.fixed ash $ id -u 65534 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-07main: fix the case where user has "halt" as login shell. Closes 9986Denys Vlasenko
halt::0:0::/:/sbin/halt function old new delta run_applet_and_exit 748 751 +3 run_applet_no_and_exit 467 459 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-04libbb: new function bb_getgroups() - allocating wrapper around getgroups()Denys Vlasenko
function old new delta bb_getgroups - 111 +111 nexpr 843 757 -86 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/1 up/down: 111/-86) Total: 25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-04Change BB_EXTRA_VERSION: now it needs to contain any spaces/parenthesisDenys Vlasenko
Before this change, BB_EXTRA_VERSION of "" resulted in: "BusyBox v1.28.0.git () multi-call binary" message, after the fix it is: "BusyBox v1.28.0.git multi-call binary" While at it, eliminate BB_BT and BANNER single-use macros. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03fixes for bugs found by make_single_applets.shDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17Spelling fixes in comments, documentation, tests and examplesDenys Vlasenko
By klemens <ka7@github.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13libbb: fix "error: redefinition of 'is_tty_secure'"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-04-13login: move check_securetty to libbbKaarle Ritvanen
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-12libbb: GETOPT_RESET macroKaarle Ritvanen
Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-12fix errors found with make_single_applets.shDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-11libbb: move isqrt from factor, use it in diff tooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-06modprobe: do not descend into /etc/modprobe.d/DIR/. Closes 8686Denys Vlasenko
Also expanded comments in recursive_action.c Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-16mount: create loop devices with LO_FLAGS_AUTOCLEAR flagDenys Vlasenko
The "autolooped" mount (mount [-oloop] IMAGE /DIR/DIR) always creates AUTOCLEARed loopdevs, so that umounting drops them (and this does not require any code in the umount userspace). This happens since circa linux-2.6.25: commit 96c5865559cee0f9cbc5173f3c949f6ce3525581 Date: Wed Feb 6 01:36:27 2008 -0800 Subject: Allow auto-destruction of loop devices IOW: in this case, umount does not have to use -d to drop the loopdev. The explicit loop mount (mount /dev/loopN /DIR/DIR) does not do this. In this case, umount without -d should not drop loopdev. Unfortunately, bbox umount currently always implies -d, this probably needs fixing. function old new delta set_loop 537 597 +60 singlemount 1101 1138 +37 losetup_main 419 432 +13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 110/0) Total: 110 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-04Replace int -> uint to avoid signed integer overflowRostislav Skudnov
An example of such an error (should be compiled with DEBUG_SANITIZE): runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-02ps: avoid -o stat to contain spaces. Closes 9631Denys Vlasenko
function old new delta procps_scan 1227 1236 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-30libbb: match_fstype() is unreadable in the extreme, fixing itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26libbb: spawn_and_wait() fflushes before forking NOEXEC; child reinits logmodeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-25libbb: shrink sump.cDenys Vlasenko
function old new delta dot_flags_width_chars - 16 +16 int_convs - 7 +7 lcc 7 - -7 index_str 16 - -16 rewrite 1013 937 -76 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 23/-99) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-25xxd: new appletDenys Vlasenko
Yet Another Hexdumper function old new delta xxd_main - 364 +364 packed_usage 31046 31116 +70 applet_names 2560 2564 +4 applet_main 1476 1480 +4 rewrite 1022 1013 -9 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/1 up/down: 442/-9) Total: 433 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-24tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't workDenys Vlasenko
Good news that TLS_RSA_WITH_AES_256_CBC_SHA256 still works with new code ;) This change adds inevitable extension to have different sized hashes and AES key sizes. In libbb, md5_end() and shaX_end() are extended to return result size instead of void - this helps *a lot* in tls (the cost is ~5 bytes per _end() function). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-15libbb: eliminate redundant variable in sha_cryptDenys Vlasenko
function old new delta sha_crypt 1136 1130 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-15sha512: use larger constant table only if sha512 is in fact selectedDenys Vlasenko
function old new delta sha_K 640 256 -384 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11libbb: consolidate the code to set termios unbuffered modeDenys Vlasenko
function old new delta set_termios_to_raw - 116 +116 count_lines 72 74 +2 powertop_main 1458 1430 -28 top_main 943 914 -29 more_main 759 714 -45 fsck_minix_main 2969 2921 -48 conspy_main 1197 1135 -62 rawmode 99 36 -63 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-11busybox: stop depending on FEATURE_AUTOWIDTH for applet listDenys Vlasenko
Many other appletw don't - they unconditionally use get_terminal_wodth(), and here the amount of code saved by FEATURE_AUTOWIDTH=n is tiny. 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>
2017-01-06Automatically disable FEATURE_COMPRESS_USAGE for small builds.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-03appletlib: avoid warning on unused function ingroupCristian Ionescu-Idbohrn
libbb/appletlib.c:558:12: warning: 'ingroup' defined but not used [-Wunused-function] static int ingroup(uid_t u, gid_t g) ^~~~~~~ That function is used only if FEATURE_SUID_CONFIG is also enabled. Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23Make FEATURE_USERNAME_COMPLETION=y by defaultDenys Vlasenko
This matches bash behavior on Fedora Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23fix breakage found by mass one-applet buildsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12df: implement -B n<suff> and -B <suff> formats of -B optionDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-10randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-09selinux: drop deprecated headersMike Frysinger
The selinux guys want you to get class values at runtime by converting textual names into constants. Drop the deprecated headers and switch to the new format. This API has been around for years, so there shouldn't be an issue with backwards compatibility. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-12-08randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-04fix musl problem with dirname, now for all users of bb_make_directory()Denys Vlasenko
function old new delta bb_make_directory 412 419 +7 install_main 793 769 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-24) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-28Do not print useless empty line after list of appletsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-28lineedit: simplify code a bitDenys Vlasenko
function old new delta lineedit_read_key 155 162 +7 put_prompt 51 46 -5 read_line_input 3722 3715 -7 cmdedit_setwidth 81 50 -31 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 7/-43) Total: -36 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-27lineedit: fix two bugs in SIGWINCH signal handlingDenys Vlasenko
(1) restore entire sigaction, not only signal handler function (2) do not use stdio when not sure WINCH did not interrupt a printf() or such. function old new delta cmdedit_setwidth - 81 +81 read_line_input 3682 3722 +40 lineedit_read_key 138 155 +17 put_prompt 55 51 -4 win_changed 93 47 -46 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/2 up/down: 138/-50) Total: 88 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-25ash,hush: make ^C in interactive mode visually much closer to bash behaviorDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24Move FEATURE_BUFFERS_USE_foo options to library tuningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24Move locale, unicode, and "use sendfile?" options to library tuningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24lineedit: fix handling of repeating Alt-b, Alt-f, Alt-d, Alt-BackspaceRostislav Skudnov
These key combinations should repeat correctly when the keys are pressed and held. Before this change, they do this erratically - many repeats are "eaten" because they are treated as unrecognized ESC seqs: ESC 0x7f is treated by Alt+baskspace, but ESC 0x7f ESC 0x7f ESC 0x7f is unrecognized. Escape sequences corresponding to these key combinations are moved from read_line_input to lineedit_read_key. Also, these key sequences are now enabled regardless of whether FEATURE_EDITING_VI is set, since Vim does not actually support these key combinations, but they are present in readline library. function old new delta static.esccmds 93 103 +10 read_line_input 3737 3687 -50 Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>