Permalink
Browse files

Merging upstream version 5.00 (Closes: #520532).

  • Loading branch information...
1 parent 0187449 commit efa33f13e130a965ac82cb33b34ba60f1db8bac2 Daniel Baumann committed Feb 18, 2009
Showing with 4,111 additions and 1,237 deletions.
  1. +126 −30 ChangeLog
  2. +29 −27 README
  3. +6 −0 TODO
  4. +12 −0 config.h.in
  5. +216 −11 configure
  6. +4 −2 configure.ac
  7. +76 −77 doc/file.man
  8. +3 −10 doc/libmagic.man
  9. +15 −4 doc/magic.man
  10. +23 −0 magic/Magdir/animation
  11. +8 −37 magic/Magdir/audio
  12. +11 −9 magic/Magdir/cafebabe
  13. +6 −0 magic/Magdir/compress
  14. +4 −2 magic/Magdir/elf
  15. +8 −7 magic/Magdir/epoc
  16. +169 −104 magic/Magdir/filesystems
  17. +8 −5 magic/Magdir/graphviz
  18. +5 −0 magic/Magdir/images
  19. +1 −0 magic/Magdir/jpeg
  20. +1 −1 magic/Magdir/mach
  21. +3 −0 magic/Magdir/macintosh
  22. +32 −17 magic/Magdir/msdos
  23. +0 −1 magic/Magdir/perl
  24. +2 −0 magic/Magdir/printer
  25. +17 −0 magic/Magdir/timezone
  26. +5 −0 magic/Magdir/wireless
  27. +9 −0 magic/Magdir/xwindows
  28. +2 −1 magic/Makefile.am
  29. +2 −1 magic/Makefile.in
  30. +2 −2 src/Makefile.am
  31. +13 −5 src/Makefile.in
  32. +90 −27 src/apprentice.c
  33. +4 −6 src/apptype.c
  34. +76 −480 src/ascmagic.c
  35. +5 −1 src/asprintf.c
  36. +1,105 −0 src/cdf.c
  37. +298 −0 src/cdf.h
  38. +182 −0 src/cdf_time.c
  39. +7 −8 src/compress.c
  40. +484 −0 src/encoding.c
  41. +99 −86 src/file.c
  42. +42 −18 src/file.h
  43. +1 −0 src/file_opts.h
  44. +70 −57 src/fsmagic.c
  45. +116 −45 src/funcs.c
  46. +6 −4 src/getopt_long.c
  47. +10 −9 src/is_tar.c
  48. +12 −14 src/magic.c
  49. +13 −7 src/magic.h
  50. +6 −3 src/patchlevel.h
  51. +8 −8 src/print.c
  52. +256 −0 src/readcdf.c
  53. +15 −12 src/readelf.c
  54. +273 −95 src/softmagic.c
  55. +57 −0 src/strlcat.c
  56. +53 −0 src/strlcpy.c
  57. +5 −4 src/vasprintf.c
View
156 ChangeLog
@@ -1,9 +1,105 @@
+2008-12-12 15:50 Christos Zoulas <christos@zoulas.com>
+
+ * fix initial offset calculation for non 4K sector files
+
+ * add loop limits to avoid DoS attacks by constructing
+ looping sector references.
+
+2008-12-03 13:05 Christos Zoulas <christos@zoulas.com>
+
+ * fix memory botches on cdf file parsing.
+
+ * exit with non-zero value for any error, not just for the last
+ file processed.
+
+2008-11-09 20:42 Charles Longeau <chl@tuxfamily.org>
+
+ * Replace all str{cpy,cat} functions with strl{cpy,cat}
+ * Ensure that strl{cpy,cat} are included in libmagic,
+ as needed.
+
+2008-11-06 18:18 Christos Zoulas <christos@zoulas.com>
+
+ * Handle ID3 format files.
+
+2008-11-06 23:00 Reuben Thomas <rrt@sc3d.org>
+
+ * Fix --mime, --mime-type and --mime-encoding under new scheme.
+
+ * Rename "ascii" to "text" and add "encoding" test.
+
+ * Return a precise ("utf-16le" or "utf-16be") MIME charset for
+ UTF-16.
+
+ * Fix error in comment caused by automatic indentation adding
+ words!
+
+2008-11-06 10:35 Christos Zoulas <christos@astron.com>
+
+ * use memchr instead of strchr because the string
+ might not be NUL terminated (Scott MacVicar)
+
+2008-11-03 07:31 Reuben Thomas <rrt@sc3d.org>
+
+ * Fix a printf with a non-literal format string.
+
+ * Fix formatting and punctuation of help for "--apple".
+
+2008-10-30 11:00 Reuben Thomas <rrt@sc3d.org>
+
+ * Correct words counts in comments of struct magic.
+
+ * Fix handle_annotation to allow both Apple and MIME types to be
+ printed, and to return correct code if MIME type is
+ printed (1, not 0) or if there's an error (-1 not 1).
+
+ * Fix output of charset for MIME type (precede with semi-colon;
+ fixes Debian bug #501460).
+
+ * Fix potential attacks via conversion specifications in magic
+ strings.
+
+ * Add a FIXME for Debian bug #488562 (magic files should be
+ read in a defined order, by sorting the names).
+
+2008-10-18 16:45 Christos Zoulas <christos@astron.com>
+
+ * Added APPLE file creator/type
+
+2008-10-12 10:20 Christos Zoulas <christos@astron.com>
+
+ * Added CDF parsing
+
+2008-10-09 16:40 Christos Zoulas <christos@astron.com>
+
+ * filesystem and msdos patches (Joerg Jenderek)
+
+2008-10-09 13:20 Christos Zoulas <christos@astron.com>
+
+ * correct --exclude documentation issues: remove troff and fortran
+ and rename "token" to "tokens". (Randy McMurchy)
+
+2008-10-01 10:30 Christos Zoulas <christos@astron.com>
+
+ * Read ~/.magic in addition to the default magic file not instead
+ of, as documented in the man page.
+
+2008-09-10 21:30 Reuben Thomas <rrt@sc3d.org>
+
+ * Comment out graphviz patterns, as they match too many files.
+
2008-08-30 12:54 Christos Zoulas <christos@astron.com>
* Don't eat trailing \n in magic enties.
* Cast defines to allow compilation using a c++ compiler.
+2008-08-25 23:56 Reuben Thomas <rrt@sc3d.org>
+
+ * Add text/x-lua MIME type for Lua scripts.
+
+ * Escape { in regex in graphviz patterns.
+
2008-07-26 00:59 Reuben Thomas <rrt@sc3d.org>
* Add MIME types for special files.
@@ -55,22 +151,22 @@
2008-05-06 00:13 Robert Byrnes <byrnes@wildpumpkin.net>
- * src/Makefile.am:
+ * src/Makefile.am:
Ensure that getopt_long and [v]asprintf are included in libmagic,
as needed.
Remove unnecessary EXTRA_DIST.
- * src/Makefile.in:
+ * src/Makefile.in:
Rerun automake.
- * src/vasprintf.c (dispatch):
+ * src/vasprintf.c (dispatch):
Fix variable precision bug: be sure to step past '*'.
- * src/vasprintf.c (core):
+ * src/vasprintf.c (core):
Remove unreachable code.
- * src/apprentice.c (set_test_type):
+ * src/apprentice.c (set_test_type):
Add cast to avoid compiler warning.
2008-04-22 23:45 Christos Zoulas <christos@astron.com>
@@ -81,12 +177,12 @@
2008-04-04 11:00 Christos Zoulas <christos@astron.com>
- * >= <= is not supported, so fix the magic and warn about it.
+ * >= <= is not supported, so fix the magic and warn about it.
reported by: Thien-Thi Nguyen <ttn@gnuvola.org>
2008-03-27 16:16 Robert Byrnes <byrnes@wildpumpkin.net>
- * src/readelf.c (donote):
+ * src/readelf.c (donote):
ELF core file command name/line bug fixes and enhancements:
Try larger offsets first to avoid false matches
@@ -112,7 +208,7 @@
* Clarify UTF-8 BOM message (Reuben Thomas)
* Add HTML comment to token list in names.h
-
+
2007-02-04 15:50 Christos Zoulas <christos@astron.com>
* Debian fixes (Reuben Thomas)
@@ -152,7 +248,7 @@
2007-10-28 20:48 Christos Zoulas <christos@astron.com>
- * float and double magic support (Behan Webster)
+ * float and double magic support (Behan Webster)
2007-10-28 20:48 Christos Zoulas <christos@astron.com>
@@ -199,7 +295,7 @@
be easily parsed:
mimetype [charset=character-set] [encoding=encoding-mime-type]
- Remove spurious extra text from some MIME type printouts
+ Remove spurious extra text from some MIME type printouts
(mostly in is_tar).
Fix one case where -i produced nothing at all (for a 1-byte file,
@@ -229,7 +325,7 @@
2007-03-15 10:51 Christos Zoulas <christos@astron.com>
* fix fortran and nroff reversed tests (Dmitry V. Levin)
-
+
* fix exclude option (Dmitry V. Levin)
2007-02-08 17:30 Christos Zoulas <christos@astron.com>
@@ -248,15 +344,15 @@
* Add exclude flag.
2007-01-18 05:29 Anon Ymous <do@not.spam.me>
-
+
* Move the "type" detection code from parse() into its own table
driven routine. This avoids maintaining multiple lists in
file.h.
* Add an optional conditional field (ust before the type field).
This code is wrapped in "#ifdef ENABLE_CONDITIONALS" as it is
likely to go away.
-
+
2007-01-16 23:24 Anon Ymous <do@not.spam.me>
* Fix an initialization bug in check_mem().
@@ -327,7 +423,7 @@
2006-12-08 16:32 Christos Zoulas <christos@astron.com>
* store and print the line number of the magic
- entry for debugging.
+ entry for debugging.
* if the magic entry did not print anything,
don't treat it as a match
@@ -342,7 +438,7 @@
file_softmagic.
2006-11-25 13:35 Christos Zoulas <christos@astron.com>
-
+
* Don't store the current offset in the magic
struct, because it needs to be restored and
it was not done properly all the time. Bug
@@ -432,7 +528,7 @@
* Look for note sections in non executables.
2005-09-20 13:33 Christos Zoulas <christos@astron.com>
-
+
* Don't print SVR4 Style in core files multiple times
(Radek Vok�l)
@@ -443,9 +539,9 @@
2005-08-18 09:53 Christos Zoulas <christos@astron.com>
* Remove erroreous mention of /etc/magic in the file man page
- This is gentoo bug 101639. (Mike Frysinger)
+ This is gentoo bug 101639. (Mike Frysinger)
- * Cross-compile support and detection (Mike Frysinger)
+ * Cross-compile support and detection (Mike Frysinger)
2005-08-12 10:17 Christos Zoulas <christos@astron.com>
@@ -477,20 +573,20 @@
* Avoid NULL pointer dereference in time conversion.
2005-03-06 00:00 Joerg Walter <jwalt@mail.garni.ch>
-
+
* Add indirect magic offset support, and search mode.
2005-01-12 00:00 Stepan Kasal <kasal@ucw.cz>
- * src/ascmagic.c (file_ascmagic): Fix three bugs about text files:
- If a CRLF text file happens to have CR at offset HOWMANY - 1
- (currently 0xffff), it should not be counted as CR line
- terminator.
- If a line has length exactly MAXLINELEN, it should not yet be
- treated as a ``very long line'', as MAXLINELEN is ``longest sane
- line length''.
- With CRLF, the line length was not computed correctly, and even
- lines of length MAXLINELEN - 1 were treated as ``very long''.
+ * src/ascmagic.c (file_ascmagic): Fix three bugs about text files:
+ If a CRLF text file happens to have CR at offset HOWMANY - 1
+ (currently 0xffff), it should not be counted as CR line
+ terminator.
+ If a line has length exactly MAXLINELEN, it should not yet be
+ treated as a ``very long line'', as MAXLINELEN is ``longest sane
+ line length''.
+ With CRLF, the line length was not computed correctly, and even
+ lines of length MAXLINELEN - 1 were treated as ``very long''.
2004-12-07 14:15 Christos Zoulas <christos@astron.com>
@@ -525,12 +621,12 @@
* Remove 3rd and 4th copyright clause; approved by Ian Darwin.
- * Fix small memory leaks; caught by: Tamas Sarlos
+ * Fix small memory leaks; caught by: Tamas Sarlos
<stamas@csillag.ilab.sztaki.hu>
2004-07-24 16:33 Christos Zoulas <christos@astron.com>
- * magic.mime update Danny Milosavljevic <danny.milo@gmx.net>
+ * magic.mime update Danny Milosavljevic <danny.milo@gmx.net>
* FreeBSD version update Oliver Eikemeier <eikemeier@fillmore-labs.com>
View
56 README
@@ -1,5 +1,5 @@
** README for file(1) Command **
-@(#) $File: README,v 1.40 2008/04/23 03:45:20 christos Exp $
+@(#) $File: README,v 1.41 2008/12/02 16:34:46 christos Exp $
E-mail: christos@astron.com
Mailing List: file@mx.gw.com
@@ -48,33 +48,35 @@ in magic(5) format please, to the maintainer, Christos Zoulas.
COPYING - read this first.
README - read this second (you are currently reading this file).
-PORTING - read this only if the program won't compile.
-Makefile - read this next, adapt it as needed (particularly
- the location of the old existing file command and
- the man page layouts), type "make" to compile,
- "make try" to try it out against your old version.
- Expect some diffs, particularly since your original
- file(1) may not grok the embedded-space ("\ ") in
- the current magic file, or may even not use the
- magic file.
-apprentice.c - parses /etc/magic to learn magic
-ascmagic.c - third & last set of tests, based on hardwired assumptions.
-core - not included in distribution due to mailer limitations.
-debug.c - includes -c printout routine
-file.1 - man page for the command
-magic.4 - man page for the magic file, courtesy Guy Harris.
+INSTALL - read on how to install
+
+src/apprentice.c - parses /etc/magic to learn magic
+src/apptype.c - used for OS/2 specific application type magic
+src/asprintf.c - replacement for OS's that don't have it.
+src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
+src/cdf.c - parser for Microsoft Compound Document Files
+src/cdf_time.c - time converter for CDF.
+src/compress.c - handles decompressing files to look inside.
+src/encoding.c - handles unicode encodings
+src/file.c - the main program
+src/file.h - header file
+src/fsmagic.c - first set of tests the program runs, based on filesystem info
+src/funcs.c - utilility functions
+src/getopt_long.c - used for OS/2 specific application type magic
+src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
+src/names.h - header file for ascmagic.c
+src/magic.c - the libmagic api
+src/print.c - print results, errors, warnings.
+src/readcdf.c - CDF wrapper.
+src/readelf.[ch] - Stand-alone elf parsing code.
+src/softmagic.c - 2nd set of tests, based on /etc/magic
+src/strlcat.c - used for OS/2 specific application type magic
+src/strlcpy.c - used for OS/2 specific application type magic
+src/vasprintf.c - used for OS/2 specific application type magic
+doc/file.1 - man page for the command
+doc/magic.4 - man page for the magic file, courtesy Guy Harris.
Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
-file.c - main program
-file.h - header file
-fsmagic.c - first set of tests the program runs, based on filesystem info
-is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
-magdir - directory of /etc/magic pieces
- magdir/Makefile - ADJUST THIS FOR YOUR CONFIGURATION
-names.h - header file for ascmagic.c
-softmagic.c - 2nd set of tests, based on /etc/magic
-readelf.[ch] - Stand-alone elf parsing code.
-compress.c - on-the-fly decompression.
-print.c - print results, errors, warnings.
+Magdir - directory of /etc/magic pieces
------------------------------------------------------------------------------
View
6 TODO
@@ -1,3 +1,9 @@
+Fix output so that tests for MIME and APPLE flags are not needed all
+over the place, and actual output is only done in one place. This
+needs a design. Suggestion: push possible outputs on to a list, then
+pick the last-pushed (most specific, one hopes) value at the end, or
+use a default if the list is empty.
+
Continue to squash all magic bugs. See Debian BTS for a good source.
Store arbitrarily long strings, for example for %s patterns, so that
View
@@ -78,6 +78,12 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the `strlcat' function. */
+#undef HAVE_STRLCAT
+
+/* Define to 1 if you have the `strlcpy' function. */
+#undef HAVE_STRLCPY
+
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
@@ -90,6 +96,12 @@
/* Define to 1 if `st_rdev' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
+/* Define to 1 if `tm_gmtoff' is member of `struct tm'. */
+#undef HAVE_STRUCT_TM_TM_GMTOFF
+
+/* Define to 1 if `tm_zone' is member of `struct tm'. */
+#undef HAVE_STRUCT_TM_TM_ZONE
+
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
Oops, something went wrong.

0 comments on commit efa33f1

Please sign in to comment.