Commit Graph

54 Commits

Author SHA1 Message Date
Ryan Mallon
1d30b3f1f6 wall,crontab: use xopen_as_uid_gid()
This fixes a narrow security race in crontab.

function                                             old     new   delta
xopen_as_uid_gid                                       -      80     +80
seteuid                                                -      64     +64
setegid                                                -      64     +64
setreuid                                               -      37     +37
xseteuid                                               -      22     +22
xsetegid                                               -      22     +22
crontab_main                                         590     577     -13
setfsuid                                              33       -     -33
setfsgid                                              33       -     -33
wall_main                                            138     102     -36
open_as_user                                         109       -    -109

   text    data     bss     dec     hex filename
 893539     497    7568  901604   dc1e4 busybox_old
 893618     497    7568  901683   dc233 busybox_unstripped

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-08 14:53:29 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
681efe20d3 use user's shell instead of hardwired "/bin/sh" (android needs this)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 21:00:36 +01:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
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-08-16 20:14:46 +02:00
Pascal Bellard
926031b764 *: introduce and use xfork() and xvfork()
function                                             old     new   delta
launch_helper                                        170     169      -1
setup_heredoc                                        312     302     -10
handle_dir_common                                    367     354     -13
expand_vars_to_list                                 2456    2443     -13
open_transformer                                      89      74     -15
data_extract_to_command                              439     423     -16
do_ipaddr                                           1406    1389     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85)             Total: -85 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 15:32:38 +02:00
Denys Vlasenko
fd686a262f setup_environment(): eliminate one parameter
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 09:52:45 +01:00
Bernhard Reutner-Fischer
99709ab033 crontab: use setup_environment
function                                             old     new   delta
setup_environment                                    184     198     +14
.rodata                                           131770  131747     -23
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-23)             Total: -9 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-02-26 09:31:40 +01:00
Denys Vlasenko
b2e5fc35eb ntpd: and real handling for -N, show usage w/o options; trim text
function                                             old     new   delta
ntp_init                                             317     348     +31
bb_msg_you_must_be_root                                -      17     +17
xsocket                                               66      76     +10
changepath                                           195     194      -1
bb_msg_perm_denied_are_you_root                       35      34      -1
send_tree                                            355     353      -2
count_lines                                           74      72      -2
must_be_root                                          17       -     -17
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/4 up/down: 58/-23)             Total: 35 bytes
   text   data    bss    dec    hexfilename
 832873    441   7548 840862  cd49ebusybox_old
 832839    441   7548 840828  cd47cbusybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-25 14:52:47 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +01:00
Denis Vlasenko
ded5dfef6e crond,crontab: make cron directory location configurable 2009-02-03 23:59:41 +00:00
Denis Vlasenko
d7a805efaf libbb: introduce and use xgetpwnam. ~ -150 bytes. 2008-12-03 19:05:55 +00:00
Denis Vlasenko
0c68a874e7 libbb: password/group function helpers rewritten by Tito:
function                                             old     new   delta
xgetpwuid                                              -      27     +27
uid2uname_utoa                                         -      22     +22
gid2group_utoa                                         -      22     +22
uid2uname                                              -      18     +18
gid2group                                              -      18     +18
buffer_fill_and_print                                179     196     +17
print_user                                            12      24     +12
print_group                                           12      24     +12
get_cached                                            89      99     +10
...
print_common                                         134     120     -14
vlock_main                                           415     396     -19
logger_main                                          410     387     -23
crontab_main                                         642     609     -33
bb_getpwuid                                           42       -     -42
bb_getgrgid                                           42       -     -42
bb_getug                                              80       -     -80
------------------------------------------------------------------------------
(add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296)        Total: -109 bytes
2008-12-02 22:56:59 +00:00
Denis Vlasenko
30cfdf90ce crontab: do not destroy STDIN_FILENO, editor may need it (crontab -e)
vi: deal with EOF/error on stdin and with input NULs

function                                             old     new   delta
crontab_main                                         623     642     +19
edit_file                                            901     906      +5
readit                                               331     318     -13
2008-09-21 15:29:29 +00:00
Denis Vlasenko
b8d1a4cd5f init: set stderr to NONBLOCK
*: s/setenv(a,b,1)/xsetenv(a,b)/

function                                             old     new   delta
init_main                                            856     895     +39
message                                              146     144      -2
crond_main                                          1418    1416      -2
run                                                  661     658      -3
zcip_main                                           1409    1403      -6
edit_file                                            910     901      -9
environment                                           20       -     -20
2008-09-20 16:28:59 +00:00
Bernhard Reutner-Fischer
d73cbd31a2 - first pass to unify/cleanup uid handling (-236b)
This needs further love, alot of love.. Tito?
2008-07-21 14:41:33 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
82604e9730 revert last two commits. vfork cannot be used in subroutine,
it trashes stack on return
2008-07-01 15:59:42 +00:00
Denis Vlasenko
3da5572bfa *: introduce and use xvfork()
function                                             old     new   delta
time_main                                           1052    1285    +233
crontab_main                                         623     856    +233
ifupdown_main                                       2202    2403    +201
xvfork                                                 -      20     +20
passwd_main                                         1049    1053      +4
grave                                               1068    1066      -2
script_main                                          935     921     -14
vfork_or_die                                          20       -     -20
vfork_compressor                                     206     175     -31
open_as_user                                         109       -    -109
popen2                                               218       -    -218
edit_file                                            910     690    -220
run_command                                          268       -    -268
------------------------------------------------------------------------------
(add/remove: 1/4 grow/shrink: 4/4 up/down: 691/-882)         Total: -191 bytes
2008-07-01 10:40:41 +00:00
Denis Vlasenko
b44c790e41 *: fix various kinds of damage to letter 'c' in Arkadiusz Mickiewicz' surname.
chrt,taskset,dc,eject: shrink
crontab: call "vi" with just name, no path
watchdog: intercept all fatal signals

function                                             old     new   delta
xstrtoull_range                                        -      35     +35
static.sg_commands                                     -      18     +18
packed_usage                                       23698   23712     +14
watchdog_main                                        148     151      +3
crontab_main                                         637     638      +1
base                                                   1       -      -1
static.ps                                              4       -      -4
pointer                                                4       -      -4
stack_machine                                         99      92      -7
run_command                                          273     260     -13
eject_main                                           360     343     -17
static.C                                              30      12     -18
ptok                                                  61      38     -23
xstrtol_range                                         27       -     -27
get_token                                             35       -     -35
taskset_main                                         586     550     -36
chrt_main                                            411     372     -39
dc_main                                              158     117     -41
time_main                                           1127    1037     -90
------------------------------------------------------------------------------
(add/remove: 2/5 grow/shrink: 3/9 up/down: 71/-355)          Total: -284 bytes
   text    data     bss     dec     hex filename
 793680     662    7420  801762   c3be2 busybox_old
 793327     662    7412  801401   c3a79 busybox_unstripped
2008-03-17 09:29:43 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00
Bernhard Reutner-Fischer
27dd495b98 - fix open(creat) without a mode 2008-02-18 18:35:53 +00:00
Denis Vlasenko
c9ca0a3274 mount: recognize "dirsync" (closes bug 835)
mount: sanitize environ if called by non-root
*: adjust for slightly different sanitize routine
2008-02-18 11:08:33 +00:00
Denis Vlasenko
03b4c14bd4 crontab: stop using remove() - use unlink() instead 2008-02-17 14:30:03 +00:00
Denis Vlasenko
7fc294cdfe crontab: clear env if run by non-root, so that we can use PATH now
crontab: make "-c /tmp/ -e" work
2008-02-16 13:47:57 +00:00
Denis Vlasenko
3718832a15 *: more readable handling of pipe fds. No code changes. 2008-02-16 13:20:56 +00:00
Denis Vlasenko
069e347863 crontab: almost complete rewrite
crontab: make options consistent with other implementations

   text    data     bss     dec     hex filename
   2042       4       0    2046     7fe busybox.t1/miscutils/crontab.o
   1331       0       0    1331     533 busybox.t2/miscutils/crontab.o

function                                             old     new   delta
edit_file                                            733     956    +223
open_as_user                                           -     171    +171
packed_usage                                       23652   23650      -2
CDir                                                   8       4      -4
ChangeUser                                           139       -    -139
crontab_main                                        1522     616    -906
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/3 up/down: 394/-1051)        Total: -657 bytes
2008-02-16 13:17:13 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
1acdc89e99 style and message text fixes 2007-09-27 10:17:53 +00:00
Denis Vlasenko
6cd84dac84 Three patches from FreeWRT people 2007-07-21 14:57:54 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
06c0a71d23 preparatory patch for -Wwrite-strings #3 2007-01-29 22:51:44 +00:00
Denis Vlasenko
9f739445cd inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid] 2006-12-16 23:49:13 +00:00
Denis Vlasenko
cf749bc10c small fixes:
fix xstrdup to not grossly overallocate memory
use xopen instean of xopen3 in several places
etc.
2006-11-26 15:45:17 +00:00
Denis Vlasenko
89f0b3486d rodata cleanup. "unable to" == "cannot". -300 bytes 2006-11-18 22:04:09 +00:00
Denis Vlasenko
ea62077b85 add open_read_close() and similar stuff 2006-10-14 02:23:43 +00:00
Denis Vlasenko
40920825d5 rename bb_default_error_retval -> xfunc_error_retval 2006-10-03 20:28:06 +00:00
Denis Vlasenko
94d5d82bd8 crontab: we indent using tabs 2006-09-27 19:48:56 +00:00
Bernhard Reutner-Fischer
64d7e93081 - convert a few xopen3(,,0) into xopen(,). Also peruse the fact that xopen defaults to 0777 on it's own, so we don't need to xopen3(,,0777).
Saves a few bytes:
$ size busybox.old busybox                                text    data     bss     dec     hex filename
 839676    8780  243592 1092048  10a9d0 busybox.old
 839660    8780  243592 1092032  10a9c0 busybox
$ make CC=gcc-4.2-HEAD bloatcheck
function                                             old     new   delta
static.vconfig_main                                  281     279      -2
static.rx_main                                      1076    1074      -2
static.mt_main                                       294     292      -2
static.gzip_main                                     753     751      -2
static.mkfs_minix_main                              4034    4030      -4
static.unzip_main                                   1771    1766      -5
static.crontab_main                                 1513    1507      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-23)             Total: -23 bytes
2006-09-11 16:01:40 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
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-08-03 15:41:12 +00:00
Rob Landley
11c7a7bed6 Various cleanups I made while going through Erik Hovland's patch submissions,
some of which are even from him. :)
2006-06-25 22:39:24 +00:00
Bernhard Reutner-Fischer
c89982dcd7 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-03 19:49:21 +00:00
Mike Frysinger
f284c767e5 use more boiler plate GPL notices 2006-04-16 20:38:26 +00:00
Bernhard Reutner-Fischer
c2cb0f32b4 - patch from Denis Vlasenko to add and use bb_xopen3() 2006-04-13 12:45:04 +00:00
Bernhard Reutner-Fischer
d9cf7ac781 - patch from Denis Vlasenko to add and use bb_xchdir() 2006-04-12 18:39:58 +00:00
"Vladimir N. Oleynik"
24f819fd74 can use TMPDIR if user's HOMEDIR do not found. Noticed by Bernhard 2006-01-10 12:35:43 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Glenn L McGrath
99bd5adf99 more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init.
Viodz last_patch_108
2003-09-03 12:18:42 +00:00
Glenn L McGrath
dc4e75ef7c move all "-/bin/sh" "/bin/sh" and "sh" to libbb/messages.c file as one
constant.
Vodz last_patch_107
2003-09-02 02:36:18 +00:00
Eric Andersen
9edcabdc34 Patch from Lars Kellogg-Stedman:
Busybox vi is installed in /bin/vi, but crontab was looking for
    /usr/bin/vi.  This patch makes crontab look for /bin/vi instead.
2003-07-14 19:14:26 +00:00