Commit Graph

617 Commits

Author SHA1 Message Date
Glenn L McGrath
240a91d8a1 Patch by Felipe Kellermann, use the common escape handling function and remove some unused code. 2004-09-15 02:05:23 +00:00
Eric Andersen
7eb79fff10 Tito writes:
Hi Erik,
Hi to all,
This is part five of the my_get*id story.
I've tweaked a bit this two functions to make them more flexible,
but this changes will not affect existing code.
Now they work so:
1) my_getpwuid( char *user, uid_t uid, int bufsize)

   if bufsize is > 0 char *user cannot be set to NULL
                     on success username is written on static allocated buffer
                     on failure uid as string is written to buffer and NULL is returned
   if bufsize is = 0 char *user can be set to NULL
                     on success username is returned
                     on failure NULL is returned
   if bufsize is < 0 char *user can be set to NULL
                     on success username is returned
                     on failure an error message is printed and the program exits

  2) 1) my_getgrgid( char *group, uid_t uid, int bufsize)

   if bufsize is > 0 char *group cannot be set to NULL
                     on success groupname is written on static allocated buffer
                     on failure gid as string is written to buffer and NULL is returned
   if bufsize is = 0 char *group can be set to NULL
                     on success groupname is returned
                     on failure NULL is returned
   if bufsize is < 0 char *group can be set to nULL
                     on success groupname is returned
                     on failure an error message is printed and the program exits

This changes were needed mainly for my new id applet.
It is somewhat bigger then the previous but matches the behaviour of GNU id
and is capable to handle usernames of whatever length.
BTW: at a first look it seems to me that it will integrate well (with just a few changes)
with the pending patch  in patches/id_groups_alias.patch.
The increase in size is balanced by the removal of my_getpwnamegid.c
from libbb as this was used only in previous id applet and by size optimizations
made possible in whoami.c and in passwd.c.
I know that we are in feature freeze but I think that i've tested it enough
(at least I hope so.......).
2004-09-02 22:21:41 +00:00
Eric Andersen
b225e2a76b Fixup some warnings 2004-08-28 00:43:07 +00:00
Eric Andersen
095dd0c46d Tito writes:
Hi,
I've fixed also the issue of whoami cutting down usernames.
This time I cannot send a diff because i don't know if my previous patches will be applied
or not, so I send in the whole file.
The changes I've made don't affect size but ensure that usernames of whatever lenght
are correctly displayed.
root@localhost:/dev/pts/3:/root/Desktop/busybox/coreutils# size whoami_orig.o
   text    data     bss     dec     hex filename
    102       0       0     102      66 whoami_orig.o
root@localhost:/dev/pts/3:/root/Desktop/busybox/coreutils# size whoami.o
   text    data     bss     dec     hex filename
     93       0       0      93      5d whoami.o

This should be applied even if the other patches aren't as this matches the behaviour of the  GNU whoami.

Thanks in advance,
Ciao,
Tito
2004-08-26 22:36:02 +00:00
Eric Andersen
52499cb9ae Tito writes:
Hi,
I've spent the half night staring at the devilish  my_getpwuid and my_getgrgid functions
trying to find out a way to avoid actual and future potential buffer overflow problems
without breaking existing code.
Finally I've  found a not intrusive way to do this that surely doesn't break existing code
and fixes a couple of problems too.
The attached patch:
1) changes the behaviour of my_getpwuid and my_getgrgid to avoid potetntial buffer overflows
2) fixes all occurences of this function calls in tar.c , id.c , ls.c, whoami.c, logger.c, libbb.h.
3) The behaviour of tar, ls and  logger is unchanged.
4) The behavior of ps with somewhat longer usernames messing up output is fixed.
5) The only bigger change was the increasing of size of the buffers in id.c to avoid
     false negatives (unknown user: xxxxxx) with usernames longer than 8 chars.
     The value i used ( 32 chars ) was taken from the tar header ( see gname and uname).
     Maybe this buffers can be reduced a bit  ( to 16 or whatever ), this is up to you.
6) The increase of size of the binary is not so dramatic:
     size busybox
       text    data     bss     dec     hex filename
     239568    2300   36816  278684   4409c busybox
    size busybox_fixed
       text    data     bss     dec     hex filename
     239616    2300   36816  278732   440cc busybox
7) The behaviour of whoami changed:
    actually it  prints out an username cut down to the size of the buffer.
    This could be fixed by increasing the size of the buffer as in id.c or
    avoid the use of my_getpwuid and use getpwuid directly instead.
    Maybe this colud be also remain unchanged......

Please apply if you think it is ok to do so.
The diff applies on today's cvs tarball (2004-08-25).
Thanks in advance,
Ciao,
Tito
2004-08-26 22:18:59 +00:00
Glenn L McGrath
73db8be80a Patch from Bastian Blank to add 64 bit support to the test command.
Example of broken usage: ./busybox test 2147483648 -gt 2147483648
2004-08-11 02:45:47 +00:00
Eric Andersen
93d7fba892 Tito, farmatito at tiscali dot it writes:
Hi to all,
This patch is useful for:
1) remove an unused var from extern char *find_real_root_device_name(const char* name)
    changing it to extern char *find_real_root_device_name(void).
2) fixes include/libbb.h, coreutils/df.c, util-linux/mount.c and  util-linux/umount.c accordingly.
3) fixes a bug, really a false positive,  in find_real_root_device_name() that happens if
    in the /dev directory exists a link named root (/dev/root) that should be skipped but
    is not. This affects applets like df that display wrong results
2004-08-03 00:14:02 +00:00
Eric Andersen
aad29b37a7 Fixup getty, login, etc so the utmp and wtmp are updated, allowing
the 'who' and 'last' applets among other things to work as expected.
 -Erik
2004-07-30 17:24:47 +00:00
Eric Andersen
4f807a84c5 BusyBox has no business hard coding the number of major and minor bits for a
dev_t.  This is especially important now that the user space concept of a dev_t
and the kernel concept of a dev_t are divergant.  The only bit of user space
allowed to know the number of major and minor bits is include/sys/sysmacros.h
(i.e. part of libc).  When used with a current C library and a 2.6.x kernel,
this fix should allow BusyBox to support wide device major/minor numbers.
 -Erik
2004-07-26 09:11:12 +00:00
Glenn L McGrath
efc6bf6365 Patch from Felipe Kellermann, fix endless loop when first > last and
increment > 0.
2004-07-23 06:43:29 +00:00
Glenn L McGrath
9c83e83628 Felipe Kellermann writes,
"As noticed today by Steven Scholz, the od's `-v' was broken.
I've fixed that and now both the flags `-v' and `-a' are OK"

Fixes a segfault in
echo "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\02bar\4"| ./busybox od -av
2004-07-23 01:42:28 +00:00
Manuel Novoa III
d709743b09 If read were to return with an error, bad things would happen. Fix it.
Also, make sure read errors are reflected in the applet exit code.
2004-05-26 15:21:19 +00:00
Eric Andersen
febd744d31 Use STDIN_FILENO rather than '0' 2004-05-26 10:26:10 +00:00
Eric Andersen
d4d01d2b9b Rob Landley writes:
Run this test, against both busybox and a non-busybox version of "tee".

while true; do i=$[$i+1]; echo "hello $i"; sleep 1; done | ./busybox tee

Now run the busybox one again with the following small patch applied:
2004-05-26 09:54:36 +00:00
Eric Andersen
6c0396ba2a Steve Grubb writes:
Hi,

I just re-reviewed the patch I just sent...and it needed to be BUFSIZ-3 in
dos2unix.c . tempFn is BUFSIZ so the last addressable spot it BUFSIZ-1. The loop
increments by 2. That's why it should be BUFSIZ-3.

Best Regards,
Steve Grubb
2004-05-05 19:39:21 +00:00
Eric Andersen
aaff79a8dd Steve Grubb writes:
Hello,

I found and patched 2 more bugs. The first is a misplaced semi-colon. The second
one is a buffer overflow. I doubt the buffer overflow is triggered in real life.
But you never know what those wily hackers are up to.

Thanks,
Steve Grubb
2004-05-05 10:37:49 +00:00
Glenn L McGrath
c6992feee3 Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
Eric Andersen
7ff33f1b42 Thats odd. I guess this was cut-n-paste error, but vodz
email address was wrong!
2004-04-16 15:02:10 +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
Eric Andersen
39396b95fc Fix non standard 'date -R' formatting 2004-04-06 09:38:18 +00:00
Eric Andersen
70060d25d2 s/fileno\(stdin\)/STDIN_FILENO/g
s/fileno\(stdout\)/STDOUT_FILENO/g
2004-03-27 10:02:48 +00:00
Eric Andersen
97310d0253 Brian Pomerantz writes:
I've noticed a bug in the "autowidth" feature more, and is probably in
others.  The call to the function get_terminal_width_height() passes
in a file descriptor but that file descriptor is never used, instead
the ioctl() is called with 0.  In more_main() the call to
get_terminal_width_height() passes 0 as the file descriptor instead of
fileno(cin).  This isn't a problem when you more a file (e.g. "more
/etc/passwd") but when you pipe a file to it (e.g. "cat /etc/passwd |
more") the size of the terminal cannot be determined because file
descriptor 0 is not a terminal.  The fix is simple, I've attached a
patch for more.c and get_terminal_width_height.c.


BAPper
2004-03-23 23:15:36 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Eric Andersen
ed43806c3b Hideki IWAMOTO writes:
Current `tr' implementation has a problem, if `plain char' is signed.

[current cvs version]

>echo a | _install/usr/bin/tr '\0' '\377'
Segmentation fault (core dumped)

[patched version]

>echo a | _install/usr/bin/tr '\0' '\377'
a
2004-03-12 22:10:40 +00:00
Glenn L McGrath
c66ebe4200 When displaying the size in 1kB blocks round up if an odd number of
blocks
2004-03-10 09:58:51 +00:00
Glenn L McGrath
44c0e17dbe Patch by Seth W. Klein, the -l switch was reversed 2004-03-10 09:10:53 +00:00
Manuel Novoa III
1117c5281b Fix broken sort order flags. 2004-03-08 10:54:29 +00:00
Eric Andersen
2479445562 Fix/eliminate use of atol 2004-03-06 22:11:45 +00:00
Glenn L McGrath
c4db0833a6 Patch from Matt Kraai to fix debian bug number 231994.
There was an extra blank line preceding the first directory.
2004-03-06 09:12:55 +00:00
Glenn L McGrath
95ed8d9f35 Close bracket in description from Peter Willis's eject applet 2004-03-05 06:47:25 +00:00
Glenn L McGrath
6db8c22d07 Return 1 upon failure 2004-02-22 02:58:57 +00:00
Glenn L McGrath
96099d51b6 Use return instead of exit, use == instead of & ==, left justify labels,
adjustment of whitespace.
2004-02-21 07:49:54 +00:00
Glenn L McGrath
01cdb66987 Add the -r option, patch from Rob with some help from myself. 2004-02-17 12:22:21 +00:00
Glenn L McGrath
c2266bd519 Woops, im getting ahead of myself, we dont have the -r (refernece)
option yet
2004-02-17 07:58:04 +00:00
Glenn L McGrath
5f11541bd4 define option names to be clearer, simplify nested if statements, remove
un-needed if statement, minor indenting change
2004-02-17 07:51:31 +00:00
Eric Andersen
d07cf59a98 Vladimir N. Oleynik writes:
Hi, Glenn.

Current CVS "ls" applet have small problem: some options
ignoring. Last patch attached ;-)


--w
vodz
2004-02-05 13:52:03 +00:00
Eric Andersen
c71c18957d Jean Wolter writes:
Hello,

when calling seq with

    seq 1 1

it generates an "endless" list of numbers until the counter wraps and
reaches 1 again. The follwoing small patch should introduce the
expected behavior (output of 1 and termination):

regards,
Jean
2004-02-04 11:01:19 +00:00
Manuel Novoa III
083862228a Use bb_xstrdup() instead of strdup(). 2004-02-01 07:34:28 +00:00
Eric Andersen
ab26cc3d8a Avoid symbol naming conflict with libm 2004-01-30 22:24:32 +00:00
Glenn L McGrath
82364bb591 New applet, seq. No options, just the basics. 2004-01-27 09:22:20 +00:00
Glenn L McGrath
43112b4b65 Align using spaces to furthurest character and then one tab, now they
should always be aligned.
2004-01-27 07:36:07 +00:00
Eric Andersen
f2ec37902a Pascal Brisset writes:
uuencode fails to encode binary data because it right-shifts
bytes as signed chars and keeps the duplicated sign bits.

The original base64_encode() from wget/http.c is broken as well,
but it is only used to encode ascii data.

-- Pascal
2004-01-26 07:17:30 +00:00
Manuel Novoa III
7018385fe7 Be stricter when converting strings to integers. Should fix the problem
reported by Rob.
2004-01-25 19:47:10 +00:00
Glenn L McGrath
4766a2d56c Add the -r option as a synonym of -R 2004-01-25 05:50:28 +00:00
Glenn L McGrath
ca43b485de Enable long options, adds 150 bytes. 2004-01-23 21:57:16 +00:00
Glenn L McGrath
654a99b691 Check valid options were given 2004-01-23 21:40:19 +00:00
Glenn L McGrath
711bb92d7c Dont change ownership unless we created the directory. 2004-01-23 20:28:53 +00:00
Glenn L McGrath
578eff5066 Remove unneeded conditions and logic, fix bug where ownership didnt
change.
Dont use bb_make_directory it doesnt have the features, and its ugly to
work around it.
2004-01-23 10:57:00 +00:00
Glenn L McGrath
65b6d8bdb6 Fix a bug where ls -le would print the time twice. 2004-01-18 05:41:30 +00:00
Glenn L McGrath
792cae5f2a Use bb_getopt_ulflags, save 200-300 bytes 2004-01-18 05:15:16 +00:00