busybox/e2fsprogs
Denys Vlasenko 9468ea06d2 lsattr,chattr: do not open e.g. device files unless asked directly; do not follow links
Add O_NOFOLLOW (and O_NOCTTY for good measure) to open calls like e2fsprogs does.

In lsattr, when recursing, operate only on regular files, symlinks, and directories.
(Otherwise, "lsattr /dev" can e.g. open a watchdog device... not good).

At this time, looks like chattr/lsattr can't operate on symlink inodes -
ioctls do not work on open(O_PATH | O_NOFOLLOW) fds.

function                                             old     new   delta
lsattr_dir_proc                                      168     203     +35
change_attributes                                    410     408      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 35/-2)              Total: 33 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-24 01:07:56 +02:00
..
chattr.c lsattr,chattr: do not open e.g. device files unless asked directly; do not follow links 2021-06-24 01:07:56 +02:00
Config.src restore documentation on the build config language 2018-06-06 15:16:48 +02:00
e2fs_lib.c e2fsprogs/*: remove ioctl calling obfuscation 2021-06-23 12:56:40 +02:00
e2fs_lib.h e2fsprogs/*: remove ioctl calling obfuscation 2021-06-23 12:56:40 +02:00
fsck.c libbb: introduce and use sleep1() 2020-11-29 11:37:34 +01:00
Kbuild.src e2fsprogs/*: convert to new-style "one file" applets 2015-10-18 22:40:23 +02:00
lsattr.c lsattr,chattr: do not open e.g. device files unless asked directly; do not follow links 2021-06-24 01:07:56 +02:00
README put small subset of e2fsprogs back in the tree: 2006-12-26 01:30:59 +00:00
tune2fs.c move storage helpers to libbb.h 2018-09-28 15:13:04 +02:00

Authors and contributors of original e2fsprogs:

Remy Card <card@masi.ibp.fr>
Theodore Ts'o <tytso@mit.edu>
Stephen C. Tweedie <sct@redhat.com>
Andreas Gruenbacher, <a.gruenbacher@computer.org>
Kaz Kylheku <kaz@ashi.footprints.net>
F.W. ten Wolde <franky@duteca.et.tudelft.nl>
Jeremy Fitzhardinge <jeremy@zip.com.au>
M.J.E. Mol <marcel@duteca.et.tudelft.nl>
Miquel van Smoorenburg <miquels@drinkel.ow.org>
Uwe Ohse <uwe@tirka.gun.de>