summaryrefslogtreecommitdiff
path: root/usr.bin/file
AgeCommit message (Collapse)Author
2015-11-17Merge xmalloc.[ch] files across base, skipping OpenSSH for now.Tobias Stoeckmann
ok nicm
2015-11-15When validating a char by calling strchr() with a string of allowed chars,Tobias Stoeckmann
check for '\0' first, because strchr() would return non-NULL. ok nicm
2015-11-13Break the message preparation bit of the main loop into its own functionNicholas Marriott
for less excessive level of indentation.
2015-11-13Call stat not lstat with -L, makes links actually be followed. ReportedNicholas Marriott
by and ok semarie@.
2015-11-05palmpilot should have gone when palm was added, it is redundant.Nicholas Marriott
2015-10-31Update Matroska magic file.Nicholas Marriott
2015-10-17The file(1) magic-parsing process was using pledge "stdio getpw proc recvfd"Theo de Raadt
early on, then a set of getpwnam/setresuid/... before quickly dropping to "stdio recvfd". It receives fd's and runs the magic code on them in a chroot'd "stdio" jail. We can do better than that. Before the recent change, "proc" contained both the concepts of "forking" and "setuid". "id" is now split out as a seperate request, and it is exactly what this process needs momentarily. So this loses another window of opportunity, in case we have a major bug in .... hmm, it'd have to be in getpwnam.... ok tedu doug semarie gilles
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-06Move from tame "cmsg" to tame "sendfd" or "recvfd", depending on whichTheo de Raadt
way the process moves fd's.
2015-10-06Simple update for pdf, from file 5.x.Nicholas Marriott
2015-10-06Another simple update for xwindows, from 5.x.Nicholas Marriott
2015-10-06Log the matched offset (and the new offset) instead of just of the newNicholas Marriott
offset (as if it was where the match was found).
2015-10-06ssh and ssl key file magic, from file 5.x.Nicholas Marriott
2015-10-06Another simple update from file 5.x.Nicholas Marriott
2015-10-05Another trivial update, some extra bits for timezone, from file 5.x.Nicholas Marriott
2015-10-05Very trivial changes from file 5.x: spelling mistakes, %ld->%d and someNicholas Marriott
style nits.
2015-10-05Get BE and LE UTF-32 correct, from file 5.x.Nicholas Marriott
2015-10-05Update compress magic from the upstream file 5.x magic files.Nicholas Marriott
2015-10-05Add support for !:strength modifier to adjust strength of a test.Nicholas Marriott
2015-10-05Offset into the file can be size_t and add some casts to remove warnings.Nicholas Marriott
2015-10-05use the normal -1 check for tame failureTheo de Raadt
2015-10-04Add tame(2) to file(1) and drop the old systrace(4) sandbox. tame(2) isNicholas Marriott
only applied to the child process, which requires the parent to not pass directory file descriptors (tame("cmsg") does not allow it). Because file(1) is already privsep, the permissions in the child can be quickly restricted: first to "stdio cmsg getpw proc" then after the privdrop to "stdio cmsg".
2015-10-02use limits.h instead of sys/param.h to get PATH_MAXTheo de Raadt
2015-08-23Need to permit kbind in this sandbox tooPhilip Guenther
2015-08-12Support + and - for dates.Nicholas Marriott
2015-08-12Fix adjustment of the offset when string, pstring or search match.Nicholas Marriott
2015-08-12Add string/Ww as aliases for string/Bb, and ignore t. (The latestNicholas Marriott
version of the original file replaced Bb with Ww and then reused b for something else (!), but alias them instead.)
2015-08-11Only warn about [bl]estring16 when they are used, like the otherNicholas Marriott
unsupported types.
2015-08-11When an exact string match is found, only print the test string, not upNicholas Marriott
to \0. Noticed by Theo with some GIF files.
2015-08-11Any type can be prefixed with "u", even where it makes no sense. AlsoNicholas Marriott
make pstring/upstring a text type.
2015-08-11Warn sensibly for unrecognised !: lines rather than trying to parse them.Nicholas Marriott
2015-08-11Accept hexadecimal numbers without 0x if they aren't a valid decimalNicholas Marriott
number.
2015-08-11Actually leave the invalid ml in the tree after making it type NONE.Nicholas Marriott
2015-08-11An invalid line can't just be thrown away because if it has any childrenNicholas Marriott
they will end up with the wrong parent. Instead, leave it in the tree but force its type to NONE so it never matches.
2015-08-11Extend accepted operators to +-&/%* for integer tests.Nicholas Marriott
2015-08-11Support = test for floats and doubles.Nicholas Marriott
2015-08-11If we are expecting a signed number but it fails, try to parse it asNicholas Marriott
unsigned instead.
2015-08-11Allow spaces around any operator, not just =.Nicholas Marriott
2015-08-11Include more context in warnings where it is possible.Nicholas Marriott
2015-08-11Add another function for printing warnings before the magic_line isNicholas Marriott
created so all warnings go through the same fprintf.
2015-07-30note that symlinks are not followed by default;Jason McIntyre
from tilo stritzky ok nicm and discussed with deraadt
2015-07-20Remove leftover xfree() prototype.Nicholas Marriott
2015-07-12Keep one byte for terminating '\0'.Tobias Stoeckmann
ok nicm@
2015-07-08Properly handle files >= 4 GB on 32 bit architectures.Tobias Stoeckmann
with input by and ok nicm@
2015-07-08Do not allow '\0' as an offset operator or type.Tobias Stoeckmann
ok nicm
2015-06-17Use strdup in xstrdup from Fritjof Bornebusch. While here, remove xfreeNicholas Marriott
which is unused.
2015-06-04systrace(4) STRIOCATTACH can only fail for file(1) if it is alreadyNicholas Marriott
systraced. If so, silently ignore the error and do not attempt to apply our own systrace policy. From Patrick Keshishian.
2015-05-30Support - to read from stdin, from Sebastien Marie.Nicholas Marriott
2015-05-29millert points out I can just call tzset() early to avoid having toNicholas Marriott
permit access() in the child.
2015-05-29Use gmtime not localtime when we want UTC, I got it right in one placeNicholas Marriott
but not in another two. I expect I was confused by the fact that the original file(1) had them the wrong way round (so, for example, leqldate was actually UTC).