diff options
Diffstat (limited to 'file')
52 files changed, 1387 insertions, 713 deletions
diff --git a/file/ChangeLog b/file/ChangeLog index 1239626af..c7ca5450a 100644 --- a/file/ChangeLog +++ b/file/ChangeLog @@ -1,3 +1,30 @@ +2004-11-24 12:39 Christos Zoulas <christos@zoulas.com> + + * Stack smash fix, and ELF more conservative reading. + Jakub Bogusz <qboosh@pld-linux.org> + +2004-11-20 18:50 Christos Zoulas <christos@zoulas.com> + + * New FreeBSD version parsing code: + Jon Noack <noackjr@alumni.rice.edu> + + * Hackish support for ucs16 strings <christos@zoulas.com> + +2004-11-13 03:07 Christos Zoulas <christos@zoulas.com> + + * print the file name and line number in syntax errors. + +2004 10-12 10:50 Christos Zoulas <christos@zoulas.com> + + * Fix stack overwriting on 0 length strings: Tim Waugh + <twaugh@redhat.com> Ned Ludd <solar@gentoo.org> + +2004-09-27 11:30 Christos Zoulas <christos@zoulas.com> + + * Remove 3rd and 4th copyright clause; approved by Ian Darwin. + + * Fix small memory leaks; caught by: Tamas Sarlos + <stamas@csillag.ilab.sztaki.hu> 2004-07-24 16:33 Christos Zoulas <christos@zoulas.com> diff --git a/file/LEGAL.NOTICE b/file/LEGAL.NOTICE index dd8b90a59..0c2c71926 100644 --- a/file/LEGAL.NOTICE +++ b/file/LEGAL.NOTICE @@ -1,7 +1,7 @@ -$Id: LEGAL.NOTICE,v 1.13 2003/03/23 22:23:30 christos Exp $ +$Id: LEGAL.NOTICE,v 1.14 2004/09/11 19:15:56 christos Exp $ Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995. Software written by Ian F. Darwin and others; -maintained 1994-2003 Christos Zoulas. +maintained 1994-2004 Christos Zoulas. This software is not subject to any export provision of the United States Department of Commerce, and may be exported to any country or planet. @@ -15,11 +15,6 @@ are met: 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by Ian F. Darwin and others. -4. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/file/Makefile.am b/file/Makefile.am index 300900dba..59dac9bc1 100644 --- a/file/Makefile.am +++ b/file/Makefile.am @@ -1,6 +1,6 @@ # don't enforce GNU packaging standards AUTOMAKE_OPTIONS = foreign no-dependencies -EXTRA_DIST = ChangeLog LEGAL.NOTICE MAINT README +EXTRA_DIST = LEGAL.NOTICE MAINT PORTING -SUBDIRS = src magic doc +SUBDIRS = src magic doc python diff --git a/file/PORTING b/file/PORTING new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/file/PORTING diff --git a/file/configure.ac b/file/configure.ac index 074f0d95b..a9cd542d2 100644 --- a/file/configure.ac +++ b/file/configure.ac @@ -1,41 +1,36 @@ dnl Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT([file],[4.10]) -AC_CANONICAL_TARGET -AC_CONFIG_HEADERS([config.h]) - -AM_INIT_AUTOMAKE([foreign]) -AM_MAINTAINER_MODE +AC_INIT +AC_CONFIG_SRCDIR([src/file.c]) +AM_INIT_AUTOMAKE(file, 4.12) +AM_CONFIG_HEADER([config.h]) +dnl AM_MAINTAINER_MODE AC_MSG_CHECKING(for builtin ELF support) AC_ARG_ENABLE(elf, [ --disable-elf disable builtin ELF support], -AH_TEMPLATE([BUILTIN_ELF], [Define if builtin ELF support is enabled.]) [if test "${enableval}" = yes; then AC_MSG_RESULT(yes) - AC_DEFINE([BUILTIN_ELF], 1) + AC_DEFINE(BUILTIN_ELF) else AC_MSG_RESULT(no) fi], [ # enable by default AC_MSG_RESULT(yes) - AC_DEFINE([BUILTIN_ELF], 1) + AC_DEFINE(BUILTIN_ELF) ]) AC_MSG_CHECKING(for ELF core file support) AC_ARG_ENABLE(elf-core, [ --disable-elf-core disable ELF core file support], -AH_TEMPLATE([ELFCORE], [Define if ELF core file support is enabled.]) [if test "${enableval}" = yes; then AC_MSG_RESULT(yes) - AC_DEFINE([ELFCORE], 1) + AC_DEFINE(ELFCORE) else AC_MSG_RESULT(no) fi], [ # enable by default AC_MSG_RESULT(yes) - AC_DEFINE([ELFCORE], 1) + AC_DEFINE(ELFCORE) ]) AC_MSG_CHECKING(for file formats in man section 5) @@ -61,10 +56,23 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_LIBTOOL -if test "$ac_cv_c_compiler_gnu" = yes; then - CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts" -fi -export CFLAGS +dnl Templates for autoheader +AH_TEMPLATE([BUILTIN_ELF], + [Use the builtin ELF recognition code]) +AH_TEMPLATE([ELFCORE], + [Recognize ELF core files]) +AH_TEMPLATE([HAVE_DAYLIGHT], []) +AH_TEMPLATE([HAVE_LONG_LONG], []) +AH_TEMPLATE([HAVE_TM_ISDST], []) +AH_TEMPLATE([SIZEOF_UINT16_T], []) +AH_TEMPLATE([SIZEOF_UINT32_T], []) +AH_TEMPLATE([SIZEOF_UINT64_T], []) +AH_TEMPLATE([SIZEOF_UINT8_T], []) +AH_TEMPLATE([int32_t], []) +AH_TEMPLATE([uint16_t], []) +AH_TEMPLATE([uint32_t], []) +AH_TEMPLATE([uint64_t], []) +AH_TEMPLATE([uint8_t], []) dnl Checks for headers AC_HEADER_STDC @@ -79,27 +87,25 @@ AC_CHECK_HEADERS(getopt.h) AC_CHECK_HEADERS(locale.h) AC_CHECK_HEADERS(utime.h) AC_CHECK_HEADERS(sys/utime.h) -AC_CHECK_HEADERS(regex.h) AC_CHECK_HEADERS(wchar.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T -AC_TYPE_PID_T AC_TYPE_SIZE_T -AC_STRUCT_ST_RDEV -AH_TEMPLATE([HAVE_DAYLIGHT], [Define if we have a global "int" variable "daylight".]) -AH_TEMPLATE([HAVE_TM_ISDST], [Define if we have "tm_isdst" in "struct tm".]) +AC_DIAGNOSE([obsolete],[AC_STRUCT_ST_RDEV: + your code should no longer depend upon `HAVE_ST_RDEV', but + `HAVE_STRUCT_STAT_ST_RDEV'. Remove this warning and + the `AC_DEFINE' when you adjust the code.]) +AC_CHECK_MEMBERS([struct stat.st_rdev],[AC_DEFINE(HAVE_ST_RDEV, 1, + [Define to 1 if your `struct stat' has `st_rdev'. + Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV' + instead.])]) + AC_STRUCT_TIMEZONE_DAYLIGHT AC_SYS_LARGEFILE AC_MBSTATE_T -AH_TEMPLATE([uint8_t], [Define to `unsigned char' if standard headers don't define.]) -AH_TEMPLATE([uint16_t], [Define to `unsigned short' if standard headers don't define.]) -AH_TEMPLATE([uint32_t], [Define to `unsigned int' if standard headers don't define.]) -AH_TEMPLATE([int32_t], [Define to `int' if standard headers don't define.]) -AH_TEMPLATE([HAVE_LONG_LONG],[Define if the `long long' type works.]) -AH_TEMPLATE([uint64_t], [Define to `unsigned long long', if available, or `unsigned long', if standard headers don't define.]) AC_CHECK_TYPE_STDC(uint8_t, unsigned char) AC_CHECK_TYPE_STDC(uint16_t, unsigned short) AC_CHECK_TYPE_STDC(uint32_t, unsigned int) @@ -113,10 +119,6 @@ fi dnl This needs a patch to autoconf 2.13 acgeneral.m4 AC_CHECK_TYPE2_STDC(uint64_t, $long64) -AH_TEMPLATE([SIZEOF_UINT8_T], [The number of bytes in a uint8_t.]) -AH_TEMPLATE([SIZEOF_UINT16_T], [The number of bytes in a uint16_t.]) -AH_TEMPLATE([SIZEOF_UINT32_T], [The number of bytes in a uint32_t.]) -AH_TEMPLATE([SIZEOF_UINT64_T], [The number of bytes in a uint64_t.]) AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0) AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0) AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0) @@ -125,16 +127,8 @@ AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0) dnl Checks for functions AC_CHECK_FUNCS(mmap strerror strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth) -# XXX Choose /usr/lib or /usr/lib64 for library installs. -MARK64= -case "${target_cpu}" in -x86_64*|powerpc64*|ppc64*|sparc64*|s390x*) MARK64=64 ;; -esac -AC_SUBST(MARK64) - dnl Checks for libraries AC_CHECK_LIB(z,gzopen) -dnl AC_CHECK_LIB(bz2, BZ2_bzReadOpen) -AC_CONFIG_FILES(Makefile src/Makefile magic/Makefile doc/Makefile) +AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile doc/Makefile python/Makefile]) AC_OUTPUT diff --git a/file/doc/Makefile.am b/file/doc/Makefile.am index d3e28e747..4a78589ce 100644 --- a/file/doc/Makefile.am +++ b/file/doc/Makefile.am @@ -5,8 +5,7 @@ else man_MAGIC = magic.4 endif fsect = @fsect@ -#man_MANS = file.1 $(man_MAGIC) libmagic.3 -noinst_MANS = file.1 $(man_MAGIC) libmagic.3 +man_MANS = file.1 $(man_MAGIC) libmagic.3 EXTRA_DIST = file.man magic.man libmagic.man CLEANFILES = $(man_MANS) diff --git a/file/doc/libmagic.man b/file/doc/libmagic.man index c60a04480..b4b343af0 100644 --- a/file/doc/libmagic.man +++ b/file/doc/libmagic.man @@ -11,8 +11,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -223,6 +221,6 @@ The compiled default magic database. .Xr file __CSECTION__ , .Xr magic __FSECTION__ .Sh AUTHORS -Måns Rullgård Initial libmagic implementation, +MÃ¥ns RullgÃ¥rd Initial libmagic implementation, and configuration. Christos Zoulas API cleanup, error code and allocation handling. diff --git a/file/magic/Localstuff b/file/magic/Localstuff index 8aa48646c..0fd0c9169 100644 --- a/file/magic/Localstuff +++ b/file/magic/Localstuff @@ -6,33 +6,11 @@ # Add any locally observed files here. Remember: # text if readable, executable if runnable binary, data if unreadable. -# -# RPM: file(1) magic for RPM packages and headers -# -0 beshort 0xedab ->2 beshort 0xeedb RPM ->>4 byte x v%d package ->>6 beshort 0 bin ->>6 beshort 1 src ->>8 beshort 1 i386 ->>8 beshort 2 Alpha ->>8 beshort 3 Sparc ->>8 beshort 4 MIPS ->>8 beshort 5 PPC ->>8 beshort 6 68000 ->>8 beshort 7 SGI ->>8 beshort 8 RS6000 ->>8 beshort 10 Sparc64 ->>8 beshort 11 MIPSEL ->>8 beshort 12 ARM ->>8 beshort 13 m68kmint ->>8 beshort 14 s390 ->>8 beshort 15 s390x ->>8 beshort 16 PPC64 ->>8 beshort 17 SH ->>8 beshort 18 Xtensa ->>10 string x %s - -0 beshort 0x8ead ->2 beshort 0xe801 RPM header - +# XXX promoted from tex so that *.tfm is not mis-identified as mc68k file. +# There is no way to detect TeX Font Metric (*.tfm) files without +# breaking them apart and reading the data. The following patterns +# match most *.tfm files generated by METAFONT or afm2tfm. +2 string \000\021 TeX font metric data +>33 string >\0 (%s) +2 string \000\022 TeX font metric data +>33 string >\0 (%s) diff --git a/file/magic/Magdir/animation b/file/magic/Magdir/animation index 815a2088b..08f92ae8c 100644 --- a/file/magic/Magdir/animation +++ b/file/magic/Magdir/animation @@ -6,123 +6,524 @@ # MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8) # FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com) -# MPEG animation format -0 belong 0x000001b3 MPEG video stream data -#>4 beshort&0xfff0 x (%d x -#>5 beshort&0x0fff x %d) -0 belong 0x000001ba MPEG system stream data +# MPEG sequences +# Scans for all common MPEG header start codes +0 belong&0xFFFFFF00 0x00000100 MPEG sequence +>3 byte 0xBA +>>4 byte &0x40 \b, v2, program multiplex +>>4 byte ^0x40 \b, v1, system multiplex +>3 byte 0xBB \b, v1/2, multiplex (missing pack header) +>3 byte 0xB0 \b, v4 +>>5 belong 0x000001B5 +>>>9 byte &0x80 +>>>>10 byte&0xF0 16 \b, video +>>>>10 byte&0xF0 32 \b, still texture +>>>>10 byte&0xF0 48 \b, mesh +>>>>10 byte&0xF0 64 \b, face +>>>9 byte ^0x80 +>>>>9 byte&0xF8 8 \b, video +>>>>9 byte&0xF8 16 \b, still texture +>>>>9 byte&0xF8 24 \b, mesh +>>>>9 byte&0xF8 32 \b, face +>>4 byte 1 \b, simple @ L1 +>>4 byte 2 \b, simple @ L2 +>>4 byte 3 \b, simple @ L3 +>>4 byte 4 \b, simple @ L0 +>>4 byte 17 \b, simple scalable @ L1 +>>4 byte 18 \b, simple scalable @ L2 +>>4 byte 33 \b, core @ L1 +>>4 byte 34 \b, core @ L2 +>>4 byte 50 \b, main @ L2 +>>4 byte 51 \b, main @ L3 +>>4 byte 53 \b, main @ L4 +>>4 byte 66 \b, n-bit @ L2 +>>4 byte 81 \b, scalable texture @ L1 +>>4 byte 97 \b, simple face animation @ L1 +>>4 byte 98 \b, simple face animation @ L2 +>>4 byte 99 \b, simple face basic animation @ L1 +>>4 byte 100 \b, simple face basic animation @ L2 +>>4 byte 113 \b, basic animation text @ L1 +>>4 byte 114 \b, basic animation text @ L2 +>>4 byte 129 \b, hybrid @ L1 +>>4 byte 130 \b, hybrid @ L2 +>>4 byte 145 \b, advanced RT simple @ L! +>>4 byte 146 \b, advanced RT simple @ L2 +>>4 byte 147 \b, advanced RT simple @ L3 +>>4 byte 148 \b, advanced RT simple @ L4 +>>4 byte 161 \b, core scalable @ L1 +>>4 byte 162 \b, core scalable @ L2 +>>4 byte 163 \b, core scalable @ L3 +>>4 byte 177 \b, advanced coding efficiency @ L1 +>>4 byte 178 \b, advanced coding efficiency @ L2 +>>4 byte 179 \b, advanced coding efficiency @ L3 +>>4 byte 180 \b, advanced coding efficiency @ L4 +>>4 byte 193 \b, advanced core @ L1 +>>4 byte 194 \b, advanced core @ L2 +>>4 byte 209 \b, advanced scalable texture @ L1 +>>4 byte 210 \b, advanced scalable texture @ L2 +>>4 byte 211 \b, advanced scalable texture @ L3 +>>4 byte 225 \b, simple studio @ L1 +>>4 byte 226 \b, simple studio @ L2 +>>4 byte 227 \b, simple studio @ L3 +>>4 byte 228 \b, simple studio @ L4 +>>4 byte 229 \b, core studio @ L1 +>>4 byte 230 \b, core studio @ L2 +>>4 byte 231 \b, core studio @ L3 +>>4 byte 232 \b, core studio @ L4 +>>4 byte 240 \b, advanced simple @ L0 +>>4 byte 241 \b, advanced simple @ L1 +>>4 byte 242 \b, advanced simple @ L2 +>>4 byte 243 \b, advanced simple @ L3 +>>4 byte 244 \b, advanced simple @ L4 +>>4 byte 245 \b, advanced simple @ L5 +>>4 byte 247 \b, advanced simple @ L3b +>>4 byte 248 \b, FGS @ L0 +>>4 byte 249 \b, FGS @ L1 +>>4 byte 250 \b, FGS @ L2 +>>4 byte 251 \b, FGS @ L3 +>>4 byte 252 \b, FGS @ L4 +>>4 byte 253 \b, FGS @ L5 +>3 byte 0xB5 \b, v4 +>>4 byte &0x80 +>>>5 byte&0xF0 16 \b, video (missing profile header) +>>>5 byte&0xF0 32 \b, still texture (missing profile header) +>>>5 byte&0xF0 48 \b, mesh (missing profile header) +>>>5 byte&0xF0 64 \b, face (missing profile header) +>>4 byte ^0x80 +>>>4 byte&0xF8 8 \b, video (missing profile header) +>>>4 byte&0xF8 16 \b, still texture (missing profile header) +>>>4 byte&0xF8 24 \b, mesh (missing profile header) +>>>4 byte&0xF8 32 \b, face (missing profile header) +>3 byte 0xB3 +>>12 belong 0x000001B8 \b, v1, progressive Y'CbCr 4:2:0 video +>>12 belong 0x000001B2 \b, v1, progressive Y'CbCr 4:2:0 video +>>12 belong 0x000001B5 \b, v2, +>>>16 byte&0x0F 1 \b HP +>>>16 byte&0x0F 2 \b Spt +>>>16 byte&0x0F 3 \b SNR +>>>16 byte&0x0F 4 \b MP +>>>16 byte&0x0F 5 \b SP +>>>17 byte&0xF0 64 \b@HL +>>>17 byte&0xF0 96 \b@H-14 +>>>17 byte&0xF0 128 \b@ML +>>>17 byte&0xF0 160 \b@LL +>>>17 byte &0x08 \b progressive +>>>17 byte ^0x08 \b interlaced +>>>17 byte&0x06 2 \b Y'CbCr 4:2:0 video +>>>17 byte&0x06 4 \b Y'CbCr 4:2:2 video +>>>17 byte&0x06 6 \b Y'CbCr 4:4:4 video +>>11 byte &0x02 +>>>75 byte &0x01 +>>>>140 belong 0x000001B8 \b, v1, progressive Y'CbCr 4:2:0 video +>>>>140 belong 0x000001B2 \b, v1, progressive Y'CbCr 4:2:0 video +>>>>140 belong 0x000001B5 \b, v2, +>>>>>144 byte&0x0F 1 \b HP +>>>>>144 byte&0x0F 2 \b Spt +>>>>>144 byte&0x0F 3 \b SNR +>>>>>144 byte&0x0F 4 \b MP +>>>>>144 byte&0x0F 5 \b SP +>>>>>145 byte&0xF0 64 \b@HL +>>>>>145 byte&0xF0 96 \b@H-14 +>>>>>145 byte&0xF0 128 \b@ML +>>>>>145 byte&0xF0 160 \b@LL +>>>>>145 byte &0x08 \b progressive +>>>>>145 byte ^0x08 \b interlaced +>>>>>145 byte&0x06 2 \b Y'CbCr 4:2:0 video +>>>>>145 byte&0x06 4 \b Y'CbCr 4:2:2 video +>>>>>145 byte&0x06 6 \b Y'CbCr 4:4:4 video +>>>76 belong 0x000001B8 \b, v1, progressive Y'CbCr 4:2:0 video +>>>76 belong 0x000001B2 \b, v1, progressive Y'CbCr 4:2:0 video +>>>76 belong 0x000001B5 \b, v2, +>>>80 byte&0x0F 1 \b HP +>>>80 byte&0x0F 2 \b Spt +>>>80 byte&0x0F 3 \b SNR +>>>80 byte&0x0F 4 \b MP +>>>80 byte&0x0F 5 \b SP +>>>81 byte&0xF0 64 \b@HL +>>>81 byte&0xF0 96 \b@H-14 +>>>81 byte&0xF0 128 \b@ML +>>>81 byte&0xF0 160 \b@LL +>>>81 byte &0x08 \b progressive +>>>81 byte ^0x08 \b interlaced +>>>81 byte&0x06 2 \b Y'CbCr 4:2:0 video +>>>81 byte&0x06 4 \b Y'CbCr 4:2:2 video +>>>81 byte&0x06 6 \b Y'CbCr 4:4:4 video +>>4 belong&0xFFFFFF00 0x78043800 \b, HD-TV 1920P +>>>7 byte&0xF0 0x10 \b, 16:9 +>>4 belong&0xFFFFFF00 0x50002D00 \b, SD-TV 1280I +>>>7 byte&0xF0 0x10 \b, 16:9 +>>4 belong&0xFFFFFF00 0x30024000 \b, PAL Capture +>>>7 byte&0xF0 0x10 \b, 4:3 +>>4 beshort&0xFFF0 0x2C00 \b, 4CIF +>>>5 beshort&0x0FFF 0x01E0 \b NTSC +>>>5 beshort&0x0FFF 0x0240 \b PAL +>>>7 byte&0xF0 0x20 \b, 4:3 +>>>7 byte&0xF0 0x30 \b, 16:9 +>>>7 byte&0xF0 0x40 \b, 11:5 +>>>7 byte&0xF0 0x80 \b, PAL 4:3 +>>>7 byte&0xF0 0xC0 \b, NTSC 4:3 +>>4 belong&0xFFFFFF00 0x2801E000 \b, LD-TV 640P +>>>7 byte&0xF0 0x10 \b, 4:3 +>>4 belong&0xFFFFFF00 0x1400F000 \b, 320x240 +>>>7 byte&0xF0 0x10 \b, 4:3 +>>4 belong&0xFFFFFF00 0x0F00A000 \b, 240x160 +>>>7 byte&0xF0 0x10 \b, 4:3 +>>4 belong&0xFFFFFF00 0x0A007800 \b, 160x120 +>>>7 byte&0xF0 0x10 \b, 4:3 +>>4 beshort&0xFFF0 0x1600 \b, CIF +>>>5 beshort&0x0FFF 0x00F0 \b NTSC +>>>5 beshort&0x0FFF 0x0120 \b PAL +>>>7 byte&0xF0 0x20 \b, 4:3 +>>>7 byte&0xF0 0x30 \b, 16:9 +>>>7 byte&0xF0 0x40 \b, 11:5 +>>>7 byte&0xF0 0x80 \b, PAL 4:3 +>>>7 byte&0xF0 0xC0 \b, NTSC 4:3 +>>>5 beshort&0x0FFF 0x0240 \b PAL 625 +>>>>7 byte&0xF0 0x20 \b, 4:3 +>>>>7 byte&0xF0 0x30 \b, 16:9 +>>>>7 byte&0xF0 0x40 \b, 11:5 +>>4 beshort&0xFFF0 0x2D00 \b, CCIR/ITU +>>>5 beshort&0x0FFF 0x01E0 \b NTSC 525 +>>>5 beshort&0x0FFF 0x0240 \b PAL 625 +>>>7 byte&0xF0 0x20 \b, 4:3 +>>>7 byte&0xF0 0x30 \b, 16:9 +>>>7 byte&0xF0 0x40 \b, 11:5 +>>4 beshort&0xFFF0 0x1E00 \b, SVCD +>>>5 beshort&0x0FFF 0x01E0 \b NTSC 525 +>>>5 beshort&0x0FFF 0x0240 \b PAL 625 +>>>7 byte&0xF0 0x20 \b, 4:3 +>>>7 byte&0xF0 0x30 \b, 16:9 +>>>7 byte&0xF0 0x40 \b, 11:5 +>>7 byte&0x0F 1 \b, 23.976 fps +>>7 byte&0x0F 2 \b, 24 fps +>>7 byte&0x0F 3 \b, 25 fps +>>7 byte&0x0F 4 \b, 29.97 fps +>>7 byte&0x0F 5 \b, 30 fps +>>7 byte&0x0F 6 \b, 50 fps +>>7 byte&0x0F 7 \b, 59.94 fps +>>7 byte&0x0F 8 \b, 60 fps +>>11 byte &0x04 \b, Constrained -# MPEG Audio (*.mpx) +# MPEG ADTS Audio (*.mpx/mxa/aac) # from dreesen@math.fu-berlin.de +# modified to fully support MPEG ADTS -# MPEG 1.0 Layer 3 -0 beshort&0xfffe =0xfffa \bMP3 ->2 byte&0xf0 =0x10 \b, 32 kBits ->2 byte&0xf0 =0x20 \b, 40 kBits ->2 byte&0xf0 =0x30 \b, 48 kBits ->2 byte&0xf0 =0x40 \b, 56 kBits ->2 byte&0xf0 =0x50 \b, 64 kBits ->2 byte&0xf0 =0x60 \b, 80 kBits ->2 byte&0xf0 =0x70 \b, 96 kBits ->2 byte&0xf0 =0x80 \b, 112 kBits ->2 byte&0xf0 =0x90 \b, 128 kBits ->2 byte&0xf0 =0xA0 \b, 160 kBits ->2 byte&0xf0 =0xB0 \b, 192 kBits ->2 byte&0xf0 =0xC0 \b, 224 kBits ->2 byte&0xf0 =0xD0 \b, 256 kBits ->2 byte&0xf0 =0xE0 \b, 320 kBits -# freq ->2 byte&0x0C =0x00 \b, 44.1 kHz ->2 byte&0x0C =0x04 \b, 48 kHz ->2 byte&0x0C =0x08 \b, 32 kHz -# misc ->3 byte&0xC0 =0x00 \b, Stereo ->3 byte&0xC0 =0x40 \b, JStereo ->3 byte&0xC0 =0x80 \b, Dual-Ch ->3 byte&0xC0 =0xC0 \b, Mono -#>1 byte&0x01 =0x00 \b, Error Protection -#>2 byte&0x02 =0x02 \b, Padding -#>2 byte&0x01 =0x01 \b, Private -#>3 byte&0x08 =0x08 \b, Copyright -#>3 byte&0x04 =0x04 \b, Original -#>3 byte&0x03 1 \b, Emphasis 5 -#>3 byte&0x03 3 \b, Emphasis c - -# MPEG 1.0 Layer 2 -0 beshort&0xfffe =0xfffc \bMP2 ->2 byte&0xf0 =0x10 \b, 32 kBits ->2 byte&0xf0 =0x20 \b, 48 kBits ->2 byte&0xf0 =0x30 \b, 56 kBits ->2 byte&0xf0 =0x40 \b, 64 kBits ->2 byte&0xf0 =0x50 \b, 80 kBits ->2 byte&0xf0 =0x60 \b, 96 kBits ->2 byte&0xf0 =0x70 \b, 112 kBits ->2 byte&0xf0 =0x80 \b, 128 kBits ->2 byte&0xf0 =0x90 \b, 160 kBits ->2 byte&0xf0 =0xA0 \b, 192 kBits ->2 byte&0xf0 =0xB0 \b, 224 kBits ->2 byte&0xf0 =0xC0 \b, 256 kBits ->2 byte&0xf0 =0xD0 \b, 320 kBits ->2 byte&0xf0 =0xE0 \b, 384 kBits -# freq ->2 byte&0x0C =0x00 \b, 44.1 kHz ->2 byte&0x0C =0x04 \b, 48 kHz ->2 byte&0x0C =0x08 \b, 32 kHz -# misc ->3 byte&0xC0 =0x00 \b, Stereo ->3 byte&0xC0 =0x40 \b, JStereo ->3 byte&0xC0 =0x80 \b, Dual-Ch ->3 byte&0xC0 =0xC0 \b, Mono -#>1 byte&0x01 =0x00 \b, Error Protection -#>2 byte&0x02 =0x02 \b, Padding -#>2 byte&0x01 =0x01 \b, Private -#>3 byte&0x08 =0x08 \b, Copyright -#>3 byte&0x04 =0x04 \b, Original -#>3 byte&0x03 1 \b, Emphasis 5 -#>3 byte&0x03 3 \b, Emphasis c - -# MPEG 2.0 -0 beshort&0xfff8 =0xfff0 MP -# Layer 3 ->1 byte &0x02 \b3 -# Layer 2 ->1 byte &0x04 \b2 ->2 byte&0xf0 =0x10 \b, 8 kBits ->2 byte&0xf0 =0x20 \b, 16 kBits ->2 byte&0xf0 =0x30 \b, 24 kBits ->2 byte&0xf0 =0x40 \b, 32 kBits ->2 byte&0xf0 =0x50 \b, 40 kBits ->2 byte&0xf0 =0x60 \b, 48 kBits ->2 byte&0xf0 =0x70 \b, 56 kBits ->2 byte&0xf0 =0x80 \b, 64 kBits ->2 byte&0xf0 =0x90 \b, 80 kBits ->2 byte&0xf0 =0xA0 \b, 96 kBits ->2 byte&0xf0 =0xB0 \b, 112 kBits ->2 byte&0xf0 =0xC0 \b, 128 kBits ->2 byte&0xf0 =0xD0 \b, 144 kBits ->2 byte&0xf0 =0xE0 \b, 160 kBits -# freq ->2 byte&0x0C =0x00 \b, 22.05 kHz ->2 byte&0x0C =0x04 \b, 24 kHz ->2 byte&0x0C =0x08 \b, 16 kHz -# misc ->3 byte&0xC0 =0x00 \b, Stereo ->3 byte&0xC0 =0x40 \b, JStereo ->3 byte&0xC0 =0x80 \b, Dual-Ch ->3 byte&0xC0 =0xC0 \b, Mono -#>1 byte&0x01 =0x00 \b, Error Protection -#>2 byte&0x02 =0x02 \b, Padding -#>2 byte&0x01 =0x01 \b, Private -#>3 byte&0x08 =0x08 \b, Copyright -#>3 byte&0x04 =0x04 \b, Original -#>3 byte&0x03 1 \b, Emphasis 5 -#>3 byte&0x03 3 \b, Emphasis c - -#From: Johan Gade <jgade@diku.dk> - -# MPEG-4 Advanced Audio Coding (AAC) file (perhaps also MPEG-2 ACC?) -16 string M4A MPEG-4 Advanced Audio Coding file (AAC) +# MP3, M1A +0 beshort&0xFFFE 0xFFFA MPEG ADTS, layer III, v1 +# rates +>2 byte&0xF0 0x10 \b, 32 kBits +>2 byte&0xF0 0x20 \b, 40 kBits +>2 byte&0xF0 0x30 \b, 48 kBits +>2 byte&0xF0 0x40 \b, 56 kBits +>2 byte&0xF0 0x50 \b, 64 kBits +>2 byte&0xF0 0x60 \b, 80 kBits +>2 byte&0xF0 0x70 \b, 96 kBits +>2 byte&0xF0 0x80 \b, 112 kBits +>2 byte&0xF0 0x90 \b, 128 kBits +>2 byte&0xF0 0xA0 \b, 160 kBits +>2 byte&0xF0 0xB0 \b, 192 kBits +>2 byte&0xF0 0xC0 \b, 224 kBits +>2 byte&0xF0 0xD0 \b, 256 kBits +>2 byte&0xF0 0xE0 \b, 320 kBits +# timing +>2 byte&0x0C 0x00 \b, 44.1 kHz +>2 byte&0x0C 0x04 \b, 48 kHz +>2 byte&0x0C 0x08 \b, 32 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 +# MP2, M1A +0 beshort&0xFFFE 0xFFFC MPEG ADTS, layer II, v1 +# rates +>2 byte&0xF0 0x10 \b, 32 kBits +>2 byte&0xF0 0x20 \b, 48 kBits +>2 byte&0xF0 0x30 \b, 56 kBits +>2 byte&0xF0 0x40 \b, 64 kBits +>2 byte&0xF0 0x50 \b, 80 kBits +>2 byte&0xF0 0x60 \b, 96 kBits +>2 byte&0xF0 0x70 \b, 112 kBits +>2 byte&0xF0 0x80 \b, 128 kBits +>2 byte&0xF0 0x90 \b, 160 kBits +>2 byte&0xF0 0xA0 \b, 192 kBits +>2 byte&0xF0 0xB0 \b, 224 kBits +>2 byte&0xF0 0xC0 \b, 256 kBits +>2 byte&0xF0 0xD0 \b, 320 kBits +>2 byte&0xF0 0xE0 \b, 384 kBits +# timing +>2 byte&0x0C 0x00 \b, 44.1 kHz +>2 byte&0x0C 0x04 \b, 48 kHz +>2 byte&0x0C 0x08 \b, 32 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 + +# MPA, M1A +0 beshort&0xFFFE 0xFFFE MPEG ADTS, layer I, v1 +# rate +>2 byte&0xF0 0x10 \b, 32 kBits +>2 byte&0xF0 0x20 \b, 64 kBits +>2 byte&0xF0 0x30 \b, 96 kBits +>2 byte&0xF0 0x40 \b, 128 kBits +>2 byte&0xF0 0x50 \b, 160 kBits +>2 byte&0xF0 0x60 \b, 192 kBits +>2 byte&0xF0 0x70 \b, 224 kBits +>2 byte&0xF0 0x80 \b, 256 kBits +>2 byte&0xF0 0x90 \b, 288 kBits +>2 byte&0xF0 0xA0 \b, 320 kBits +>2 byte&0xF0 0xB0 \b, 352 kBits +>2 byte&0xF0 0xC0 \b, 384 kBits +>2 byte&0xF0 0xD0 \b, 416 kBits +>2 byte&0xF0 0xE0 \b, 448 kBits +# timing +>2 byte&0x0C 0x00 \b, 44.1 kHz +>2 byte&0x0C 0x04 \b, 48 kHz +>2 byte&0x0C 0x08 \b, 32 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 + +# MP3, M2A +0 beshort&0xFFFE 0xFFF2 MPEG ADTS, layer III, v2 +# rate +>2 byte&0xF0 0x10 \b, 8 kBits +>2 byte&0xF0 0x20 \b, 16 kBits +>2 byte&0xF0 0x30 \b, 24 kBits +>2 byte&0xF0 0x40 \b, 32 kBits +>2 byte&0xF0 0x50 \b, 40 kBits +>2 byte&0xF0 0x60 \b, 48 kBits +>2 byte&0xF0 0x70 \b, 56 kBits +>2 byte&0xF0 0x80 \b, 64 kBits +>2 byte&0xF0 0x90 \b, 80 kBits +>2 byte&0xF0 0xA0 \b, 96 kBits +>2 byte&0xF0 0xB0 \b, 112 kBits +>2 byte&0xF0 0xC0 \b, 128 kBits +>2 byte&0xF0 0xD0 \b, 144 kBits +>2 byte&0xF0 0xE0 \b, 160 kBits +# timing +>2 byte&0x0C 0x00 \b, 22.05 kHz +>2 byte&0x0C 0x04 \b, 24 kHz +>2 byte&0x0C 0x08 \b, 16 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 + +# MP2, M2A +0 beshort&0xFFFE 0xFFF4 MPEG ADTS, layer II, v2 +# rate +>2 byte&0xF0 0x10 \b, 8 kBits +>2 byte&0xF0 0x20 \b, 16 kBits +>2 byte&0xF0 0x30 \b, 24 kBits +>2 byte&0xF0 0x40 \b, 32 kBits +>2 byte&0xF0 0x50 \b, 40 kBits +>2 byte&0xF0 0x60 \b, 48 kBits +>2 byte&0xF0 0x70 \b, 56 kBits +>2 byte&0xF0 0x80 \b, 64 kBits +>2 byte&0xF0 0x90 \b, 80 kBits +>2 byte&0xF0 0xA0 \b, 96 kBits +>2 byte&0xF0 0xB0 \b, 112 kBits +>2 byte&0xF0 0xC0 \b, 128 kBits +>2 byte&0xF0 0xD0 \b, 144 kBits +>2 byte&0xF0 0xE0 \b, 160 kBits +# timing +>2 byte&0x0C 0x00 \b, 22.05 kHz +>2 byte&0x0C 0x04 \b, 24 kHz +>2 byte&0x0C 0x08 \b, 16 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 + +# MPA, M2A +0 beshort&0xFFFE 0xFFF6 MPEG ADTS, layer I, v2 +# rate +>2 byte&0xF0 0x10 \b, 32 kBits +>2 byte&0xF0 0x20 \b, 48 kBits +>2 byte&0xF0 0x30 \b, 56 kBits +>2 byte&0xF0 0x40 \b, 64 kBits +>2 byte&0xF0 0x50 \b, 80 kBits +>2 byte&0xF0 0x60 \b, 96 kBits +>2 byte&0xF0 0x70 \b, 112 kBits +>2 byte&0xF0 0x80 \b, 128 kBits +>2 byte&0xF0 0x90 \b, 144 kBits +>2 byte&0xF0 0xA0 \b, 160 kBits +>2 byte&0xF0 0xB0 \b, 176 kBits +>2 byte&0xF0 0xC0 \b, 192 kBits +>2 byte&0xF0 0xD0 \b, 224 kBits +>2 byte&0xF0 0xE0 \b, 256 kBits +# timing +>2 byte&0x0C 0x00 \b, 22.05 kHz +>2 byte&0x0C 0x04 \b, 24 kHz +>2 byte&0x0C 0x08 \b, 16 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 + +# MP3, M25A +0 beshort&0xFFFE 0xFFE2 MPEG ADTS, layer III, v2.5 +# rate +>2 byte&0xF0 0x10 \b, 8 kBits +>2 byte&0xF0 0x20 \b, 16 kBits +>2 byte&0xF0 0x30 \b, 24 kBits +>2 byte&0xF0 0x40 \b, 32 kBits +>2 byte&0xF0 0x50 \b, 40 kBits +>2 byte&0xF0 0x60 \b, 48 kBits +>2 byte&0xF0 0x70 \b, 56 kBits +>2 byte&0xF0 0x80 \b, 64 kBits +>2 byte&0xF0 0x90 \b, 80 kBits +>2 byte&0xF0 0xA0 \b, 96 kBits +>2 byte&0xF0 0xB0 \b, 112 kBits +>2 byte&0xF0 0xC0 \b, 128 kBits +>2 byte&0xF0 0xD0 \b, 144 kBits +>2 byte&0xF0 0xE0 \b, 160 kBits +# timing +>2 byte&0x0C 0x00 \b, 11.025 kHz +>2 byte&0x0C 0x04 \b, 12 kHz +>2 byte&0x0C 0x08 \b, 8 kHz +# channels/options +>3 byte&0xC0 0x00 \b, Stereo +>3 byte&0xC0 0x40 \b, JntStereo +>3 byte&0xC0 0x80 \b, 2x Monaural +>3 byte&0xC0 0xC0 \b, Monaural +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Packet Pad +#>2 byte &0x01 \b, Custom Flag +#>3 byte &0x08 \b, Copyrighted +#>3 byte &0x04 \b, Original Source +#>3 byte&0x03 1 \b, NR: 50/15 ms +#>3 byte&0x03 3 \b, NR: CCIT J.17 + +# AAC (aka MPEG-2 NBC audio) and MPEG-4 audio + +# Stored AAC streams (instead of the MP4 format) +0 string ADIF MPEG ADIF, AAC +>4 byte &0x80 +>>13 byte &0x10 \b, VBR +>>13 byte ^0x10 \b, CBR +>>16 byte&0x1E 0x02 \b, single stream +>>16 byte&0x1E 0x04 \b, 2 streams +>>16 byte&0x1E 0x06 \b, 3 streams +>>16 byte &0x08 \b, 4 or more streams +>>16 byte &0x10 \b, 8 or more streams +>>4 byte &0x80 \b, Copyrighted +>>13 byte &0x40 \b, Original Source +>>13 byte &0x20 \b, Home Flag +>4 byte ^0x80 +>>4 byte &0x10 \b, VBR +>>4 byte ^0x10 \b, CBR +>>7 byte&0x1E 0x02 \b, single stream +>>7 byte&0x1E 0x04 \b, 2 streams +>>7 byte&0x1E 0x06 \b, 3 streams +>>7 byte &0x08 \b, 4 or more streams +>>7 byte &0x10 \b, 8 or more streams +>>4 byte &0x40 \b, Original Stream(s) +>>4 byte &0x20 \b, Home Source + +# Live or stored single AAC stream (used with MPEG-2 systems) +0 beshort&0xFFF6 0xFFF0 MPEG ADTS, AAC +>1 byte ^0x08 \b, v2 +>1 byte &0x08 \b, v4 +# profile +>>2 byte &0xC0 \b LTP +>2 byte&0xc0 0x00 \b, Main +>2 byte&0xc0 0x40 \b, LC +>2 byte&0xc0 0x80 \b, SSR +# timing +>2 byte&0x3c 0x00 \b, 96 kHz +>2 byte&0x3c 0x04 \b, 88.2 kHz +>2 byte&0x3c 0x08 \b, 64 kHz +>2 byte&0x3c 0x0c \b, 48 kHz +>2 byte&0x3c 0x10 \b, 44.1 kHz +>2 byte&0x3c 0x14 \b, 32 kHz +>2 byte&0x3c 0x18 \b, 24 kHz +>2 byte&0x3c 0x1c \b, 22.05 kHz +>2 byte&0x3c 0x20 \b, 16 kHz +>2 byte&0x3c 0x24 \b, 12 kHz +>2 byte&0x3c 0x28 \b, 11.025 kHz +>2 byte&0x3c 0x2c \b, 8 kHz +# channels/options +>2 beshort&0x01c0 0x0040 \b, monaural +>2 beshort&0x01c0 0x0080 \b, stereo +>2 beshort&0x01c0 0x00c0 \b, stereo + center +>2 beshort&0x01c0 0x0100 \b, stereo+center+LFE +>2 beshort&0x01c0 0x0140 \b, surround +>2 beshort&0x01c0 0x0180 \b, surround + LFE +>2 beshort &0x01C0 \b, surround + side +#>1 byte ^0x01 \b, Data Verify +#>2 byte &0x02 \b, Custom Flag +#>3 byte &0x20 \b, Original Stream +#>3 byte &0x10 \b, Home Source +#>3 byte &0x08 \b, Copyrighted + +# Live MPEG-4 audio streams (instead of RTP FlexMux) +0 beshort&0xFFE0 0x56E0 MPEG-4 LOAS +#>1 beshort&0x1FFF x \b, %u byte packet +>3 byte&0xE0 0x40 +>>4 byte&0x3C 0x04 \b, single stream +>>4 byte&0x3C 0x08 \b, 2 streams +>>4 byte&0x3C 0x0C \b, 3 streams +>>4 byte &0x08 \b, 4 or more streams +>>4 byte &0x20 \b, 8 or more streams +>3 byte&0xC0 0 +>>4 byte&0x78 0x08 \b, single stream +>>4 byte&0x78 0x10 \b, 2 streams +>>4 byte&0x78 0x18 \b, 3 streams +>>4 byte &0x20 \b, 4 or more streams +>>4 byte &0x40 \b, 8 or more streams +0 beshort 0x4DE1 MPEG-4 LO-EP audio stream # FLI animation format 4 leshort 0xAF11 FLI file @@ -166,16 +567,31 @@ # SGI formats 0 string MOVI Silicon Graphics movie file -# Apple Quicktime: Scan for all known top-level QT atom markers -4 string moov Apple QuickTime movie file (moov) -4 string mdat Apple QuickTime movie file (mdat) -4 string ftyp Apple QuickTime movie file (ftyp) -4 string free Apple QuickTime movie file (free) -4 string junk Apple QuickTime movie file (junk) -4 string pnot Apple QuickTime movie file (pnot) -4 string skip Apple QuickTime movie file (skip) -4 string wide Apple QuickTime movie file (wide) -4 string pict Apple QuickTime movie file (pict) +# Apple Quicktime and ISO types +4 string moov Apple QuickTime +>12 string mvhd \b movie (fast start) +>12 string mdra \b URL +>12 string cmov \b movie (fast start, compressed header) +>12 string rmra \b multiple URLs +4 string mdat Apple QuickTime movie (unoptimized) +4 string wide Apple QuickTime movie (unoptimized) +4 string skip Apple QuickTime movie (modified) +4 string free Apple QuickTime movie (modified) +4 string idsc Apple QuickTime image (fast start) +4 string idat Apple QuickTime image (unoptimized) +4 string pckg Apple QuickTime compressed archive +4 string/B jP JPEG 2000 image +4 string ftyp ISO Media +>8 string isom \b, MPEG v4 system +>8 string mp41 \b, MPEG v4 system, version 1 +>8 string mp42 \b, MPEG v4 system, version 2 +>8 string/B jp2 \b, JPEG 2000 image +>8 string 3gp \b, MPEG v4 system, 3GPP (H.263/AMR) +>8 string mmp4 \b, MPEG v4 system, Mobile +>8 string/B M4A \b, MPEG v4 system, iTunes AAC-LC +>8 string/B M4P \b, MPEG v4 system, ISMA encrypted AAC-LC +>8 string/B M4B \b, MPEG v4 system, iTunes AAC-LC/AMR +>8 string/B qt \b, Apple QuickTime movie # iso 13818 transport stream # diff --git a/file/magic/Magdir/apple b/file/magic/Magdir/apple index 2b0a290ca..694480595 100644 --- a/file/magic/Magdir/apple +++ b/file/magic/Magdir/apple @@ -10,6 +10,23 @@ 0 belong 0x00051600 AppleSingle encoded Macintosh file 0 belong 0x00051607 AppleDouble encoded Macintosh file +# Apple Emulator 2IMG format +# +0 string 2IMG Apple ][ 2IMG Disk Image +>4 string XGS! \b, XGS +>4 string CTKG \b, Catakig +>4 string ShIm \b, Sheppy's ImageMaker +>4 string WOOF \b, Sweet 16 +>4 string B2TR \b, Bernie ][ the Rescue +>4 string !nfc \b, ASIMOV2 +>4 string x \b, Unknown Format +>0xc byte 00 \b, DOS 3.3 sector order +>>0x10 byte 00 \b, Volume 254 +>>0x10 byte&0x7f x \b, Volume %u +>0xc byte 01 \b, ProDOS sector order +>>0x14 short x \b, %u Blocks +>0xc byte 02 \b, NIB data + # magic for Newton PDA package formats # from Ruda Moura <ruda@helllabs.org> 0 string package0 Newton package, NOS 1.x, diff --git a/file/magic/Magdir/archive b/file/magic/Magdir/archive index 070feab6f..84a55a3ea 100644 --- a/file/magic/Magdir/archive +++ b/file/magic/Magdir/archive @@ -128,7 +128,9 @@ # version (not tested)] #0 byte 0x1a RISC OS archive #>1 string archive (ArcFS format) -0 string \032archive RISC OS archive (ArcFS format) +#0 string \032archive RISC OS archive (ArcFS format) +0 string \032 RISC OS archive (spark format) +0 string Archive\000 RISC OS archive (ArcFS format) # ARJ archiver (jason@jarthur.Claremont.EDU) 0 leshort 0xea60 ARJ archive data diff --git a/file/magic/Magdir/audio b/file/magic/Magdir/audio index 6a4ef95a9..ccdf14cc1 100644 --- a/file/magic/Magdir/audio +++ b/file/magic/Magdir/audio @@ -398,3 +398,14 @@ # From "Simon Hosie 0 string TFMX-SONG TFMX module sound data + +# From danny.milo@gmx.net (Danny Milosavljevic) +# monkeysaudio for magic.mime +0 string MAC\ X/Monkey audio, +>4 leshort >0 version %d, +>6 leshort >0 compression level %d, +>8 leshort >0 flags %x, +>10 leshort >0 channels %d, +>12 lelong >0 samplerate %d, +>24 lelong >0 frames %d + diff --git a/file/magic/Magdir/console b/file/magic/Magdir/console index ff5a15268..fdad7c4e5 100644 --- a/file/magic/Magdir/console +++ b/file/magic/Magdir/console @@ -153,3 +153,45 @@ # Microsoft Xbox data file formats 0 string XIP0 XIP, Microsoft Xbox data 0 string XTF0 XTF, Microsoft Xbox data + +# Atari Lynx cartridge dump (EXE/BLL header) +# From: "Stefan A. Haubenthal" <polluks@web.de> + +0 beshort 0x8008 Lynx cartridge, +>2 beshort x RAM start $%04x +>6 string BS93 + +#------------------------------------------------------------------------------ +# Z-machine: file(1) magic for Z-machine binaries. +# +# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which +# appears to be a version-0 Z-machine binary. +# +# The (false match) message is to correct that behavior. Perhaps it is +# not needed. +# +>16 belong&0xfe00f0f0 0x3030 Infocom game data +>0 ubyte 0 (false match) +>0 ubyte >0 (Z-machine %d, +>>2 ubeshort x Release %d / +>>18 string >\0 Serial %.6s) + +#------------------------------------------------------------------------------ +# Glulx: file(1) magic for Glulx binaries. +# +# I haven't checked for false matches yet. +# +0 string Glul Glulx game data + + + +# These go at the end of the iff rules +# +# I don't see why these might collide with anything else. +# +# Interactive Fiction related formats +# +>8 string IFRS \b, Blorb Interactive Fiction +>>24 string Exec with executable chunk +>8 string IFZS \b, Z-machine or Glulx saved game file (Quetzal) + diff --git a/file/magic/Magdir/elf b/file/magic/Magdir/elf index 10aac0693..67e527064 100644 --- a/file/magic/Magdir/elf +++ b/file/magic/Magdir/elf @@ -98,12 +98,13 @@ >>18 leshort 47 Hitachi H8/300H, >>18 leshort 48 Hitachi H8S, >>18 leshort 49 Hitachi H8/500, ->>18 leshort 50 IA-64 (Intel 64 bit architecture) +>>18 leshort 50 IA-64, >>18 leshort 51 Stanford MIPS-X, >>18 leshort 52 Motorola Coldfire, >>18 leshort 53 Motorola M68HC12, >>18 leshort 62 AMD x86-64, >>18 leshort 75 Digital VAX, +>>18 leshort 88 Renesas M32R, >>18 leshort 97 NatSemi 32k, >>18 leshort 0x9026 Alpha (unofficial), >>20 lelong 0 invalid version @@ -186,12 +187,13 @@ >>18 beshort 47 Hitachi H8/300H, >>18 beshort 48 Hitachi H8S, >>18 beshort 49 Hitachi H8/500, ->>18 beshort 50 Intel Merced Processor, +>>18 beshort 50 IA-64, >>18 beshort 51 Stanford MIPS-X, >>18 beshort 52 Motorola Coldfire, >>18 beshort 53 Motorola M68HC12, >>18 beshort 73 Cray NV1, >>18 beshort 75 Digital VAX, +>>18 beshort 88 Renesas M32R, >>18 beshort 97 NatSemi 32k, >>18 beshort 0x9026 Alpha (unofficial), >>18 beshort 0xa390 IBM S/390 (obsolete), diff --git a/file/magic/Magdir/esri b/file/magic/Magdir/esri new file mode 100644 index 000000000..35c34923e --- /dev/null +++ b/file/magic/Magdir/esri @@ -0,0 +1,27 @@ + +#------------------------------------------------------------------------------ +# ESRI Shapefile format (.shp .shx .dbf=DBaseIII) +# Based on info from +# <URL:http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf> +0 belong 9994 ESRI Shapefile +>4 belong =0 +>8 belong =0 +>12 belong =0 +>16 belong =0 +>20 belong =0 +>28 lelong x version %d +>24 belong x length %d +>32 lelong =0 type Null Shape +>32 lelong =1 type Point +>32 lelong =3 type PolyLine +>32 lelong =5 type Polygon +>32 lelong =8 type MultiPoint +>32 lelong =11 type PointZ +>32 lelong =13 type PolyLineZ +>32 lelong =15 type PolygonZ +>32 lelong =18 type MultiPointZ +>32 lelong =21 type PointM +>32 lelong =23 type PolyLineM +>32 lelong =25 type PolygonM +>32 lelong =28 type MultiPointM +>32 lelong =31 type MultiPatch diff --git a/file/magic/Magdir/filesystems b/file/magic/Magdir/filesystems index c79852580..5a4ac2362 100644 --- a/file/magic/Magdir/filesystems +++ b/file/magic/Magdir/filesystems @@ -126,6 +126,9 @@ >>>>>>71 string =NO\ NAME \b, unlabeled ### FATs end >0x200 lelong 0x82564557 \b, BSD disklabel +# FATX +0 string FATX FATX filesystem data + # Minix filesystems - Juan Cespedes <cespedes@debian.org> 0x410 leshort 0x137f Minix filesystem diff --git a/file/magic/Magdir/images b/file/magic/Magdir/images index b992a92ba..747c461f3 100644 --- a/file/magic/Magdir/images +++ b/file/magic/Magdir/images @@ -519,3 +519,12 @@ # From: Tom Hilinski <tom.hilinski@comcast.net> # http://www.unidata.ucar.edu/packages/netcdf/ 0 string CDF\001 netcdf file + + +# The boot loaders syslinux and isolinux use a RLE based image format +# called SLL16 to store splash screens. +0 lelong 0x1413f33d Syslinux SLL16 image data, +>4 leshort >0 %hd x +>6 leshort >0 %hd + + diff --git a/file/magic/Magdir/linux b/file/magic/Magdir/linux index 1b8961c27..37c41bb42 100644 --- a/file/magic/Magdir/linux +++ b/file/magic/Magdir/linux @@ -172,3 +172,9 @@ # 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable # 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable +# SYSLINUX boot logo files (from 'ppmtolss16' sources) +# http://syslinux.zytor.com/ +# +0 lelong =0x1413f33d SYSLINUX' LSS16 image data +>4 leshort x \b, width %d +>6 leshort x \b, height %d diff --git a/file/magic/Magdir/msdos b/file/magic/Magdir/msdos index 1c707d467..3c230b74e 100644 --- a/file/magic/Magdir/msdos +++ b/file/magic/Magdir/msdos @@ -149,6 +149,16 @@ 0 string regf Windows NT registry file 0 string CREG Windows 95 registry file + +# AAF files: +# <stuartc@rd.bbc.co.uk> Stuart Cunningham +0 string \320\317\021\340\241\261\032\341AAFB\015\000OM\006\016\053\064\001\001\001\377 AAF legacy file using MS Structured Storage +>30 byte 9 (512B sectors) +>30 byte 12 (4kB sectors) +0 string \320\317\021\340\241\261\032\341\001\002\001\015\000\002\000\000\006\016\053\064\003\002\001\001 AAF file using MS Structured Storage +>30 byte 9 (512B sectors) +>30 byte 12 (4kB sectors) + # Popular applications 2080 string Microsoft\ Word\ 6.0\ Document %s 2080 string Documento\ Microsoft\ Word\ 6 Spanish Microsoft Word 6 document data @@ -374,3 +384,23 @@ >4 byte =0xC6 Folder database >4 byte =0xC7 Accounts informations >4 byte =0x30 Offline database + + +# Windows Enhanced Metafile (EMF) +# See msdn.microsoft.com/archive/en-us/dnargdi/html/msdn_enhmeta.asp +# for further information. Note that "0 lelong 1" should be true i.e. +# the first double word in the file should be 1. With the extended +# syntax available by some file commands you could write: +# 0 lelong 1 +# &40 ulelong 0x464D4520 Windows Enhanced Metafile (EMF) image data +40 ulelong 0x464D4520 Windows Enhanced Metafile (EMF) image data +>44 ulelong x version 0x%x. +# If the description has a length greater than zero, it exists and is +# found at offset (*64). +>64 ulelong >0 Description available at offset 0x%x +>>60 ulelong >0 (length 0x%x) +# Note it would be better to print out the description, which is found +# as below. Unfortunately the following only prints out the first couple +# of characters instead of all the "description length" +# number of characters -- indicated by the ulelong at offset 60. +>>(64.l) lestring16 >0 Description: %15.15s diff --git a/file/magic/Magdir/os9 b/file/magic/Magdir/os9 index df3bd1d89..ed2ed2ca4 100644 --- a/file/magic/Magdir/os9 +++ b/file/magic/Magdir/os9 @@ -37,10 +37,10 @@ >6 byte&0x0f 0x00 non-executable >6 byte&0x0f 0x01 machine language >6 byte&0x0f 0x02 BASIC I-code ->6 byte&0x0f 0x03 P-code +>6 byte&0x0f 0x03 Pascal P-code >6 byte&0x0f 0x04 C I-code >6 byte&0x0f 0x05 COBOL I-code ->6 byte&0x0f 0x06 FORTRAN I-code +>6 byte&0x0f 0x06 Fortran I-code # >6 byte&0xf0 0x10 program executable >6 byte&0xf0 0x20 subroutine @@ -57,28 +57,28 @@ 0 beshort 0x4AFC OS9/68K module: # # attr ->14 byte&0x80 0x80 re-entrant ->14 byte&0x40 0x40 ghost ->14 byte&0x20 0x20 system-state +>0x14 byte&0x80 0x80 re-entrant +>0x14 byte&0x40 0x40 ghost +>0x14 byte&0x20 0x20 system-state # # lang: # ->13 byte 1 machine language ->13 byte 2 BASIC I-code ->13 byte 3 P-code ->13 byte 4 C I-code ->13 byte 5 COBOL I-code ->13 byte 6 Fortran I-code +>0x13 byte 1 machine language +>0x13 byte 2 BASIC I-code +>0x13 byte 3 Pascal P-code +>0x13 byte 4 C I-code +>0x13 byte 5 COBOL I-code +>0x13 byte 6 Fortran I-code # # # type: # ->12 byte 1 program executable ->12 byte 2 subroutine ->12 byte 3 multi-module ->12 byte 4 data module ->12 byte 11 trap library ->12 byte 12 system module ->12 byte 13 file manager ->12 byte 14 device driver ->12 byte 15 device descriptor +>0x12 byte 1 program executable +>0x12 byte 2 subroutine +>0x12 byte 3 multi-module +>0x12 byte 4 data module +>0x12 byte 11 trap library +>0x12 byte 12 system module +>0x12 byte 13 file manager +>0x12 byte 14 device driver +>0x12 byte 15 device descriptor diff --git a/file/magic/Magdir/perl b/file/magic/Magdir/perl index f70b8dccb..417220e80 100644 --- a/file/magic/Magdir/perl +++ b/file/magic/Magdir/perl @@ -17,3 +17,17 @@ # XXX: christos matches #0 regex package Perl5 module source text (via regex) 0 string package Perl5 module source text + +# Perl Storable data files. +0 string perl-store perl Storable(v0.6) data +>4 byte >0 (net-order %d) +>>4 byte &01 (network-ordered) +>>4 byte =3 (major 1) +>>4 byte =2 (major 1) + +0 string pst0 perl Storable(v0.7) data +>4 byte >0 +>>4 byte &01 (network-ordered) +>>4 byte =5 (major 2) +>>4 byte =4 (major 2) +>>5 byte >0 (minor %d) diff --git a/file/magic/Magdir/plan9 b/file/magic/Magdir/plan9 index b564fc846..58fb071c7 100644 --- a/file/magic/Magdir/plan9 +++ b/file/magic/Magdir/plan9 @@ -1,4 +1,17 @@ + #------------------------------------------------------------------------------ # plan9: file(1) magic for AT&T Bell Labs' Plan 9 executables +# From: "Stefan A. Haubenthal" <polluks@web.de> # -0 belong 0x000001EB Plan 9 executable +0 belong 0x00000107 Plan 9 executable, Motorola 68k +0 belong 0x000001EB Plan 9 executable, Intel 386 +0 belong 0x00000247 Plan 9 executable, Intel 960 +0 belong 0x000002AB Plan 9 executable, SPARC +0 belong 0x00000407 Plan 9 executable, MIPS R3000 +0 belong 0x0000048B Plan 9 executable, AT&T DSP 3210 +0 belong 0x00000517 Plan 9 executable, MIPS R4000 BE +0 belong 0x000005AB Plan 9 executable, AMD 29000 +0 belong 0x00000647 Plan 9 executable, ARM 7-something +0 belong 0x000006EB Plan 9 executable, PowerPC +0 belong 0x00000797 Plan 9 executable, MIPS R4000 LE +0 belong 0x0000084B Plan 9 executable, DEC Alpha diff --git a/file/magic/Magdir/policy b/file/magic/Magdir/policy new file mode 100644 index 000000000..50a612211 --- /dev/null +++ b/file/magic/Magdir/policy @@ -0,0 +1,6 @@ +# SE Linux policy database +0 lelong 0xf97cff8c SE Linux policy +>16 lelong x v%d +>20 lelong 1 MLS +>24 lelong x %d symbols +>28 lelong x %d ocons diff --git a/file/magic/Magdir/revision b/file/magic/Magdir/revision index 36a829ba0..8b57aa39d 100644 --- a/file/magic/Magdir/revision +++ b/file/magic/Magdir/revision @@ -3,3 +3,9 @@ # file(1) magic for revision control files # From Hendrik Scholz <hendrik@scholz.net> 0 string /1\ :pserver: cvs password text file + + +# Subversion (SVN) dumps +# Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de> +0 string SVN-fs-dump-format-version: Subversion dumpfile +>28 string >\0 (version: %s) diff --git a/file/magic/Magdir/sinclair b/file/magic/Magdir/sinclair index 702875ea5..fbad852c5 100644 --- a/file/magic/Magdir/sinclair +++ b/file/magic/Magdir/sinclair @@ -30,97 +30,15 @@ # Sinclair QL firmware executables (ThMO) 0 string NqNqNq`\004 QL firmware executable (BCPL) -# Sinclair QL libraries (ThMO) -0 beshort =0xFB01 QL library archive data +# Sinclair QL libraries (was ThMO) +0 beshort 0xFB01 QDOS object +>2 pstring x '%s' -# Sinclair QL executbables (ThMO) -6 beshort =0x4AFB QL executable, ->10 string =\0 un-named ->8 beshort =1 ->>10 string >\0 named: %.1s ->8 beshort =2 ->>10 string >\0 named: %.2s ->8 beshort =3 ->>10 string >\0 named: %.3s ->8 beshort =4 ->>10 string >\0 named: %.4s ->8 beshort =5 ->>10 string >\0 named: %.5s ->8 beshort =6 ->>10 string >\0 named: %.6s ->8 beshort =7 ->>10 string >\0 named: %.7s ->8 beshort =8 ->>10 string >\0 named: %.8s ->8 beshort =9 ->>10 string >\0 named: %.9s ->8 beshort =10 ->>10 string >\0 named: %.10s ->8 beshort =11 ->>10 string >\0 named: %.11s ->8 beshort =12 ->>10 string >\0 named: %.12s ->8 beshort =13 ->>10 string >\0 named: %.13s ->8 beshort =14 ->>10 string >\0 named: %.14s ->8 beshort =15 ->>10 string >\0 named: %.15s ->8 beshort =16 ->>10 string >\0 named: %.16s ->8 beshort =17 ->>10 string >\0 named: %.17s ->8 beshort =18 ->>10 string >\0 named: %.18s ->8 beshort =19 ->>10 string >\0 named: %.19s ->8 beshort =20 ->>10 string >\0 named: %.20s ->8 beshort >20 ->>10 string >\0 (truncated) named: %.20s +# Sinclair QL executables (was ThMO) +4 belong 0x4AFB QDOS executable +>9 pstring x '%s' -# Sinclair QL rom (ThMO) +# Sinclair QL ROM (ThMO) 0 belong =0x4AFB0001 QL plugin-ROM data, ->10 string =\0 un-named ->8 beshort =1 ->>10 string >\0 named: %.1s ->8 beshort =2 ->>10 string >\0 named: %.2s ->8 beshort =3 ->>10 string >\0 named: %.3s ->8 beshort =4 ->>10 string >\0 named: %.4s ->8 beshort =5 ->>10 string >\0 named: %.5s ->8 beshort =6 ->>10 string >\0 named: %.6s ->8 beshort =7 ->>10 string >\0 named: %.7s ->8 beshort =8 ->>10 string >\0 named: %.8s ->8 beshort =9 ->>10 string >\0 named: %.9s ->8 beshort =10 ->>10 string >\0 named: %.10s ->8 beshort =11 ->>10 string >\0 named: %.11s ->8 beshort =12 ->>10 string >\0 named: %.12s ->8 beshort =13 ->>10 string >\0 named: %.13s ->8 beshort =14 ->>10 string >\0 named: %.14s ->8 beshort =15 ->>10 string >\0 named: %.15s ->8 beshort =16 ->>10 string >\0 named: %.16s ->8 beshort =17 ->>10 string >\0 named: %.17s ->8 beshort =18 ->>10 string >\0 named: %.18s ->8 beshort =19 ->>10 string >\0 named: %.19s ->8 beshort =20 ->>10 string >\0 named: %.20s ->8 beshort >20 ->>10 string >\0 (truncated) named: %.20s +>9 pstring =\0 un-named +>9 pstring >\0 named: %s diff --git a/file/magic/Magdir/sniffer b/file/magic/Magdir/sniffer index b45b63e99..282c44fec 100644 --- a/file/magic/Magdir/sniffer +++ b/file/magic/Magdir/sniffer @@ -32,6 +32,7 @@ # # Network General Sniffer capture files. # Sorry, make that "Network Associates Sniffer capture files." +# Sorry, make that "Network General old DOS Sniffer capture files." # 0 string TRSNIFF\ data\ \ \ \ \032 Sniffer capture file >33 byte 2 (compressed) @@ -54,6 +55,7 @@ # Sorry, make that "Network Associates Sniffer Basic capture files." # Sorry, make that "Network Associates Sniffer Basic, and Windows # Sniffer Pro", capture files." +# Sorry, make that "Network General Sniffer capture files." # 0 string XCP\0 NetXRay capture file >4 string >\0 - version %s @@ -88,8 +90,10 @@ >20 belong 12 (raw IP >20 belong 13 (BSD/OS SLIP >20 belong 14 (BSD/OS PPP +>20 belong 19 (Linux ATM Classical IP >20 belong 50 (PPP or Cisco HDLC >20 belong 51 (PPP-over-Ethernet +>20 belong 99 (Symantec Enterprise Firewall >20 belong 100 (RFC 1483 ATM >20 belong 101 (raw IP >20 belong 102 (BSD/OS SLIP @@ -105,13 +109,32 @@ >20 belong 114 (LocalTalk >20 belong 117 (OpenBSD PFLOG >20 belong 119 (802.11 with Prism header +>20 belong 122 (RFC 2625 IP over Fibre Channel >20 belong 123 (SunATM >20 belong 127 (802.11 with radiotap header >20 belong 129 (Linux ARCNET +>20 belong 138 (Apple IP over IEEE 1394 >20 belong 140 (MTP2 >20 belong 141 (MTP3 >20 belong 143 (DOCSIS >20 belong 144 (IrDA +>20 belong 147 (Private use 0 +>20 belong 148 (Private use 1 +>20 belong 149 (Private use 2 +>20 belong 150 (Private use 3 +>20 belong 151 (Private use 4 +>20 belong 152 (Private use 5 +>20 belong 153 (Private use 6 +>20 belong 154 (Private use 7 +>20 belong 155 (Private use 8 +>20 belong 156 (Private use 9 +>20 belong 157 (Private use 10 +>20 belong 158 (Private use 11 +>20 belong 159 (Private use 12 +>20 belong 160 (Private use 13 +>20 belong 161 (Private use 14 +>20 belong 162 (Private use 15 +>20 belong 163 (802.11 with AVS header >16 belong x \b, capture length %d) 0 ulelong 0xa1b2c3d4 tcpdump capture file (little-endian) >4 leshort x - version %d @@ -131,8 +154,10 @@ >20 lelong 12 (raw IP >20 lelong 13 (BSD/OS SLIP >20 lelong 14 (BSD/OS PPP +>20 lelong 19 (Linux ATM Classical IP >20 lelong 50 (PPP or Cisco HDLC >20 lelong 51 (PPP-over-Ethernet +>20 lelong 99 (Symantec Enterprise Firewall >20 lelong 100 (RFC 1483 ATM >20 lelong 101 (raw IP >20 lelong 102 (BSD/OS SLIP @@ -142,19 +167,38 @@ >20 lelong 106 (Linux Classical IP over ATM >20 lelong 107 (Frame Relay >20 lelong 108 (OpenBSD loopback ->20 lelong 109 (OpenBSD IPSEC encrypted +>20 lelong 109 (OpenBSD IPsec encrypted >20 lelong 112 (Cisco HDLC >20 lelong 113 (Linux "cooked" >20 lelong 114 (LocalTalk >20 lelong 117 (OpenBSD PFLOG >20 lelong 119 (802.11 with Prism header +>20 lelong 122 (RFC 2625 IP over Fibre Channel >20 lelong 123 (SunATM >20 lelong 127 (802.11 with radiotap header >20 lelong 129 (Linux ARCNET +>20 lelong 138 (Apple IP over IEEE 1394 >20 lelong 140 (MTP2 >20 lelong 141 (MTP3 >20 lelong 143 (DOCSIS >20 lelong 144 (IrDA +>20 lelong 147 (Private use 0 +>20 lelong 148 (Private use 1 +>20 lelong 149 (Private use 2 +>20 lelong 150 (Private use 3 +>20 lelong 151 (Private use 4 +>20 lelong 152 (Private use 5 +>20 lelong 153 (Private use 6 +>20 lelong 154 (Private use 7 +>20 lelong 155 (Private use 8 +>20 lelong 156 (Private use 9 +>20 lelong 157 (Private use 10 +>20 lelong 158 (Private use 11 +>20 lelong 159 (Private use 12 +>20 lelong 160 (Private use 13 +>20 lelong 161 (Private use 14 +>20 lelong 162 (Private use 15 +>20 lelong 163 (802.11 with AVS header >16 lelong x \b, capture length %d) # @@ -231,3 +275,23 @@ # 0 string NetS NetStumbler log file >8 lelong x \b, %d stations found + +# +# EtherPeek/AiroPeek "version 9" capture files. +# +0 string \177ver EtherPeek/AiroPeek capture file + +# +# Visual Networks traffic capture files. +# +0 string \x05VNF Visual Networks traffic capture file + +# +# Network Instruments Observer capture files. +# +0 string ObserverPktBuffe Network Instruments Observer capture file + +# +# Files from Accellent Group's 5View products. +# +0 string \xaa\xaa\xaa\xaa 5View capture file diff --git a/file/magic/Magdir/tex b/file/magic/Magdir/tex index be84ecc4c..a6c734e32 100644 --- a/file/magic/Magdir/tex +++ b/file/magic/Magdir/tex @@ -55,41 +55,17 @@ # file(1) magic for BibTex text files # From Hendrik Scholz <hendrik@scholz.net> -0 string @article{ BibTex text file -0 string @book{ BibTex text file -0 string @inbook{ BibTex text file -0 string @incollection{ BibTex text file -0 string @inproceedings{ BibTex text file -0 string @manual{ BibTex text file -0 string @misc{ BibTex text file -0 string @preamble{ BibTex text file -0 string @phdthesis{ BibTex text file -0 string @techreport{ BibTex text file -0 string @unpublished{ BibTex text file - -0 string @Article{ BibTex text file -0 string @Book{ BibTex text file -0 string @Inbook{ BibTex text file -0 string @Incollection{ BibTex text file -0 string @Inproceedings{ BibTex text file -0 string @Manual{ BibTex text file -0 string @Misc{ BibTex text file -0 string @Preamble{ BibTex text file -0 string @Phdthesis{ BibTex text file -0 string @Techreport{ BibTex text file -0 string @Unpublished{ BibTex text file - -0 string @ARTICLE{ BibTex text file -0 string @BOOK{ BibTex text file -0 string @INBOOK{ BibTex text file -0 string @INCOLLECTION{ BibTex text file -0 string @INPROCEEDINGS{ BibTex text file -0 string @MANUAL{ BibTex text file -0 string @MISC{ BibTex text file -0 string @PREAMBLE{ BibTex text file -0 string @PHDTHESIS{ BibTex text file -0 string @TECHREPORT{ BibTex text file -0 string @UNPUBLISHED{ BibTex text file +0 string/c @article{ BibTeX text file +0 string/c @book{ BibTeX text file +0 string/c @inbook{ BibTeX text file +0 string/c @incollection{ BibTeX text file +0 string/c @inproceedings{ BibTeX text file +0 string/c @manual{ BibTeX text file +0 string/c @misc{ BibTeX text file +0 string/c @preamble{ BibTeX text file +0 string/c @phdthesis{ BibTeX text file +0 string/c @techreport{ BibTeX text file +0 string/c @unpublished{ BibTeX text file 73 string %%%\ \ BibTeX-file{ BibTex text file (with full header) diff --git a/file/magic/Magdir/virtutech b/file/magic/Magdir/virtutech new file mode 100644 index 000000000..cea8443b2 --- /dev/null +++ b/file/magic/Magdir/virtutech @@ -0,0 +1,10 @@ +#------------------------------------------------------------------------------ +# Virtutech Compressed Random Access File Format +# +# From <gustav@virtutech.com> +0 string \211\277\036\203 Virtutech CRAFF +>4 belong x v%d +>20 belong 0 uncompressed +>20 belong 1 bzipp2ed +>20 belong 2 gzipped +>24 belong 0 not clean diff --git a/file/magic/Magdir/xo65 b/file/magic/Magdir/xo65 new file mode 100644 index 000000000..1020cee58 --- /dev/null +++ b/file/magic/Magdir/xo65 @@ -0,0 +1,29 @@ + +#------------------------------------------------------------------------------ +# xo65 object files +# From: "Ullrich von Bassewitz" <uz@cc65.org> +# +0 string \x55\x7A\x6E\x61 xo65 object, +>4 leshort x version %d, +>6 leshort&0x0001 =0x0001 with debug info +>6 leshort&0x0001 =0x0000 no debug info + +# xo65 library files +0 string \x6E\x61\x55\x7A xo65 library, +>4 leshort x version %d + +# o65 object files +0 string \x01\x00\x6F\x36\x35 o65 +>6 leshort&0x1000 =0x0000 executable, +>6 leshort&0x1000 =0x1000 object, +>5 byte x version %d, +>6 leshort&0x8000 =0x8000 65816, +>6 leshort&0x8000 =0x0000 6502, +>6 leshort&0x2000 =0x2000 32 bit, +>6 leshort&0x2000 =0x0000 16 bit, +>6 leshort&0x4000 =0x4000 page reloc, +>6 leshort&0x4000 =0x0000 byte reloc, +>6 leshort&0x0003 =0x0000 alignment 1 +>6 leshort&0x0003 =0x0001 alignment 2 +>6 leshort&0x0003 =0x0002 alignment 4 +>6 leshort&0x0003 =0x0003 alignment 256 diff --git a/file/magic/Makefile.am b/file/magic/Makefile.am index eb8116c2b..82e27193a 100644 --- a/file/magic/Makefile.am +++ b/file/magic/Makefile.am @@ -1,6 +1,4 @@ -#pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc -pkglibdir = @prefix@/lib/rpm -pkglib_DATA = magic magic.mime magic.mgc magic.mime.mgc +pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS) @@ -69,11 +67,11 @@ Magdir/diff \ Magdir/digital \ Magdir/dolby \ Magdir/dump \ -Magdir/dyadic \ Magdir/editors \ Magdir/elf \ Magdir/encore \ Magdir/epoc \ +Magdir/esri \ Magdir/fcs \ Magdir/filesystems \ Magdir/flash \ @@ -149,6 +147,7 @@ Magdir/pgp \ Magdir/pkgadd \ Magdir/plan9 \ Magdir/plus5 \ +Magdir/policy \ Magdir/printer \ Magdir/project \ Magdir/psdbms \ @@ -171,6 +170,7 @@ Magdir/sinclair \ Magdir/sketch \ Magdir/smalltalk \ Magdir/sniffer \ +Magdir/dyadic \ Magdir/softquad \ Magdir/spectrum \ Magdir/sql \ @@ -191,6 +191,7 @@ Magdir/varied.out \ Magdir/varied.script \ Magdir/vax \ Magdir/vicar \ +Magdir/virtutech \ Magdir/visx \ Magdir/vms \ Magdir/vmware \ @@ -199,6 +200,7 @@ Magdir/vxl \ Magdir/wordprocessors \ Magdir/xdelta \ Magdir/xenix \ +Magdir/xo65 \ Magdir/xwindows \ Magdir/zilog \ Magdir/zyxel diff --git a/file/magic/magic.mime b/file/magic/magic.mime index d314c4f4d..30ad66796 100644 --- a/file/magic/magic.mime +++ b/file/magic/magic.mime @@ -184,14 +184,13 @@ 0 string RIFF # - WAVE format >8 string WAVE audio/x-wav ->8 string AVI video/x-msvideo +>8 string/B AVI video/x-msvideo # -0 belong 0x2e7261fd application/x-realaudio >8 string CDRA image/x-coreldraw # MPEG Layer 3 sound files -0 beshort &0xffe0 audio/mpeg +0 beshort&0xfffe =0xfffa audio/mpeg #MP3 with ID3 tag 0 string ID3 audio/mpeg # Ogg/Vorbis @@ -206,7 +205,7 @@ 0 string /*\ XPM image/x-xpm 7bit # 3DS (3d Studio files) -16 beshort 0x3d3d image/x-3ds +#16 beshort 0x3d3d image/x-3ds # this first will upset you if you're a PL/1 shop... (are there any left?) # in which case rm it; ascmagic will catch real C programs @@ -290,10 +289,10 @@ # because it tries to uncompress it to figure out what's inside. # standard unix compress -0 string \037\235 application/x-compress +#0 string \037\235 application/x-compress # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver) -0 string \037\213 application/x-gzip +#0 string \037\213 application/x-gzip 0 string PK\003\004 application/x-zip @@ -394,19 +393,14 @@ # # from Daniel Quinlan <quinlan@yggdrasil.com> # -0 string \<HEAD text/html -0 string \<head text/html -0 string \<TITLE text/html -0 string \<title text/html -0 string \<html text/html -0 string \<HTML text/html +0 string/cB \<!DOCTYPE\ html text/html +0 string/cb \<head text/html +0 string/cb \<title text/html +0 string/bc \<html text/html 0 string \<!-- text/html -0 string \<h1 text/html -0 string \<H1 text/html -0 string \<!doctype\ HTML text/html -0 string \<!DOCTYPE\ HTML text/html -0 string \<!doctype\ html text/html -0 string \<!doctype\ HTML text/html +0 string/c \<h1 text/html + +0 string \<?xml text/xml #------------------------------------------------------------------------------ # images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps) @@ -469,7 +463,7 @@ 0 beshort 0xffd8 image/jpeg # PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu) -0 string BM image/bmp +0 string BM image/x-ms-bmp #>14 byte 12 (OS/2 1.x format) #>14 byte 64 (OS/2 2.x format) #>14 byte 40 (Windows 3.x format) @@ -588,20 +582,40 @@ # # animation formats, originally from vax@ccwf.cc.utexas.edu (VaX#n8) # MPEG file -0 belong 0x000001b3 video/mpeg -0 belong 0x000001ba video/mpeg +# MPEG sequences +0 belong 0x000001BA video/mpeg +0 belong 0x000001BB video/mpeg +0 belong 0x000001B0 video/mp4v-es +0 belong 0x000001B5 video/mp4v-es +0 belong 0x000001B3 video/mpv +0 belong&0xFF5FFF1F 0x47400010 video/mp2t # FLI animation format 0 leshort 0xAF11 video/fli # FLC animation format 0 leshort 0xAF12 video/flc -# AVI ->8 string AVI\ video/avi # # SGI and Apple formats -# -0 string MOVI video/sgi -4 string moov video/quicktime moov -4 string mdat video/quicktime mdat +# Added ISO mimes +# Added ISO mimes +0 string MOVI video/sgi +4 string moov video/quicktime +4 string mdat video/quicktime +4 string wide video/quicktime +4 string skip video/quicktime +4 string free video/quicktime +4 string idsc image/x-quicktime +4 string idat image/x-quicktime +4 string pckg application/x-quicktime +4 string/B jP image/jp2 +4 string ftyp application/octet-stream +>8 string isom video/mp4 +>8 string mp41 video/mp4 +>8 string mp42 video/mp4 +>8 string/B jp2 image/jp2 +>8 string 3gp video/3gpp +>8 string mmp4 video/mp4 +>8 string/B M4A audio/mp4 +>8 string/B qt video/quicktime # The contributor claims: # I couldn't find a real magic number for these, however, this # -appears- to work. Note that it might catch other files, too, @@ -628,17 +642,17 @@ # # Executables # -0 string \177ELF ->4 byte 0 ->4 byte 1 ->4 byte 2 ->5 byte 0 ->5 byte 1 ->>16 leshort 0 ->>16 leshort 1 application/x-object ->>16 leshort 2 application/x-executable ->>16 leshort 3 application/x-sharedlib ->>16 leshort 4 application/x-coredump +0 string \177ELF +>16 leshort 0 application/octet-stream +>16 leshort 1 application/x-object +>16 leshort 2 application/x-executable +>16 leshort 3 application/x-sharedlib +>16 leshort 4 application/x-coredump +>16 beshort 0 application/octet-stream +>16 beshort 1 application/x-object +>16 beshort 2 application/x-executable +>16 beshort 3 application/x-sharedlib +>16 beshort 4 application/x-coredump # # DOS 0 string MZ application/x-dosexec @@ -868,30 +882,6 @@ # Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF) 0 lelong 0x223e9f78 application/ms-tnef - -# -# QuickTime format -# Contributer: Peter Breton -# - -0 string MOVI video/quicktime -4 string moov video/quicktime -4 string mdat video/quicktime - -# Video Formate -0 string RIFF -# AVI == Audio Video Interleave ->8 string AVI\ -#>0xbc string >\0 video/x-%s - ->>0xbc string DIV3 video/x-DivX-3 ->>0xbc string div3 video/x-divX-3 ->>0xbc string DIV4 video/x-DivX-4 ->>0x70 string DX50 video/x-DIVX-5 ->>0x70 string MP4 video/x-MPEG-4 ->>0xbc string DIVX video/x-DivX ->8 string WAVE audio/x-wav - # From: stephane.loeuillet@tiscali.f # http://www.djvuzone.org/ 0 string AT&TFORM image/x.djvu @@ -903,5 +893,15 @@ # 0x9445366139FA (V 3.80) # this is from source (http://www.adrift.org.uk/) and I have some taf # files, and checked them. -#0 belong 0x3C423FC9 -#>4 belong 0x6A87C2CF application/x-adrift +#0 belong 0x3C423FC9 +#>4 belong 0x6A87C2CF application/x-adrift +#0 string \000\000\001\000 image/x-ico + +# Quark Xpress 3 Files: +# (made the mimetype up) +0 string \0\0MMXPR3\0 application/x-quark-xpress-3 + +# Gnumeric spreadsheet +# This entry is only semi-helpful, as Gnumeric compresses its files, so +# they will ordinarily reported as "compressed", but at least -z helps +39 string =<gmr:Workbook application/x-gnumeric diff --git a/file/mkinstalldirs b/file/mkinstalldirs index 922a27e80..8ab885ec9 100644 --- a/file/mkinstalldirs +++ b/file/mkinstalldirs @@ -4,9 +4,53 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.2 2000/11/13 00:30:49 christos Exp $ - errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac for file do @@ -22,13 +66,24 @@ do esac if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" - mkdir "$pathcomp" || lasterr=$? + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi fi pathcomp="$pathcomp/" @@ -37,3 +92,8 @@ done exit $errstatus +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here diff --git a/file/python/Makefile.am b/file/python/Makefile.am new file mode 100644 index 000000000..6052d9cb1 --- /dev/null +++ b/file/python/Makefile.am @@ -0,0 +1,2 @@ + +EXTRA_DIST = README example.py py_magic.c py_magic.h setup.py diff --git a/file/src/Makefile.am b/file/src/Makefile.am index 2a957b2bb..1977b887e 100644 --- a/file/src/Makefile.am +++ b/file/src/Makefile.am @@ -1,7 +1,8 @@ LINT = splint BUILT_SOURCES = listobjs -#MAGIC = $(pkgdatadir)/magic +EXTRA_DIST = test.c + pkglibdir = @prefix@/lib/rpm MAGIC = $(pkglibdir)/magic @@ -31,7 +32,7 @@ listobjs: .PHONY: lint lint: $(LINT) $(DEFS) $(INCLUDES) $(file_SOURCES) $(libmagic_la_SOURCES) $(include_HEADERS) $(noinst_HEADERS) - + .PHONY: sources sources: @echo $(libmagic_la_SOURCES:%=file/src/%) diff --git a/file/src/apprentice.c b/file/src/apprentice.c index 5aa4c29b8..31d94abc5 100644 --- a/file/src/apprentice.c +++ b/file/src/apprentice.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -50,7 +45,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.78 2004/07/24 20:38:56 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.82 2004/11/24 18:56:04 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -79,6 +74,9 @@ FILE_RCSID("@(#)$Id: apprentice.c,v 1.78 2004/07/24 20:38:56 christos Exp $") #define MAXPATHLEN 1024 #endif +#define IS_STRING(t) ((t) == FILE_STRING || (t) == FILE_PSTRING || \ + (t) == FILE_BESTRING16 || (t) == FILE_LESTRING16) + /*@unchecked@*/ private size_t maxmagic = 0; /*@unchecked@*/ @@ -87,24 +85,21 @@ private size_t magicsize = sizeof(struct magic); private int getvalue(struct magic_set *ms, struct magic *m, char **p) /*@globals fileSystem @*/ /*@modifies ms, m, *p, fileSystem @*/; -private int hextoint(int c) +private int hextoint(int) /*@*/; /*@null@*/ -private char *getstr(struct magic_set *ms, /*@returned@*/ char *s, char *p, int plen, - int *slen) +private char *getstr(struct magic_set *ms, /*@returned@*/ char *s, char *p, int plen, int *slen) /*@modifies ms, *p, *slen @*/; -private int parse(struct magic_set *ms, struct magic **magicp, - uint32_t *nmagicp, char *l, int action) +private int parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, int action) /*@globals maxmagic, fileSystem @*/ /*@modifies ms, *magicp, *nmagicp, maxmagic, fileSystem @*/; private void eatsize(char **p) /*@modifies *p @*/; -private int apprentice_1(struct magic_set *ms, const char *fn, int action, - struct mlist *mlist) +private int apprentice_1(struct magic_set *ms, const char *fn, int action, struct mlist *mlist) /*@globals fileSystem, internalState @*/ /*@modifies ms, mlist, fileSystem, internalState @*/; -private int apprentice_file(struct magic_set *ms, struct magic **magicp, - uint32_t *nmagicp, const char *fn, int action) +private int apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, + const char *fn, int action) /*@globals maxmagic, fileSystem @*/ /*@modifies ms, *magicp, *nmagicp, maxmagic, fileSystem @*/; private void byteswap(struct magic *magic, uint32_t nmagic) @@ -115,17 +110,17 @@ private uint16_t swap2(uint16_t sv) /*@*/; private uint32_t swap4(uint32_t sv) /*@*/; -private char *mkdbname(const char *fn, /*@returned@*/ char *buf, size_t bufsiz) +private char *mkdbname(const char *fn, /*@returned@*/ char *buf, size_t, int) /*@modifies buf @*/; -private int apprentice_map(struct magic_set *ms, struct magic **magicp, - uint32_t *nmagicp, const char *fn) +private int apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, + const char *fn) /*@globals fileSystem, internalState @*/ /*@modifies ms, *magicp, *nmagicp, fileSystem, internalState @*/; -private int apprentice_compile(struct magic_set *ms, struct magic **magicp, - uint32_t *nmagicp, const char *fn) +private int apprentice_compile(struct magic_set *ms, struct magic **magicp, uint32_t * nmagicp, + const char *fn) /*@globals fileSystem, internalState @*/ /*@modifies ms, fileSystem, internalState @*/; -private int check_format(struct magic *m) +private int check_format(struct magic_set *ms, struct magic *m) /*@globals fileSystem @*/ /*@modifies fileSystem @*/; @@ -194,7 +189,7 @@ apprentice_1(struct magic_set *ms, const char *fn, int action, #ifndef COMPILE_ONLY if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) { if (ms->flags & MAGIC_CHECK) - file_magwarn("using regular magic file `%s'", fn); + file_magwarn(ms, "using regular magic file `%s'", fn); rv = apprentice_file(ms, &magic, &nmagic, fn, action); if (rv != 0) return -1; @@ -325,10 +320,9 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, "cont\toffset\ttype\topcode\tmask\tvalue\tdesc"; FILE *f; char line[BUFSIZ+1]; - int lineno; int errs = 0; - f = fopen(fn, "r"); + f = fopen(ms->file = fn, "r"); if (f == NULL) { if (errno != ENOENT) file_error(ms, errno, "cannot read magic file `%s'", @@ -349,12 +343,14 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, (void)fprintf(stderr, "%s\n", hdr); /* parse it */ - for (lineno = 1; fgets(line, BUFSIZ, f) != NULL; lineno++) { + for (ms->line = 1; fgets(line, BUFSIZ, f) != NULL; ms->line++) { + size_t len; if (line[0]=='#') /* comment, do not parse */ continue; - if (strlen(line) <= (unsigned)1) /* null line, garbage, etc */ + len = strlen(line); + if (len < 2) /* null line, garbage, etc */ continue; - line[strlen(line)-1] = '\0'; /* delete newline */ + line[len - 1] = '\0'; /* delete newline */ if (parse(ms, magicp, nmagicp, line, action) != 0) errs = 1; } @@ -402,12 +398,14 @@ file_signextend(struct magic_set *ms, struct magic *m, uint32_t v) break; case FILE_STRING: case FILE_PSTRING: + case FILE_BESTRING16: + case FILE_LESTRING16: break; case FILE_REGEX: break; default: if (ms->flags & MAGIC_CHECK) - file_magwarn("cannot happen: m->type=%d\n", + file_magwarn(ms, "cannot happen: m->type=%d\n", m->type); return ~0U; } @@ -466,7 +464,7 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, m->offset = (uint32_t)strtoul(l, &t, 0); if (l == t) if (ms->flags & MAGIC_CHECK) - file_magwarn("offset %s invalid", l); + file_magwarn(ms, "offset `%s' invalid", l); l = t; if (m->flag & INDIR) { @@ -500,8 +498,8 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, break; default: if (ms->flags & MAGIC_CHECK) - file_magwarn( - "indirect offset type %c invalid", + file_magwarn(ms, + "indirect offset type `%c' invalid", *l); break; } @@ -551,7 +549,8 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, t = l; if (*t++ != ')') if (ms->flags & MAGIC_CHECK) - file_magwarn("missing ')' in indirect offset"); + file_magwarn(ms, + "missing ')' in indirect offset"); l = t; } @@ -576,6 +575,8 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, #define NBELDATE 7 #define NLELDATE 7 #define NREGEX 5 +#define NBESTRING16 10 +#define NLESTRING16 10 if (*l == 'u') { ++l; @@ -633,23 +634,28 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, l += NLELDATE; } else if (strncmp(l, "regex", NREGEX)==0) { m->type = FILE_REGEX; - l += sizeof("regex"); + l += NREGEX; + } else if (strncmp(l, "bestring16", NBESTRING16)==0) { + m->type = FILE_BESTRING16; + l += NBESTRING16; + } else if (strncmp(l, "lestring16", NLESTRING16)==0) { + m->type = FILE_LESTRING16; + l += NLESTRING16; } else { if (ms->flags & MAGIC_CHECK) - file_magwarn("type %s invalid", l); + file_magwarn(ms, "type `%s' invalid", l); return -1; } /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */ /* New and improved: ~ & | ^ + - * / % -- exciting, isn't it? */ if (*l == '~') { - if (FILE_STRING != m->type && FILE_PSTRING != m->type) + if (!IS_STRING(m->type)) m->mask_op = FILE_OPINVERSE; ++l; } if ((t = strchr(fops, *l)) != NULL) { uint32_t op = (uint32_t)(t - fops); - if (op != FILE_OPDIVIDE || - (FILE_STRING != m->type && FILE_PSTRING != m->type)) { + if (op != FILE_OPDIVIDE || !IS_STRING(m->type)) { ++l; m->mask_op |= op; val = (uint32_t)strtoul(l, &l, 0); @@ -671,8 +677,8 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, break; default: if (ms->flags & MAGIC_CHECK) - file_magwarn( - "string extension %c invalid", + file_magwarn(ms, + "string extension `%c' invalid", *l); return -1; } @@ -700,7 +706,7 @@ parse(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, char *l, } break; case '!': - if (m->type != FILE_STRING && m->type != FILE_PSTRING) { + if (!IS_STRING(m->type)) { m->reln = *l; ++l; break; @@ -744,7 +750,7 @@ GetDesc: /* NULLBODY */; if (ms->flags & MAGIC_CHECK) { - if (!check_format(m)) + if (!check_format(ms, m)) return -1; } #ifndef COMPILE_ONLY @@ -761,7 +767,7 @@ GetDesc: * the type of the magic. */ private int -check_format(struct magic *m) +check_format(struct magic_set *ms, struct magic *m) { /*@-nullassign@*/ /*@observer@*/ @@ -779,13 +785,13 @@ check_format(struct magic *m) return 1; } if (m->type >= sizeof(formats)/sizeof(formats[0])) { - file_magwarn("Internal error inconsistency between m->type" + file_magwarn(ms, "Internal error inconsistency between m->type" " and format strings"); return 0; } if (formats[m->type] == NULL) { - file_magwarn("No format string for `%s' with description `%s'", - m->desc, names[m->type]); + file_magwarn(ms, "No format string for `%s' with description " + "`%s'", m->desc, names[m->type]); return 0; } for (; *ptr; ptr++) { @@ -798,12 +804,12 @@ check_format(struct magic *m) } if (*ptr == '\0') { /* Missing format string; bad */ - file_magwarn("Invalid format `%s' for type `%s'", + file_magwarn(ms, "Invalid format `%s' for type `%s'", m->desc, names[m->type]); return 0; } if (strchr(formats[m->type], *ptr) == NULL) { - file_magwarn("Printf format `%c' is not valid for type `%s'" + file_magwarn(ms, "Printf format `%c' is not valid for type `%s'" " in description `%s'", *ptr, names[m->type], m->desc); return 0; @@ -822,13 +828,15 @@ getvalue(struct magic_set *ms, struct magic *m, char **p) int slen; switch (m->type) { + case FILE_BESTRING16: + case FILE_LESTRING16: case FILE_STRING: case FILE_PSTRING: case FILE_REGEX: *p = getstr(ms, *p, m->value.s, sizeof(m->value.s), &slen); if (*p == NULL) { if (ms->flags & MAGIC_CHECK) - file_magwarn("cannot get string from `%s'", + file_magwarn(ms, "cannot get string from `%s'", m->value.s); return -1; } @@ -1060,7 +1068,7 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, uint32_t version; int needsbyteswap; char buf[MAXPATHLEN]; - char *dbname = mkdbname(fn, buf, sizeof(buf)); + char *dbname = mkdbname(fn, buf, sizeof(buf), 0); void *mm = NULL; if (dbname == NULL) @@ -1152,7 +1160,7 @@ apprentice_compile(struct magic_set *ms, struct magic **magicp, { int fd; char buf[MAXPATHLEN]; - char *dbname = mkdbname(fn, buf, sizeof(buf)); + char *dbname = mkdbname(fn, buf, sizeof(buf), 1); if (dbname == NULL) return -1; @@ -1189,13 +1197,14 @@ private const char ext[] = ".mgc"; * make a dbname */ private char * -mkdbname(const char *fn, char *buf, size_t bufsiz) +mkdbname(const char *fn, char *buf, size_t bufsiz, int strip) { -#ifdef notdef - const char *p; - if ((p = strrchr(fn, '/')) != NULL) - fn = ++p; -#endif + if (strip) { + const char *p; + if ((p = strrchr(fn, '/')) != NULL) + fn = ++p; + } + (void)snprintf(buf, bufsiz, "%s%s", fn, ext); return buf; } @@ -1250,7 +1259,7 @@ bs1(struct magic *m) m->cont_level = swap2(m->cont_level); m->offset = swap4((uint32_t)m->offset); m->in_offset = swap4((uint32_t)m->in_offset); - if (m->type != FILE_STRING) + if (IS_STRING(m->type)) m->value.l = swap4(m->value.l); m->mask = swap4(m->mask); } diff --git a/file/src/ascmagic.c b/file/src/ascmagic.c index 3572ba739..e1d5bc36b 100644 --- a/file/src/ascmagic.c +++ b/file/src/ascmagic.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -54,7 +49,7 @@ #include "names.h" #ifndef lint -FILE_RCSID("@(#)$Id: ascmagic.c,v 1.40 2003/11/20 00:25:39 christos Exp $") +FILE_RCSID("@(#)$Id: ascmagic.c,v 1.41 2004/09/11 19:15:57 christos Exp $") #endif /* lint */ typedef unsigned long unichar; @@ -63,23 +58,17 @@ typedef unsigned long unichar; #define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \ || (x) == 0x85 || (x) == '\f') -private int looks_ascii(const unsigned char *buf, size_t nbytes, - unichar *ubuf, size_t *ulen) +private int looks_ascii(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) /*@modifies *ubuf, *ulen @*/; -private int looks_utf8(const unsigned char *buf, size_t nbytes, - unichar *ubuf, size_t *ulen) +private int looks_utf8(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) /*@modifies *ubuf, *ulen @*/; -private int looks_unicode(const unsigned char *buf, size_t nbytes, - unichar *ubuf, size_t *ulen) +private int looks_unicode(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) /*@modifies *ubuf, *ulen @*/; -private int looks_latin1(const unsigned char *buf, size_t nbytes, - unichar *ubuf, size_t *ulen) +private int looks_latin1(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) /*@modifies *ubuf, *ulen @*/; -private int looks_extended(const unsigned char *buf, size_t nbytes, - unichar *ubuf, size_t *ulen) +private int looks_extended(const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t *ulen) /*@modifies *ubuf, *ulen @*/; -private void from_ebcdic(const unsigned char *buf, size_t nbytes, - unsigned char *out) +private void from_ebcdic(const unsigned char *buf, size_t nbytes, unsigned char *out) /*@modifies *out @*/; private int ascmatch(const unsigned char *s, const unichar *us, size_t ulen) /*@*/; @@ -673,6 +662,7 @@ private unsigned char ebcdic_to_ascii[] = { * cases for the NEL character can be taken out of the code. */ +/*@unchecked@*/ /*@observer@*/ private unsigned char ebcdic_1047_to_8859[] = { 0x00,0x01,0x02,0x03,0x9C,0x09,0x86,0x7F,0x97,0x8D,0x8E,0x0B,0x0C,0x0D,0x0E,0x0F, 0x10,0x11,0x12,0x13,0x9D,0x0A,0x08,0x87,0x18,0x19,0x92,0x8F,0x1C,0x1D,0x1E,0x1F, diff --git a/file/src/compress.c b/file/src/compress.c index 6101397a5..b0236f46f 100644 --- a/file/src/compress.c +++ b/file/src/compress.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -55,7 +50,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.37 2004/07/24 21:00:56 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.38 2004/09/11 19:15:57 christos Exp $") #endif @@ -90,8 +85,8 @@ private ssize_t swrite(int fd, const void *buf, size_t n) /*@*/; private ssize_t sread(int fd, void *buf, size_t n) /*@modifies buf @*/; -private size_t uncompressbuf(struct magic_set *ms, size_t method, - const unsigned char *old, unsigned char **newch, size_t n) +private size_t uncompressbuf(struct magic_set *ms, size_t method, const unsigned char *old, + unsigned char **newch, size_t n) /*@globals fileSystem, internalState @*/ /*@modifies ms, *newch, fileSystem, internalState @*/; #ifdef HAVE_LIBZ diff --git a/file/src/file.c b/file/src/file.c index b23729007..425b82bea 100644 --- a/file/src/file.c +++ b/file/src/file.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -77,7 +72,7 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.93 2004/04/07 14:23:55 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.95 2004/09/27 15:28:37 christos Exp $") #endif /* lint */ @@ -109,7 +104,7 @@ private char *separator = ":"; /* Default field separator */ /*@unchecked@*/ /*@null@*/ private char *progname; /* used throughout */ -/*@unchecked@*/ /*@observer@*/ /*@null@*/ +/*@unchecked@*/ /*@only@*/ /*@null@*/ private struct magic_set *magic; private void unwrap(char *fn) @@ -124,9 +119,9 @@ private void help(void) /*@modifies fileSystem @*/; #endif #if 0 -private int byteconv4(int from, int same, int big_endian) +private int byteconv4(int, int, int) /*@*/; -private short byteconv2(int from, int same, int big_endian) +private short byteconv2(int, int, int) /*@*/; #endif @@ -343,6 +338,8 @@ main(int argc, char *argv[]) process(argv[optind], wid); } + magic_close(magic); + magic = NULL; return 0; } @@ -394,7 +391,8 @@ unwrap(char *fn) } while (fgets(buf, MAXPATHLEN, f) != NULL) { - buf[file_mbswidth(buf)-1] = '\0'; + // cut off CR, we _need_ bytes here, not characters + buf[strlen(buf)-1] = '\0'; process(buf, wid); if(nobuffer) (void) fflush(stdout); diff --git a/file/src/file.h b/file/src/file.h index 186a46cbd..846f13024 100644 --- a/file/src/file.h +++ b/file/src/file.h @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -32,7 +27,7 @@ */ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.61 2004/05/12 14:53:01 christos Exp $ + * @(#)$Id: file.h,v 1.64 2004/11/20 23:50:12 christos Exp $ */ #ifndef __file_h__ @@ -113,6 +108,8 @@ struct magic { #define FILE_BELDATE 15 #define FILE_LELDATE 16 #define FILE_REGEX 17 +#define FILE_BESTRING16 18 +#define FILE_LESTRING16 19 #define FILE_FORMAT_NAME \ /* 0 */ "invalid 0", \ @@ -132,7 +129,9 @@ struct magic { /* 14 */ "ldate", \ /* 15 */ "beldate", \ /* 16 */ "leldate", \ -/* 17 */ "regex", +/* 17 */ "regex", \ +/* 18 */ "bestring16", \ +/* 19 */ "lestring16", #define FILE_FMT_NUM "cduxXi" #define FILE_FMT_STR "s" @@ -155,7 +154,9 @@ struct magic { /* 14 */ FILE_FMT_STR, \ /* 15 */ FILE_FMT_STR, \ /* 16 */ FILE_FMT_STR, \ -/* 17 */ FILE_FMT_STR, +/* 17 */ FILE_FMT_STR, \ +/* 18 */ FILE_FMT_STR, \ +/* 19 */ FILE_FMT_STR, /* Word 3 */ uint8_t in_op; /* operator for indirection */ @@ -240,6 +241,8 @@ struct magic_set { int error; int flags; int haderr; + const char *file; + size_t line; }; struct stat; @@ -249,10 +252,9 @@ protected char *file_fmttime(uint32_t, int) protected int file_buffer(struct magic_set *ms, const void *, size_t) /*@globals fileSystem, internalState @*/ /*@modifies ms, fileSystem, internalState @*/; -protected int file_fsmagic(struct magic_set *ms, /*@null@*/ const char * fn, struct stat *sb) +protected int file_fsmagic(struct magic_set *ms, /*@null@*/ const char *fn, struct stat *sb) /*@modifies ms, sb @*/; -protected int file_pipe2file(struct magic_set *ms, int fd, const void *startbuf, - size_t nbytes) +protected int file_pipe2file(struct magic_set *ms, int fd, const void *startbuf, size_t nbytes) /*@globals errno, fileSystem, internalState @*/ /*@modifies ms, errno, fileSystem, internalState @*/; protected int file_printf(struct magic_set *ms, const char *, ...) @@ -279,7 +281,7 @@ protected struct mlist *file_apprentice(struct magic_set *ms, const char *, int) protected uint32_t file_signextend(struct magic_set *ms, struct magic *, uint32_t) /*@globals fileSystem @*/ /*@modifies ms, fileSystem @*/; -protected void file_delmagic(/*@only@*/ struct magic *p, int type, size_t entries) +protected void file_delmagic(struct magic *p, int type, size_t entries) /*@globals fileSystem @*/ /*@modifies p, fileSystem @*/; protected void file_badread(struct magic_set *ms) @@ -290,13 +292,13 @@ protected void file_oomem(struct magic_set *ms) /*@modifies ms @*/; protected void file_error(struct magic_set *ms, int, const char *, ...) /*@modifies ms @*/; -protected void file_magwarn(const char *f, ...) +protected void file_magwarn(struct magic_set *ms, const char *, ...) /*@globals fileSystem @*/ /*@modifies fileSystem @*/; protected void file_mdump(struct magic *m) /*@globals fileSystem @*/ /*@modifies m, fileSystem @*/; -protected void file_showstr(FILE *fp, const char *s, size_t len) +protected void file_showstr(FILE *fp, const char *, size_t) /*@globals fileSystem @*/ /*@modifies fp, fileSystem @*/; protected size_t file_mbswidth(const char *) diff --git a/file/src/fsmagic.c b/file/src/fsmagic.c index 7581b72ac..ce41ad92d 100644 --- a/file/src/fsmagic.c +++ b/file/src/fsmagic.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -62,7 +57,7 @@ #undef HAVE_MAJOR #ifndef lint -FILE_RCSID("@(#)$Id: fsmagic.c,v 1.43 2003/10/14 19:29:55 christos Exp $") +FILE_RCSID("@(#)$Id: fsmagic.c,v 1.45 2004/11/13 10:19:48 christos Exp $") #endif /* lint */ protected int @@ -94,10 +89,11 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb) file_error(ms, errno, "cannot stat `%s'", fn); return -1; } - if (file_printf(ms, "cannot open (%s)", + if (file_printf(ms, "cannot open `%s' (%s)", fn, strerror(errno)) == -1) return -1; - return 1; + ms->haderr++; + return -1; } if ((ms->flags & MAGIC_MIME) != 0) { diff --git a/file/src/funcs.c b/file/src/funcs.c index 44cbdf1af..bd77f13ca 100644 --- a/file/src/funcs.c +++ b/file/src/funcs.c @@ -11,8 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -34,7 +32,7 @@ #include <ctype.h> #ifndef lint -FILE_RCSID("@(#)$Id: funcs.c,v 1.12 2004/06/04 14:40:20 christos Exp $") +FILE_RCSID("@(#)$Id: funcs.c,v 1.13 2004/09/11 19:15:57 christos Exp $") #endif /* lint */ /* * Like printf, only we print to a buffer and advance it. diff --git a/file/src/is_tar.c b/file/src/is_tar.c index 4ab1a1f18..84f201e00 100644 --- a/file/src/is_tar.c +++ b/file/src/is_tar.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -50,7 +45,7 @@ #include "tar.h" #ifndef lint -FILE_RCSID("@(#)$Id: is_tar.c,v 1.24 2003/11/11 20:01:46 christos Exp $") +FILE_RCSID("@(#)$Id: is_tar.c,v 1.25 2004/09/11 19:15:57 christos Exp $") #endif #define isodigit(c) ( ((c) >= '0') && ((c) <= '7') ) diff --git a/file/src/magic.c b/file/src/magic.c index c2d9e6256..ceefbfaa7 100644 --- a/file/src/magic.c +++ b/file/src/magic.c @@ -11,8 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -65,7 +63,7 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: magic.c,v 1.22 2004/07/24 19:55:17 christos Exp $") +FILE_RCSID("@(#)$Id: magic.c,v 1.24 2004/09/27 15:28:37 christos Exp $") #endif /* lint */ #ifdef __EMX__ @@ -77,8 +75,8 @@ protected int file_os2_apptype(struct magic_set *ms, const char *fn, private void free_mlist(/*@only@*/ struct mlist *mlist) /*@globals fileSystem @*/ /*@modifies mlist, fileSystem @*/; -private void close_and_restore(const struct magic_set *ms, const char *name, - int fd, const struct stat *sb) +private void close_and_restore(const struct magic_set *ms, const char *name, int fd, + const struct stat *sb) /*@globals fileSystem, internalState @*/ /*@modifies fileSystem, internalState @*/; @@ -91,34 +89,34 @@ magic_open(int flags) return NULL; if (magic_setflags(ms, flags) == -1) { - free(ms); errno = EINVAL; - return NULL; + goto free1; } ms->o.ptr = ms->o.buf = malloc(ms->o.size = 1024); - ms->o.len = 0; - if (ms->o.buf == NULL) { - free(ms); - return NULL; - } + if (ms->o.buf == NULL) + goto free1; + ms->o.pbuf = malloc(ms->o.psize = 1024); - if (ms->o.pbuf == NULL) { - free(ms->o.buf); - free(ms); - return NULL; - } + if (ms->o.pbuf == NULL) + goto free2; + ms->c.off = malloc((ms->c.len = 10) * sizeof(*ms->c.off)); - if (ms->c.off == NULL) { - free(ms->o.pbuf); - free(ms->o.buf); - free(ms); - return NULL; - } + if (ms->c.off == NULL) + goto free3; + + ms->o.len = 0; ms->haderr = 0; ms->error = -1; ms->mlist = NULL; return ms; +free3: + free(ms->o.pbuf); +free2: + free(ms->o.buf); +free1: + free(ms); + return NULL; } private void @@ -145,6 +143,7 @@ public void magic_close(struct magic_set *ms) { free_mlist(ms->mlist); + free(ms->o.pbuf); free(ms->o.buf); free(ms->c.off); free(ms); @@ -169,22 +168,16 @@ public int magic_compile(struct magic_set *ms, const char *magicfile) { struct mlist *ml = file_apprentice(ms, magicfile, FILE_COMPILE); - if (ml) { - free_mlist(ml); - return 0; - } - return -1; + free_mlist(ml); + return ml ? 0 : -1; } public int magic_check(struct magic_set *ms, const char *magicfile) { struct mlist *ml = file_apprentice(ms, magicfile, FILE_CHECK); - if (ml) { - free_mlist(ml); - return 0; - } - return -1; + free_mlist(ml); + return ml ? 0 : -1; } private void @@ -224,13 +217,13 @@ magic_file(struct magic_set *ms, const char *inname) { int fd = 0; unsigned char buf[HOWMANY+1]; /* one extra for terminating '\0' */ - struct stat sb; + struct stat sb, * st = &sb; ssize_t nbytes = 0; /* number of bytes read from a datafile */ if (file_reset(ms) == -1) return NULL; - switch (file_fsmagic(ms, inname, &sb)) { + switch (file_fsmagic(ms, inname, st)) { case -1: return NULL; case 0: diff --git a/file/src/magic.h b/file/src/magic.h index ae0e12f33..77fe8ccb0 100644 --- a/file/src/magic.h +++ b/file/src/magic.h @@ -11,8 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/file/src/names.h b/file/src/names.h index 6978a7711..8e6d21f3f 100644 --- a/file/src/names.h +++ b/file/src/names.h @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -37,7 +32,7 @@ * appear at fixed offsets into the file. Don't make HOWMANY * too high unless you have a very fast CPU. * - * $Id: names.h,v 1.24 2004/03/22 19:09:12 christos Exp $ + * $Id: names.h,v 1.25 2004/09/11 19:15:57 christos Exp $ */ /* diff --git a/file/src/patchlevel.h b/file/src/patchlevel.h index e5e1b0146..1f74d4804 100644 --- a/file/src/patchlevel.h +++ b/file/src/patchlevel.h @@ -1,11 +1,17 @@ #define FILE_VERSION_MAJOR 4 -#define patchlevel 10 +#define patchlevel 12 /* * Patchlevel file for Ian Darwin's MAGIC command. - * $Id: patchlevel.h,v 1.53 2004/07/24 20:40:46 christos Exp $ + * $Id: patchlevel.h,v 1.55 2004/11/24 18:57:47 christos Exp $ * * $Log: patchlevel.h,v $ + * Revision 1.55 2004/11/24 18:57:47 christos + * Re-do the autoconf stuff once more; passes make dist now. + * + * Revision 1.54 2004/11/21 05:52:05 christos + * ready for 4.11 + * * Revision 1.53 2004/07/24 20:40:46 christos * welcome to 4.10 * diff --git a/file/src/print.c b/file/src/print.c index 161ffdd21..638780849 100644 --- a/file/src/print.c +++ b/file/src/print.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -46,7 +41,7 @@ #include <time.h> #ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.44 2003/09/12 19:39:44 christos Exp $") +FILE_RCSID("@(#)$Id: print.c,v 1.46 2004/11/13 08:11:39 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -143,7 +138,7 @@ file_mdump(struct magic *m) /*VARARGS*/ protected void -file_magwarn(const char *f, ...) +file_magwarn(struct magic_set *ms, const char *f, ...) { va_list va; va_start(va, f); @@ -151,7 +146,8 @@ file_magwarn(const char *f, ...) /* cuz we use stdout for most, stderr here */ (void) fflush(stdout); - (void) fprintf(stderr, "WARNING: "); + (void) fprintf(stderr, "%s, %lu: Warning ", ms->file, + (unsigned long)ms->line); (void) vfprintf(stderr, f, va); va_end(va); fputc('\n', stderr); diff --git a/file/src/readelf.c b/file/src/readelf.c index 21405f1f6..cd20bedc6 100644 --- a/file/src/readelf.c +++ b/file/src/readelf.c @@ -11,8 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -39,22 +37,19 @@ #include "readelf.h" #ifndef lint -FILE_RCSID("@(#)$Id: readelf.c,v 1.42 2004/07/24 20:57:22 christos Exp $") +FILE_RCSID("@(#)$Id: readelf.c,v 1.45 2004/11/24 17:38:24 christos Exp $") #endif #ifdef ELFCORE -private int dophn_core(struct magic_set *ms, int class, int swap, int fd, - off_t off, int num, size_t size) +private int dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off, int num, size_t size) /*@modifies ms @*/; #endif -private int dophn_exec(struct magic_set *ms, int class, int swap, int fd, - off_t off, int num, size_t size) +private int dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off, int num, size_t size) /*@modifies ms @*/; -private int doshn(struct magic_set *ms, int class, int swap, int fd, off_t off, - int num, size_t size) +private int doshn(struct magic_set *ms, int class, int swap, int fd, off_t off, int num, size_t size) /*@modifies ms @*/; -private size_t donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, - size_t size, int class, int swap, size_t align) +private size_t donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, size_t size, int class, + int swap, size_t align) /*@modifies ms @*/; #define ELF_ALIGN(a) ((((a) + align - 1) / align) * align) @@ -269,7 +264,8 @@ dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off, file_badseek(ms); return -1; } - bufsize = read(fd, nbuf, sizeof(nbuf)); + bufsize = read(fd, nbuf, + ((ph_filesz < sizeof(nbuf)) ? ph_filesz : sizeof(nbuf))); if (bufsize == -1) { file_badread(ms); return -1; @@ -340,7 +336,7 @@ donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, size_t size, } offset = ELF_ALIGN(doff + descsz); - if (offset + descsz > size) { + if (doff + descsz > size) { return offset; } @@ -426,48 +422,67 @@ donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, size_t size, /* * Contents is __FreeBSD_version, whose relation to OS - * versions is defined by a huge table in the Porters' - * Handbook. For up to 5.x, the first three digits are - * the version number. For 5.x and higher, the scheme - * is: <major><two digit minor> <0 if release branch, - * otherwise 1>xx + * versions is defined by a huge table in the Porter's + * Handbook. This is the general scheme: + * + * Releases: + * Mmp000 (before 4.10) + * Mmi0p0 (before 5.0) + * Mmm0p0 + * + * Development branches: + * Mmpxxx (before 4.6) + * Mmp1xx (before 4.10) + * Mmi1xx (before 5.0) + * M000xx (pre-M.0) + * Mmm1xx + * + * M = major version + * m = minor version + * i = minor version increment (491000 -> 4.10) + * p = patchlevel + * x = revision + * + * The first release of FreeBSD to use ELF by default + * was version 3.0. */ - if (desc / 100000 < 5) { - if (desc / 10000 % 10 == 9) { - if (file_printf(ms, " %d.%d", desc / 100000, - 9 + desc / 1000 % 10) == -1) + if (desc == 460002) { + if (file_printf(ms, " 4.6.2") == -1) + return size; + } else if (desc < 460100) { + if (file_printf(ms, " %d.%d", desc / 100000, + desc / 10000 % 10) == -1) + return size; + if (desc / 1000 % 10 > 0) + if (file_printf(ms, ".%d", desc / 1000 % 10) + == -1) return size; - } else { - if (file_printf(ms, " %d.%d", desc / 100000, - desc / 10000 % 10) == -1) + if ((desc % 1000 > 0) || (desc % 100000 == 0)) + if (file_printf(ms, " (%d)", desc) == -1) + return size; + } else if (desc < 500000) { + if (file_printf(ms, " %d.%d", desc / 100000, + desc / 10000 % 10 + desc / 1000 % 10) == -1) + return size; + if (desc / 100 % 10 > 0) { + if (file_printf(ms, " (%d)", desc) == -1) + return size; + } else if (desc / 10 % 10 > 0) { + if (file_printf(ms, ".%d", desc / 10 % 10) + == -1) return size; - if (desc / 1000 % 10 > 0) - if (file_printf(ms, ".%d", desc / 1000 % 10) - == -1) - return size; - } - if (desc / 10000 % 10 > 5) { - desc %= 1000; - if (desc >= 100) { - if (file_printf(ms, "-STABLE (rev %d)", - desc % 100) == -1) - return size; - } else if (desc != 0) { - if (file_printf(ms, ".%d", desc) == -1) - return size; - } } } else { if (file_printf(ms, " %d.%d", desc / 100000, desc / 1000 % 100) == -1) return size; - desc %= 1000; - if (desc >= 100) { - if (file_printf(ms, "-CURRENT (rev %d)", - desc % 100) == -1) + if ((desc / 100 % 10 > 0) || + (desc % 100000 / 100 == 0)) { + if (file_printf(ms, " (%d)", desc) == -1) return size; - } else if (desc != 0) { - if (file_printf(ms, ".%d", desc / 10) == -1) + } else if (desc / 10 % 10 > 0) { + if (file_printf(ms, ".%d", desc / 10 % 10) + == -1) return size; } } @@ -706,7 +721,8 @@ dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off, file_badseek(ms); return -1; } - bufsize = read(fd, nbuf, sizeof(nbuf)); + bufsize = read(fd, nbuf, ((ph_filesz < sizeof(nbuf)) ? + ph_filesz : sizeof(nbuf))); if (bufsize == -1) { file_badread(ms); return -1; diff --git a/file/src/readelf.h b/file/src/readelf.h index 391b54d38..bc5e8e56c 100644 --- a/file/src/readelf.h +++ b/file/src/readelf.h @@ -11,8 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/file/src/softmagic.c b/file/src/softmagic.c index dfb93019e..82bc72930 100644 --- a/file/src/softmagic.c +++ b/file/src/softmagic.c @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -44,27 +39,29 @@ #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.66 2004/07/24 20:38:56 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.72 2004/11/24 17:38:25 christos Exp $") #endif /* lint */ private int match(struct magic_set *ms, struct magic *magic, uint32_t nmagic, const unsigned char *s, size_t nbytes) /*@globals fileSystem @*/ /*@modifies ms, magic, fileSystem @*/; -private int mget(struct magic_set *ms, union VALUETYPE *p, - const unsigned char *s, struct magic *m, size_t nbytes) +private int mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, + struct magic *m, size_t nbytes) /*@globals fileSystem @*/ /*@modifies ms, p, m, fileSystem @*/; private int mcheck(struct magic_set *ms, union VALUETYPE *p, struct magic *m) /*@globals fileSystem @*/ /*@modifies ms, p, fileSystem @*/; -private int32_t mprint(struct magic_set *ms, union VALUETYPE *p, - struct magic *m) +private int32_t mprint(struct magic_set *ms, union VALUETYPE *p, struct magic *m) /*@globals fileSystem @*/ /*@modifies ms, p, fileSystem @*/; private void mdebug(uint32_t offset, const char *str, size_t len) /*@globals fileSystem @*/ /*@modifies fileSystem @*/; +private int mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, + const unsigned char *s, size_t offset, size_t nbytes) + /*@modifies ms, p @*/; private int mconvert(struct magic_set *ms, union VALUETYPE *p, struct magic *m) /*@modifies ms, p @*/; private int check_mem(struct magic_set *ms, unsigned int level) @@ -289,6 +286,8 @@ mprint(struct magic_set *ms, union VALUETYPE *p, struct magic *m) case FILE_STRING: case FILE_PSTRING: + case FILE_BESTRING16: + case FILE_LESTRING16: if (m->reln == '=') { if (file_printf(ms, m->desc, m->value.s) == -1) return -1; @@ -439,28 +438,30 @@ mconvert(struct magic_set *ms, union VALUETYPE *p, struct magic *m) p->l = ~p->l; return 1; case FILE_STRING: + case FILE_BESTRING16: + case FILE_LESTRING16: { - int n; + size_t len; /* Null terminate and eat *trailing* return */ p->s[sizeof(p->s) - 1] = '\0'; - n = strlen(p->s) - 1; - if (p->s[n] == '\n') - p->s[n] = '\0'; + len = strlen(p->s); + if (len-- && p->s[len] == '\n') + p->s[len] = '\0'; return 1; } case FILE_PSTRING: { char *ptr1 = p->s, *ptr2 = ptr1 + 1; - unsigned int n = *p->s; - if (n >= sizeof(p->s)) - n = sizeof(p->s) - 1; - while (n--) + size_t len = *p->s; + if (len >= sizeof(p->s)) + len = sizeof(p->s) - 1; + while (len--) *ptr1++ = *ptr2++; *ptr1 = '\0'; - n = strlen(p->s) - 1; - if (p->s[n] == '\n') - p->s[n] = '\0'; + len = strlen(p->s); + if (len-- && p->s[len] == '\n') + p->s[len] = '\0'; return 1; } case FILE_BESHORT: @@ -616,12 +617,10 @@ mdebug(uint32_t offset, const char *str, size_t len) } private int -mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, - struct magic *m, size_t nbytes) +mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, + const unsigned char *s, size_t offset, size_t nbytes) { - uint32_t offset = m->offset; - - if (m->type == FILE_REGEX) { + if (type == FILE_REGEX && indir == 0) { /* * offset is interpreted as last line to search, * (starting at 1), not as bytes-from start-of-file @@ -637,18 +636,59 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, last = b; if (last != NULL) *last = '\0'; - } else if (offset + sizeof(union VALUETYPE) <= nbytes) - memcpy(p, s + offset, sizeof(union VALUETYPE)); - else { - /* - * the usefulness of padding with zeroes eludes me, it - * might even cause problems - */ - memset(p, 0, sizeof(union VALUETYPE)); - if (offset < nbytes) - memcpy(p, s + offset, nbytes - offset); + return 0; } + if (indir == 0 && (type == FILE_BESTRING16 || type == FILE_LESTRING16)) + { + const char *src = s + offset; + const char *esrc = s + nbytes; + char *dst = p->s, *edst = &p->s[sizeof(p->s) - 1]; + + if (type == FILE_BESTRING16) + src++; + + for (;src < esrc; src++, dst++) { + if (dst < edst) + *dst = *src++; + else + break; + if (*dst == '\0') + *dst = ' '; + } + *edst = '\0'; + return 0; + } + + if (offset >= nbytes) { + (void)memset(p, '\0', sizeof(*p)); + return 0; + } + if (nbytes - offset < sizeof(*p)) + nbytes = nbytes - offset; + else + nbytes = sizeof(*p); + + (void)memcpy(p, s + offset, nbytes); + + /* + * the usefulness of padding with zeroes eludes me, it + * might even cause problems + */ + if (nbytes < sizeof(*p)) + (void)memset(((char *)p) + nbytes, '\0', sizeof(*p) - nbytes); + return 0; +} + +private int +mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, + struct magic *m, size_t nbytes) +{ + uint32_t offset = m->offset; + + if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes) == -1) + return -1; + /* Verify we have enough data to match magic type */ switch (m->type) { case FILE_BYTE: @@ -1035,11 +1075,8 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, break; } - if (nbytes < sizeof(union VALUETYPE) || - nbytes - sizeof(union VALUETYPE) < offset) - return 0; - - memcpy(p, s + offset, sizeof(union VALUETYPE)); + if (mcopy(ms, p, m->type, 0, s, offset, nbytes) == -1) + return -1; if ((ms->flags & MAGIC_DEBUG) != 0) { mdebug(offset, (char *)(void *)p, @@ -1088,6 +1125,8 @@ mcheck(struct magic_set *ms, union VALUETYPE *p, struct magic *m) break; case FILE_STRING: + case FILE_BESTRING16: + case FILE_LESTRING16: case FILE_PSTRING: { /* @@ -1147,8 +1186,8 @@ mcheck(struct magic_set *ms, union VALUETYPE *p, struct magic *m) file_error(ms, 0, "regex error %d, (%s)", rc, errmsg); return -1; } else { - rc = regexec(&rx, p->buf, 0, 0, 0); /*@-immediatetrans -moduncon -noeffectuncon @*/ /* regfree annotate bogus only @*/ + rc = regexec(&rx, p->buf, 0, 0, 0); regfree(&rx); /*@=immediatetrans =moduncon =noeffectuncon @*/ free(p->buf); diff --git a/file/src/tar.h b/file/src/tar.h index 983ab561b..c3fc185ee 100644 --- a/file/src/tar.h +++ b/file/src/tar.h @@ -12,11 +12,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ian F. Darwin and others. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -37,7 +32,7 @@ * * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu. * - * $Id: tar.h,v 1.7 2003/10/14 19:29:56 christos Exp $ # checkin only + * $Id: tar.h,v 1.8 2004/09/11 19:15:58 christos Exp $ # checkin only */ /* diff --git a/file/src/test.c b/file/src/test.c index 2c60585c7..ab4c10538 100644 --- a/file/src/test.c +++ b/file/src/test.c @@ -11,8 +11,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |