Compare commits

...
186 Commits
Author SHA1 Message Date
Ken Smith ba209d619d Prepare for tagging RELENG_7_0_0_RELEASE and the 7.0-RELEASE builds.
Approved by:	re (implicit)
2008-02-24 05:45:16 +00:00
Ken Smith c305071382 Speculate on the release date for FreeBSD 7.0.
Approved by:	re (implicit)
2008-02-24 05:17:54 +00:00
Christian Brueffer 273f2878cf MFC: rev. 1.4
Add some missing Xrefs to drivers.

Approved by:	re (kensmith)
2008-02-21 23:29:26 +00:00
Ken Smith d6b756fedf Prepare for a "mini-RC3". Only amd64/i386 builds will be done. Targetted
at getting people to test the backout of the hptrr(4) driver.

Approved by:	re (implicit)
2008-02-20 04:37:25 +00:00
Ken Smith 1a6175d504 MFR7 the backout of hptrr v1.2 due to problems encountered during testing
of 7.0-RC2.  Versions being MFR7-ed:

        1.1.2.3   amd64-elf.hptrr_lib.o.uu
        1.1.2.3   array.h
        1.1.2.3   him.h
        1.1.2.3   hptintf.h
        1.1.2.3   hptrr_config.c
        1.1.2.3   hptrr_config.h
        1.1.2.4   hptrr_os_bsd.c
        1.1.2.3   hptrr_osm_bsd.c
        1.1.2.3   i386-elf.hptrr_lib.o.uu
        1.1.2.3   ldm.h
        1.1.2.3   os_bsd.h
        1.1.2.4   osm.h

Approved by:    re (rwatson)
2008-02-20 04:35:24 +00:00
Justin T. Gibbs e64896ab62 MFC: Properly advertise U320 transport capabilities to CAM.
MFC: Quiet sense data logging behind AHD_DEBUG/AHD_SHOW_SENSE.

Approved by: re (kensmith)
2008-02-19 17:08:34 +00:00
Xin LI 0170aa6bf2 Catch up with 1.1068.2.20.2.3.
Approved by:	re (bmah)
2008-02-17 01:16:40 +00:00
Christian Brueffer b345cdf33f MFC: rev. 1.3
The hptrr driver first appeared in 6.3, not 5.3.

Approved by:	re (bmah)
2008-02-16 20:29:06 +00:00
Bruce A. Mah d766e68b5b New release notes: SA-08:03.sendfile, 700MB CDROM media for ISOs,
rr232x(4) gone.

Modified release notes:  Added missing word to SA-08:02.libc note,
mention SATA RAID in hptiop(4) note, FILE 4.23.

Approved by:	re (implicitly)
2008-02-16 16:03:48 +00:00
Colin Percival 981ef535d7 MFC rev.1.13: Use case-insensitive comparisons for HTTP header keywords.
Approved by:	re (kensmith)
2008-02-15 16:17:28 +00:00
Christian Brueffer 016bc70050 MFC: rev. 1.325
Remove dublicate MLINK.

Approved by:	re (bmah)
2008-02-15 15:19:26 +00:00
Mitsuru IWASAKI e06244ec03 MFC: share/man/man4/ciss.4:1.15, sys/dev/ciss/ciss.c:1.87
Add `hw.ciss.nop_message_heartbeat' tunable (default disabled) for
NOP-message polling in ciss_periodic().
Note that setting the tunable to non-zero can be workaround only for
`ADAPTER HEARTBEAT FAILED' problem, and may freeze the system w/o
the problem.

Approved by:	re (kensmith)
2008-02-15 13:55:23 +00:00
Marcel Moolenaar 765537c6f5 MFC: machdep.c:1.230, pmap.c:1.197
On Montecito processors, the instruction cache is in fact not
coherent with the data caches. Implement a quick fix to allow
us to boot on Montecito, while I'm working on a better fix in
the mean time.

Approved by: re (kensmith - big thanks!)
2008-02-14 22:51:52 +00:00
Remko Lodder 03b346e6fa MFC rev 1.22 hosts.equiv.5
v1.22
  Improve readability for the hosts.equiv file regarding the notation
  of hostnames.

  PR:		docs/35953
  Submitted by:	"Gary W. Swearingen" <swear at blarg dot net>
		With minor modifications by me.

Approved by:	re (bmah)
2008-02-14 21:48:53 +00:00
Remko Lodder ba492a05a0 MFC revs 1.17 to 1.18 timed.8
v1.18
  Typo fix.

  Spotted by:	brueffer

  v1.17
  Enhance descriptions in the timed manual.

  PR:		docs/115445
  Submitted by:	"Julian Stacey" <jhs at berklix dot org>
  MFC After:	3 days

Approved by:	re (bmah)
2008-02-14 21:48:24 +00:00
Remko Lodder b0884b996e MFC rev 1.9 to 1.11 nve.4
v1.11
  Language nit.

  v1.10
  There is no list to stop, so dont use .El.

  Noticed by:	brueffer

  v1.9
  Add 1000baseTX support for the nve driver, which is known here and there.

  Also mention that the driver sometimes returns '10baseTX' as output instead
  of 100baseTX (which is the case at that moment).

  PR:		docs/115284
  Submitted by:	Julian Stacey Jhs <jhs at berklix dot org>
  MFC After:	3 days

Approved by:	re (bmah)
2008-02-14 21:47:49 +00:00
Remko Lodder fe2aa7693d MFC rev 1.69 to 1.70 bsdlabel.8
v1.70
  Remove redundant whitespace.

  Noticed by:	brueffer

  v1.69
  Attempt to describe the ''auto'' type a bit better in the default
  section (if nothing had been specified, or if the auto type had
  been specified, a default layout is used).

  PR:		docs/116047
  Submitted by:	Ian Smith <smithi at nimnet dot asn dot au>
		Minor modifications by me.

Approved by:	re (bmah)
2008-02-14 21:46:19 +00:00
Remko Lodder 72fd2dafeb MFC rev 1.20 to 1.23 access.2
v1.23
  After issueing a ntpdate [1] I noticed it's already 2008, reflect that
  in the last modified date.

  Noticed by:	brueffer [1]

  v1.22
  Fix typo (s/existance/existence/)

  Noticed by:	ceri

  v1.21
  Fix some style nits.

  Prodded by:	brueffer
  MFC After:	3 days

  v1.20
  Make the warning a bit less 'broad' then it used to be.  The access
  is seems to be a problem for SUID applications, which we like to
  prevent as much as possible.

  PR:		docs/39530
  Submitted by:	Soren Spies <sspies at apple dot com>
  MFC After:	3 days

Approved by:	re (bmah)
2008-02-14 21:45:41 +00:00
Christian Brueffer 52a42b6a92 MFC: rev. 1.26
Add missing \n.

Approved by:	re (bmah), rwatson (mentor), [email protected]
2008-02-14 20:52:03 +00:00
Remko Lodder 9bb4915ac6 MFC rev 1.153 nfs_srvsubs.c
Use nfsrv_destroycache() only once, else it crashes the server.

  PR: kern/118152
  Submitted by: Bjoern Groenvall <bg at sics dot se>
  Approved by: imp (mentor, a while ago already), jhb
  MFC After: 3 days

Approved by:	re (kensmith), imp (mentor, implicit)
2008-02-14 14:12:13 +00:00
Simon L. B. Nielsen 5d674ba13d Fix sendfile(2) write-only file permission bypass.
Security:	FreeBSD-SA-08:03.sendfile
Approved by:	re (kensmith)
2008-02-14 11:45:41 +00:00
Doug Barton a330834f3c MFC version 1.14, from the 4 February 2008 update:
IPv6 addresses for 6 of the root name servers!

Approved by:	re (kensmith)
2008-02-07 20:55:42 +00:00
Ken Smith 397d753b08 Get ready for the 7.0-RC2 builds.
Approved by:	re (implicit)
2008-02-07 12:50:27 +00:00
Pierre Beyssac b1e439e170 MFC rev 1.4: fix a bug in hexadecimal formatting of the CHAP digest:
bytes >= 0x80 were formatted as 0xff, causing the authentication
to fail.

Note: fast MFC to RELENG_7 and RELENG_7_0 to get the changes in
time for 7.0-RC2.

Approved by:	re (kensmith)
2008-02-07 00:08:57 +00:00
Xin LI 75cf92539f Remove rr232x(4) from release documentations. It is actually
a hard link from hptrr(4).

Approved by:	re (bmah)
2008-02-06 19:47:29 +00:00
David E. O'Brien 9fb0721520 MFC: file version 4.23.
Approved by:	re(kensmith)
2008-02-06 18:26:38 +00:00
Scott Long eaaf37485b Fix a symbol conflict between hptrr and hptmv
Approved by: re
2008-02-06 13:59:17 +00:00
Scott Long f37e77691e Update the hptrr driver to version 1.2. This adds port multiplier support
for several cards.  See the Highpoint website for more information.  Again,
many thanks to Highpoint for their continued support of FreeBSD.

Approved by: re
2008-02-06 04:37:58 +00:00
Scott Long 1347778aea Update the hptiop driver to version 1.3. This adds support for the 4xxx
series of adapters.  Thanks again to Highpoint for their continued support
of FreeBSD.

Submitted by: Highpoint Technologies
Approved by: re
2008-02-06 03:44:11 +00:00
Mitsuru IWASAKI 5b20ea5899 MFC revision: 1.83, 1.85, 1.86
Add NOP-message polling to ciss_periodic().
Disable adapter by detecting adapter is dead.

Reviewed by:    scottl
Approved by:    re (kensmith)
2008-02-06 03:39:02 +00:00
Scott Long fc148186da Remove the rr232x.4 manual page and add links and references to the hptrr
page.

Approved by: re
2008-02-06 03:38:47 +00:00
Mitsuru IWASAKI c5c7b65188 MFC revision: subr_bus.c:1.204, bus.h:1.79, acpi.c:1.244
o Add devctl_process_running() so that power management system driver
  can check whether devd(8) is running.
o Enter the sleep state immediately without waiting for timeout if
  devd(8) is not running such as the system in single user mode.

Approved by:	re (kensmith)
2008-02-06 03:35:40 +00:00
Scott Long bbcc7dac08 Remove the rr232x driver. It has been superseced by the hptrr driver.
Approved by: re
2008-02-06 03:24:29 +00:00
Simon L. B. Nielsen ac9f2799f0 MFC 1.2:
Unbreak detection of cryptodev support for FreeBSD which was broken
  with OpenSSL 0.9.8 import.

  Note that this does not enable cryptodev by default, as it was the
  case with OpenSSL 0.9.7 in FreeBSD base, but this change makes it
  possible to enable cryptodev at all.

Approved by:	re (kensmith)
2008-02-05 21:02:04 +00:00
Sam Leffler 3546df733e MFC 1.115: fix use w/ altq
Submitted by:	sephe
Approved by:	re (kensmith)
2008-02-05 18:29:03 +00:00
Sam Leffler 8ba342d557 MFC 1.8: correct typo that broke check when handling addba response
Approved by:	re (kensmith)
2008-02-05 18:19:12 +00:00
Sam Leffler 3125256ec6 MFC 1.50: correct tx rate displayed by list sta
Approved by:	re (kensmith)
2008-02-05 18:17:29 +00:00
Sam Leffler 517c2e2bb7 MFC 1.49: fix list mac
Approved by:	re (kensmith)
2008-02-05 18:16:35 +00:00
Christian S.J. Peron 0f93896fb4 MFC revision 1.23
Make sure we handle listen() and eliminate console messages for unknown
event types.

Approved by:	re@ (kensmith)
2008-02-05 14:36:41 +00:00
Julian Elischer e1a6d0886b MFC changes from 1.14 for sys/lock.c and 1.127+1.128 for thread/thr_kern.c
this copes with the fact that during a fork the child may get
really screwy state in the threading system due to the
sudden vaporisation of it's sibling threads.

Approved by: re(kensmith)
2008-02-04 20:03:36 +00:00
Doug Ambrisko 93d9a654b3 MFC: Fix some bugs in dealing with DCMD's without data. MegaCli was sending
down some DCMD's without any data.  Thanks to Dell and LSI for helping
to provide clues to figure out this problem.  Now MegaCli can upgrade
the firmware and should work identical when run on Linux.

Approved by:	re (kensmith)
2008-02-04 14:54:21 +00:00
Robert Watson f9c2966924 Merge uipc_sockbuf.c:1.175, uipc_socket.c:1.304, uipc_syscalls.c:1.264,
sctp_input.c:1.67, sctp_peeloff.c:1.17, sctputil.c:1.73,
socketvar.h:1.161 from HEAD to RELENG_7_0:

  Correct two problems relating to sorflush(), which is called to flush
  read socket buffers in shutdown() and close():

  - Call socantrcvmore() before sblock() to dislodge any threads that
    might be sleeping (potentially indefinitely) while holding sblock(),
    such as a thread blocked in recv().

  - Flag the sblock() call as non-interruptible so that a signal
    delivered to the thread calling sorflush() doesn't cause sblock() to
    fail.  The sblock() is required to ensure that all other socket
    consumer threads have, in fact, left, and do not enter, the socket
    buffer until we're done flushin it.

  To implement the latter, change the 'flags' argument to sblock() to
  accept two flags, SBL_WAIT and SBL_NOINTR, rather than one M_WAITOK
  flag.  When SBL_NOINTR is set, it forces a non-interruptible sx
  acquisition, regardless of the setting of the disposition of SB_NOINTR
  on the socket buffer; without this change it would be possible for
  another thread to clear SB_NOINTR between when the socket buffer mutex
  is released and sblock() is invoked.

  Reviewed by:    bz, kmacy, rrs
  Reported by:    Jos Backus <jos at catnook dot com>

Approved by:	re (kensmith)
2008-02-02 12:44:14 +00:00
Sam Leffler 355dc2b707 MFC 1.7: use m_gethdr to populate the rx ring
Approved by:	re (kensmith)
2008-02-02 07:30:02 +00:00
Jung-uk Kim def6dd1073 MFC: 1.159, 1.160
Do not sanitize disk geometry if it is set by scripts in non-interactive mode.

Approved by:	re (kensmith)
2008-02-01 20:33:40 +00:00
Randall Stewart b59b122423 - Fixes is a bug in sctp_auth that will cause a panic if
a socket is closed as it gets auth'd data in. (sctp_auth.c)
  - Reverts the priority back to 0, do not change prioritys (sctp_bsd_addr.c)
  - Fixes a wrap error in calculation of gap ack segments that
    wrap the TSN number. (sctp_indata.c)
  - Fixes a comment, and also moves a lock up to cover the pulling
    of the VRF from the inp structure. (sctp_pcb.c)
Approved by:	[email protected] (Ken Smith)
2008-01-31 17:21:50 +00:00
Christian Brueffer 07832de232 MFC: rev. 1.194
Correct the kernel config hint in a printf statement.

Approved by:	re (kensmith), rwatson (mentor)
2008-01-31 14:19:06 +00:00
Alexander Motin b1f6a82ffd MFC rev. 1.27
Fix memory leak when export hook is not connected.

Approved by:	re (kensmith)
2008-01-30 21:29:10 +00:00
Ruslan Ermilov 9f934a7e5f MFC: Add a wrapper function that bound checks writes to the dump device.
Approved by:	re (kensmith)
2008-01-30 21:21:51 +00:00
Christian Brueffer e7b4df3955 MFC:
Remove references to the obsolete card(4) manpage.

Approved by:	re (bmah)
2008-01-30 18:13:53 +00:00
Christian Brueffer 57fdd6b658 MFC:
OLDCARD is long gone, so finally remove the oldcard.4 manpage.

Approved by:	re (bmah)
2008-01-30 18:12:35 +00:00
David E. O'Brien 9386f49e3e MFC: rev. 1.1.1.7 (Check for a failure return from cplus_demangle_type)
Approved by:	re(kensmith)
2008-01-29 18:13:53 +00:00
John Baldwin 7e8d6fb1f3 MFC 1.42,1.43: Fix races and other bugs with sleepq timeout handling.
Approved by:	re (kensmith)
2008-01-29 16:37:04 +00:00
Mike Makonnen 406d294d7d MFC: ver. 1.7
Partial backout of rev. 1.6, but instead of putting
	kerberos5_server_flags back in command_args, put it
	where rc.subr(8) expects it: kerberos5_flags.

Approved by: re (kensmith)
2008-01-29 07:15:46 +00:00
Ken Smith c45b292880 MFC v1.7 (by request from remko because he is injured)
> revision 1.7
> date: 2008/01/16 13:54:40;  author: remko;  state: Exp;  lines: +9 -6
> Dont accidentally remove a filesocket which is still in use. This gives
> problems when the DRM driver is loaded and the AIXGL extension is loaded
> , the AIXGL driver requests a drm_close and this will cause the radeon
> driver to fail while starting X windows.
>
> PR:             kern/114688
> Submitted by:   vehemens <vehemens at verizon dot net>
> Prodded by:     Robert Noland
> Approved by:    imp (mentor, a while ago already), anholt

Approved by:			re (kensmith)
Me doing MFC requested by:	remko
2008-01-29 01:39:16 +00:00
Doug Barton 2b0d8cb338 MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.

And update comments in rc.firewall* and defaults/rc.conf.

Approved by:	re (kensmith)
2008-01-29 00:22:33 +00:00
Mike Makonnen 285d5a9d6a MFC:
Rev. 1.6 made it impossible to use rc.d/kerberos with the krb5 port.
	Re-implement the change so that the script once again works with
	the krb5 port.

	Submitted by: kensmith (slightly modified)

Approved by: re (kensmith)
2008-01-28 20:59:48 +00:00
Robert Watson f0b5521fbb Merge ipfw2.c:1.113, ip_fw.h:1.111, ip_fw2.c:1.180 from HEAD to
RELENG_7_0:

  Hide ipfw internal data structures behind IPFW_INTERNAL rather than
  exposing them to all consumers of ip_fw.h.  These structures are
  used in both ipfw(8) and ipfw(4), but not part of the user<->kernel
  interface for other applications to use, rather, shared
  implementation.

  Reported by:    Paul Vixie <paul at vix dot com>

Approved by:	re (kensmith)
2008-01-28 17:44:30 +00:00
Andrew Gallatin 6682e365b1 MFC: Only reset driver state when a hardware error is detected.
Approved by: re (kensmith)
2008-01-28 15:58:03 +00:00
Konstantin Belousov c5f8c7522a MFC rev. 1.52:
udf_vget() shall vgone() the vnode when the file_entry cannot be allocated
or read from the volume. Otherwise, half-constructed vnode could be found
later and cause panic when accessed.

Approved by:	re (kensmith)
2008-01-28 12:51:31 +00:00
Konstantin Belousov 00d99a8a27 MFC rev. 1.457:
Do not dereference NULL scp in the case the screen is not opened.
Instead, return ENXIO to the ioctl caller.

Approved by:	re (kensmith)
2008-01-28 12:49:33 +00:00
Konstantin Belousov 4411d38642 MFC rev. 1.157:
In rev. 1.156, the convertion of the minor number to the unit number
resulted in the argument to the make_dev() to be a unit number.

Correct this by supplying a minor number to make_dev(), and using
the unit number for the calculation of the slave tty name.

Approved by:	re (kensmith)
2008-01-28 12:47:56 +00:00
Jean-Sébastien Pédron a9a2a8643e MFC:
sys/kern/vfs_aio.c; revision 1.237
  sys/sys/event.h; revision 1.38

  When asked to use kqueue, AIO stores its internal state in the
  `kn_sdata' member of the newly registered knote. The problem is that
  this member is overwritten by a call to kevent(2) with the EV_ADD flag,
  targetted at the same kevent/knote. For instance, a userland application
  may set the pointer to NULL, leading to a panic.

  A testcase was provided by the submitter.

  PR:	kern/118911
  Submitted by:	MOROHOSHI Akihiko <[email protected]>

Approved by:	re (kensmith)
2008-01-28 10:43:11 +00:00
Doug Barton d592bfdc47 Regenerated page with WITHOUT_GSSAPI
Approved by:	re (kensmith)
2008-01-28 09:00:43 +00:00
Doug Barton 77d3ed1b58 MFC the WITHOUT_GSSAPI knob.
Approved by:	re (kensmith)
2008-01-28 08:57:11 +00:00
Doug Barton e9690482a4 MFC the purely cosmetic changes, including removal of $NetBSD$ Ids,
a few spurious #'s, an empty REQUIRE, and a never-used KEYWORD.

Approved by:	re (kensmith)
2008-01-28 07:58:32 +00:00
Doug Barton f074d1d36f GC this file, which was brought over from NetBSD but never used by us.
Approved by:	re (kensmith)
2008-01-28 07:32:25 +00:00
Marius Strobl c642531635 MFC: 1.36
Add missing locking for SBus controllers.

Approved by:	re (kensmith)
2008-01-27 15:44:37 +00:00
Xin LI ba92c33f87 MFC revision 1.7
date: 2008/01/12 00:11:26;  author: delphij;  state: Exp;  lines: +4 -4
 - Handle the case where interface from "middle" is missing by
   more carefully inspecting the return value from sysctl(3). [1]
 - Use calloc instead of malloc+memset of zero.

Submitted by:	Alexander Chernikov <admin su29 net> [1]
PR:		bin/119581
Approved by:	re (kensmith)
2008-01-26 22:13:30 +00:00
Alexander Motin 797142b381 MFC rev 1.71
Fix bundle xmit octets stats for packet-split operation mode.

Approved by:	re (kensmith)
2008-01-26 14:14:10 +00:00
Robert Watson be7a7240c4 Merge tcp_usrreq.c:1.167 from HEAD to RELENG_7_0:
tcp_usrreq.c:1.130 removed tcbinfo locking from tcp_usr_accept(), which
  while in principle a good idea, opened us up to a race inherrent to
  the syncache's direct insertion of incoming TCP connections into the
  "completed connection" listen queue, as it transpires that the socket
  is inserted before the inpcb is fully filled in by syncache_expand().
  The bug manifested with the occasional returning of 0.0.0.0:0 in the
  address returned by the accept() system call, which occurred if accept
  managed to execute tcp_usr_accept() before syncache_expand() had copied
  the endpoint addresses into inpcb connection state.

  Re-add tcbinfo locking around the address copyout, which has the effect
  of delaying the copy until syncache_expand() has finished running, as
  it is run while the tcbinfo lock is held.  This is undesirable in that
  it increases contention on tcbinfo further, but a more significant
  change will be required to how the syncache inserts new sockets in
  order to fix this and keep more granular locking here.  In particular,
  either more state needs to be passed into sonewconn() so that
  pru_attach() can fill in the fields *before* the socket is inserted, or
  the socket needs to be inserted in the incomplete connection queue
  until it is actually ready to be used.

  Reported by:    glebius (and kris)
  Tested by:      glebius

Approved by:	re (kensmith)
2008-01-26 13:57:33 +00:00
Marcus Alves Grando 2bb3e6c220 MFC: 1.430
- Add new NTP servers provided by NIC.br (http://www.ntp.br)
  - Remove nonfunctional servers

  PR:             119884
  Approved by:    simon

Approved by:	re (bmah)
2008-01-25 10:54:40 +00:00
Ulf Lilleengen 9320c26dae - Add geom_virstor to the module build.
PR:		kern/119902
Submitted by:	Yoshihiro Ota <ota -at- j.email.ne.jp>
Approved by:	re (kensmith), pjd (mentor)
2008-01-24 20:28:27 +00:00
John Baldwin 8d34407042 MFC: Don't cache the new-bus name of a PCI device in the PCI conf
structure.

Approved by:	re (kensmith)
2008-01-24 18:53:29 +00:00
John Baldwin a57f35aa34 MFC: Fix some minor issues such as using read/modify/write for updating
the configuration register and add a header file to hold HPET register
constants.

Approved by:	re (kensmith)
2008-01-24 18:52:26 +00:00
Christian Brueffer fbfdb91277 MFC: rev. 1.65
Document the 'maintainer' target.

Approved by:	re (kensmith)
2008-01-24 07:11:29 +00:00
Xin LI eebe675427 MFen 1.1068.2.20.2.2
Approved by:	re (kensmith)
2008-01-23 20:37:44 +00:00
Ken Smith dd8fad9331 MFC:
Add fsck_4.2bsd and fsck_ufs as hard links to fsck_ffs in /stand on
the MFS image so that (for example) "fsck /dev/ad0s1a" will work.
Without this you needed (for example) "fsck -t ffs /dev/ad0s1a" (or
needed to run fsck_ffs instead of fsck).

Versions being MFCed:

        1.62    src/release/amd64/boot_crunch.conf
        1.62    src/release/i386/boot_crunch.conf
        1.12    src/release/ia64/boot_crunch.conf
        1.63    src/release/pc98/boot_crunch.conf
        1.5     src/release/powerpc/boot_crunch.conf
        1.9     src/release/sparc64/boot_crunch.conf
        1.2     src/release/sun4v/boot_crunch.conf

Approved by:	re (bmah)
2008-01-23 20:22:48 +00:00
Ken Smith 39cb72a0ad MFC v1.12:
Update EDITOR and PAGER environment variables so they are correct for
the CDROM fixit environment.

Noticed by:     gallatin
Approved by:	re (bmah)
2008-01-23 20:06:27 +00:00
Robert Watson a7f6626427 Merge revisions 1.1 and 1.2 of the coda.4 man page from HEAD to RELENG_7_0:
Add a rather basic man page for the coda kernel module.

  Small fixes.

Approved by:	re (kensmith)
2008-01-23 12:22:11 +00:00
Robert Watson 5063049acf Merge a variety of Coda fixes from HEAD to RELENG_7_0:
coda_vnops.c:1.79:

  Borrow the VM object associated with an underlying cache vnode with the
  Coda vnode derived from it, in the style of nullfs.  This allows files
  in the Coda file system to be memory-mapped, such as with execve(2) or
  mmap(2).

  Reported by:    Rune <u+openafsdev-sr55 at chalmers dot se>

coda_vnops.c:1.80:

  Lock the new directory vnode returned by coda_mkdir(), as this is required
  by FreeBSD's vnode locking protocol.

coda_vnops.c:1.81:

  Use VOP_NULL rather than VOP_PANIC for Coda's vop_print routine, so as
  to avoid panicking in DDB show lockedvnods.

cnode.h:1.22, coda_namecache.h:1.12, coda_psdev.c:1.40, coda_vfsops.c:1.70:

  Don't declare functions as extern.

  Move all extern variable definitions to associated .h files, move some
  extern variable definitions between include files to place them more
  appropriately.

coda_vnops.c:1.82:

  Don't acquire an additional vnode reference to a vnode when it is opened
  and then release it when it is closed: we rely on the caller to keep the
  vnode around with a valid reference.  This avoids vrele() destroying the
  vnode vop_close() is being called from during a call to vop_close(), and
  a crash due to lockmgr recursing the vnode lock when a Coda unmount
  occurs.

coda_vfsops.c:1.71:

  Zero mi_rotovp and coda_ctlvp immediately after calling vrele() on the
  vnodes during coda_unmount() in order to detect errant use of them
  after the vnode references may no longer be valid.

  No need to clear the VV_ROOT flag on mi_rootvp flag (especially after
  the vnode reference is no longer valid) as this isn't done on other
  file systems.

coda_vfsops.c:

  Rework coda_statfs(): no longer need to zero the statfs structure or
  fill out all fields, just fill out the ones the file system knows
  about.  Among other things, this causes the outpuf of "mount" and
  "df" to make quite a bit more sense as /dev/cfs0 is specified as the
  mountfrom name.

coda_vnops.c:1.83:

  Improve default vnode operation handling for Coda:

  - Don't specify vnode operations for mknod, lease, and advlock--let them
    fall through to vop_default.

  - Implement vop_default with &default_vnodeops, rather than with
    VOP_PANIC, so that unimplemented vnode operations are handled in more
    sensible ways than panicking, such as EOPNOTSUPP on ACL queries
    generated by bsdtar, or mknod.

coda_namecache.h:1.13:

  Remove unused oldhash definition from Coda namecache.

coda_vnops.c:1.84:

  Replace references to VOP_LOCK() w/o LK_RETRY to vn_lock() with LK_RETRY,
  avoiding extra error handling, or in some cases, missing error handling.

  Discussed with: kib

coda_vnops.c:1.85:

  Put "coda_rdwr: Internally Opening" printf generated by in-kernel writes
  to files, such as ktrace output, under CODA_VERBOSE.  Otherwise, each
  such call to VOP_WRITE() results in a kernel printf.

  Obtained from:  NetBSD

Approved by:	re (kensmith)
2008-01-23 12:09:43 +00:00
Robert Watson 524d43e266 Merge uipc_usrreq.c:1.214 from HEAD to RELENG_7_0:
Move unlock of global UNIX domain socket lock slightly lower in
  unp_connect(): it is expected to return with the lock held, and two
  possible error paths otherwise returned with it unlocked.

  The fix committed here is slightly different from the patch in the
  PR, but along an alternative line suggested in the PR.

  PR:             119778
  Submitted by:   James Juran <james dot juran at baesystems dot com>

Approved by:	re (gnn)
2008-01-23 12:08:12 +00:00
Jung-uk Kim d41b57e296 MFC: 1.26
Check battery presence first before trying to get battery information.

Approved by:	re (kensmith)
2008-01-23 00:15:22 +00:00
Bruce A. Mah af1845a999 New release notes: SA-08:01, SA-08:02. Bump copyright date.
Approved by:	re (implicitly)
2008-01-22 23:05:26 +00:00
Jung-uk Kim 8f2d8624bd MFC: 1.201
Fix mbuf pool watermark configuration.

Approved by:	re (kensmith)
2008-01-22 17:30:13 +00:00
cvs2svn 0438fc0b57 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2008-01-22 07:40:23 +00:00
Christian Brueffer c8ee4e95ae MFC: rev. 1.12
Remove files conditional on the obsolete MK_FORTRAN knob.  They are already
listed in ObsoleteFiles.inc anyway.

Approved by:	re (kensmith), rwatson (mentor)
2008-01-21 22:02:21 +00:00
Christian Brueffer fc78806aed MFC: rev. 1.72
Remove remnants of old *_FORTRAN build flags.

Approved by:	re (kensmith), rwatson (mentor)
2008-01-21 22:00:25 +00:00
Christian Brueffer 2df5c59335 MFC: rev. 1.592
Remove WITHOUT_FORTRAN from the XMAKE target, it doesn't exist anymore.

Approved by:	re (kensmith), rwatson (mentor)
2008-01-21 21:58:55 +00:00
Christian Brueffer e5bc3ff47f MFC:
WITHOUT_FORTRAN was removed some time ago.  Regen src.conf.5.

Approved by:	re (kensmith), rwatson (mentor)
2008-01-21 21:56:02 +00:00
Konstantin Belousov 263a670dd4 MFC rev. 1.156:
In the rev. 1.153, the one place for converting minor number to unit
was missed. As result, pty_create_slave() may index out of the names[]
bounds, creating wrong slave tty names.

Approved by:	re (kensmith)
2008-01-21 12:57:18 +00:00
Craig Rodrigues ba9c1d252c MFC: 1.270
- In vfs_scanopt(), make sure that the mount option value is not NULL
   before calling vsscanf().

PR:             118531

MFC: 1.268
  - Internally convert "rdonly" mount option to "ro".

Approved by:    re (kensmith)
2008-01-20 02:38:42 +00:00
Nate Lawson dec9ed20c8 MFC 1.28,1.29: reject cpufreq changes before sched_bind() is usable and
remove duplicated levels.

Approved by:	re
2008-01-19 20:31:00 +00:00
Konstantin Belousov d1d0d592d0 MFC fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

The reason for MFCing this so late in release cycle is, according to
marius@, because
> it fixes the crashing (though no panic) of the test suite
> of the graphic/OpenEXR port on sparc64. This test suite is run
> (and required to succeed) during the package build and that's
> why portmgr@ bitch about at it as OpenEXR is a dependency of KDE
> which in turn is supposed to end up on the release CD images.

Revisions MFCed:
  1.677     of      src/sys/amd64/amd64/machdep.c
  1.592     of      src/sys/amd64/amd64/pmap.c
  1.88      of      src/sys/arm/arm/pmap.c
  1.27      of      src/sys/arm/at91/kb920x_machdep.c
  1.22      of      src/sys/arm/sa11x0/assabet_machdep.c
  1.8       of      src/sys/arm/xscale/i80321/ep80219_machdep.c
  1.29      of      src/sys/arm/xscale/i80321/iq31244_machdep.c
  1.3       of      src/sys/arm/xscale/i8134x/crb_machdep.c
  1.6       of      src/sys/arm/xscale/ixp425/avila_machdep.c
  1.41      of      src/sys/compat/pecoff/imgact_pecoff.c
  1.26      of      src/sys/compat/svr4/imgact_svr4.c
  1.660     of      src/sys/i386/i386/machdep.c
  1.596     of      src/sys/i386/i386/pmap.c
  1.68      of      src/sys/i386/ibcs2/imgact_coff.c
  1.56      of      src/sys/i386/linux/imgact_linux.c
  1.226     of      src/sys/ia64/ia64/machdep.c
  1.192     of      src/sys/ia64/ia64/pmap.c
  1.102     of      src/sys/kern/imgact_aout.c
  1.179     of      src/sys/kern/imgact_elf.c
  1.56      of      src/sys/kern/imgact_gzip.c
  1.310     of      src/sys/kern/kern_exec.c
  1.287     of      src/sys/kern/kern_fork.c
  1.236     of      src/sys/kern/kern_kse.c
  1.253     of      src/sys/kern/kern_proc.c
  1.352     of      src/sys/kern/kern_sig.c
  1.63      of      src/sys/kern/kern_thr.c
  1.257     of      src/sys/kern/kern_thread.c
  1.397     of      src/sys/pc98/pc98/machdep.c
  1.104     of      src/sys/powerpc/powerpc/machdep.c
  1.10      of      src/sys/powerpc/powerpc/pmap_dispatch.c
  1.139     of      src/sys/sparc64/sparc64/machdep.c
  1.167     of      src/sys/sparc64/sparc64/pmap.c
  1.16      of      src/sys/sun4v/sun4v/machdep.c
  1.40      of      src/sys/sun4v/sun4v/pmap.c
  1.493     of      src/sys/sys/proc.h
  1.78      of      src/sys/sys/signalvar.h
  1.80      of      src/sys/vm/pmap.h
  1.79      of      src/sys/vm/vm_extern.h
  1.226     of      src/sys/vm/vm_glue.c
  1.390     of       src/sys/vm/vm_map.c

Requested by:	marius
Tested by:	Peter Holm, marius (make universe and sparc64 runs)
Approved by:	re (kensmith)
2008-01-19 18:15:07 +00:00
Konstantin Belousov 2044a6a462 MFC rev. 1.52:
The ffs_balloc() routines, whan allocating the indirect blocks for
the inode, do the rollback in case the allocation failed (due to
insufficient free space or quota limits). But, the code does leaves the
buffers corresponding to the inoirect blocks on the vnode bufobj list.
This causes several assertion failures (for instance, "ffs_truncate3"
in ffs_truncate()) to fail, and could result in the indirect block
aliasing problem, like writing the context of such blocks to random
disk location.

Remove the buffers from the bufobj properly.

MFC rev. 1.53:
ffs_balloc_ufsX() routines, in the case of recovering from the failed
allocation, free the indirect blocks before clearing the disk pointers,
that could lead to the softupdate inconsistencies in the case of the
machine or disk crash at the wrong time.

Rearrange the recover code to do the ffs_blkfree() after the second
ffs_syncvnode(), that clears the pointers chain.

Approved by:	re (kensmith)
2008-01-19 18:12:25 +00:00
cvs2svn f86934faa8 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2008-01-18 05:06:00 +00:00
Robert Watson ec57f9e314 Merge uipc_sem.c:1.30 from RELENG_7 to RELENG_7_0:
Free MAC label on a POSIX semaphore when the semaphore is freed.

  Submitted by:   jhb

Approved by:	re (kensmith)
2008-01-17 19:52:01 +00:00
Pawel Jakub Dawidek 496f0a126b MFC: sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c 1.4
Call zil_commit() (if ZIL is not disabled) after every non-read request
(BIO_WRITE and BIO_FLUSH) as it is done is Solaris. The difference is
that Solaris calls it only for sync requests, but we can't say in GEOM
if the request is sync or async, so we do it for every request.

Approved by:	re (gnn)
2008-01-17 14:59:26 +00:00
Pawel Jakub Dawidek 68c7ff1337 MFC: sys/contrib/opensolaris/uts/common/fs/zfs/vdev.c 1.4
Close access to vdev when setting state to anything but open state.
This fixes replacing drive in place, eg. zpool replace tank da1 da1.
Before the fix, it complained that device is already open.

Obtained from:	OpenSolaris
Approved by:	re (gnn)
2008-01-17 14:58:49 +00:00
Pawel Jakub Dawidek 25a9a41ea9 MFC: sys/vm/vm_kern.c 1.131
When one tries to allocate memory with the M_WAITOK flag and we are short in
address space in kmem map call vm_lowmem event in a loop and wait a bit for
subsystems to reclaim some memory which in turn will reclaim address space as
well.

Note, this is a work-around.

Reviewed by:	alc
Approved by:	alc
Approved by:	re (gnn)
2008-01-17 14:57:50 +00:00
Olivier Houchard ba668a1c0b MFC rev 1.14:
Back when I committed the arm port, I've been asked to move
memcpy/memset/memcmp and friends from libkern/arm to arm/arm/support.S, and so
I did, but in the process, I didn't add the appropriate copyrights.
This is a major oversight from me, and I apology to the NetBSD people for it.

Approved by:	re (mux)
2008-01-16 22:45:03 +00:00
Nate Lawson 53bc044a5d MFC: queue an asynch handler to re-enable a level-triggered GPE
Approved by:	re
2008-01-16 01:22:15 +00:00
Colin Percival c1f1f5d49e Fix date of last advisory -- January 14th, not January 18th.
Approved by:	re (kensmith)
2008-01-15 23:37:07 +00:00
John Baldwin dd38cd7054 MFC: Use a dummy interrupt handler to work around lpt(4) interrupt
problems.

Approved by:	re (gnn)
2008-01-15 22:28:15 +00:00
Andrew Gallatin b573f27291 MFC: Update to firmware version 1.4.29 from 1.4.25
Approved by: re (kensmith)
2008-01-15 17:59:15 +00:00
Colin Percival ff94fecee5 Fix issues which allow snooping on ptys. [08:01]
Fix an off-by-one error in inet_network(3). [08:02]

Security: FreeBSD-SA-08:01.pty
Security: FreeBSD-SA-08:02.libc
Approved by:	re (kensmith)
2008-01-14 22:57:45 +00:00
Christian Brueffer 39955554ac Remove a dublicate complete copy of the manpage. No MFC as the version
in HEAD is ok.

Submitted by:	pluknet
Approved by:	re (hrs)
2008-01-14 21:50:06 +00:00
Ken Smith 9399da327e MFC: dist.c v1.254, dist.h v1.72, menus.c v1.429, sysinstall.h v1.275
> Change sysinstall's handling of X11 stuff.  Doing it in pieces was
> probably the right thing to do a while ago but xorg has progressed
> to the point that for novice users (who are the ones expected to think
> installing X11 during an install...) it's best to just install the
> whole x11/xorg metaport for them.  This removes the X11 sub-menus
> and sets it up so you just select whether or not you want X11.  While
> here garbage collect an X11 configuration menu I missed removing when
> I removed support for attempting xorg configuration from inside sysinstall
> a while ago.

Approved by:    re (hrs)
2008-01-14 19:28:43 +00:00
Ken Smith b20de944bc MFRELENG_7 v1.16.2.3
> Add the various packages we've ejected from the CD sets through
> recent years back on disc3.

Approved by:    re (hrs)
2008-01-14 17:31:35 +00:00
Doug Barton 5fd1b63742 MFC the change from 1.27, removal of zones from the empty zone list that
may theoretically be allocated some day.

Approved by:	re (kensmith)
2008-01-13 20:51:09 +00:00
John Baldwin ebad0ab421 MFC: Close a race in the kern.ttys sysctl handler that resulted in panics
in dev2udev().

Approved by:	re (gnn)
2008-01-12 00:20:06 +00:00
John Baldwin b6b1755b57 MFC: Lock the vnode interlock while reading v_usecount to update
si_usecount in a cdev in devfs_reclaim().

Approved by:	re (gnn)
2008-01-12 00:13:33 +00:00
John Baldwin 376081cbeb MFC: Only use sockoptname() to parse socket option names for SOL_SOCKET
requests.

Approved by:	re (gnn)
2008-01-12 00:07:50 +00:00
Marius Strobl f715124c6a MFC: 1.25
Fix some bugs in the FreeBSD 4/5/6 pci(4) IOCTLs compatibility code:
- Use the correct offsets when copying out the results of PCIOCGETCONF_OLD.
  This happened to not affect the 64-bit architectures because there the
  addition of pc_domain to struct pcisel didn't change the overall size of
  struct pci_conf.
- Always copy the name and unit information to conf_old so it's also part
  of the output once this information is cached in dinfo.
- Use the correct type for flags in struct pci_match_conf_old. This
  change is more or less cosmetic though.

Approved by:	re (gnn)
2008-01-09 21:45:37 +00:00
Alexander Motin 6c55177060 MFC rev. 1.22
Increase control channel xmit queue to 128 packets.
Previous value 16 was too small for real LAC as temporal activity
spike cound easily overflow queue demanding tunnel disconnection due
to possible state inconsistency.

Approved by:	re (gnn)
2008-01-09 19:55:51 +00:00
John Baldwin d7b985d990 MFC: Update the shlib version for libgssapi_krb5.
Approved by:	re (kensmith)
2008-01-09 18:00:51 +00:00
Konstantin Belousov 66efc31684 MFC rev. 1.89, 1.90:
Apply the LCONVPATH() to the (old) linux_stat() and linux_lstat() syscalls.

Approved by:	re (kensmith)
2008-01-09 16:03:02 +00:00
Konstantin Belousov 82b64d7b3b MFC rev. 1.392:
In the vm_map_stack(), check for the specified stack region wraparound.

Approved by:	re (kensmith)
2008-01-09 15:59:15 +00:00
Maxime Henrion 736af7c0d0 MFC [email protected] and [email protected]:
Add a workaround for a deadlock between the rt_setgate() and rt_check()
  functions.  It is easily triggered by running routed, and, I expect, by
  running any other daemon that uses routing sockets.

Approved by:    re (kensmith)
2008-01-09 15:23:36 +00:00
Xin LI 5bcb0d6f32 MFC important fixes by sos@:
Implement a workaround of the datacorruption problem on ServerWorks
HT1000 chipsets.  The HT1000 DMA engine seems to not always like 64K
transfers and sometimes barfs data all over memory leading to instant
chrash and burn.

Also fix 48bit adressing issues, apparently newer chips needs 16bit
writes and not the usual fifo thing.

HW donated by:	Travis Mikalson at TerraNovaNet
Original work:	sos
Approved by:	re (kensmith)
2008-01-09 08:55:10 +00:00
Gabor Kovesdan ffaeb38171 MFC r1.5:
- This driver will first appear in FreeBSD 6.3, not 7.0

Approved by:	re (hrs)
2008-01-08 15:37:57 +00:00
Henrik Brix Andersen 603ed752a9 MFC:
- src/sys/dev/usb/usb_quirks.c (revision 1.64)
- src/sys/dev/usb/usbdevs (revision 1.333)

Update quirks for the MetaGeek Wi-Spy 1A, 1B and 2.4x.

Approved by:	re (kensmith), erwin (mentor)
2008-01-07 23:12:45 +00:00
John Baldwin 782c339cc3 MFC: Fix a typo in regards to the ENOENT error.
Approved by:	re (hrs)
2008-01-07 21:29:29 +00:00
John Baldwin 77d4e09ffb MFC: Use devclass_get_count() instead of devclass_get_maxunit().
Approved by:	re (hrs)
2008-01-07 21:27:50 +00:00
Henrik Brix Andersen d95a02d264 MFC: (revision 1.2)
Add reload functionality.

Approved by:	re (kensmith), erwin (mentor)
2008-01-07 21:15:45 +00:00
Xin LI a45ddb5079 Reflect the fact that tzdata was updated to 2007k.
Approved by:	re (bmah)
2008-01-07 19:41:13 +00:00
Gabor Kovesdan c5c4528e84 MFC r1.10:
- ipmi(4) appeared in FreeBSD 6.2, not in 6.3

Approved by:	re (hrs)
2008-01-07 14:53:59 +00:00
Peter Wemm 06fd214a87 MFC: rev 1.4: forward compatability with cvs-1.12 repository
Approved by: re (kensmith)
2008-01-07 09:08:53 +00:00
Edwin Groothuis 66f1289531 MFC of tzdata2007k.
Approved by:	re (ken smith)
2008-01-06 07:36:08 +00:00
Edwin Groothuis d9d4c110d6 Update iso3166 with the data from Newsletter VI-1 2007-09-21:
Added SAINT BARTHELEMY (BL) and SAINT MARTIN (MF).

MFC of rev 1.17

Approved by: re (ken smith)
2008-01-06 07:25:43 +00:00
Marius Strobl d8ff91e4d0 Merge from RELENG_7: 1.1.1.8.2.1
On FreeBSD GCC 4.2.x checks for the existence of pthread_cancel() in
order to determine whether a program is running with multithreading
support. This check causes __gthread_active_p() to always return 1
however, regardless of whether the program was actually compiled with
-pthread or not, due to the fact that the FreeBSD libc contains a
pthread_cancel() stub. Fix this by using the __gthread_active_p()
version that GCC uses for Solaris and which actively checks for a
working POSIX threads implementation (if such functions exist) instead
of checking for the mere existence of corresponding functions.

On platforms without TLS support, i.e. on arm and sparc64 due to the
lack of GNU TLS support for these archs in binutils 2.15., the false
positives returned by __gthread_active_p() for non-threaded programs
cause the exception handling implementation GCC uses in this case to
crash. This is because GCC assumes that the POSIX threading functions
actually work when __gthread_active_p() returns 1 while in fact the
corresponding stubs in libc just immediately return.
Given that __gthread_active_p() is also used in a couple of other
places besides exception handling, this bug has great potential to
also cause problems in other areas and on all archs.

Approved by:	re (kensmith)
2008-01-05 23:04:59 +00:00
Gabor Kovesdan 181646a467 MFC
r1.62:
- Document icase variable of make search, which can be used to control
  case-sensitivity
r1.63:
- Document PORT_DBDIR
r1.64:
- Remove incomplete sentence fragment

Approved by:	re (hrs)
2008-01-04 13:33:01 +00:00
Gabor Kovesdan f38e825599 MFC r1.39
- Adjust INDEX file name to INDEX-7 so that it matches the major FreeBSD
  version number, as it is named after that

Approved by:	re (hrs)
2008-01-04 13:22:09 +00:00
Gabor Kovesdan 47cabd0773 MFC r1.7
- This driver has already appeared in 6.2

Approved by:	re (hrs)
2008-01-04 13:15:02 +00:00
Gabor Kovesdan ae29be00e1 MFC r1.4
- This driver will first appear in 6.3, not 7.0

Approved by:	re (hrs)
2008-01-04 13:14:32 +00:00
Gabor Kovesdan adadd0aebe MFC r1.13
- This driver will first appear in 6.3, not 7.0

Approved by:	re (hrs)
2008-01-04 13:14:06 +00:00
Gabor Kovesdan defc39cad7 MFC r1.3
- This driver will first appear in 6.3, not 7.0

Approved by:	re (hrs)
2008-01-04 13:13:44 +00:00
Gabor Kovesdan e2e63530e0 MFC r.18
- This driver will first appear in 6.3, not 7.0

Approved by:	re (hrs)
2008-01-04 13:12:47 +00:00
Gabor Kovesdan 3c12f2c559 MFC r1.9
- This driver will first appear in 6.3, not 7.0

Approved by:	re (hrs)
2008-01-04 13:12:19 +00:00
Gabor Kovesdan d428bd79fe MFC r1.2
- This driver will first appear in 6.3, not 7.0

Approved by:	re (hrs)
2008-01-04 13:11:59 +00:00
Konstantin Belousov eac612218e MFC rev. 1.107:
Plug the leaks in the present implementation of the linux_openat().

Approved by:	re (kensmith)
2008-01-04 04:56:07 +00:00
Konstantin Belousov 23be48af29 MFC rev. 1.106:
Do not allow the SNPSTTY ioctl for the snoop device that has a tty
attached. Otherwise, the snp->snp_tty would be overwritten, while the
tty line discipline still set to the snpdisc. Then snplwrite() causes
panic because ttytosnp() cannot find the snp. (And do it at the proper
place, from rev. 1.107).

MFC rev. 1.107:
The snp_target == NULL implies the snp_tty == NULL. Remove the code
that is put under snp_target == NULL and snp_tty != NULL clause.

In snpclose(), do the snp_detach() before scheduling the snp device
destruction. Otherwise, after the return from snpclose(), the snp
device is already removed from the snp_list, but tty is still in
snooped state. Any attempt to do i/o on such tty cause panic because
ttytosnp() returns NULL.

Approved by:	re (kensmith)
2008-01-04 04:53:21 +00:00
Warner Losh e639d6a298 MFC new year
Approved by: re@
2008-01-01 09:36:30 +00:00
John Baldwin b9e8ce33bf MFC: Clean up some of the pts(4) vs pty(4) stuff in grantpt(3) and friends.
Approved by:	re (gnn)
2007-12-31 17:39:24 +00:00
Andrew Thompson 8ed7efb349 MFC r1.8
Fix a panic where if the mbuf was consumed by the filter for requeueing
  (dummynet), ipsec_filter() would return the empty error code and the ipsec
  code would continue to forward/deference the null mbuf.

Approved by:	re (gnn)
2007-12-29 17:29:11 +00:00
Randall Stewart 50c731d76d - sctp-iterator should run at PI_NET priority ...not 0.
Approved by:	[email protected](gnn)
2007-12-29 15:07:54 +00:00
Ken Smith 00170154da MFC v1.117:
> Plug a memory leak.  Once any given package (e.g. perl) was installed
> we would leak a saved screen for every other package we tried to install
> that listed perl as one of its dependencies.  When installing things
> like gnome and kde that wound up being a LOT of leaked memory.

Approved by:	re (bmah)
2007-12-29 06:17:39 +00:00
Ken Smith 13a8dfbcde MFC v1.78 and v1.79:
Remove process limits for datasize and stacksize which are unlimited
during a "normal login" (thanks to /etc/login.conf) but not when
sysinstall is running as part of an installation.  Fixups for error
messages and a comment that became untrue.

Approved by:	re (bmah)
2007-12-29 06:17:04 +00:00
Bruce A. Mah 4a68dc7fcc Version number bumps for 7.0-RELEASE release documentation.
Approved by:	re (implicitly)
2007-12-27 19:34:32 +00:00
Warner Losh 26cfc8a825 MFC: Update to 2008.
Approved by: re@ (kensmith)
2007-12-26 16:49:12 +00:00
Ken Smith a70dcd4c90 MFC v1.116:
> For the INDEX file to be used on disc1 of the 7.0-RELEASE the longest
> "build dependencies" field is 5,108 characters which overflows the
> length of the junk buffer by a teeny bit.  This whole section needs
> much more error checking but for now just completely ignore stuff
> we have no interest in instead of copying it to someplace we don't
> use in the process.

Approved by:    re (bmah)
2007-12-24 06:42:35 +00:00
Doug Barton f3b38a8f52 MFC version 1.55, safety belt for the (unlikely) disappearance of
the temproot before a -r run.

Approved by:	re (kensmith)
2007-12-24 06:33:22 +00:00
Marius Strobl fa4cc34e04 MFC: 1.8
In openprom_ioctl() ensure appropriate permissions and that data isn't
NULL and doesn't point to a NULL pointer before dereferencing it.

Approved by:	re (kensmith)
2007-12-23 11:31:24 +00:00
Robert Watson 8ddae67c7d Merge in_pcb.c:1.196.2.1 from RELENG_7 to RELENG_7_0:
When IPSEC fails to allocate policy state for an inpcb, and MAC is in use,
  free the MAC label on the inpcb before freeing the inpcb.

  Submitted by:   tanyong <tanyong at ercist dot iscas dot ac dot cn>,
                  zhouzhouyi

Approved by:	re (kensmith)
2007-12-22 20:54:46 +00:00
Ken Smith 23152f69a9 Get ready for 7.0-RC1 builds.
Approved by:	re (implicit)
2007-12-22 13:46:15 +00:00
Ken Smith 210c9941a4 Update directories to search for packages in.
Approved by:	re (implicit)
2007-12-22 13:45:15 +00:00
Ken Smith 8e02d0e34e Update src branch tag.
Approved by:	re (implicit)
2007-12-22 13:39:03 +00:00
Ken Smith d1214f7fa9 Update branch tag for 'make update'.
Approved by:	re (implicit)
2007-12-22 13:34:43 +00:00
cvs2svn ca0202a548 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-12-22 06:32:46 +00:00
cvs2svn 6b0086231a This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-12-18 00:36:22 +00:00
cvs2svn a0dd3a4a26 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-12-02 09:12:04 +00:00
cvs2svn 507c62c1e0 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-11-30 05:11:59 +00:00
cvs2svn 36e5e37f4b This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-11 12:34:41 +00:00
cvs2svn fb687ff857 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-11 06:26:20 +00:00
cvs2svn 860eb9060c This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:38 +00:00
cvs2svn f05f8b2c0a This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:37 +00:00
cvs2svn e97dd3a19c This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:36 +00:00
cvs2svn ea9db834af This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:35 +00:00
cvs2svn 5ebdb7288b This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:34 +00:00
cvs2svn e5be0015b3 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:33 +00:00
cvs2svn b63b29ce52 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:32 +00:00
cvs2svn b87fe5d509 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:31 +00:00
cvs2svn 111ffdbefe This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:30 +00:00
cvs2svn 0db15beb52 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:29 +00:00
cvs2svn 596c85c684 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:28 +00:00
cvs2svn 110c4497b3 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:27 +00:00
cvs2svn 48d7844109 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:26 +00:00
cvs2svn 4f2b812354 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:25 +00:00
cvs2svn c634999a01 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:24 +00:00
cvs2svn 886d3dc28d This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:23 +00:00
cvs2svn 7bd6fcaf56 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:22 +00:00
cvs2svn b606aa9c81 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:21 +00:00
cvs2svn 367002cf4d This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:20 +00:00
cvs2svn 0698aa3ad9 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:19 +00:00
cvs2svn ab83b9eb20 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:18 +00:00
cvs2svn 3649fa51f5 This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:17 +00:00
cvs2svn a2c65d8ffe This commit was manufactured by cvs2svn to create branch 'RELENG_7_0'. 2007-10-10 16:59:16 +00:00
430 changed files with 38257 additions and 53460 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (C) 1992-2007 The FreeBSD Project. All rights reserved.
Copyright (C) 1992-2008 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
+2 -2
View File
@@ -85,7 +85,7 @@ CLEANDIR= cleandir
.endif
CVS?= cvs
CVSFLAGS?= -r RELENG_7 -P -d -I!
CVSFLAGS?= -r RELENG_7_0 -P -d -I!
SUP?= /usr/bin/csup
SUPFLAGS?= -g -L 2
.if defined(SUPHOST)
@@ -220,7 +220,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
# cross-tools stage
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
-DWITHOUT_FORTRAN -DWITHOUT_GDB
-DWITHOUT_GDB
# world stage
WMAKEENV= ${CROSSENV} \
+3
View File
@@ -14,6 +14,9 @@
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
#
# 20080126: oldcard.4 removal
OLD_FILES+=usr/share/man/man4/card.4.gz
OLD_FILES+=usr/share/man/man4/oldcard.4.gz
# 20071207: Merged with fortunes-o.real
OLD_FILES+=usr/share/games/fortune/fortunes2-o
OLD_FILES+=usr/share/games/fortune/fortunes2-o.dat
+10
View File
@@ -8,6 +8,16 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before running
portupgrade.
20080226:
FreeBSD 7.0-RELEASE
20080214: FreeBSD-SA-08:02.sendfile
Fix sendfile(2) write-only file permission bypass.
20080114: FreeBSD-SA-08:01.pty, FreeBSD-SA-08:02.libc
Fix issues which allow snooping on ptys. [08:01]
Fix an off-by-one error in inet_network(3). [08:02]
20071126:
The AT keyboard emulation of sunkbd(4) has been turned on
by default. In order to make the special symbols of the Sun
-80
View File
@@ -1,80 +0,0 @@
.\" Copyright (c) 2002 Marcel Moolenaar
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 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.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd September 7, 2005
.Dt UUIDGEN 1
.Os
.Sh NAME
.Nm uuidgen
.Nd generate universally unique identifiers
.Sh SYNOPSIS
.Nm
.Op Fl 1
.Op Fl n Ar count
.Op Fl o Ar filename
.Sh DESCRIPTION
The
.Nm
utility by default generates a single DCE version 1
universally unique identifier (UUID),
also known as a globally unique identifier (GUID).
The UUID is written to stdout by default.
The following options can be used to change the behaviour of
.Nm :
.Bl -tag -width indent
.It Fl 1
This option only has effect if multiple identifiers are to be generated and
instructs
.Nm
to not generate them in batch, but one at a time.
.It Fl n
This option controls the number of identifiers generated.
By default, multiple
identifiers are generated in batch.
.It Fl o
Redirect output to
.Ar filename
instead of stdout.
.El
.Pp
Batched generation yields a dense set of identifiers in such a way that there
is no identifier that is larger than the smallest identifier in the set and
smaller than the largest identifier in the set and that is not already in the
set.
.Pp
When generating the identifiers one at a time, the identifiers will be close
to each other, but operating system latency and processing time will be
reflected in the distance between two successive identifiers.
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
.Xr uuidgen 2 ,
.Xr uuid 3
.Sh HISTORY
The
.Nm
command first appeared in
.Fx 5.0 .
-113
View File
@@ -1,113 +0,0 @@
/*
* Copyright (c) 2002 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <uuid.h>
static void
usage(void)
{
(void)fprintf(stderr, "usage: uuidgen [-1] [-n count] [-o filename]\n");
exit(1);
}
int
main(int argc, char *argv[])
{
FILE *fp;
uuid_t *store, *uuid;
char *p;
int ch, count, i, iterate;
count = -1; /* no count yet */
fp = stdout; /* default output file */
iterate = 0; /* not one at a time */
while ((ch = getopt(argc, argv, "1n:o:")) != -1)
switch (ch) {
case '1':
iterate = 1;
break;
case 'n':
if (count > 0)
usage();
count = strtol(optarg, &p, 10);
if (*p != 0 || count < 1)
usage();
break;
case 'o':
if (fp != stdout)
errx(1, "multiple output files not allowed");
fp = fopen(optarg, "w");
if (fp == NULL)
err(1, "fopen");
break;
default:
usage();
}
argv += optind;
argc -= optind;
if (argc)
usage();
if (count == -1)
count = 1;
store = (uuid_t*)malloc(sizeof(uuid_t) * count);
if (store == NULL)
err(1, "malloc()");
if (!iterate) {
/* Get them all in a single batch */
if (uuidgen(store, count) != 0)
err(1, "uuidgen()");
} else {
uuid = store;
for (i = 0; i < count; i++) {
if (uuidgen(uuid++, 1) != 0)
err(1, "uuidgen()");
}
}
uuid = store;
while (count--) {
uuid_to_string(uuid++, &p, NULL);
fprintf(fp, "%s\n", p);
free(p);
}
free(store);
if (fp != stdout)
fclose(fp);
return (0);
}
-69
View File
@@ -1,69 +0,0 @@
Am-utils Frequently Asked Questions
Note: we started this FAQ only on March 15, 2005; so it's not long or
comprehensive, yet. Amd is much older than that, and so there's a lot of
information that's already available in other forms. If this FAQ doesn't
answer your questions, see information in the following sources:
1. The Am-utils book: http://www.am-utils.org/docs/amd-book/
2. The Am-utils user manual, which is part of the distribution and is also
available from www.am-utils.org.
3. The www.am-utils.org Web site resources, especially the "am-utils" mailing
list (and its archives).
4. In the am-utils distribution (always use the latest ones), see all of the
various README files (README, README.autofs, README.ldap, README.osx, and
README.y2k). The "BUGS" file also lists useful information about bugs
and problems with specific OSs which affect Amd. All of these text files
are also available from www.am-utils.org.
5. Some FAQ questions (including newbie questions) are available here:
http://www.kernelcorp.com/resources_faqs.html
6. Some problems are known bugs but have not been fixed yet: this are
listed in bugzilla in https://bugzilla.am-utils.org/
If you have additions to this FAQ, please let us know at
[email protected].
Thank you,
The Am-utils development team.
<FAQ>
*** Linux Questions
Q1. When I use Amd with Autofs and I restart Amd, how come it cannot remount
the Autofs partitions?
A1. This is a limitation of the Linux Autofs kernel module (for both autofs
v2. and v3). The Linux Autofs does not allow restarting automounted
points. There's nothing Amd can do about this. In fact, the same
problem exists if you use the userland "automount" daemon instead of
Amd. Hopefully Autofs-v4 or the separate effort of Autofs-NG will
address this serious problem.
Note that Amd itself can restart autofs automounted points just fine on
OSs that support it, for example Solaris.
Q2. When I use Amd, I get this console message frequently: "mount version
older than kernel." Is it a problem?
A2. No, it's a harmless warning message that the Linux kernel prints for NFS
mounts. The intent was to alert administrators that the kernel has
supposedly a different version of the mount(2) code than a userland
program used. This happens if you compile Amd against kernel headers
that are different than the kernel you're running. If the message
really bothers you, then one way to "fix" the problem is to recompile
Amd against the same kernel headers as the running kernel.
Nevertheless, it is a relatively useless message because as far as we
know, the NFS v2 and v3 mount codes have been in perfect sync between
the userland and kernel sides, and were "standardized" for years
already. This warning message caused more unnecessary worry among
administrators than helping alert them to legitimate problems.
</FAQ>
-129
View File
@@ -1,129 +0,0 @@
NFS Attribute Caching OS Problems and Amd
Last updated September 18, 2005
* Summary:
Some OSs don't seem to have a way to turn off the NFS attribute cache, which
breaks the Amd automounter so badly that it is not recommend using Amd on
such OS for heavy use, not until this is fixed.
* Details:
Amd is a user-level NFSv2 server that manages automounts of all other file
systems. The kernel contacts Amd via RPCs, and Amd in turn performs the
actual mounts, and then responds back to the kernel's RPCs. Every kernel
caches attributes of files, in a cache called the Directory Name Lookup
Cache (DNLC), or a Directory Cache (dcache).
Amd manages its namespace in the user level, but the kernel caches names
itself. So the two must coordinate to ensure that both namespaces are in
sync. If the kernel uses a cached entry from the DNLC, without consulting
Amd, users may see corruption of the automounter namespace (symlinks
pointing to the wrong places, ESTALE errors, and more). For example,
suppose Amd timed out an entry and removed the entry from Amd's namespace.
Amd has to tell the kernel to purge its corresponding DNLC entry too. The
way Amd often does that is by incrementing the last modification time
(mtime) of the parent directory. This is the most common method for kernels
to check if their DNLC entries are stale: if the parent directory mtime is
newer, the kernel will discard all cached entries for that directory, and
will re-issue lookup methods. Those lookups will result in
NFS_GETATTR/NFS_LOOKUP calls sent from the kernel down to Amd, and Amd can
then properly inform the kernel of the new state of automounted entries.
In order to ensure that Amd is "in charge" of its namespace without
interference from the kernel, Amd will try to turn off the NFS attribute
cache. It does so by using the NFSMNT_NOAC flag, if it exists, or by
setting various "cache timeout" fields in struct nfs_args to 0 (acregmin,
acregmax, acdirmin, or acdirmax).
We have released a major new version of am-utils, version 6.1, in June 2005.
Since then, a lot of people have experimented with Amd, in anticipation of
migrating from the very old am-utils 6.0 to the new 6.1. For a couple of
months since the release of 6.1, we have received reports of problems with
Amd, especially under heavy use. Users reported getting ESTALE errors from
time to time, or seeing automounted entries whose symlinks don't point to
where it should be. After much debugging, we traced it to a few places in
Amd where it wasn't updating the parent directory mtime as it should have;
in some places where Amd was indeed updating the mtime, it was using a
resolution of only 1 second, which was not fine enough under heavy load. We
fixed this problem and switched to using a microsecond resolution mtime.
After fixing this in Amd, we went on to verify that things work for other
OSs. When we got to test certain BSDs, we found out that they always cache
directory entries, and there is no way to turn it off completely.
Specifically, if we set the ac{reg,dir}{min,max} fields in struct nfs_args
all to zero, the kernel seems to cache the entries for a default number of
seconds (something like 5-30 seconds). On some OSs, setting these four
fields to 0 turns off the attribute cache, but not on some BSDs. We were
able to verify this using Amd and a script that exercises the interaction of
the kernel's attrcache and Amd. (If you're interested, the script can be
made available.)
We then experimented by setting the ac{reg,dir}{min,max} fields in struct
nfs_args all to 1, the smallest non-zero value we could. When we ran the
Amd exercising script, we found that the value of 1 reduced the race between
the DNLC and Amd, and the script took a little longer to run before it
detected an incoherency. That makes sense: the smaller the DNLC cache
interval is, the shorter the window of vulnerability is. (BTW, the man
pages on some OSs say that the ac{reg,dir}{min,max} fields use a 1 second
resolution, but experimentation indicated it was in 0.1 second units.)
Clearly, setting the ac{reg,dir}{min,max} fields to 0 is worse than setting
it to 1 on those OSs that don't have a way to turn off the attribute cache.
So the current workaround I've implemented in am-utils is to create a
configuration parameter called "broken_attrcache" which, if turned on, will
set these nfs_args fields to 1 instead of 0. I wish I didn't have to create
such ugly workaround features in Amd, but I've got no choice.
The near term solution is for every OS to support a true 'noac' flag, which
can be added fairly easily. This'd make Amd work reliably.
The long term solution is to implement Autofs support for all OSs and to
support it in Amd. Currently, Amd supports autofs on Solaris and Linux;
FreeBSD is next. Still, we found that even with autofs support, many
sysadmins still prefer to use the good 'ol non-autofs mode.
* Confirmed Status
This is the confirmed status of various OSs' vulnerability to this attribute
cache bug. We are slowly checking the status of other OSs. The status of
any OS not listed is unknown as of the date at the top of this file.
** Not Vulnerable (support a proper "noac" flag):
Sun Solaris 8 and 9 (10 probably works fine)
Linux: 2.6.11 kernel (2.4.latest probably works fine)
FreeBSD 5.4 and 6.0-SNAP001 (older versions probably work fine)
OpenBSD 3.7 (older versions probably work fine)
** Vulnerable (don't support a proper "noac" flag natively):
NetBSD 2.0.2 (older versions are also probably affected)
Note: NetBSD has promised to support a noac flag hopefully after 2.1.0 is
released (maybe in 3.0 or 2.2). In the mean time, you can apply one of
these two kernel patchs to support a 'noac' flag in NetBSD 2.x or 3.x:
ftp://ftp.netbsd.org/pub/NetBSD/misc/christos/2x.nfs.noac.diff
ftp://ftp.netbsd.org/pub/NetBSD/misc/christos/3x.nfs.noac.diff
After applying this patch and rebuilding your kernel, reboot with the new
kernel. Then copy the new nfs.h and nfsmount.h from /sys/nfs/ to
/usr/include/nfs/, and finally rebuild am-utils from scratch.
** Testing
When you build am-utils, a script named scripts/test-attrcache is built,
which can be used to test the NFS attribute cache behavior of the current
OS. You can run this script as root as follows:
# make install
# cd scripts
# sh test-attrcache
If you run this script on an OS whose status is known (and not listed
above), please report it to [email protected], so we can record it in
this file.
Sincerely,
Erez.
File diff suppressed because it is too large. Load diff
-423
View File
@@ -1,423 +0,0 @@
/*
* Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry at Imperial College, London.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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 acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* File: am-utils/amd/info_exec.c
*
*/
/*
* Get info from executable map
*
* Original from Erik Kline, 2004.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
#define MAX_LINE_LEN 1500
/* forward declarations */
int exec_init(mnt_map *m, char *map, time_t *tp);
int exec_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp);
/*
* a timed fgets()
*/
static char *
fgets_timed(char *s, int size, int rdfd, int secs)
{
fd_set fds;
struct timeval timeo;
time_t start, now;
int rval=0, i=0;
if (!s || size < 0 || rdfd < 0)
return 0;
s[0] = 0;
if (size == 0)
return s;
start = clocktime(NULL);
while (s[i] != '\n' && i < size-1) {
s[i+1] = 0; /* places the requisite trailing '\0' */
/* ready for reading */
rval = read(rdfd, (void *)(s+i), 1);
if (rval == 1) {
if (s[i] == 0) {
rval = 0;
break;
}
i++;
continue;
} else if (rval == 0) {
break;
} else if (rval < 0 && errno != EAGAIN && errno != EINTR) {
plog(XLOG_WARNING, "fgets_timed read error: %m");
break;
}
timeo.tv_usec = 0;
now = clocktime(NULL) - start;
if (secs <= 0)
timeo.tv_sec = 0;
else if (now < secs)
timeo.tv_sec = secs - now;
else {
/* timed out (now>=secs) */
plog(XLOG_WARNING, "executable map read timed out (> %d secs)", secs);
rval = -1;
break;
}
FD_ZERO(&fds);
FD_SET(rdfd, &fds);
rval = select(rdfd+1, &fds, 0, 0, &timeo);
if (rval < 0) {
/* error selecting */
plog(XLOG_WARNING, "fgets_timed select error: %m");
if (errno == EINTR)
continue;
rval = -1;
break;
} else if (rval == 0) {
/* timed out */
plog(XLOG_WARNING, "executable map read timed out (> %d secs)", secs);
rval = -1;
break;
}
}
if (rval > 0)
return s;
close(rdfd);
return (rval == 0 ? s : 0);
}
static int
read_line(char *buf, int size, int fd)
{
int done = 0;
while (fgets_timed(buf, size, fd, gopt.exec_map_timeout)) {
int len = strlen(buf);
done += len;
if (len > 1 && buf[len - 2] == '\\' &&
buf[len - 1] == '\n') {
buf += len - 2;
size -= len - 2;
*buf = '\n';
buf[1] = '\0';
} else {
return done;
}
}
return done;
}
/*
* Try to locate a value in a query answer
*/
static int
exec_parse_qanswer(int fd, char *map, char *key, char **pval, time_t *tp)
{
char qanswer[MAX_LINE_LEN], *dc = 0;
int chuck = 0;
int line_no = 0;
while (read_line(qanswer, sizeof(qanswer), fd)) {
char *cp;
char *hash;
int len = strlen(qanswer);
line_no++;
/*
* Make sure we got the whole line
*/
if (qanswer[len - 1] != '\n') {
plog(XLOG_WARNING, "line %d in \"%s\" is too long", line_no, map);
chuck = 1;
} else {
qanswer[len - 1] = '\0';
}
/*
* Strip comments
*/
hash = strchr(qanswer, '#');
if (hash)
*hash = '\0';
/*
* Find beginning of value (query answer)
*/
for (cp = qanswer; *cp && !isascii((int)*cp) && !isspace((int)*cp); cp++)
;;
/* Ignore blank lines */
if (!*cp)
goto again;
/*
* Return a copy of the data
*/
dc = strdup(cp);
*pval = dc;
dlog("%s returns %s", key, dc);
close(fd);
return 0;
again:
/*
* If the last read didn't get a whole line then
* throw away the remainder before continuing...
*/
if (chuck) {
while (fgets_timed(qanswer, sizeof(qanswer), fd, gopt.exec_map_timeout) &&
!strchr(qanswer, '\n')) ;
chuck = 0;
}
}
return ENOENT;
}
static int
set_nonblock(int fd)
{
int val;
if (fd < 0)
return 0;
if ((val = fcntl(fd, F_GETFL, 0)) < 0) {
plog(XLOG_WARNING, "set_nonblock fcntl F_GETFL error: %m");
return 0;
}
val |= O_NONBLOCK;
if (fcntl(fd, F_SETFL, val) < 0) {
plog(XLOG_WARNING, "set_nonblock fcntl F_SETFL error: %m");
return 0;
}
return 1;
}
static int
exec_map_open(char *emap, char *key)
{
pid_t p1, p2;
int pdes[2], nullfd, i;
char *argv[3];
if (!emap)
return 0;
argv[0] = emap;
argv[1] = key;
argv[2] = NULL;
if ((nullfd = open("/dev/null", O_WRONLY|O_NOCTTY)) < 0)
return -1;
if (pipe(pdes) < 0) {
close(nullfd);
return -1;
}
switch ((p1 = vfork())) {
case -1:
/* parent: fork error */
close(nullfd);
close(pdes[0]);
close(pdes[1]);
return -1;
case 0:
/* child #1 */
p2 = vfork();
switch (p2) {
case -1:
/* child #1: fork error */
exit(errno);
case 0:
/* child #2: init will reap our status */
if (pdes[1] != STDOUT_FILENO) {
dup2(pdes[1], STDOUT_FILENO);
close(pdes[1]);
}
if (nullfd != STDERR_FILENO) {
dup2(nullfd, STDERR_FILENO);
close(nullfd);
}
for (i=0; i<FD_SETSIZE; i++)
if (i != STDOUT_FILENO && i != STDERR_FILENO)
close(i);
/* make the write descriptor non-blocking */
if (!set_nonblock(STDOUT_FILENO)) {
close(STDOUT_FILENO);
exit(-1);
}
execve(emap, argv, NULL);
exit(errno); /* in case execve failed */
}
/* child #1 */
exit(0);
}
/* parent */
close(nullfd);
close(pdes[1]);
/* anti-zombie insurance */
while (waitpid(p1,0,0) < 0)
if (errno != EINTR)
exit(errno);
/* make the read descriptor non-blocking */
if (!set_nonblock(pdes[0])) {
close(pdes[0]);
return -1;
}
return pdes[0];
}
/*
* Check for various permissions on executable map without trying to
* fork a new executable-map process.
*
* return: >0 (errno) if failed
* 0 if ok
*/
static int
exec_check_perm(char *map)
{
struct stat sb;
/* sanity and permission checks */
if (!map) {
dlog("exec_check_permission got a NULL map");
return EINVAL;
}
if (stat(map, &sb)) {
plog(XLOG_ERROR, "map \"%s\" stat failure: %m", map);
return errno;
}
if (!S_ISREG(sb.st_mode)) {
plog(XLOG_ERROR, "map \"%s\" should be regular file", map);
return EINVAL;
}
if (sb.st_uid != 0) {
plog(XLOG_ERROR, "map \"%s\" owned by uid %u (must be 0)", map, (u_int) sb.st_uid);
return EACCES;
}
if (!(sb.st_mode & S_IXUSR)) {
plog(XLOG_ERROR, "map \"%s\" should be executable", map);
return EACCES;
}
if (sb.st_mode & (S_ISUID|S_ISGID)) {
plog(XLOG_ERROR, "map \"%s\" should not be setuid/setgid", map);
return EACCES;
}
if (sb.st_mode & S_IWOTH) {
plog(XLOG_ERROR, "map \"%s\" should not be world writeable", map);
return EACCES;
}
return 0; /* all is well */
}
int
exec_init(mnt_map *m, char *map, time_t *tp)
{
/*
* Basically just test that the executable map can be found
* and has proper permissions.
*/
return exec_check_perm(map);
}
int
exec_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
{
int mapfd, ret;
if ((ret = exec_check_perm(map)) != 0) {
return ret;
}
if (!key)
return 0;
if (logfp)
fflush(logfp);
dlog("exec_search \"%s\", key: \"%s\"", map, key);
mapfd = exec_map_open(map, key);
if (mapfd >= 0) {
if (tp)
*tp = clocktime(NULL);
return exec_parse_qanswer(mapfd, map, key, pval, tp);
}
return errno;
}
-498
View File
@@ -1,498 +0,0 @@
/*
* Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry at Imperial College, London.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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 acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* File: am-utils/amd/readdir.c
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
/****************************************************************************
*** MACROS ***
****************************************************************************/
#define DOT_DOT_COOKIE (u_int) 1
#define MAX_CHAIN 2048
/****************************************************************************
*** FORWARD DEFINITIONS ***
****************************************************************************/
static int key_already_in_chain(char *keyname, const nfsentry *chain);
static nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable);
static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable);
/****************************************************************************
*** FUNCTIONS ***
****************************************************************************/
/*
* Was: NEW_TOPLVL_READDIR
* Search a chain for an entry with some name.
* -Erez Zadok <ezk@cs.columbia.edu>
*/
static int
key_already_in_chain(char *keyname, const nfsentry *chain)
{
const nfsentry *tmpchain = chain;
while (tmpchain) {
if (keyname && tmpchain->ne_name && STREQ(keyname, tmpchain->ne_name))
return 1;
tmpchain = tmpchain->ne_nextentry;
}
return 0;
}
/*
* Create a chain of entries which are not linked.
* -Erez Zadok <ezk@cs.columbia.edu>
*/
static nfsentry *
make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable)
{
static u_int last_cookie = (u_int) 2; /* monotonically increasing */
static nfsentry chain[MAX_CHAIN];
static int max_entries = MAX_CHAIN;
char *key;
int num_entries = 0, i;
u_int preflen = 0;
nfsentry *retval = (nfsentry *) NULL;
mntfs *mf;
mnt_map *mmp;
if (!mp) {
plog(XLOG_DEBUG, "make_entry_chain: mp is (NULL)");
return retval;
}
mf = mp->am_mnt;
if (!mf) {
plog(XLOG_DEBUG, "make_entry_chain: mp->am_mnt is (NULL)");
return retval;
}
mmp = (mnt_map *) mf->mf_private;
if (!mmp) {
plog(XLOG_DEBUG, "make_entry_chain: mp->am_mnt->mf_private is (NULL)");
return retval;
}
if (mp->am_pref)
preflen = strlen(mp->am_pref);
/* iterate over keys */
for (i = 0; i < NKVHASH; i++) {
kv *k;
for (k = mmp->kvhash[i]; k ; k = k->next) {
/*
* Skip unwanted entries which are either not real entries or
* very difficult to interpret (wildcards...) This test needs
* lots of improvement. Any takers?
*/
key = k->key;
if (!key)
continue;
/* Skip '/defaults' */
if (STREQ(key, "/defaults"))
continue;
/* Skip '*' */
if (!fully_browsable && strchr(key, '*'))
continue;
/*
* If the map has a prefix-string then check if the key starts with
* this string, and if it does, skip over this prefix. If it has a
* prefix and it doesn't match the start of the key, skip it.
*/
if (preflen) {
if (preflen > strlen(key))
continue;
if (!NSTREQ(key, mp->am_pref, preflen))
continue;
key += preflen;
}
/* no more '/' are allowed, unless browsable_dirs=full was used */
if (!fully_browsable && strchr(key, '/'))
continue;
/* no duplicates allowed */
if (key_already_in_chain(key, current_chain))
continue;
/* fill in a cell and link the entry */
if (num_entries >= max_entries) {
/* out of space */
plog(XLOG_DEBUG, "make_entry_chain: no more space in chain");
if (num_entries > 0) {
chain[num_entries - 1].ne_nextentry = 0;
retval = &chain[0];
}
return retval;
}
/* we have space. put entry in next cell */
++last_cookie;
chain[num_entries].ne_fileid = (u_int) last_cookie;
*(u_int *) chain[num_entries].ne_cookie = (u_int) last_cookie;
chain[num_entries].ne_name = key;
if (num_entries < max_entries - 1) { /* link to next one */
chain[num_entries].ne_nextentry = &chain[num_entries + 1];
}
++num_entries;
} /* end of "while (k)" */
} /* end of "for (i ... NKVHASH ..." */
/* terminate chain */
if (num_entries > 0) {
chain[num_entries - 1].ne_nextentry = 0;
retval = &chain[0];
}
return retval;
}
/* This one is called only if map is browsable */
static int
amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable)
{
u_int gen = *(u_int *) cookie;
int chain_length, i;
static nfsentry *te, *te_next;
static int j;
dp->dl_eof = FALSE; /* assume readdir not done */
if (amuDebug(D_READDIR))
plog(XLOG_DEBUG, "amfs_readdir_browsable gen=%u, count=%d",
gen, count);
if (gen == 0) {
/*
* In the default instance (which is used to start a search) we return
* "." and "..".
*
* This assumes that the count is big enough to allow both "." and ".."
* to be returned in a single packet. If it isn't (which would be
* fairly unbelievable) then tough.
*/
dlog("amfs_readdir_browsable: default search");
/*
* Check for enough room. This is extremely approximate but is more
* than enough space. Really need 2 times:
* 4byte fileid
* 4byte cookie
* 4byte name length
* 4byte name
* plus the dirlist structure */
if (count < (2 * (2 * (sizeof(*ep) + sizeof("..") + 4) + sizeof(*dp))))
return EINVAL;
/*
* compute # of entries to send in this chain.
* heuristics: 128 bytes per entry.
* This is too much probably, but it seems to work better because
* of the re-entrant nature of nfs_readdir, and esp. on systems
* like OpenBSD 2.2.
*/
chain_length = count / 128;
/* reset static state counters */
te = te_next = NULL;
dp->dl_entries = ep;
/* construct "." */
ep[0].ne_fileid = mp->am_gen;
ep[0].ne_name = ".";
ep[0].ne_nextentry = &ep[1];
*(u_int *) ep[0].ne_cookie = 0;
/* construct ".." */
if (mp->am_parent)
ep[1].ne_fileid = mp->am_parent->am_gen;
else
ep[1].ne_fileid = mp->am_gen;
ep[1].ne_name = "..";
ep[1].ne_nextentry = 0;
*(u_int *) ep[1].ne_cookie = DOT_DOT_COOKIE;
/*
* If map is browsable, call a function make_entry_chain() to construct
* a linked list of unmounted keys, and return it. Then link the chain
* to the regular list. Get the chain only once, but return
* chunks of it each time.
*/
te = make_entry_chain(mp, dp->dl_entries, fully_browsable);
if (!te)
return 0;
if (amuDebug(D_READDIR)) {
nfsentry *ne;
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen1 key %4d \"%s\"", j++, ne->ne_name);
}
/* return only "chain_length" entries */
te_next = te;
for (i=1; i<chain_length; ++i) {
te_next = te_next->ne_nextentry;
if (!te_next)
break;
}
if (te_next) {
nfsentry *te_saved = te_next->ne_nextentry;
te_next->ne_nextentry = NULL; /* terminate "te" chain */
te_next = te_saved; /* save rest of "te" for next iteration */
dp->dl_eof = FALSE; /* tell readdir there's more */
} else {
dp->dl_eof = TRUE; /* tell readdir that's it */
}
ep[1].ne_nextentry = te; /* append this chunk of "te" chain */
if (amuDebug(D_READDIR)) {
nfsentry *ne;
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen2 key %4d \"%s\"", j++, ne->ne_name);
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen2+ key %4d \"%s\" fi=%d ck=%d",
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
plog(XLOG_DEBUG, "EOF is %d", dp->dl_eof);
}
return 0;
} /* end of "if (gen == 0)" statement */
dlog("amfs_readdir_browsable: real child");
if (gen == DOT_DOT_COOKIE) {
dlog("amfs_readdir_browsable: End of readdir in %s", mp->am_path);
dp->dl_eof = TRUE;
dp->dl_entries = 0;
return 0;
}
/*
* If browsable directories, then continue serving readdir() with another
* chunk of entries, starting from where we left off (when gen was equal
* to 0). Once again, assume last chunk served to readdir.
*/
dp->dl_eof = TRUE;
dp->dl_entries = ep;
te = te_next; /* reset 'te' from last saved te_next */
if (!te) { /* another indicator of end of readdir */
dp->dl_entries = 0;
return 0;
}
/*
* compute # of entries to send in this chain.
* heuristics: 128 bytes per entry.
*/
chain_length = count / 128;
/* return only "chain_length" entries */
for (i = 1; i < chain_length; ++i) {
te_next = te_next->ne_nextentry;
if (!te_next)
break;
}
if (te_next) {
nfsentry *te_saved = te_next->ne_nextentry;
te_next->ne_nextentry = NULL; /* terminate "te" chain */
te_next = te_saved; /* save rest of "te" for next iteration */
dp->dl_eof = FALSE; /* tell readdir there's more */
}
ep = te; /* send next chunk of "te" chain */
dp->dl_entries = ep;
if (amuDebug(D_READDIR)) {
nfsentry *ne;
plog(XLOG_DEBUG, "dl_entries=%p, te_next=%p, dl_eof=%d",
dp->dl_entries, te_next, dp->dl_eof);
for (ne = te; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen3 key %4d \"%s\"", j++, ne->ne_name);
}
return 0;
}
/*
* This readdir function which call a special version of it that allows
* browsing if browsable_dirs=yes was set on the map.
*/
int
amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count)
{
u_int gen = *(u_int *) cookie;
am_node *xp;
mntent_t mnt;
dp->dl_eof = FALSE; /* assume readdir not done */
/* check if map is browsable */
if (mp->am_mnt && mp->am_mnt->mf_mopts) {
mnt.mnt_opts = mp->am_mnt->mf_mopts;
if (amu_hasmntopt(&mnt, "fullybrowsable"))
return amfs_readdir_browsable(mp, cookie, dp, ep, count, TRUE);
if (amu_hasmntopt(&mnt, "browsable"))
return amfs_readdir_browsable(mp, cookie, dp, ep, count, FALSE);
}
/* when gen is 0, we start reading from the beginning of the directory */
if (gen == 0) {
/*
* In the default instance (which is used to start a search) we return
* "." and "..".
*
* This assumes that the count is big enough to allow both "." and ".."
* to be returned in a single packet. If it isn't (which would be
* fairly unbelievable) then tough.
*/
dlog("amfs_generic_readdir: default search");
/*
* Check for enough room. This is extremely approximate but is more
* than enough space. Really need 2 times:
* 4byte fileid
* 4byte cookie
* 4byte name length
* 4byte name
* plus the dirlist structure */
if (count < (2 * (2 * (sizeof(*ep) + sizeof("..") + 4) + sizeof(*dp))))
return EINVAL;
xp = next_nonerror_node(mp->am_child);
dp->dl_entries = ep;
/* construct "." */
ep[0].ne_fileid = mp->am_gen;
ep[0].ne_name = ".";
ep[0].ne_nextentry = &ep[1];
*(u_int *) ep[0].ne_cookie = 0;
/* construct ".." */
if (mp->am_parent)
ep[1].ne_fileid = mp->am_parent->am_gen;
else
ep[1].ne_fileid = mp->am_gen;
ep[1].ne_name = "..";
ep[1].ne_nextentry = 0;
*(u_int *) ep[1].ne_cookie = (xp ? xp->am_gen : DOT_DOT_COOKIE);
if (!xp)
dp->dl_eof = TRUE; /* by default assume readdir done */
if (amuDebug(D_READDIR)) {
nfsentry *ne;
int j;
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen1 key %4d \"%s\" fi=%d ck=%d",
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
}
return 0;
}
dlog("amfs_generic_readdir: real child");
if (gen == DOT_DOT_COOKIE) {
dlog("amfs_generic_readdir: End of readdir in %s", mp->am_path);
dp->dl_eof = TRUE;
dp->dl_entries = 0;
if (amuDebug(D_READDIR))
plog(XLOG_DEBUG, "end of readdir eof=TRUE, dl_entries=0\n");
return 0;
}
/* non-browsable directories code */
xp = mp->am_child;
while (xp && xp->am_gen != gen)
xp = xp->am_osib;
if (xp) {
int nbytes = count / 2; /* conservative */
int todo = MAX_READDIR_ENTRIES;
dp->dl_entries = ep;
do {
am_node *xp_next = next_nonerror_node(xp->am_osib);
if (xp_next) {
*(u_int *) ep->ne_cookie = xp_next->am_gen;
} else {
*(u_int *) ep->ne_cookie = DOT_DOT_COOKIE;
dp->dl_eof = TRUE;
}
ep->ne_fileid = xp->am_gen;
ep->ne_name = xp->am_name;
nbytes -= sizeof(*ep) + 1;
if (xp->am_name)
nbytes -= strlen(xp->am_name);
xp = xp_next;
if (nbytes > 0 && !dp->dl_eof && todo > 1) {
ep->ne_nextentry = ep + 1;
ep++;
--todo;
} else {
todo = 0;
}
} while (todo > 0);
ep->ne_nextentry = 0;
if (amuDebug(D_READDIR)) {
nfsentry *ne;
int j;
for (j=0,ne=ep; ne; ne=ne->ne_nextentry)
plog(XLOG_DEBUG, "gen2 key %4d \"%s\" fi=%d ck=%d",
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
}
return 0;
}
return ESTALE;
}
-4
View File
@@ -1,4 +0,0 @@
@set UPDATED 20 April 2006
@set UPDATED-MONTH April 2006
@set EDITION 6.1.5
@set VERSION 6.1.5
-52
View File
@@ -1,52 +0,0 @@
# A schema for the Berkeley automounter (AMD)
# Authored by Erez Zadok and/or source maintainers
# Definition by Tim Colles <timc at dai.ed.ac.uk>
# Revised by Adam Morley <adam at gmi.com>
# OID Base is 1.3.6.1.4.1.10180
#
# Syntaxes are under 1.3.6.1.4.1.10180.3.175-199
# Attribute types are under 1.3.6.1.4.1.10180.2.175-199
# Object classes are under 1.3.6.1.4.1.10180.1.175-199
# Attribute Type Definitions
attributetype ( 1.3.6.1.4.1.10180.2.175
NAME 'amdmapTimestamp'
DESC 'Probably the time the map was last modified'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.10180.2.176
NAME 'amdmapName'
DESC 'The symbolic name of the map, ie. map_name'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.10180.2.177
NAME 'amdmapKey'
DESC 'The key value for this entry'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.10180.2.178
NAME 'amdmapValue'
DESC 'The mount information for this entry'
EQUALITY caseIgnoreMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
# Object Class Definitions
objectclass ( 1.3.6.1.4.1.10180.1.175 NAME 'amdmapTimestamp'
SUP top STRUCTURAL
DESC 'Timestamp for an AMD map'
MUST ( cn $ amdmapName $ amdmapTimestamp ) )
objectclass ( 1.3.6.1.4.1.10180.1.176 NAME 'amdmap'
SUP top STRUCTURAL
DESC 'Defines an AMD map entry'
MUST ( cn $ amdmapName $ amdmapKey $ amdmapValue ) )
-270
View File
@@ -1,270 +0,0 @@
/*
* Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry at Imperial College, London.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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 acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* File: am-utils/libamu/strutil.c
*
*/
/*
* String Utilities.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amu.h>
char *
strnsave(const char *str, int len)
{
char *sp = (char *) xmalloc(len + 1);
memmove(sp, str, len);
sp[len] = '\0';
return sp;
}
/*
* Concatenate three strings and store the result in the buffer pointed to
* by p, making p large enough to hold the strings
*/
char *
str3cat(char *p, char *s1, char *s2, char *s3)
{
int l1 = strlen(s1);
int l2 = strlen(s2);
int l3 = strlen(s3);
p = (char *) xrealloc(p, l1 + l2 + l3 + 1);
memmove(p, s1, l1);
memmove(p + l1, s2, l2);
memmove(p + l1 + l2, s3, l3 + 1);
return p;
}
/*
* Split s using ch as delimiter and qc as quote character
*/
char **
strsplit(char *s, int ch, int qc)
{
char **ivec;
int ic = 0;
int done = 0;
ivec = (char **) xmalloc((ic + 1) * sizeof(char *));
while (!done) {
char *v;
/*
* skip to split char
*/
while (*s && (ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch))
*s++ = '\0';
/*
* End of string?
*/
if (!*s)
break;
/*
* remember start of string
*/
v = s;
/*
* skip to split char
*/
while (*s && !(ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) {
if (*s++ == qc) {
/*
* Skip past string.
*/
s++;
while (*s && *s != qc)
s++;
if (*s == qc)
s++;
}
}
if (!*s)
done = 1;
*s++ = '\0';
/*
* save string in new ivec slot
*/
ivec[ic++] = v;
ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *));
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved \"%s\"", v);
}
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
ivec[ic] = NULL;
return ivec;
}
/*
* Use generic strlcpy to copy a string more carefully, null-terminating it
* as needed. However, if the copied string was truncated due to lack of
* space, then warn us.
*
* For now, xstrlcpy returns VOID because it doesn't look like anywhere in
* the Amd code do we actually use the return value of strncpy/strlcpy.
*/
void
#ifdef DEBUG
_xstrlcpy(const char *filename, int lineno, char *dst, const char *src, size_t len)
#else /* not DEBUG */
xstrlcpy(char *dst, const char *src, size_t len)
#endif /* not DEBUG */
{
if (len == 0)
return;
if (strlcpy(dst, src, len) >= len)
#ifdef DEBUG
plog(XLOG_ERROR, "xstrlcpy(%s:%d): string \"%s\" truncated to \"%s\"",
filename, lineno, src, dst);
#else /* not DEBUG */
plog(XLOG_ERROR, "xstrlcpy: string \"%s\" truncated to \"%s\"", src, dst);
#endif /* not DEBUG */
}
/*
* Use generic strlcat to concatenate a string more carefully,
* null-terminating it as needed. However, if the copied string was
* truncated due to lack of space, then warn us.
*
* For now, xstrlcat returns VOID because it doesn't look like anywhere in
* the Amd code do we actually use the return value of strncat/strlcat.
*/
void
#ifdef DEBUG
_xstrlcat(const char *filename, int lineno, char *dst, const char *src, size_t len)
#else /* not DEBUG */
xstrlcat(char *dst, const char *src, size_t len)
#endif /* not DEBUG */
{
if (len == 0)
return;
if (strlcat(dst, src, len) >= len) {
/* strlcat does not null terminate if the size of src is equal to len. */
dst[strlen(dst) - 1] = '\0';
#ifdef DEBUG
plog(XLOG_ERROR, "xstrlcat(%s:%d): string \"%s\" truncated to \"%s\"",
filename, lineno, src, dst);
#else /* not DEBUG */
plog(XLOG_ERROR, "xstrlcat: string \"%s\" truncated to \"%s\"", src, dst);
#endif /* not DEBUG */
}
}
/* our version of snprintf */
int
#if defined(DEBUG) && (defined(HAVE_C99_VARARGS_MACROS) || defined(HAVE_GCC_VARARGS_MACROS))
_xsnprintf(const char *filename, int lineno, char *str, size_t size, const char *format, ...)
#else /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
xsnprintf(char *str, size_t size, const char *format, ...)
#endif /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
{
va_list ap;
int ret = 0;
va_start(ap, format);
#if defined(DEBUG) && (defined(HAVE_C99_VARARGS_MACROS) || defined(HAVE_GCC_VARARGS_MACROS))
ret = _xvsnprintf(filename, lineno, str, size, format, ap);
#else /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
ret = xvsnprintf(str, size, format, ap);
#endif /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
va_end(ap);
return ret;
}
/* our version of vsnprintf */
int
#if defined(DEBUG) && (defined(HAVE_C99_VARARGS_MACROS) || defined(HAVE_GCC_VARARGS_MACROS))
_xvsnprintf(const char *filename, int lineno, char *str, size_t size, const char *format, va_list ap)
#else /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
xvsnprintf(char *str, size_t size, const char *format, va_list ap)
#endif /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
{
int ret = 0;
#ifdef HAVE_VSNPRINTF
ret = vsnprintf(str, size, format, ap);
#else /* not HAVE_VSNPRINTF */
ret = vsprintf(str, format, ap); /* less secure version */
#endif /* not HAVE_VSNPRINTF */
/*
* If error or truncation, plog error.
*
* WARNING: we use the static 'maxtrunc' variable below to break out any
* possible infinite recursion between plog() and xvsnprintf(). If it
* ever happens, it'd indicate a bug in Amd.
*/
if (ret < 0 || (size_t) ret >= size) { /* error or truncation occured */
static int maxtrunc; /* hack to avoid inifinite loop */
if (++maxtrunc > 10)
#if defined(DEBUG) && (defined(HAVE_C99_VARARGS_MACROS) || defined(HAVE_GCC_VARARGS_MACROS))
plog(XLOG_ERROR, "xvsnprintf(%s:%d): string %p truncated (ret=%d, format=\"%s\")",
filename, lineno, str, ret, format);
#else /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
plog(XLOG_ERROR, "xvsnprintf: string %p truncated (ret=%d, format=\"%s\")",
str, ret, format);
#endif /* not DEBUG or no C99/GCC-style vararg cpp macros supported */
}
return ret;
}
-135
View File
@@ -1,135 +0,0 @@
#!/bin/sh
# Script to test the attribute cache behavior of the local OS client.
# If this script fails, it means that Amd cannot turn off the attrcache
# reliably on this host, and Amd therefore may not run reliably. See
# the README.attrcache file distributed with this am-utils.
# -Erez Zadok, September 29, 2005
# set PATH (must install am-utils first)
prefix=@prefix@
exec_prefix=@exec_prefix@
PATH=@sbindir@:@bindir@:/usr/ucb:/usr/bin:/bin:${PATH}
export PATH
# test if amd is running
amq -p > /dev/null 2>&1
if test $? = 0
then
echo "### Amd already running... please shutdown Amd first"
exit 1
fi
mapfile="/tmp/amd.testmap.$$"
logfile="/var/log/amd"
delay=1
a=/a
CreateMap1 () {
echo "### Creating correct map"
cat - >$mapfile <<EOF
a type:=link;fs:=/tmp/a
EOF
}
CreateMap2 () {
echo "### Creating weird map"
cat - >$mapfile <<EOF
a type:=link;fs:=/tmp/b
EOF
}
StopAMD () {
ctl-amd stop
# do not delete files we may need to use to debug Amd
# rm -f /tmp/a /tmp/b $mapfile $logfile
}
touch /tmp/a
touch /tmp/b
CreateMap1
echo amd -x all -D all -r -l $logfile $a $mapfile -cache:=mapdefault,sync
amd -x all -D all -r -l $logfile $a $mapfile -cache:=mapdefault,sync
sleep 3 # give amd chance to start properly
amq
inode_a=`ls -lLi /tmp/a | awk '{print $1}'`
inode_b=`ls -lLi /tmp/b | awk '{print $1}'`
ls -lLi $a/a
ls -lLi $a/b
ls -l $mapfile
# how many times to try until we call it a success...
maxtry=10
while test $maxtry -gt 0
do
echo "$maxtry tries left ..."
let maxtry=maxtry-1
amq
CreateMap1
sleep $delay
ls -l $mapfile
echo "### looking at a... should get a"
ino=`ls -lLi $a/a | awk '{print $1}'`
if test -z "$ino"
then
ls -li $a/a
amq
amq -m
stat $a
echo "a link does not exist!"
StopAMD
exit 1
fi
if test $ino -ne $inode_a
then
ls -li $a/a
amq
amq -m
stat $a
echo "a link does not point to A!"
StopAMD
exit 1
fi
# Here is the main trick we try: force amd to flush one entry, then
# change the amd map on disk, and then see if the kernel will have
# flushed the attribute cache; if it did, then Amd will see the
# correctly changed map entry.
amq -u $a/a
sleep $delay
stat $a
CreateMap2
sleep $delay
ls -l $mapfile
echo "### looking at a... should get b"
ino=`ls -lLi $a/a | awk '{print $1}'`
if test -z "$ino"
then
ls -li $a/a
amq
amq -m
stat $a
echo "a link does not exist!"
StopAMD
exit 1
fi
if test $ino -ne $inode_b
then
ls -li $a/a
amq
amq -m
stat $a
echo "a link does not point to B!"
StopAMD
exit 1
fi
amq -u $a/a
sleep $delay
stat $a
done
StopAMD
-1
View File
@@ -1 +0,0 @@
[6.1.5]dnl
+2
View File
@@ -2396,6 +2396,8 @@ d_expr_primary (di)
const char *s;
type = cplus_demangle_type (di);
if (type == NULL)
return NULL;
/* If we have a type we know how to print, we aren't going to
print the type name itself. */
+10
View File
@@ -429,6 +429,16 @@ warning: this CVS does not support PreservePermissions");
else if (strcmp (p, "stat") == 0)
RereadLogAfterVerify = LOGMSG_REREAD_STAT;
}
else if (strcmp(line, "LocalKeyword") == 0)
{
/* Recognize cvs-1.12-style keyword control rather than erroring out. */
RCS_setlocalid(p);
}
else if (strcmp(line, "KeywordExpand") == 0)
{
/* Recognize cvs-1.12-style keyword control rather than erroring out. */
RCS_setincexc(p);
}
else
{
/* We may be dealing with a keyword which was added in a
-1
View File
@@ -1 +0,0 @@
autom4te.cache
+81
View File
@@ -1,3 +1,84 @@
2007-12-28 15:06 Christos Zoulas <[email protected]>
* strtof detection
* remove bogus regex magic that could cause a DoS
* better mismatch version message
2007-12-27 11:35 Christos Zoulas <[email protected]>
* bring back some fixes from OpenBSD
* treat ELF dynamic objects as executables
* fix gcc warnings
2007-12-01 19:55 Christos Zoulas <[email protected]>
* make sure we have zlib.h and libz to compile the builtin
decompress code
2007-10-28 20:48 Christos Zoulas <[email protected]>
* float and double magic support (Behan Webster)
2007-10-28 20:48 Christos Zoulas <[email protected]>
* Convert fortran to a soft test (Reuben Thomas)
2007-10-23 5:25 Christos Zoulas <[email protected]>
* Add --with-filename, and --no-filename (Reuben Thomas)
2007-10-23 3:59 Christos Zoulas <[email protected]>
* Rest of the mime split (Reuben Thomas)
* Make usage message generated from the flags so that
they stay consistent (Reuben Thomas)
2007-10-20 3:06 Christos Zoulas <[email protected]>
* typo in comment, missing ifdef QUICK, remove unneeded code
(Charles Longeau)
2007-10-17 3:33 Christos Zoulas <[email protected]>
* Fix problem printing -\012 in some entries
* Separate magic type and encoding flags (Reuben Thomas)
2007-10-09 3:55 Christos Zoulas <[email protected]>
* configure fix for int64 and strndup (Reuben Thomas)
2007-09-26 4:45 Christos Zoulas <[email protected]>
* Add magic_descriptor() function.
* Fix regression in elf reading code where the core name was
not being printed.
* Don't convert NUL's to spaces in {l,b}estring16 (Daniel Dawson)
2007-08-19 6:30 Christos Zoulas <[email protected]>
* Make mime format consistent so that it can
be easily parsed:
mimetype [charset=character-set] [encoding=encoding-mime-type]
Remove spurious extra text from some MIME type printouts
(mostly in is_tar).
Fix one case where -i produced nothing at all (for a 1-byte file,
which is now classed as application/octet-stream).
Remove 7/8bit classifications, since they were arbitrary
and not based on the file data.
This work was done by Reuben Thomas
2007-05-24 10:00 Christos Zoulas <[email protected]>
* Fix another integer overflow (Colin Percival)
+3 -3
View File
@@ -17,14 +17,14 @@ Imported by:
rm -f missing depcomp
rm -f config.{guess,sub}
cvs import -m "Virgin import of Christos Zoulas's FILE 4.21." \
src/contrib/file ZOULAS file_4_21
cvs import -m "Virgin import of Christos Zoulas's FILE 4.23." \
src/contrib/file ZOULAS file_4_23
Never make local changes to ZOULAS `file'. Christos is very willing to
work with us to meet our FreeBSD needs. Thus submit any desired changes
to him <[email protected]> and wait for the next release and vendor
import to get them.
[email protected]
15-Sept-2002
+35
View File
@@ -30,3 +30,38 @@
0 string Maestro\r RISC OS music file
>8 byte x version %d
>8 byte x type %d
# Digital Symphony data files
# From: Bernard Jungen ([email protected])
0 string \x02\x01\x13\x13\x13\x01\x0d\x10 Digital Symphony sound sample (RISC OS),
>8 byte x version %d,
>9 pstring x named "%s",
>(9.b+19) byte =0 8-bit logarithmic
>(9.b+19) byte =1 LZW-compressed linear
>(9.b+19) byte =2 8-bit linear signed
>(9.b+19) byte =3 16-bit linear signed
>(9.b+19) byte =4 SigmaDelta-compressed linear
>(9.b+19) byte =5 SigmaDelta-compressed logarithmic
>(9.b+19) byte >5 unknown format
0 string \x02\x01\x13\x13\x14\x12\x01\x0b Digital Symphony song (RISC OS),
>8 byte x version %d,
>9 byte =1 1 voice,
>9 byte !1 %d voices,
>10 leshort =1 1 track,
>10 leshort !1 %d tracks,
>12 leshort =1 1 pattern
>12 leshort !1 %d patterns
0 string \x02\x01\x13\x13\x10\x14\x12\x0e
>9 byte =0 Digital Symphony sequence (RISC OS),
>>8 byte x version %d,
>>10 byte =1 1 line,
>>10 byte !1 %d lines,
>>11 leshort =1 1 position
>>11 leshort !1 %d positions
>9 byte =1 Digital Symphony pattern data (RISC OS),
>>8 byte x version %d,
>>10 leshort =1 1 pattern
>>10 leshort !1 %d patterns
+11
View File
@@ -678,3 +678,14 @@
>0x21 byte x v%x
0 string DVDVIDEO-VMG Video manager,
>0x21 byte x v%x
# From: Behan Webster <[email protected]>
# NuppelVideo used by Mythtv (*.nuv)
0 regex NuppelVideo|MythTVVideo MythTV NuppelVideo
>12 string x v%s
>20 lelong x (%d
>24 lelong x \bx%d),
>36 string P \bprogressive,
>36 string I \binterlaced,
>40 ledouble x \baspect:%.2f,
>48 ledouble x \bfps:%.2f
+41
View File
@@ -189,3 +189,44 @@
>0 byte <5 \b
>>13 byte 0x81 \b
>>>14 uleshort x \b, system %hd
#------------------------------------------------------------------------------
# CAF: Apple CoreAudio File Format
#
# Container format for high-end audio purposes.
# From: David Remahl <[email protected]>
#
0 string caff CoreAudio Format audio file
>4 beshort <10 version %d
>6 beshort x
#------------------------------------------------------------------------------
# Keychain database files
0 string kych Mac OS X Keychain File
#------------------------------------------------------------------------------
# Code Signing related file types
0 belong 0xfade0c00 Mac OS X Code Requirement
>8 belong 1 (opExpr)
>4 belong x - %d bytes
0 belong 0xfade0c01 Mac OS X Code Requirement Set
>8 belong >1 containing %d items
>4 belong x - %d bytes
0 belong 0xfade0c02 Mac OS X Code Directory
>8 belong x version %x
>12 belong >0 flags 0x%x
>4 belong x - %d bytes
0 belong 0xfade0cc0 Mac OS X Detached Code Signature (non-executable)
>4 belong x - %d bytes
0 belong 0xfade0cc1 Mac OS X Detached Code Signature
>8 belong >1 (%d elements)
>4 belong x - %d bytes
# From: "Nelson A. de Oliveira" <[email protected]>
# .vdi
4 string innotek\ VirtualBox\ Disk\ Image %s
+17
View File
@@ -531,6 +531,7 @@
# ZIP archives (Greg Roelofs, c/o [email protected])
0 string PK\003\004
>4 byte 0x00 Zip archive data
>4 byte 0x09 Zip archive data, at least v0.9 to extract
>4 byte 0x0a Zip archive data, at least v1.0 to extract
>4 byte 0x0b Zip archive data, at least v1.1 to extract
@@ -731,3 +732,19 @@
>4 lelong 0x1000006D (EPOC release 3/4/5)
>4 lelong 0x10003A12 (EPOC release 6)
0 lelong 0x10201A7A Symbian installation file (Symbian OS 9.x)
# Pack200 Java archives, http://jcp.org/en/jsr/detail?id=200
0 belong 0xcafed00d Pack200 Java archive
# From "Nelson A. de Oliveira" <[email protected]>
0 string MPQ\032 MoPaQ (MPQ) archive
# From: Dirk Jagdmann <[email protected]>
# xar archive format: http://code.google.com/p/xar/
0 string xar! xar archive
>6 beshort x - version %ld
# From: "Nelson A. de Oliveira" <[email protected]>
# .kgb
0 string KGB_arch KGB Archiver file
>10 string x with compression level %.1s
+7
View File
@@ -556,3 +556,10 @@
# From: Matthew Flaschen <[email protected]>
0 string #EXTM3U M3U playlist text
# From: "Mateus Caruccio" <[email protected]>
# guitar pro v3,4,5 from http://filext.com/file-extension/gp3
0 string \030FICHIER\ GUITAR\ PRO\ v3. Guitar Pro Ver. 3 Tablature
# From: "Leslie P. Polzer" <[email protected]>
60 string SONG SoundFX Module sound file
-12
View File
@@ -1,12 +0,0 @@
#------------------------------------------------------------------------------
# bFLT: file(1) magic for BFLT uclinux binary files
#
# From Philippe De Muyter <[email protected]>
#
0 string bFLT BFLT executable
>4 belong x - version %ld
>4 belong 4
>>36 belong&0x1 0x1 ram
>>36 belong&0x2 0x2 gotpic
>>36 belong&0x4 0x4 gzip
>>36 belong&0x8 0x8 gzdata
+34 -14
View File
@@ -1,17 +1,37 @@
#------------------------------------------------------------------------------
# blender: file(1) magic for Blender 3D data files
# blender: file(1) magic for Blender 3D related files
#
# Coded by Guillermo S. Romero <[email protected]> using the
# data from Ton Roosendaal <[email protected]>. Ton or his company do not
# support the rule, so mail GSR if problems with it. Rule version: 1.1.
# You can get latest version with comments and details about the format
# at http://acd.asoc.euitt.upm.es/~gsromero/3d/blender/magic.blender
# Native format rule v1.2. For questions use the developers list
# http://lists.blender.org/mailman/listinfo/bf-committers
# GLOB chunk was moved near start and provides subversion info since 2.42
0 string =BLENDER Blender3D,
>7 string =_ saved as 32-bits
>7 string =- saved as 64-bits
>8 string =v little endian
>8 string =V big endian
>9 byte x with version %c.
>10 byte x \b%c
>11 byte x \b%c
0 string =BLENDER Blender3D,
>7 string =_ saved as 32-bits
>>8 string =v little endian
>>>9 byte x with version %c.
>>>10 byte x \b%c
>>>11 byte x \b%c
>>>0x40 string =GLOB \b.
>>>>0x58 leshort x \b%.4d
>>8 string =V big endian
>>>9 byte x with version %c.
>>>10 byte x \b%c
>>>11 byte x \b%c
>>>0x40 string =GLOB \b.
>>>>0x58 beshort x \b%.4d
>7 string =- saved as 64-bits
>>8 string =v little endian
>>9 byte x with version %c.
>>10 byte x \b%c
>>11 byte x \b%c
>>0x44 string =GLOB \b.
>>>0x60 leshort x \b%.4d
>>8 string =V big endian
>>>9 byte x with version %c.
>>>10 byte x \b%c
>>>11 byte x \b%c
>>>0x44 string =GLOB \b.
>>>>0x60 beshort x \b%.4d
# Scripts that run in the embeded Python interpreter
0 string #!BPY Blender3D BPython script
-7
View File
@@ -1,7 +0,0 @@
#------------------------------------------------------------------------------
# chi: file(1) magic for ChiWriter files
#
0 string \\1cw\ ChiWriter file
>5 string >\0 version %s
0 string \\1cw ChiWriter file
+2 -1
View File
@@ -28,7 +28,8 @@
0 string/b #!\ /bin/awk awk script text executable
0 string/b #!\ /usr/bin/awk awk script text executable
# update to distinguish from *.vcf files
0 regex BEGIN[[:space:]]*[{] awk script text
# this is broken because postscript has /EBEGIN{ for example.
#0 regex BEGIN[[:space:]]*[{] awk script text
# AT&T Bell Labs' Plan 9 shell
0 string/b #!\ /bin/rc Plan 9 rc shell script text executable
+61
View File
@@ -191,3 +191,64 @@
0 string PPF10 Playstation Patch File version 1.0
>5 byte 0 \b, Simple Encoding
>6 string x \b, description: %s
# From: Daniel Dawson <[email protected]>
# SNES9x .smv "movie" file format.
0 string SMV\x1A SNES9x input recording
>0x4 lelong x \b, version %d
# version 4 is latest so far
>0x4 lelong <5
>>0x8 ledate x \b, recorded at %s
>>0xc lelong >0 \b, rerecorded %d times
>>0x10 lelong x \b, %d frames long
>>0x14 byte >0 \b, data for controller(s):
>>>0x14 byte &0x1 #1
>>>0x14 byte &0x2 #2
>>>0x14 byte &0x4 #3
>>>0x14 byte &0x8 #4
>>>0x14 byte &0x10 #5
>>0x15 byte ^0x1 \b, begins from snapshot
>>0x15 byte &0x1 \b, begins from reset
>>0x15 byte ^0x2 \b, NTSC standard
>>0x15 byte &0x2 \b, PAL standard
>>0x17 byte &0x1 \b, settings:
# WIP1Timing not used as of version 4
>>>0x4 lelong <4
>>>>0x17 byte &0x2 WIP1Timing
>>>0x17 byte &0x4 Left+Right
>>>0x17 byte &0x8 VolumeEnvX
>>>0x17 byte &0x10 FakeMute
>>>0x17 byte &0x20 SyncSound
# New flag as of version 4
>>>0x4 lelong >3
>>>>0x17 byte &0x80 NoCPUShutdown
>>0x4 lelong <4
>>>0x18 lelong >0x23
>>>>0x20 leshort !0
>>>>>0x20 lestring16 x \b, metadata: "%s"
>>0x4 lelong >3
>>>0x24 byte >0 \b, port 1:
>>>>0x24 byte 1 joypad
>>>>0x24 byte 2 mouse
>>>>0x24 byte 3 SuperScope
>>>>0x24 byte 4 Justifier
>>>>0x24 byte 5 multitap
>>>0x24 byte >0 \b, port 2:
>>>>0x25 byte 1 joypad
>>>>0x25 byte 2 mouse
>>>>0x25 byte 3 SuperScope
>>>>0x25 byte 4 Justifier
>>>>0x25 byte 5 multitap
>>>0x18 lelong >0x43
>>>>0x40 leshort !0
>>>>>0x40 lestring16 x \b, metadata: "%s"
>>0x17 byte &0x40 \b, ROM:
>>>(0x18.l-26) lelong x CRC32 0x%08x
>>>(0x18.l-23) string x "%s"
# From: "Nelson A. de Oliveira" <[email protected]>
# .w3g
0 string Warcraft\ III\ recorded\ game %s
# .w3m
0 string HM3W Warcraft III map file
-6
View File
@@ -1,6 +0,0 @@
#------------------------------------------------------------------------------
# file(1) magic for cvs(1) files
# From Hendrik Scholz <[email protected]>
0 string /1\ :pserver: cvs password text file
+10
View File
@@ -210,3 +210,13 @@
16 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
17 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
18 string MIT-MAGIC-COOKIE-1 X11 Xauthority data
# From: Maxime Henrion <[email protected]>
# PostgreSQL's custom dump format, Maxime Henrion <[email protected]>
0 string PGDMP PostgreSQL custom database dump
>5 byte x - v%d
>6 byte x \b.%d
>5 beshort <=0x100 \b-0
>5 beshort >0x100
>>7 byte x \b-%d
+14
View File
@@ -0,0 +1,14 @@
#------------------------------------------------------------------------------
# efi: file(1) magic for Universal EFI binaries
0 lelong 0x0ef1fab9
>4 lelong 1 Universal EFI binary with 1 architecture
>>&0 lelong 7 \b, i386
>>&0 lelong 0x01000007 \b, x86_64
>4 lelong 2 Universal EFI binary with 2 architectures
>>&0 lelong 7 \b, i386
>>&0 lelong 0x01000007 \b, x86_64
>>&20 lelong 7 \b, i386
>>&20 lelong 0x01000007 \b, x86_64
>4 lelong >2 Universal EFI binary with %ld architectures
+17 -16
View File
@@ -51,10 +51,10 @@
>>>>36 lelong&0xf0000000 0x20000000 MIPS-III
>>>>36 lelong&0xf0000000 0x30000000 MIPS-IV
>>>>36 lelong&0xf0000000 0x40000000 MIPS-V
>>>>36 lelong&0xf0000000 0x60000000 MIPS32
>>>>36 lelong&0xf0000000 0x70000000 MIPS64
>>>>36 lelong&0xf0000000 0x80000000 MIPS32 rel2
>>>>36 lelong&0xf0000000 0x90000000 MIPS64 rel2
>>>>36 lelong&0xf0000000 0x50000000 MIPS32
>>>>36 lelong&0xf0000000 0x60000000 MIPS64
>>>>36 lelong&0xf0000000 0x70000000 MIPS32 rel2
>>>>36 lelong&0xf0000000 0x80000000 MIPS64 rel2
# only for 64-bit
>>>4 byte 2
>>>>48 lelong&0xf0000000 0x00000000 MIPS-I
@@ -62,10 +62,10 @@
>>>>48 lelong&0xf0000000 0x20000000 MIPS-III
>>>>48 lelong&0xf0000000 0x30000000 MIPS-IV
>>>>48 lelong&0xf0000000 0x40000000 MIPS-V
>>>>48 lelong&0xf0000000 0x60000000 MIPS32
>>>>48 lelong&0xf0000000 0x70000000 MIPS64
>>>>48 lelong&0xf0000000 0x80000000 MIPS32 rel2
>>>>48 lelong&0xf0000000 0x90000000 MIPS64 rel2
>>>>48 lelong&0xf0000000 0x50000000 MIPS32
>>>>48 lelong&0xf0000000 0x60000000 MIPS64
>>>>48 lelong&0xf0000000 0x70000000 MIPS32 rel2
>>>>48 lelong&0xf0000000 0x80000000 MIPS64 rel2
>>18 leshort 9 Amdahl - invalid byte order,
>>18 leshort 10 MIPS (deprecated),
>>18 leshort 11 RS6000 - invalid byte order,
@@ -139,10 +139,10 @@
>>>>36 belong&0xf0000000 0x20000000 MIPS-III
>>>>36 belong&0xf0000000 0x30000000 MIPS-IV
>>>>36 belong&0xf0000000 0x40000000 MIPS-V
>>>>36 belong&0xf0000000 0x60000000 MIPS32
>>>>36 belong&0xf0000000 0x70000000 MIPS64
>>>>36 belong&0xf0000000 0x80000000 MIPS32 rel2
>>>>36 belong&0xf0000000 0x90000000 MIPS64 rel2
>>>>36 belong&0xf0000000 0x50000000 MIPS32
>>>>36 belong&0xf0000000 0x60000000 MIPS64
>>>>36 belong&0xf0000000 0x70000000 MIPS32 rel2
>>>>36 belong&0xf0000000 0x80000000 MIPS64 rel2
# only for 64-bit
>>>4 byte 2
>>>>48 belong&0xf0000000 0x00000000 MIPS-I
@@ -150,10 +150,10 @@
>>>>48 belong&0xf0000000 0x20000000 MIPS-III
>>>>48 belong&0xf0000000 0x30000000 MIPS-IV
>>>>48 belong&0xf0000000 0x40000000 MIPS-V
>>>>48 belong&0xf0000000 0x60000000 MIPS32
>>>>48 belong&0xf0000000 0x70000000 MIPS64
>>>>48 belong&0xf0000000 0x80000000 MIPS32 rel2
>>>>48 belong&0xf0000000 0x90000000 MIPS64 rel2
>>>>48 belong&0xf0000000 0x50000000 MIPS32
>>>>48 belong&0xf0000000 0x60000000 MIPS64
>>>>48 belong&0xf0000000 0x70000000 MIPS32 rel2
>>>>48 belong&0xf0000000 0x80000000 MIPS64 rel2
>>18 beshort 9 Amdahl,
>>18 beshort 10 MIPS (deprecated),
>>18 beshort 11 RS6000,
@@ -196,6 +196,7 @@
>>18 beshort 88 Renesas M32R,
>>18 beshort 94 Tensilica Xtensa,
>>18 beshort 97 NatSemi 32k,
>>18 beshort 0x18ad AVR32 (unofficial),
>>18 beshort 0x9026 Alpha (unofficial),
>>18 beshort 0xa390 IBM S/390 (obsolete),
>>20 belong 0 invalid version
+140 -91
View File
@@ -52,7 +52,13 @@
>>>>11 ulelong >0 \b, %d sectors/track
>>>>15 ulelong >0 \b, %d cylinders
# updated by Joerg Jenderek at Sep 2007
# only for sector sizes with 512 or more Bytes
0x1FE leshort 0xAA55 x86 boot sector
# to do also for sectors < than 512 Bytes and some other files, GRR
#30 search/481 \x55\xAA x86 boot sector
# not for BeOS floppy 1440k, MBRs
#(11.s-2) uleshort 0xAA55 x86 boot sector
>2 string OSBS \b, OS/BS MBR
# J\xf6rg Jenderek <joerg dot jenderek at web dot de>
>0x8C string Invalid\ partition\ table \b, MS-DOS MBR
@@ -173,56 +179,59 @@
>>498 string BCDL\ \ \ \ BIN \b, Bootable CD Loader (1.50Z)
# mbr partion table entries
# OEM-ID not Microsoft,SYSLINUX,or MTOOLs
>3 string !MS
>3 string !MS
>>3 string !SYSLINUX
>>>3 string !MTOOL
# not FAT (32 bit)
>>>>82 string !FAT32
#not IO.SYS
>>>>>472 string !IO\ \ \ \ \ \ SYS
>>>>>>480 string !IO\ \ \ \ \ \ SYS
#not Linux kernel
>>>>>>514 string !HdrS
>>>>>>>514 string !HdrS
#not BeOS
>>>>>>>>422 string !Be\ Boot\ Loader
# active flag 0 or 0x80 and type > 0
>>>>>>>446 ubyte <0x81
>>>>>>>>446 ubyte&0x7F 0
>>>>>>>>>446 ubyte <0x81
>>>>>>>>>>446 ubyte&0x7F 0
>>>>>>>>>>>450 ubyte >0 \b; partition 1: ID=0x%x
>>>>>>>>>>446 ubyte 0x80 \b, active
>>>>>>>>>>447 ubyte x \b, starthead %u
#>>>>>>>>>>448 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>448 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>454 ulelong x \b, startsector %u
>>>>>>>>>>458 ulelong x \b, %u sectors
>>>>>>>>>>>>446 ubyte 0x80 \b, active
>>>>>>>>>>>>447 ubyte x \b, starthead %u
#>>>>>>>>>>>>448 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>>>448 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>>>454 ulelong x \b, startsector %u
>>>>>>>>>>>>458 ulelong x \b, %u sectors
#
>>>>>>>462 ubyte <0x81
>>>>>>>>462 ubyte&0x7F 0
>>>>>>>>>466 ubyte >0 \b; partition 2: ID=0x%x
>>>>>>>>>>462 ubyte 0x80 \b, active
>>>>>>>>>>463 ubyte x \b, starthead %u
#>>>>>>>>>>464 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>464 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>470 ulelong x \b, startsector %u
>>>>>>>>>>474 ulelong x \b, %u sectors
>>>>>>>>>462 ubyte <0x81
>>>>>>>>>>462 ubyte&0x7F 0
>>>>>>>>>>>466 ubyte >0 \b; partition 2: ID=0x%x
>>>>>>>>>>>>462 ubyte 0x80 \b, active
>>>>>>>>>>>>463 ubyte x \b, starthead %u
#>>>>>>>>>>>>464 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>>>464 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>>>470 ulelong x \b, startsector %u
>>>>>>>>>>>>474 ulelong x \b, %u sectors
#
>>>>>>>478 ubyte <0x81
>>>>>>>>478 ubyte&0x7F 0
>>>>>>>>>482 ubyte >0 \b; partition 3: ID=0x%x
>>>>>>>>>>478 ubyte 0x80 \b, active
>>>>>>>>>>479 ubyte x \b, starthead %u
#>>>>>>>>>>480 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>481 ubyte x \b, start C2S: 0x%x
#>>>>>>>>>>480 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>486 ulelong x \b, startsector %u
>>>>>>>>>>490 ulelong x \b, %u sectors
>>>>>>>>>478 ubyte <0x81
>>>>>>>>>>478 ubyte&0x7F 0
>>>>>>>>>>>482 ubyte >0 \b; partition 3: ID=0x%x
>>>>>>>>>>>>478 ubyte 0x80 \b, active
>>>>>>>>>>>>479 ubyte x \b, starthead %u
#>>>>>>>>>>>>480 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>>>481 ubyte x \b, start C2S: 0x%x
#>>>>>>>>>>>>480 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>>>486 ulelong x \b, startsector %u
>>>>>>>>>>>>490 ulelong x \b, %u sectors
#
>>>>>>>494 ubyte <0x81
>>>>>>>>494 ubyte&0x7F 0
>>>>>>>>>498 ubyte >0 \b; partition 4: ID=0x%x
>>>>>>>>>>494 ubyte 0x80 \b, active
>>>>>>>>>>495 ubyte x \b, starthead %u
#>>>>>>>>>>496 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>496 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>502 ulelong x \b, startsector %u
>>>>>>>>>>506 ulelong x \b, %u sectors
>>>>>>>>>494 ubyte <0x81
>>>>>>>>>>494 ubyte&0x7F 0
>>>>>>>>>>>498 ubyte >0 \b; partition 4: ID=0x%x
>>>>>>>>>>>>494 ubyte 0x80 \b, active
>>>>>>>>>>>>495 ubyte x \b, starthead %u
#>>>>>>>>>>>>496 ubyte x \b, start C_S: 0x%x
#>>>>>>>>>>>>496 ubeshort&1023 x \b, startcylinder? %d
>>>>>>>>>>>>502 ulelong x \b, startsector %u
>>>>>>>>>>>>506 ulelong x \b, %u sectors
# mbr partion table entries end
# http://www.acronis.de/
#FAT label=ACRONIS\ SZ
@@ -507,34 +516,52 @@
>>>>>>>498 ubyte&0xDF >0
>>>>>>>>498 string x \b.%-.3s
#
>486 ubyte&0xDF >0
>>416 string Non-System\ disk\ or\
>>>435 string disk\ error\r
>>>>447 string Replace\ and\ press\ any\ key\
>>>>>473 string when\ ready\r \b, Microsoft DOS Bootloader
>480 ubyte&0xDF >0
>>393 string Non-System\ disk\ or\
>>>412 string disk\ error\r
>>>>424 string Replace\ and\ press\ any\ key\
>>>>>450 string when\ ready\r \b, Microsoft DOS bootloader
#IO.SYS
>>>>>480 string x \b %-.2s
>>>>>>482 ubyte&0xDF >0
>>>>>>>48 string x \b%-.6s
>>>>>488 ubyte&0xDF >0
>>>>>>488 string x \b.%-.3s
#MSDOS.SYS
>>>>>>491 ubyte&0xDF >0 \b+
>>>>>>>491 string x \b%-.5s
>>>>>>>>496 ubyte&0xDF >0
>>>>>>>>>496 string x \b%-.3s
>>>>>>>499 ubyte&0xDF >0
>>>>>>>>499 string x \b.%-.3s
>376 search/41 Non-System\ disk\ or\
>>395 search/41 disk\ error\r
>>>407 search/41 Replace\ and\
>>>>419 search/41 press\ \b,
>>>>419 search/41 strike\ \b, old
>>>>426 search/41 any\ key\ when\ ready\r MS or PC-DOS bootloader
#449 Disk\ Boot\ failure\r MS 3.21
#466 Boot\ Failure\r MS 3.30
>>>>>468 search/18 \0
#IO.SYS,IBMBIO.COM
>>>>>>&0 string x \b %-.2s
>>>>>>>&-20 ubyte&0xDF >0
>>>>>>>>&-1 string x \b%-.4s
>>>>>>>>>&-16 ubyte&0xDF >0
>>>>>>>>>>&-1 string x \b%-.2s
>>>>>>&8 ubyte&0xDF >0 \b.
>>>>>>>&-1 string x \b%-.3s
#MSDOS.SYS,IBMDOS.COM
>>>>>>&11 ubyte&0xDF >0 \b+
>>>>>>>&-1 string x \b%-.5s
>>>>>>>>&-6 ubyte&0xDF >0
>>>>>>>>>&-1 string x \b%-.1s
>>>>>>>>>>&-5 ubyte&0xDF >0
>>>>>>>>>>>&-1 string x \b%-.2s
>>>>>>>&7 ubyte&0xDF >0 \b.
>>>>>>>>&-1 string x \b%-.3s
>441 string Cannot\ load\ from\ harddisk.\n\r
>>469 string Insert\ Systemdisk\
>>>487 string and\ press\ any\ key.\n\r \b, MS (2.11) DOS bootloader
#>43 string \224R-LOADER\ \ SYS =label
>54 string SYS
>>324 string VASKK
>>>495 string NEWLDR\0 \b, DR-DOS Bootloader (LOADER.SYS)
#
>98 string Press\ a\ key\ to\ retry\0\r
>>120 string Cannot\ find\ file\ \0\r
>>>139 string Disk\ read\ error\0\r
>>>>156 string Loading\ ...\0 \b, DR-DOS (3.41) Bootloader
#DRBIOS.SYS
>>>>>44 ubyte&0xDF >0
>>>>>>44 string x \b %-.6s
>>>>>>>50 ubyte&0xDF >0
>>>>>>>>50 string x \b%-.2s
>>>>>>52 ubyte&0xDF >0
>>>>>>>52 string x \b.%-.3s
#
>70 string IBMBIO\ \ COM
>>472 string Cannot\ load\ DOS!\
>>>489 string Any\ key\ to\ retry \b, DR-DOS Bootloader
@@ -679,26 +706,43 @@
#it also hangs with another message ("NF").
>>>>>492 string RENF \b, FAT (12 bit)
>>>>>495 string RENF \b, FAT (16 bit)
# added by Joerg Jenderek
# http://syslinux.zytor.com/iso.php
0 ulelong 0x7c40eafa isolinux Loader
# http://syslinux.zytor.com/pxe.php
0 ulelong 0x007c05ea pxelinux Loader
0 ulelong 0x60669c66 pxelinux Loader
# loader end
# Joerg Jenderek
>446 ubyte 0
>>450 ubyte >0
>>>482 ubyte 0
>>>>498 ubyte 0
>>>>466 ubyte 0x05 \b, extended partition table
>>>>466 ubyte 0x0F \b, extended partition table (LBA)
>>>>466 ubyte 0x0 \b, extended partition table (last)
# updated by Joerg Jenderek at Sep 2007
>3 ubyte 0
#no active flag
>>446 ubyte 0
# partition 1 not empty
>>>450 ubyte >0
# partitions 3,4 empty
>>>>482 ubyte 0
>>>>>498 ubyte 0
# partition 2 ID=0,5,15
>>>>>>466 ubyte <0x10
>>>>>>>466 ubyte 0x05 \b, extended partition table
>>>>>>>466 ubyte 0x0F \b, extended partition table (LBA)
>>>>>>>466 ubyte 0x0 \b, extended partition table (last)
# JuMP short bootcodeoffset NOP assembler instructions will usually be EB xx 90
# older drives may use E9 xx xx
# http://mirror.href.com/thestarman/asm/2bytejumps.htmm#FWD
# older drives may use Near JuMP instruction E9 xx xx
>0 lelong&0x009000EB 0x009000EB
>0 lelong&0x000000E9 0x000000E9
>>1 ubyte >37 \b, code offset 0x%x
# maximal short forward jump is 07fx
>1 ubyte <0xff \b, code offset 0x%x
# mtools-3.9.8/msdos.h
# usual values are marked with comments to get only informations of strange FAT systems
# valid sectorsize are from 32 to 2048
>>>11 uleshort <2049
>>>>11 uleshort >31
# valid sectorsize must be a power of 2 from 32 to 32768
>>11 uleshort&0x000f x
>>>11 uleshort <32769
>>>>11 uleshort >31
>>>>>3 string >\0 \b, OEM-ID "%8.8s"
#http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC
>>>>>>8 string IHC \b cached by Windows 9M
>>>>>11 uleshort >512 \b, Bytes/sector %u
#>>>>>11 uleshort =512 \b, Bytes/sector %u=512 (usual)
>>>>>11 uleshort <512 \b, Bytes/sector %u
@@ -725,17 +769,18 @@
>>>>>26 ubyte >2 \b, heads %u
#>>>>>26 ubyte =2 \b, heads %u (usual floppy)
>>>>>26 ubyte =1 \b, heads %u
>>>>>28 ulelong >0 \b, hidden sectors %u
#>>>>>28 ulelong =0 \b, hidden sectors %u (usual floppy)
>>>>>32 ulelong >0 \b, sectors %u (volumes > 32 MB)
#>>>>>32 ulelong =0 \b, sectors %u (volumes > 32 MB)
#skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk
>>>>>38 ubyte !0x70
>>>>>>28 ulelong >0 \b, hidden sectors %u
#>>>>>>28 ulelong =0 \b, hidden sectors %u (usual floppy)
>>>>>>32 ulelong >0 \b, sectors %u (volumes > 32 MB)
#>>>>>>32 ulelong =0 \b, sectors %u (volumes > 32 MB)
# FAT<32 specific
# NOT le FAT3=NOT 3TAF=0xCCABBEB9
>>>>>82 ulelong&0xCCABBEB9 >0
>>>>>>36 ubyte >0x80 \b, physical drive 0x%x
#>>>>>>36 ubyte =0x80 \b, physical drive 0x%x=0x80 (usual harddisk)
>>>>>>36 ubyte&0x7F >0 \b, physical drive 0x%x
#>>>>>>36 ubyte =0 \b, physical drive 0x%x=0 (usual floppy)
>>>>>82 string !FAT32
#>>>>>>36 ubyte 0x80 \b, physical drive 0x%x=0x80 (usual harddisk)
#>>>>>>36 ubyte 0 \b, physical drive 0x%x=0 (usual floppy)
>>>>>>36 ubyte !0x80
>>>>>>>36 ubyte !0 \b, physical drive 0x%x
>>>>>>37 ubyte >0 \b, reserved 0x%x
#>>>>>>37 ubyte =0 \b, reserved 0x%x
>>>>>>38 ubyte >0x29 \b, dos < 4.0 BootSector (0x%x)
@@ -1072,13 +1117,12 @@
# Modified for UDF by [email protected]
32769 string CD001
>38913 string !NSR0 ISO 9660 CD-ROM filesystem data
>38913 string NSR01 UDF filesystem data (version 1.0)
>38913 string NSR02 UDF filesystem data (version 1.5)
>38913 string NSR03 UDF filesystem data (version 2.0)
>38913 string >NSR03 UDF filesystem data (unknown version,
>>38917 byte x id 'NSR0%c')
>38913 string <NSR01 UDF filesystem data (unknown version,
>>38917 byte x id 'NSR0%c')
>38913 string NSR0 UDF filesystem data
>>38917 string 1 (version 1.0)
>>38917 string 2 (version 1.5)
>>38917 string 3 (version 2.0)
>>38917 byte >0x33 (unknown version, ID 0x%X)
>>38917 byte <0x31 (unknown version, ID 0x%X)
# "application id" which appears to be used as a volume label
>32808 string >\0 '%s'
>34816 string \000CD001\001EL\ TORITO\ SPECIFICATION (bootable)
@@ -1210,3 +1254,8 @@
>525 byte x Level %d
>525 byte x (ODS-%d OpenVMS file system),
>984 string x volume label is '%-12.12s'
# From: Thomas Klausner <[email protected]>
# http://filext.com/file-extension/DAA
# describes the daa file format. The magic would be:
0 string DAA\x0\x0\x0\x0\x0 PowerISO Direct-Access-Archive
+2
View File
@@ -0,0 +1,2 @@
# FORTRAN source
0 string/c c\ FORTRAN program
-7
View File
@@ -1,7 +0,0 @@
#------------------------------------------------------------------------------
# Hierarchical Data Format, used to facilitate scientific data exchange
# specifications at http://hdf.ncsa.uiuc.edu/
0 belong 0x0e031301 Hierarchical Data Format (version 4) data
0 string \211HDF\r\n\032 Hierarchical Data Format (version 5) data
-18
View File
@@ -1,18 +0,0 @@
#------------------------------------------------------------------------------
# impulse tracker: file(1) magic for Impulse Tracker data files
#
# From <[email protected]>
# These are the /etc/magic entries to decode modules, instruments, and
# samples in Impulse Tracker's native format.
0 string IMPS Impulse Tracker Sample
>18 byte &2 16 bit
>18 byte ^2 8 bit
>18 byte &4 stereo
>18 byte ^4 mono
0 string IMPI Impulse Tracker Instrument
>28 leshort !0 ITv%x
>30 byte !0 %d samples
0 string IMPM Impulse Tracker Module
>40 leshort !0 compatible w/ITv%x
>42 leshort !0 created w/ITv%x
+14
View File
@@ -7,3 +7,17 @@
# From Martin Pool ([email protected])
0 beshort 0xaced Java serialization data
>2 beshort >0x0004 \b, version %d
0 belong 0xfeedfeed Java KeyStore
0 belong 0xcececece Java JCE KeyStore
# Dalvik .dex format. http://retrodev.com/android/dexformat.html
# From <[email protected]> "Mike Fleming"
0 string dex\n
>0 regex dex\n[0-9][0-9][0-9]\0 Dalvik dex file
>4 string >000 version %s
0 string dey\n
>0 regex dey\n[0-9][0-9][0-9]\0 Dalvik dex file (optimized for host)
>4 string >000 version %s
+1 -1
View File
@@ -357,4 +357,4 @@
>>>>0xa54 belong x number of blocks: %d
# From: Remi Mommsen <[email protected]>
0 string BOMStore Mac OS X bill of materials (BOM) fil
0 string BOMStore Mac OS X bill of materials (BOM) file
+48 -11
View File
@@ -17,10 +17,6 @@
100 regex/c =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc OS/2 REXX batch file text
100 regex/c =^[\ \t]{0,10}say\ ['"] OS/2 REXX batch file text
100 regex/c =^\\s*call\\s+rxfuncadd.*sysloadfu OS/2 REXX batch file text
100 regex/c =^\\s*say\ ['"] OS/2 REXX batch file text
0 leshort 0x14c MS Windows COFF Intel 80386 object file
#>4 ledate x stamp %s
0 leshort 0x166 MS Windows COFF MIPS R4000 object file
@@ -363,8 +359,6 @@
>30 byte 12 (4kB sectors)
# Popular applications
# False positive with PPT
#0 string \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF Microsoft Installer
2080 string Microsoft\ Word\ 6.0\ Document %s
2080 string Documento\ Microsoft\ Word\ 6 Spanish Microsoft Word 6 document data
# Pawel Wiecek <[email protected]> (for polish Word)
@@ -610,10 +604,44 @@
0 string VMDK VMware4 disk image
0 string KDMV VMware4 disk image
0 belong 0x514649fb QEMU Copy-On-Write disk image
>4 belong x version %d,
>24 belong x size %d +
>28 belong x %d
#--------------------------------------------------------------------
# Qemu Emulator Images
# Lines written by Friedrich Schwittay ([email protected])
# Made by reading sources and doing trial and error on existing
# qcow files
0 string QFI Qemu Image, Format: Qcow
# Uncomment the following line to display Magic (only used for debugging
# this magic number)
#>0 string x , Magic: %s
# There are currently 2 Versions: "1" and "2"
# I do not use Version 2 and therefor branch here
# but can assure: it works (tested on both versions)
# Also my Qemu 0.9.0 which uses this Version 2 refuses
# to start in its bios
>0x04 belong 2 , Version: 2
>0x04 belong 1 , Version: 1
# Using the existence of the Backing File Offset to Branch or not
# to read Backing File Information
>>0xc belong >0 , Backing File( Offset: %d
>>>(0xc.L) string >\0 , Path: %s
# Didnt got the Trick here how qemu stores the "Size" at this Position
# There is actually something stored but nothing makes sense
# The header in the sources talks about it
#>>>16 lelong x , Size: %d
# Modification time of the Backing File
# Really usefull if you want to know if your backing
# file is still usable together with this image
>>>20 bedate x , Mtime: %s )
# Dont know how to calculate in Magicfiles
# Also: this Information is not reliably
# stored in image-files
>>24 lelong x , Disk Size could be: %d * 256 bytes
0 string QEVM QEMU's suspend to disk image
@@ -624,5 +652,14 @@
0 lelong 0x02468ace Bochs Sparse disk image
# from http://filext.com by Derek M Jones <[email protected]>
0 string \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF Microsoft Installer
# False positive with PPT
#0 string \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF Microsoft Installer
0 string \320\317\021\340\241\261\032\341 Microsoft Office Document
# From: "Nelson A. de Oliveira" <[email protected]>
# Magic type for Dell's BIOS .hdr files
# Dell's .hdr
0 string $RBU
>23 string Dell %s system BIOS
>48 string x version %.3s
+6
View File
@@ -5,3 +5,9 @@
0 string %PDF- PDF document
>5 byte x \b, version %c
>7 byte x \b.%c
# From: Nick Schmalenberger <[email protected]>
# Forms Data Format
0 string %FDF- FDF text
>5 byte x \b, version %c
>7 byte x \b.%c
+5 -2
View File
@@ -15,19 +15,22 @@
>20 lelong 0 log volume #0
>20 lelong >0 log volume #%ld
>24 string >\0 host: %s
0 string PCPFolio PCP
0 string PCPFolio PCP
>9 string Version: Archive Folio
>18 string >\0 (V.%s)
0 string #pmchart PCP pmchart view
>9 string Version
>17 string >\0 (V%-3.3s)
0 string #kmchart PCP kmchart view
>9 string Version
>17 string >\0 (V.%s)
0 string pmview PCP pmview config
>7 string Version
>15 string >\0 (V%-3.3s)
0 string #pmlogger PCP pmlogger config
>10 string Version
>18 string >\0 (V%1.1s)
0 string PcPh PCP Help
0 string PcPh PCP Help
>4 string 1 Index
>4 string 2 Text
>5 string >\0 (V.%1.1s)
-91
View File
@@ -1,91 +0,0 @@
#WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
0 string \377WPC\020\000\000\000\022\012\001\001\000\000\000\000 (WP) loadable text
>15 byte 0 Optimized for Intel
>15 byte 1 Optimized for Non-Intel
1 string WPC (Corel/WP)
>8 short 257 WordPerfect macro
>8 short 258 WordPerfect help file
>8 short 259 WordPerfect keyboard file
>8 short 266 WordPerfect document
>8 short 267 WordPerfect dictionary
>8 short 268 WordPerfect thesaurus
>8 short 269 WordPerfect block
>8 short 270 WordPerfect rectangular block
>8 short 271 WordPerfect column block
>8 short 272 WordPerfect printer data
>8 short 275 WordPerfect printer data
>8 short 276 WordPerfect driver resource data
>8 short 279 WordPerfect hyphenation code
>8 short 280 WordPerfect hyphenation data
>8 short 281 WordPerfect macro resource data
>8 short 283 WordPerfect hyphenation lex
>8 short 285 WordPerfect wordlist
>8 short 286 WordPerfect equation resource data
>8 short 289 WordPerfect spell rules
>8 short 290 WordPerfect dictionary rules
>8 short 295 WordPerfect spell rules (Microlytics)
>8 short 299 WordPerfect settings file
>8 short 301 WordPerfect 4.2 document
>8 short 325 WordPerfect dialog file
>8 short 332 WordPerfect button bar
>8 short 513 Shell macro
>8 short 522 Shell definition
>8 short 769 Notebook macro
>8 short 770 Notebook help file
>8 short 771 Notebook keyboard file
>8 short 778 Notebook definition
>8 short 1026 Calculator help file
>8 short 1538 Calendar help file
>8 short 1546 Calendar data file
>8 short 1793 Editor macro
>8 short 1794 Editor help file
>8 short 1795 Editor keyboard file
>8 short 1817 Editor macro resource file
>8 short 2049 Macro editor macro
>8 short 2050 Macro editor help file
>8 short 2051 Macro editor keyboard file
>8 short 2305 PlanPerfect macro
>8 short 2306 PlanPerfect help file
>8 short 2307 PlanPerfect keyboard file
>8 short 2314 PlanPerfect worksheet
>8 short 2319 PlanPerfect printer definition
>8 short 2322 PlanPerfect graphic definition
>8 short 2323 PlanPerfect data
>8 short 2324 PlanPerfect temporary printer
>8 short 2329 PlanPerfect macro resource data
>8 byte 11 Mail
>8 short 2818 help file
>8 short 2821 distribution list
>8 short 2826 out box
>8 short 2827 in box
>8 short 2836 users archived mailbox
>8 short 2837 archived message database
>8 short 2838 archived attachments
>8 short 3083 Printer temporary file
>8 short 3330 Scheduler help file
>8 short 3338 Scheduler in file
>8 short 3339 Scheduler out file
>8 short 3594 GroupWise settings file
>8 short 3601 GroupWise directory services
>8 short 3627 GroupWise settings file
>8 short 4362 Terminal resource data
>8 short 4363 Terminal resource data
>8 short 4395 Terminal resource data
>8 short 4619 GUI loadable text
>8 short 4620 graphics resource data
>8 short 4621 printer settings file
>8 short 4622 port definition file
>8 short 4623 print queue parameters
>8 short 4624 compressed file
>8 short 5130 Network service msg file
>8 short 5131 Network service msg file
>8 short 5132 Async gateway login msg
>8 short 5134 GroupWise message file
>8 short 7956 GroupWise admin domain database
>8 short 7957 GroupWise admin host database
>8 short 7959 GroupWise admin remote host database
>8 short 7960 GroupWise admin ADS deferment data file
>8 short 8458 IntelliTAG (SGML) compiled DTD
>8 long 18219264 WordPerfect graphic image (1.0)
>8 long 18219520 WordPerfect graphic image (2.0)
#end of WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
+2
View File
@@ -77,6 +77,7 @@ Magdir/digital \
Magdir/dolby \
Magdir/dump \
Magdir/editors \
Magdir/efi \
Magdir/elf \
Magdir/encore \
Magdir/epoc \
@@ -85,6 +86,7 @@ Magdir/fcs \
Magdir/filesystems \
Magdir/flash \
Magdir/fonts \
Magdir/fortran \
Magdir/frame \
Magdir/freebsd \
Magdir/fsav \
+54 -47
View File
@@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -14,15 +14,11 @@
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -59,8 +55,6 @@ pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgdata_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
@@ -87,14 +81,12 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FSECT5_FALSE = @FSECT5_FALSE@
FSECT5_TRUE = @FSECT5_TRUE@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
IS_CROSS_COMPILE_FALSE = @IS_CROSS_COMPILE_FALSE@
IS_CROSS_COMPILE_TRUE = @IS_CROSS_COMPILE_TRUE@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -102,9 +94,8 @@ LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -118,16 +109,13 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -139,7 +127,11 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fsect = @fsect@
host = @host@
@@ -147,21 +139,28 @@ host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc
EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS)
CLEANFILES = magic magic.mgc magic.mime.mgc
@@ -217,6 +216,7 @@ Magdir/digital \
Magdir/dolby \
Magdir/dump \
Magdir/editors \
Magdir/efi \
Magdir/elf \
Magdir/encore \
Magdir/epoc \
@@ -225,6 +225,7 @@ Magdir/fcs \
Magdir/filesystems \
Magdir/flash \
Magdir/fonts \
Magdir/fortran \
Magdir/frame \
Magdir/freebsd \
Magdir/fsav \
@@ -394,13 +395,9 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-pkgdataDATA: $(pkgdata_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
@list='$(pkgdata_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
@@ -423,23 +420,21 @@ CTAGS:
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/Magdir
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
@@ -455,7 +450,7 @@ check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(pkgdatadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
@@ -488,7 +483,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
distclean-am: clean-am distclean-generic
dvi: dvi-am
@@ -502,12 +497,20 @@ info-am:
install-data-am: install-pkgdataDATA
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -526,17 +529,21 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-pkgdataDATA
uninstall-am: uninstall-pkgdataDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-pkgdataDATA \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgdataDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-info-am uninstall-pkgdataDATA
uninstall uninstall-am uninstall-pkgdataDATA
magic: Header Localstuff $(magic_FRAGMENTS)
-60
View File
@@ -1,60 +0,0 @@
/* Autoheader needs me */
#undef PACKAGE
/* Autoheader needs me */
#undef VERSION
/* Define if builtin ELF support is enabled. */
#undef BUILTIN_ELF
/* Define if ELF core file support is enabled. */
#undef ELFCORE
/* Define if the `long long' type works. */
#undef HAVE_LONG_LONG
/* Define if we have "tm_zone" in "struct tm". */
#undef HAVE_TM_ZONE
/* Define if we have a global "char * []" "tzname" variable. */
#undef HAVE_TZNAME
/* Define if we have "tm_isdst" in "struct tm". */
#undef HAVE_TM_ISDST
/* Define if we have a global "int" variable "daylight". */
#undef HAVE_DAYLIGHT
/* Define if we have a mkstemp */
#undef HAVE_MKSTEMP
/* Define to `unsigned char' if standard headers don't define. */
#undef uint8_t
/* Define to `unsigned short' if standard headers don't define. */
#undef uint16_t
/* Define to `unsigned int' if standard headers don't define. */
#undef uint32_t
/* Define to `unsigned long long', if available, or `unsigned long', if
standard headers don't define. */
#undef uint64_t
/* Define to `int' if standard headers don't define. */
#undef int32_t
/* FIXME: These have to be added manually because autoheader doesn't know
about AC_CHECK_SIZEOF_INCLUDES. */
/* The number of bytes in a uint8_t. */
#define SIZEOF_UINT8_T 0
/* The number of bytes in a uint16_t. */
#define SIZEOF_UINT16_T 0
/* The number of bytes in a uint32_t. */
#define SIZEOF_UINT32_T 0
/* The number of bytes in a uint64_t. */
#define SIZEOF_UINT64_T 0
-4
View File
@@ -157,8 +157,6 @@ fi
dnl AC_HEADER_STDINT
AC_DEFUN([AC_HEADER_STDINT], [AC_CHECK_HEADERS(stdint.h)])
#serial 19
dnl By default, many hosts won't let programs access large files;
dnl one must use special compiler options to get large-file access to work.
dnl For more details about this brain damage please see:
@@ -252,8 +250,6 @@ AC_DEFUN([AC_FUNC_FSEEKO],
[Define if fseeko (and presumably ftello) exists and is declared.])
fi])
# serial 9
# From Paul Eggert.
# BeOS 5 has <wchar.h> but does not define mbstate_t,
+93 -81
View File
@@ -1,7 +1,7 @@
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# generated automatically by aclocal 1.10 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,11 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_if(m4_PACKAGE_VERSION, [2.61],,
[m4_fatal([this file was generated for autoconf 2.61.
You have another version of autoconf. If you want to use that,
you should regenerate the build system entirely.], [63])])
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
# serial 47 AC_PROG_LIBTOOL
@@ -6159,7 +6164,7 @@ SED=$lt_cv_path_SED
AC_MSG_RESULT([$SED])
])
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -6169,14 +6174,29 @@ AC_MSG_RESULT([$SED])
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.6])])
[AM_AUTOMAKE_VERSION([1.10])dnl
_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
@@ -6233,14 +6253,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -6249,8 +6269,10 @@ AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
@@ -6264,15 +6286,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -6300,6 +6321,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
@@ -6365,6 +6387,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
@@ -6417,7 +6440,8 @@ if test "x$enable_dependency_tracking" != xno; then
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
@@ -6442,8 +6466,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
@@ -6502,8 +6527,8 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -6526,16 +6551,20 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
@@ -6555,6 +6584,9 @@ m4_ifval([$2],
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
@@ -6590,6 +6622,10 @@ AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
@@ -6625,7 +6661,7 @@ echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
@@ -6732,14 +6768,14 @@ rm -f confinc confmf
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -6755,6 +6791,7 @@ AC_SUBST($1)])
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
@@ -6765,7 +6802,7 @@ else
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -6773,60 +6810,23 @@ fi
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
@@ -6938,9 +6938,21 @@ dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+85 -6
View File
@@ -31,6 +31,7 @@
#include "file.h"
#include "magic.h"
#include "patchlevel.h"
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -46,7 +47,7 @@
#endif
#ifndef lint
FILE_RCSID("@(#)$File: apprentice.c,v 1.105 2007/05/16 20:51:40 christos Exp $")
FILE_RCSID("@(#)$File: apprentice.c,v 1.109 2007/12/27 20:52:36 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
@@ -110,6 +111,7 @@ private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
const char *);
private int check_format_type(const char *, int);
private int check_format(struct magic_set *, struct magic *);
private int get_op(char);
private size_t maxmagic = 0;
private size_t magicsize = sizeof(struct magic);
@@ -188,6 +190,12 @@ static const struct type_tbl_s {
{ XX("qldate"), FILE_QLDATE, FILE_FMT_STR },
{ XX("leqldate"), FILE_LEQLDATE, FILE_FMT_STR },
{ XX("beqldate"), FILE_BEQLDATE, FILE_FMT_STR },
{ XX("float"), FILE_FLOAT, FILE_FMT_FLOAT },
{ XX("befloat"), FILE_BEFLOAT, FILE_FMT_FLOAT },
{ XX("lefloat"), FILE_LEFLOAT, FILE_FMT_FLOAT },
{ XX("double"), FILE_DOUBLE, FILE_FMT_DOUBLE },
{ XX("bedouble"), FILE_BEDOUBLE, FILE_FMT_DOUBLE },
{ XX("ledouble"), FILE_LEDOUBLE, FILE_FMT_DOUBLE },
{ XX_NULL, FILE_INVALID, FILE_FMT_NONE },
# undef XX
# undef XX_NULL
@@ -261,7 +269,6 @@ apprentice_1(struct magic_set *ms, const char *fn, int action,
rv = apprentice_file(ms, &magic, &nmagic, fn, action);
if (rv != 0)
return -1;
mapped = 0;
}
mapped = rv;
@@ -296,10 +303,12 @@ file_delmagic(struct magic *p, int type, size_t entries)
if (p == NULL)
return;
switch (type) {
#ifdef QUICK
case 2:
p--;
(void)munmap((void *)p, sizeof(*p) * (entries + 1));
break;
#endif
case 1:
p--;
/*FALLTHROUGH*/
@@ -431,6 +440,9 @@ apprentice_magic_strength(const struct magic *m)
case FILE_LELDATE:
case FILE_BELDATE:
case FILE_MELDATE:
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
val += 4 * MULT;
break;
@@ -443,6 +455,9 @@ apprentice_magic_strength(const struct magic *m)
case FILE_QLDATE:
case FILE_LEQLDATE:
case FILE_BEQLDATE:
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
val += 8 * MULT;
break;
@@ -512,7 +527,7 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
private const char hdr[] =
"cont\toffset\ttype\topcode\tmask\tvalue\tdesc";
FILE *f;
char line[BUFSIZ+1];
char line[BUFSIZ];
int errs = 0;
struct magic_entry *marray;
uint32_t marraycount, i, mentrycount = 0;
@@ -541,7 +556,7 @@ apprentice_file(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
(void)fprintf(stderr, "%s\n", hdr);
/* read and parse this file */
for (ms->line = 1; fgets(line, BUFSIZ, f) != NULL; ms->line++) {
for (ms->line = 1; fgets(line, sizeof(line), f) != NULL; ms->line++) {
size_t len;
len = strlen(line);
if (len == 0) /* null line, garbage, etc */
@@ -646,6 +661,9 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
case FILE_BELONG:
case FILE_LELONG:
case FILE_MELONG:
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
v = (int32_t) v;
break;
case FILE_QUAD:
@@ -657,6 +675,9 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
case FILE_BEQLDATE:
case FILE_LEQDATE:
case FILE_LEQLDATE:
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
v = (int64_t) v;
break;
case FILE_STRING:
@@ -959,6 +980,16 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
case 'B':
m->in_type = FILE_BYTE;
break;
case 'e':
case 'f':
case 'g':
m->in_type = FILE_LEDOUBLE;
break;
case 'E':
case 'F':
case 'G':
m->in_type = FILE_BEDOUBLE;
break;
default:
if (ms->flags & MAGIC_CHECK)
file_magwarn(ms,
@@ -1252,6 +1283,31 @@ check_format_type(const char *ptr, int type)
return -1;
}
case FILE_FMT_FLOAT:
case FILE_FMT_DOUBLE:
if (*ptr == '-')
ptr++;
if (*ptr == '.')
ptr++;
while (isdigit((unsigned char)*ptr)) ptr++;
if (*ptr == '.')
ptr++;
while (isdigit((unsigned char)*ptr)) ptr++;
switch (*ptr++) {
case 'e':
case 'E':
case 'f':
case 'F':
case 'g':
case 'G':
return 0;
default:
return -1;
}
case FILE_FMT_STR:
if (*ptr == '-')
ptr++;
@@ -1358,6 +1414,28 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
}
m->vallen = slen;
return 0;
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
if (m->reln != 'x') {
char *ep;
#ifdef HAVE_STRTOF
m->value.f = strtof(*p, &ep);
#else
m->value.f = (float)strtod(*p, &ep);
#endif
*p = ep;
}
return 0;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
if (m->reln != 'x') {
char *ep;
m->value.d = strtod(*p, &ep);
*p = ep;
}
return 0;
default:
if (m->reln != 'x') {
char *ep;
@@ -1685,8 +1763,9 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
else
version = ptr[1];
if (version != VERSIONNO) {
file_error(ms, 0, "version mismatch (%d != %d) in `%s'",
version, VERSIONNO, dbname);
file_error(ms, 0, "File %d.%d supports only %d version magic "
"files. `%s' is version %d", FILE_VERSION_MAJOR, patchlevel,
VERSIONNO, dbname, version);
goto error;
}
*nmagicp = (uint32_t)(st.st_size / sizeof(struct magic)) - 1;
+17 -17
View File
@@ -49,7 +49,7 @@
#include "names.h"
#ifndef lint
FILE_RCSID("@(#)$File: ascmagic.c,v 1.50 2007/03/15 14:51:00 christos Exp $")
FILE_RCSID("@(#)$File: ascmagic.c,v 1.53 2007/10/29 00:54:08 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
@@ -76,6 +76,7 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
size_t ulen;
struct names *p;
int rv = -1;
int mime = ms->flags & MAGIC_MIME;
const char *code = NULL;
const char *code_mime = NULL;
@@ -184,13 +185,6 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
}
}
if ((ms->flags & MAGIC_NO_CHECK_FORTRAN) == 0 &&
(*buf == 'c' || *buf == 'C') && ISSPC(buf[1])) {
subtype_mime = "text/fortran";
subtype = "fortran program";
goto subtype_identified;
}
/* look for tokens from names.h - this is expensive! */
if ((ms->flags & MAGIC_NO_CHECK_TOKENS) != 0)
@@ -271,21 +265,27 @@ subtype_identified:
if (seen_cr && nbytes < HOWMANY)
n_cr++;
if ((ms->flags & MAGIC_MIME)) {
if (subtype_mime) {
if (file_printf(ms, subtype_mime) == -1)
goto done;
} else {
if (file_printf(ms, "text/plain") == -1)
goto done;
if (mime) {
if (mime & MAGIC_MIME_TYPE) {
if (subtype_mime) {
if (file_printf(ms, subtype_mime) == -1)
goto done;
} else {
if (file_printf(ms, "text/plain") == -1)
goto done;
}
}
if (code_mime) {
if (file_printf(ms, "; charset=") == -1)
if ((mime == 0 || mime == MAGIC_MIME) && code_mime) {
if ((mime & MAGIC_MIME_TYPE) &&
file_printf(ms, " charset=") == -1)
goto done;
if (file_printf(ms, code_mime) == -1)
goto done;
}
if (mime == MAGIC_MIME_ENCODING)
file_printf(ms, "binary");
} else {
if (file_printf(ms, code) == -1)
goto done;
+18 -9
View File
@@ -49,13 +49,14 @@
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#ifdef HAVE_LIBZ
#if defined(HAVE_ZLIB_H) && defined(HAVE_LIBZ)
#define BUILTIN_DECOMPRESS
#include <zlib.h>
#endif
#ifndef lint
FILE_RCSID("@(#)$File: compress.c,v 1.51 2007/03/05 02:41:29 christos Exp $")
FILE_RCSID("@(#)$File: compress.c,v 1.54 2007/12/02 00:28:10 christos Exp $")
#endif
private struct {
@@ -86,7 +87,7 @@ private size_t ncompr = sizeof(compr) / sizeof(compr[0]);
private ssize_t swrite(int, const void *, size_t);
private size_t uncompressbuf(struct magic_set *, int, size_t,
const unsigned char *, unsigned char **, size_t);
#ifdef HAVE_LIBZ
#ifdef BUILTIN_DECOMPRESS
private size_t uncompressgzipped(struct magic_set *, const unsigned char *,
unsigned char **, size_t);
#endif
@@ -98,6 +99,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
unsigned char *newbuf = NULL;
size_t i, nsz;
int rv = 0;
int mime = ms->flags & MAGIC_MIME;
if ((ms->flags & MAGIC_COMPRESS) == 0)
return 0;
@@ -112,11 +114,18 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
rv = -1;
if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
goto error;
if (file_printf(ms, " (") == -1)
if (mime == MAGIC_MIME || mime == 0) {
if (file_printf(ms, mime ?
" compressed-encoding=" : " (") == -1)
goto error;
}
if ((mime == 0 || mime & MAGIC_MIME_ENCODING) &&
file_buffer(ms, -1, NULL, buf, nbytes) == -1)
goto error;
if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
goto error;
if (file_printf(ms, ")") == -1)
if (!mime && file_printf(ms, ")") == -1)
goto error;
rv = 1;
break;
@@ -285,7 +294,7 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
return fd;
}
#ifdef HAVE_LIBZ
#ifdef BUILTIN_DECOMPRESS
#define FHCRC (1 << 1)
#define FEXTRA (1 << 2)
@@ -364,7 +373,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method,
int fdin[2], fdout[2];
int r;
#ifdef HAVE_LIBZ
#ifdef BUILTIN_DECOMPRESS
if (method == 2)
return uncompressgzipped(ms, old, newch, n);
#endif
+19 -2
View File
@@ -72,6 +72,9 @@
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the `strtof' function. */
#undef HAVE_STRTOF
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
@@ -133,6 +136,9 @@
/* Define to 1 if you have the `wcwidth' function. */
#undef HAVE_WCWIDTH
/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
#undef MAJOR_IN_MKDEV
@@ -159,6 +165,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* */
#undef SIZEOF_INT64_T
/* */
#undef SIZEOF_UINT16_T
@@ -183,6 +192,11 @@
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
@@ -192,13 +206,16 @@
/* */
#undef int32_t
/* */
#undef int64_t
/* Define to a type if <wchar.h> does not define. */
#undef mbstate_t
/* Define to `long' if <sys/types.h> does not define. */
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* */
+5277 -4539
View File
File diff suppressed because it is too large. Load diff
+13 -5
View File
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/file.c])
AM_INIT_AUTOMAKE(file, 4.21)
AM_INIT_AUTOMAKE(file, 4.23)
AM_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE
@@ -49,6 +49,7 @@ fi], [
])
AC_SUBST(fsect)
AM_CONDITIONAL(FSECT5, test x$fsect = x5)
AC_GNU_SOURCE
dnl Checks for programs.
AC_PROG_CC
@@ -66,11 +67,13 @@ AH_TEMPLATE([HAVE_LONG_LONG], [])
AH_TEMPLATE([HAVE_TM_ISDST], [])
AH_TEMPLATE([SIZEOF_UINT16_T], [])
AH_TEMPLATE([SIZEOF_UINT32_T], [])
AH_TEMPLATE([SIZEOF_INT64_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([int64_t], [])
AH_TEMPLATE([uint64_t], [])
AH_TEMPLATE([uint8_t], [])
@@ -82,6 +85,7 @@ AC_HEADER_STDINT
AC_CHECK_HEADERS(fcntl.h locale.h stdint.h inttypes.h unistd.h getopt.h)
AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
AC_CHECK_HEADERS(zlib.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -106,20 +110,24 @@ AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
AC_CHECK_TYPE_STDC(int32_t, int)
AC_C_LONG_LONG
if test $ac_cv_c_long_long = yes; then
long64='unsigned long long';
ulong64='unsigned long long';
long64='long long';
else
long64='unsigned long';
ulong64='unsigned long';
long64='long';
fi
dnl This needs a patch to autoconf 2.13 acgeneral.m4
AC_CHECK_TYPE2_STDC(uint64_t, $long64)
AC_CHECK_TYPE2_STDC(uint64_t, $ulong64)
AC_CHECK_TYPE2_STDC(int64_t, $long64)
AC_CHECK_SIZEOF_STDC_HEADERS(uint8_t, 0)
AC_CHECK_SIZEOF_STDC_HEADERS(uint16_t, 0)
AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0)
AC_CHECK_SIZEOF_STDC_HEADERS(int64_t, 0)
AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
dnl Checks for functions
AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf)
AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf strtof)
dnl Checks for libraries
AC_CHECK_LIB(z,gzopen)
+49 -77
View File
@@ -71,7 +71,7 @@
#include "patchlevel.h"
#ifndef lint
FILE_RCSID("@(#)$File: file.c,v 1.111 2007/05/08 14:44:18 christos Exp $")
FILE_RCSID("@(#)$File: file.c,v 1.117 2007/12/27 16:35:58 christos Exp $")
#endif /* lint */
@@ -122,7 +122,8 @@ private void load(const char *, int);
int
main(int argc, char *argv[])
{
int c, i;
int c;
size_t i;
int action = 0, didsomefiles = 0, errflg = 0;
int flags = 0;
char *home, *usermagic;
@@ -133,33 +134,15 @@ main(int argc, char *argv[])
int longindex;
static const struct option long_options[] =
{
{"version", 0, 0, 'v'},
{"help", 0, 0, 0},
{"brief", 0, 0, 'b'},
{"checking-printout", 0, 0, 'c'},
{"debug", 0, 0, 'd'},
{"exclude", 1, 0, 'e' },
{"files-from", 1, 0, 'f'},
{"separator", 1, 0, 'F'},
{"mime", 0, 0, 'i'},
{"keep-going", 0, 0, 'k'},
#ifdef S_IFLNK
{"dereference", 0, 0, 'L'},
{"no-dereference", 0, 0, 'h'},
#endif
{"magic-file", 1, 0, 'm'},
#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
{"preserve-date", 0, 0, 'p'},
#endif
{"uncompress", 0, 0, 'z'},
{"raw", 0, 0, 'r'},
{"no-buffer", 0, 0, 'n'},
{"no-pad", 0, 0, 'N'},
{"special-files", 0, 0, 's'},
{"compile", 0, 0, 'C'},
{"print0", 0, 0, '0'},
{0, 0, 0, 0},
};
#define OPT(shortname, longname, opt, doc) \
{longname, opt, NULL, shortname},
#define OPT_LONGONLY(longname, opt, doc) \
{longname, opt, NULL, 0},
#include "file_opts.h"
#undef OPT
#undef OPT_LONGONLY
{0, 0, NULL, 0}
};
#endif
static const struct {
@@ -170,7 +153,6 @@ main(int argc, char *argv[])
{ "ascii", MAGIC_NO_CHECK_ASCII },
{ "compress", MAGIC_NO_CHECK_COMPRESS },
{ "elf", MAGIC_NO_CHECK_ELF },
{ "fortran", MAGIC_NO_CHECK_FORTRAN },
{ "soft", MAGIC_NO_CHECK_SOFT },
{ "tar", MAGIC_NO_CHECK_TAR },
{ "tokens", MAGIC_NO_CHECK_TOKENS },
@@ -220,15 +202,24 @@ main(int argc, char *argv[])
switch (c) {
#ifdef HAVE_GETOPT_LONG
case 0 :
if (longindex == 1)
switch (longindex) {
case 0:
help();
break;
case 10:
flags |= MAGIC_MIME_TYPE;
break;
case 11:
flags |= MAGIC_MIME_ENCODING;
break;
}
break;
#endif
case '0':
nulsep = 1;
break;
case 'b':
++bflag;
bflag++;
break;
case 'c':
action = FILE_CHECK;
@@ -287,9 +278,9 @@ main(int argc, char *argv[])
flags |= MAGIC_DEVICES;
break;
case 'v':
(void)fprintf(stdout, "%s-%d.%.2d\n", progname,
(void)fprintf(stderr, "%s-%d.%.2d\n", progname,
FILE_VERSION_MAJOR, patchlevel);
(void)fprintf(stdout, "magic file from %s\n",
(void)fprintf(stderr, "magic file from %s\n",
magicfile);
return 1;
case 'z':
@@ -341,12 +332,19 @@ main(int argc, char *argv[])
}
}
else {
int i, wid, nw;
for (wid = 0, i = optind; i < argc; i++) {
nw = file_mbswidth(argv[i]);
size_t j, wid, nw;
for (wid = 0, j = (size_t)optind; j < (size_t)argc; j++) {
nw = file_mbswidth(argv[j]);
if (nw > wid)
wid = nw;
}
/*
* If bflag is only set twice, set it depending on
* number of files [this is undocumented, and subject to change]
*/
if (bflag == 2) {
bflag = optind >= argc - 1;
}
for (; optind < argc; optind++)
process(argv[optind], wid);
}
@@ -383,7 +381,6 @@ unwrap(char *fn)
char buf[MAXPATHLEN];
FILE *f;
int wid = 0, cwid;
size_t len;
if (strcmp("-", fn) == 0) {
f = stdin;
@@ -396,9 +393,7 @@ unwrap(char *fn)
}
while (fgets(buf, MAXPATHLEN, f) != NULL) {
len = strlen(buf);
if (len > 0 && buf[len - 1] == '\n')
buf[len - 1] = '\0';
buf[strcspn(buf, "\n")] = '\0';
cwid = file_mbswidth(buf);
if (cwid > wid)
wid = cwid;
@@ -407,10 +402,8 @@ unwrap(char *fn)
rewind(f);
}
while (fgets(buf, MAXPATHLEN, f) != NULL) {
len = strlen(buf);
if (len > 0 && buf[len - 1] == '\n')
buf[len - 1] = '\0';
while (fgets(buf, sizeof(buf), f) != NULL) {
buf[strcspn(buf, "\n")] = '\0';
process(buf, wid);
if(nobuffer)
(void)fflush(stdout);
@@ -551,38 +544,17 @@ usage(void)
private void
help(void)
{
(void)puts(
"Usage: file [OPTION]... [FILE]...\n"
"Determine file type of FILEs.\n"
"\n"
" -m, --magic-file LIST use LIST as a colon-separated list of magic\n"
" number files\n"
" -z, --uncompress try to look inside compressed files\n"
" -b, --brief do not prepend filenames to output lines\n"
" -c, --checking-printout print the parsed form of the magic file, use in\n"
" conjunction with -m to debug a new magic file\n"
" before installing it\n"
" -e, --exclude exclude test from the list of test to be\n"
" performed for file. Valid tests are:\n"
" ascii, apptype, elf, compress, soft, tar\n"
" -f, --files-from FILE read the filenames to be examined from FILE\n"
" -F, --separator string use string as separator instead of `:'\n"
" -i, --mime output mime type strings\n"
" -k, --keep-going don't stop at the first match\n"
" -L, --dereference causes symlinks to be followed\n"
" -n, --no-buffer do not buffer output\n"
" -N, --no-pad do not pad output\n"
" -p, --preserve-date preserve access times on files\n"
" -r, --raw don't translate unprintable chars to \\ooo\n"
" -s, --special-files treat special (block/char devices) files as\n"
" ordinary ones\n"
"or\n"
" --help display this help and exit\n"
"or\n"
" --version output version information and exit\n"
"or\n"
" -C, --compile compile file specified by -m\n"
);
(void)fputs(
"Usage: file [OPTION...] [FILE...]\n"
"Determine type of FILEs.\n"
"\n", stderr);
#define OPT(shortname, longname, opt, doc) \
fprintf(stderr, " -%c, --" longname doc, shortname);
#define OPT_LONGONLY(longname, opt, doc) \
fprintf(stderr, " --" longname doc);
#include "file_opts.h"
#undef OPT
#undef OPT_LONGONLY
exit(0);
}
#endif
+12 -2
View File
@@ -27,7 +27,7 @@
*/
/*
* file.h - definitions for file(1) program
* @(#)$File: file.h,v 1.91 2007/03/25 03:13:47 christos Exp $
* @(#)$File: file.h,v 1.92 2007/11/08 00:31:37 christos Exp $
*/
#ifndef __file_h__
@@ -146,7 +146,13 @@ struct magic {
#define FILE_QLDATE 30
#define FILE_LEQLDATE 31
#define FILE_BEQLDATE 32
#define FILE_NAMES_SIZE 33/* size of array to contain all names */
#define FILE_FLOAT 33
#define FILE_BEFLOAT 34
#define FILE_LEFLOAT 35
#define FILE_DOUBLE 36
#define FILE_BEDOUBLE 37
#define FILE_LEDOUBLE 38
#define FILE_NAMES_SIZE 39/* size of array to contain all names */
#define IS_STRING(t) \
((t) == FILE_STRING || \
@@ -161,6 +167,8 @@ struct magic {
#define FILE_FMT_NUM 1 /* "cduxXi" */
#define FILE_FMT_STR 2 /* "s" */
#define FILE_FMT_QUAD 3 /* "ll" */
#define FILE_FMT_FLOAT 4 /* "eEfFgG" */
#define FILE_FMT_DOUBLE 5 /* "eEfFgG" */
/* Word 3 */
uint8_t in_op; /* operator for indirection */
@@ -224,6 +232,8 @@ struct magic {
uint8_t hl[4]; /* 4 bytes of a fixed-endian "long" */
uint8_t hq[8]; /* 8 bytes of a fixed-endian "quad" */
char s[MAXstring]; /* the search string or regex pattern */
float f;
double d;
} value; /* either number or string */
/* Words 17..31 */
char desc[MAXDESC]; /* description */
+327 -257
View File
@@ -1,78 +1,75 @@
.TH FILE __CSECTION__ "Copyright but distributable"
.\" $Id: file.man,v 1.57 2005/08/18 15:18:22 christos Exp $
.SH NAME
file
\- determine file type
.SH SYNOPSIS
.B file
[
.B \-bchikLnNprsvz
]
[
.B \-f
.I namefile
]
[
.B \-F
.I separator
]
[
.B \-m
.I magicfiles
]
.I file
\&...
.br
.B file
.B -C
[
.B \-m
magicfile ]
.SH DESCRIPTION
.\" $File: file.man,v 1.66 2007/10/23 19:58:59 christos Exp $
.Dd January 8, 2007
.Dt FILE __CSECTION__
.Os
.Sh NAME
.Nm file
.Nd determine file type
.Sh SYNOPSIS
.Nm
.Op Fl bchikLnNprsvz
.Op Fl mime-type
.Op Fl mime-encoding
.Op Fl f Ar namefile
.Op Fl F Ar separator
.Op Fl m Ar magicfiles
.Ar file
.Nm
.Fl C
.Op Fl m Ar magicfile
.Sh DESCRIPTION
This manual page documents version __VERSION__ of the
.B file
.Nm
command.
.PP
.B File
.Pp
.Nm
tests each argument in an attempt to classify it.
There are three sets of tests, performed in this order:
filesystem tests, magic number tests, and language tests.
The
.I first
.Em first
test that succeeds causes the file type to be printed.
.PP
.Pp
The type printed will usually contain one of the words
.B text
.Em text
(the file contains only
printing characters and a few common control
characters and is probably safe to read on an
.SM ASCII
.Dv ASCII
terminal),
.B executable
.Em executable
(the file contains the result of compiling a program
in a form understandable to some \s-1UNIX\s0 kernel or another),
in a form understandable to some
.Dv UNIX
kernel or another),
or
.B data
meaning anything else (data is usually `binary' or non-printable).
.Em data
meaning anything else (data is usually
.Sq binary
or non-printable).
Exceptions are well-known file formats (core files, tar archives)
that are known to contain binary data.
When modifying the file
.I __MAGIC__
or the program itself,
.B "preserve these keywords" .
.Pa __MAGIC__
or the program itself, make sure to
.Em "preserve these keywords" .
People depend on knowing that all the readable files in a directory
have the word ``text'' printed.
Don't do as Berkeley did and change ``shell commands text''
to ``shell script''.
have the word
.Dq text
printed.
Don't do as Berkeley did and change
.Dq shell commands text
to
.Dq shell script .
Note that the file
.I __MAGIC__
.Pa __MAGIC__
is built mechanically from a large number of small files in
the subdirectory
.I Magdir
.Pa Magdir
in the source distribution of this program.
.PP
.Pp
The filesystem tests are based on examining the return from a
.BR stat (2)
.Xr stat 2
system call.
The program checks to see if the file is empty,
or if it's some sort of special file.
@@ -81,36 +78,42 @@ Any known file types appropriate to the system you are running on
implement them)
are intuited if they are defined in
the system header file
.IR <sys/stat.h> .
.PP
.In sys/stat.h .
.Pp
The magic number tests are used to check for files with data in
particular fixed formats.
The canonical example of this is a binary executable (compiled program)
.I a.out
.Dv a.out
file, whose format is defined in
.I a.out.h
.In elf.h ,
.In a.out.h
and possibly
.I exec.h
.In exec.h
in the standard include directory.
These files have a `magic number' stored in a particular place
near the beginning of the file that tells the \s-1UNIX\s0 operating system
These files have a
.Sq "magic number"
stored in a particular place
near the beginning of the file that tells the
.Dv UNIX operating system
that the file is a binary executable, and which of several types thereof.
The concept of `magic number' has been applied by extension to data files.
The concept of a
.Sq "magic number"
has been applied by extension to data files.
Any file with some invariant identifier at a small fixed
offset into the file can usually be described in this way.
The information identifying these files is read from the compiled
magic file
.I __MAGIC__.mgc ,
.Pa __MAGIC__.mgc ,
or
.I __MAGIC__
.Pa __MAGIC__
if the compile file does not exist. In addition
.B file
.Nm
will look in
.I $HOME/.magic.mgc ,
.Pa $HOME/.magic.mgc ,
or
.I $HOME/.magic
.Pa $HOME/.magic
for magic entries.
.PP
.Pp
If a file does not match any of the entries in the magic file,
it is examined to see if it seems to be a text file.
ASCII, ISO-8859-x, non-ISO 8-bit extended-ASCII character sets
@@ -121,270 +124,320 @@ ranges and sequences of bytes that constitute printable text
in each set.
If a file passes any of these tests, its character set is reported.
ASCII, ISO-8859-x, UTF-8, and extended-ASCII files are identified
as ``text'' because they will be mostly readable on nearly any terminal;
UTF-16 and EBCDIC are only ``character data'' because, while
as
.Dq text
because they will be mostly readable on nearly any terminal;
UTF-16 and EBCDIC are only
.Dq character data
because, while
they contain text, it is text that will require translation
before it can be read.
In addition,
.B file
.Nm
will attempt to determine other characteristics of text-type files.
If the lines of a file are terminated by CR, CRLF, or NEL, instead
of the Unix-standard LF, this will be reported.
Files that contain embedded escape sequences or overstriking
will also be identified.
.PP
.Pp
Once
.B file
.Nm
has determined the character set used in a text-type file,
it will
attempt to determine in what language the file is written.
The language tests look for particular strings (cf
.IR names.h )
.In names.h
that can appear anywhere in the first few blocks of a file.
For example, the keyword
.B .br
.Em .br
indicates that the file is most likely a
.BR troff (1)
.Xr troff 1
input file, just as the keyword
.B struct
.Em struct
indicates a C program.
These tests are less reliable than the previous
two groups, so they are performed last.
The language test routines also test for some miscellany
(such as
.BR tar (1)
.Xr tar 1
archives).
.PP
.Pp
Any file that cannot be identified as having been written
in any of the character sets listed above is simply said to be ``data''.
.SH OPTIONS
.TP 8
.B "\-b, \-\-brief"
.Sh OPTIONS
.Bl -tag -width indent
.It Fl b , -brief
Do not prepend filenames to output lines (brief mode).
.TP 8
.B "\-c, \-\-checking\-printout"
.It Fl c , -checking-printout
Cause a checking printout of the parsed form of the magic file.
This is usually used in conjunction with
.B \-m
to debug a new magic file before installing it.
.TP 8
.B "\-C, \-\-compile"
Write a magic.mgc output file that contains a pre-parsed version of
file.
.TP 8
.BI "\-f, \-\-files\-from" " namefile"
This is usually used in conjunction with the
.Fl m
flag to debug a new magic file before installing it.
.It Fl C , -compile
Write a
.Pa magic.mgc
output file that contains a pre-parsed version of the magic file.
.It Fl e , -exclude Ar testname
Exclude the test named in
.Ar testname
from the list of tests made to determine the file type. Valid test names
are:
.Bl -tag -width
.It apptype
Check for
.Dv EMX
application type (only on EMX).
.It ascii
Check for various types of ascii files.
.It compress
Don't look for, or inside compressed files.
.It elf
Don't print elf details.
.It fortran
Don't look for fortran sequences inside ascii files.
.It soft
Don't consult magic files.
.It tar
Don't examine tar files.
.It token
Don't look for known tokens inside ascii files.
.It troff
Don't look for troff sequences inside ascii files.
.El
.It Fl f , -files-from Ar namefile
Read the names of the files to be examined from
.I namefile
.Ar namefile
(one per line)
before the argument list.
Either
.I namefile
.Ar namefile
or at least one filename argument must be present;
to test the standard input, use ``\-'' as a filename argument.
.TP 8
.BI "\-F, \-\-separator" " separator"
to test the standard input, use
.Sq -
as a filename argument.
.It Fl F , -separator Ar separator
Use the specified string as the separator between the filename and the
file result returned. Defaults to ``:''.
.TP 8
.B "\-h, \-\-no-dereference"
file result returned. Defaults to
.Sq \&: .
.It Fl h , -no-dereference
option causes symlinks not to be followed
(on systems that support symbolic links). This is the default if the
environment variable
.I POSIXLY_CORRECT
.Dv POSIXLY_CORRECT
is not defined.
.TP 8
.B "\-i, \-\-mime"
.It Fl i , -mime
Causes the file command to output mime type strings rather than the more
traditional human readable ones. Thus it may say
``text/plain; charset=us-ascii''
rather
than ``ASCII text''.
.Dq text/plain charset=us-ascii
rather than
.Dq ASCII text .
In order for this option to work, file changes the way
it handles files recognised by the command itself (such as many of the
it handles files recognized by the command itself (such as many of the
text file types, directories etc), and makes use of an alternative
``magic'' file.
(See ``FILES'' section, below).
.TP 8
.B "\-k, \-\-keep\-going"
.Dq magic
file.
(See
.Dq FILES
section, below).
.It Fl -mime-type , -mime-encoding
Like
.Fl i ,
but print only the specified element(s).
.It Fl k , -keep-going
Don't stop at the first match, keep going.
.TP 8
.B "\-L, \-\-dereference"
.It Fl L , -dereference
option causes symlinks to be followed, as the like-named option in
.BR ls (1)
.Xr ls 1
(on systems that support symbolic links).
This is the default if the environment variable
.I POSIXLY_CORRECT
.Dv POSIXLY_CORRECT
is defined.
.TP 8
.BI "\-m, \-\-magic\-file" " list"
.It Fl m , -magic-file Ar list
Specify an alternate list of files containing magic numbers.
This can be a single file, or a colon-separated list of files.
If a compiled magic file is found alongside, it will be used instead.
With the \-i or \-\-mime option, the program adds ".mime" to each file name.
.TP 8
.B "\-n, \-\-no\-buffer"
With the
.Fl i
or
.Fl "mime"
option, the program adds
.Dq .mime
to each file name.
.It Fl n , -no-buffer
Force stdout to be flushed after checking each file.
This is only useful if checking a list of files.
It is intended to be used by programs that want filetype output from a pipe.
.TP 8
.B "\-N, \-\-no\-pad"
.It Fl N , -no-pad
Don't pad filenames so that they align in the output.
.TP 8
.B "\-p, \-\-preserve\-date"
.It Fl p , -preserve-date
On systems that support
.BR utime (2)
.Xr utime 2
or
.BR utimes(2),
.Xr utimes 2 ,
attempt to preserve the access time of files analyzed, to pretend that
.BR file (2)
.Nm
never read them.
.TP 8
.B "\-r, \-\-raw"
.It Fl r , -raw
Don't translate unprintable characters to \eooo.
Normally
.B file
.Nm
translates unprintable characters to their octal representation.
.TP 8
.B "\-s, \-\-special\-files"
.It Fl s , -special-files
Normally,
.B file
.Nm
only attempts to read and determine the type of argument files which
.BR stat (2)
.Xr stat 2
reports are ordinary files.
This prevents problems, because reading special files may have peculiar
consequences.
Specifying the
.BR \-s
.Fl s
option causes
.B file
.Nm
to also read argument files which are block or character special files.
This is useful for determining the filesystem types of the data in raw
disk partitions, which are block special files.
This option also causes
.B file
.Nm
to disregard the file size as reported by
.BR stat (2)
.Xr stat 2
since on some systems it reports a zero size for raw disk partitions.
.TP 8
.B "\-v, \-\-version"
.It Fl v , -version
Print the version of the program and exit.
.TP 8
.B "\-z, \-\-uncompress"
.It Fl z , -uncompress
Try to look inside compressed files.
.TP 8
.B "\-\-help"
.It Fl 0 , -print0
Output a null character
.Sq \e0
after the end of the filename. Nice to
.Xr cut 1
the output. This does not affect the separator which is still printed.
.It Fl -help
Print a help message and exit.
.SH FILES
.TP
.I __MAGIC__.mgc
.El
.Sh FILES
.Bl -tag -width __MAGIC__.mime.mgc -compact
.It Pa __MAGIC__.mgc
Default compiled list of magic numbers
.TP
.I __MAGIC__
.It Pa __MAGIC__
Default list of magic numbers
.TP
.I __MAGIC__.mime.mgc
.It Pa __MAGIC__.mime.mgc
Default compiled list of magic numbers, used to output mime types when
the -i option is specified.
.TP
.I __MAGIC__.mime
Default list of magic numbers, used to output mime types when the -i option
is specified.
.SH ENVIRONMENT
the
.Fl i
option is specified.
.It Pa __MAGIC__.mime
Default list of magic numbers, used to output mime types when the
.Fl i
option is specified.
.El
.Sh ENVIRONMENT
The environment variable
.B MAGIC
.Dv MAGIC
can be used to set the default magic number file name.
If that variable is set, then
.B file
.Nm
will not attempt to open
.B $HOME/.magic .
.B file
adds ".mime" and/or ".mgc" to the value of this variable as appropriate.
.Pa $HOME/.magic .
.Nm
adds
.Dq .mime
and/or
.Dq .mgc
to the value of this variable as appropriate.
The environment variable
.B POSIXLY_CORRECT
.Dv POSIXLY_CORRECT
controls (on systems that support symbolic links), if
.B file
.Nm
will attempt to follow symlinks or not. If set, then
.B file
.Nm
follows symlink, otherwise it does not. This is also controlled
by the
.B L
.Fl L
and
.B h
.Fl h
options.
.SH SEE ALSO
.BR magic (__FSECTION__)
\- description of magic file format.
.br
.BR strings (1), " od" (1), " hexdump(1)"
\- tools for examining non-textfiles.
.SH STANDARDS CONFORMANCE
.Sh SEE ALSO
.Xr magic __FSECTION__ ,
.Xr strings 1 ,
.Xr od 1 ,
.Xr hexdump 1
.Sh STANDARDS CONFORMANCE
This program is believed to exceed the System V Interface Definition
of FILE(CMD), as near as one can determine from the vague language
contained therein.
Its behaviour is mostly compatible with the System V program of the same name.
Its behavior is mostly compatible with the System V program of the same name.
This version knows more magic, however, so it will produce
different (albeit more accurate) output in many cases.
.PP
.\" URL: http://www.opengroup.org/onlinepubs/009695399/utilities/file.html
.Pp
The one significant difference
between this version and System V
is that this version treats any white space
as a delimiter, so that spaces in pattern strings must be escaped.
For example,
.br
.Bd -literal -offset indent
>10 string language impress\ (imPRESS data)
.br
.Ed
.Pp
in an existing magic file would have to be changed to
.br
.Bd -literal -offset indent
>10 string language\e impress (imPRESS data)
.br
.Ed
.Pp
In addition, in this version, if a pattern string contains a backslash,
it must be escaped.
For example
.br
.Bd -literal -offset indent
0 string \ebegindata Andrew Toolkit document
.br
.Ed
.Pp
in an existing magic file would have to be changed to
.br
.Bd -literal -offset indent
0 string \e\ebegindata Andrew Toolkit document
.br
.PP
.Ed
.Pp
SunOS releases 3.2 and later from Sun Microsystems include a
.BR file (1)
.Nm
command derived from the System V one, but with some extensions.
My version differs from Sun's only in minor ways.
It includes the extension of the `&' operator, used as,
It includes the extension of the
.Sq &
operator, used as,
for example,
.br
.Bd -literal -offset indent
>16 long&0x7fffffff >0 not stripped
.SH MAGIC DIRECTORY
.Ed
.Sh MAGIC DIRECTORY
The magic file entries have been collected from various sources,
mainly USENET, and contributed by various authors.
Christos Zoulas (address below) will collect additional
or corrected magic file entries.
A consolidation of magic file entries
will be distributed periodically.
.PP
.Pp
The order of entries in the magic file is significant.
Depending on what system you are using, the order that
they are put together may be incorrect.
If your old
.B file
.Nm
command uses a magic file,
keep the old magic file around for comparison purposes
(rename it to
.IR __MAGIC__.orig ).
.SH EXAMPLES
.nf
.Pa __MAGIC__.orig ).
.Sh EXAMPLES
.Bd -literal -offset indent
$ file file.c file /dev/{wd0a,hda}
file.c: C program text
file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), stripped
/dev/wd0a: block special (0/0)
/dev/hda: block special (3/0)
$ file -s /dev/wd0{b,d}
/dev/wd0b: data
/dev/wd0d: x86 boot sector
$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
/dev/hda: x86 boot sector
/dev/hda1: Linux/i386 ext2 filesystem
@@ -400,130 +453,147 @@ $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
$ file -i file.c file /dev/{wd0a,hda}
file.c: text/x-c
file: application/x-executable, dynamically linked (uses shared libs),
not stripped
file: application/x-executable
/dev/hda: application/x-not-regular-file
/dev/wd0a: application/x-not-regular-file
.fi
.SH HISTORY
.Ed
.Sh HISTORY
There has been a
.B file
command in every \s-1UNIX\s0 since at least Research Version 4
.Nm
command in every
.Dv UNIX since at least Research Version 4
(man page dated November, 1973).
The System V version introduced one significant major change:
the external list of magic number types.
This slowed the program down slightly but made it a lot more flexible.
.PP
.Pp
This program, based on the System V version,
was written by Ian Darwin <[email protected]>
without looking at anybody else's source code.
.PP
.Pp
John Gilmore revised the code extensively, making it better than
the first version.
Geoff Collyer found several inadequacies
and provided some magic file entries.
Contributions by the `&' operator by Rob McMahon, [email protected], 1989.
.PP
.Pp
Guy Harris, [email protected], made many changes from 1993 to the present.
.PP
.Pp
Primary development and maintenance from 1990 to the present by
Christos Zoulas ([email protected]).
.PP
.Pp
Altered by Chris Lowth, [email protected], 2000:
Handle the ``-i'' option to output mime type strings and using an alternative
Handle the
.Fl i
option to output mime type strings and using an alternative
magic file and internal logic.
.PP
.Pp
Altered by Eric Fischer ([email protected]), July, 2000,
to identify character codes and attempt to identify the languages
of non-ASCII files.
.PP
.Pp
The list of contributors to the "Magdir" directory (source for the
.I __MAGIC__
.Pa __MAGIC__
file) is too long to include here.
You know who you are; thank you.
.SH LEGAL NOTICE
.Sh LEGAL NOTICE
Copyright (c) Ian F. Darwin, Toronto, Canada, 1986-1999.
Covered by the standard Berkeley Software Distribution copyright; see the file
LEGAL.NOTICE in the source distribution.
.PP
.Pp
The files
.I tar.h
.Dv tar.h
and
.I is_tar.c
.Dv is_tar.c
were written by John Gilmore from his public-domain
.B tar
.Xr tar 1
program, and are not covered by the above license.
.SH BUGS
.Sh BUGS
There must be a better way to automate the construction of the Magic
file from all the glop in magdir.
file from all the glop in Magdir.
What is it?
Better yet, the magic file should be compiled into binary (say,
.BR ndbm (3)
or, better yet, fixed-length
.SM ASCII
strings for use in heterogenous network environments) for faster startup.
Then the program would run as fast as the Version 7 program of the same name,
with the flexibility of the System V version.
.PP
.B File
.\" Compilation support has been done
.\" Better yet, the magic file should be compiled into binary (say,
.\" .Xr ndbm 3
.\" or, better yet, fixed-length
.\" .Dv ASCII
.\" strings for use in heterogenous network environments) for faster startup.
.\" Then the program would run as fast as the Version 7 program of the same
.\" name, with the flexibility of the System V version.
.Pp
.Nm
uses several algorithms that favor speed over accuracy,
thus it can be misled about the contents of
text
files.
.PP
The support for
text
files (primarily for programming languages)
.Pp
The support for text files (primarily for programming languages)
is simplistic, inefficient and requires recompilation to update.
.PP
There should be an ``else'' clause to follow a series of continuation lines.
.PP
The magic file and keywords should have regular expression support.
.\" Else support has been done
.\" There should be an
.\" .Dv else
.\" clause to follow a series of continuation lines.
.\" .Pp
.\" Regular expression support has been done
.\" The magic file and keywords should have regular expression support.
Their use of
.SM "ASCII TAB"
.Dv ASCII TAB
as a field delimiter is ugly and makes
it hard to edit the files, but is entrenched.
.PP
.Pp
It might be advisable to allow upper-case letters in keywords
for e.g.,
.BR troff (1)
.Xr troff 1
commands vs man page macros.
Regular expression support would make this easy.
.PP
The program doesn't grok \s-2FORTRAN\s0.
It should be able to figure \s-2FORTRAN\s0 by seeing some keywords which
.Pp
The program doesn't grok
.Dv FORTRAN .
It should be able to figure
.Dv FORTRAN
by seeing some keywords which
appear indented at the start of line.
Regular expression support would make this easy.
.PP
.Pp
The list of keywords in
.I ascmagic
.Dv ascmagic
probably belongs in the Magic file.
This could be done by using some keyword like `*' for the offset value.
.PP
Another optimisation would be to sort
the magic file so that we can just run down all the
tests for the first byte, first word, first long, etc, once we
have fetched it.
This could be done by using some keyword like
.Sq *
for the offset value.
.Pp
.\" Sorting has been done.
.\" Another optimization would be to sort
.\" the magic file so that we can just run down all the
.\" tests for the first byte, first word, first long, etc, once we
.\" have fetched it.
Complain about conflicts in the magic file entries.
Make a rule that the magic entries sort based on file offset rather
than position within the magic file?
.PP
.Pp
The program should provide a way to give an estimate
of ``how good'' a guess is.
We end up removing guesses (e.g. ``From '' as first 5 chars of file) because
they are not as good as other guesses (e.g. ``Newsgroups:'' versus
``Return-Path:'').
of
.Dq how good
a guess is.
We end up removing guesses (e.g.
.Dq From\
as first 5 chars of file) because
they are not as good as other guesses (e.g.
.Dq Newsgroups:
versus
.Dq Return-Path:
).
Still, if the others don't pan out, it should be possible to use the
first guess.
.PP
.Pp
This program is slower than some vendors' file commands.
The new support for multiple character codes makes it even slower.
.PP
.Pp
This manual page, and particularly this section, is too long.
.SH AVAILABILITY
.Sh AVAILABILITY
You can obtain the original author's latest version by anonymous FTP
on
.B ftp.astron.com
.Dv ftp.astron.com
in the directory
.I /pub/file/file-X.YZ.tar.gz
.Dv /pub/file/file-X.YZ.tar.gz
+48
View File
@@ -0,0 +1,48 @@
/*
* Table of command-line options
*
* The first column specifies the short name, if any, or 0 if none.
* The second column specifies the long name.
* The third column specifies whether it takes a parameter.
* The fourth column is the documentation.
*
* N.B. The long options' order must correspond to the code in file.c,
* and OPTSTRING must be kept up-to-date with the short options.
* Pay particular attention to the numbers of long-only options in the
* switch statement!
*/
OPT_LONGONLY("help", 0, " display this help and exit\n")
OPT('v', "version", 0, " output version information and exit\n")
OPT('m', "magic-file", 1, " LIST use LIST as a colon-separated list of magic\n"
" number files\n")
OPT('z', "uncompress", 0, " try to look inside compressed files\n")
OPT('b', "brief", 0, " do not prepend filenames to output lines\n")
OPT('c', "checking-printout", 0, " print the parsed form of the magic file, use in\n"
" conjunction with -m to debug a new magic file\n"
" before installing it\n")
OPT('e', "exclude", 1, " TEST exclude TEST from the list of test to be\n"
" performed for file. Valid tests are:\n"
" ascii, apptype, compress, elf, soft, tar, tokens, troff\n")
OPT('f', "files-from", 1, " FILE read the filenames to be examined from FILE\n")
OPT('F', "separator", 1, " STRING use string as separator instead of `:'\n")
OPT('i', "mime", 0, " output MIME type strings (--mime-type and\n"
" --mime-encoding)\n")
OPT_LONGONLY("mime-type", 0, " output the MIME type\n")
OPT_LONGONLY("mime-encoding", 0, " output the MIME encoding\n")
OPT('k', "keep-going", 0, " don't stop at the first match\n")
#ifdef S_IFLNK
OPT('L', "dereference", 0, " follow symlinks (default)\n")
OPT('h', "no-dereference", 0, " don't follow symlinks\n")
#endif
OPT('n', "no-buffer", 0, " do not buffer output\n")
OPT('N', "no-pad", 0, " do not pad output\n")
OPT('0', "print0", 0, " terminate filenames with ASCII NUL\n")
#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
OPT('p', "preserve-date", 0, " preserve access times on files\n")
#endif
OPT('r', "raw", 0, " don't translate unprintable chars to \\ooo\n")
OPT('s', "special-files", 0, " treat special (block/char devices) files as\n"
" ordinary ones\n")
OPT('C', "compile", 0, " compile file specified by -m\n")
OPT('d', "debug", 0, " print debugging messages\n")
+9 -6
View File
@@ -57,13 +57,14 @@
#undef HAVE_MAJOR
#ifndef lint
FILE_RCSID("@(#)$File: fsmagic.c,v 1.47 2007/01/12 17:38:28 christos Exp $")
FILE_RCSID("@(#)$File: fsmagic.c,v 1.48 2007/10/17 19:33:31 christos Exp $")
#endif /* lint */
protected int
file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
{
int ret = 0;
int mime = ms->flags & MAGIC_MIME;
#ifdef S_IFLNK
char buf[BUFSIZ+4];
int nch;
@@ -95,11 +96,12 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
return 1;
}
if ((ms->flags & MAGIC_MIME) != 0) {
if (mime) {
if ((sb->st_mode & S_IFMT) != S_IFREG) {
if (file_printf(ms, "application/x-not-regular-file")
if ((mime & MAGIC_MIME_TYPE) &&
file_printf(ms, "application/x-not-regular-file")
== -1)
return -1;
return -1;
return 1;
}
}
@@ -303,8 +305,9 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
* when we read the file.)
*/
if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
"application/x-empty" : "empty") == -1)
if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
file_printf(ms, mime ? "application/x-empty" :
"empty") == -1)
return -1;
return 1;
}
+70 -47
View File
@@ -41,14 +41,14 @@
#endif
#ifndef SIZE_T_MAX
#ifdef __LP64__
#define SIZE_T_MAX (size_t)0xfffffffffffffffffU
#define SIZE_T_MAX (size_t)0xffffffffffffffffU
#else
#define SIZE_T_MAX (size_t)0xffffffffU
#endif
#endif
#ifndef lint
FILE_RCSID("@(#)$File: funcs.c,v 1.32 2007/05/24 17:22:27 christos Exp $")
FILE_RCSID("@(#)$File: funcs.c,v 1.35 2007/12/27 16:35:59 christos Exp $")
#endif /* lint */
#ifndef HAVE_VSNPRINTF
@@ -62,12 +62,16 @@ protected int
file_printf(struct magic_set *ms, const char *fmt, ...)
{
va_list ap;
size_t len, size;
size_t size;
ssize_t len;
char *buf;
va_start(ap, fmt);
if ((len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap)) >= ms->o.left) {
len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap);
if (len == -1)
goto out;
if (len >= (ssize_t)ms->o.left) {
long diff; /* XXX: really ptrdiff_t */
va_end(ap);
@@ -84,11 +88,16 @@ file_printf(struct magic_set *ms, const char *fmt, ...)
va_start(ap, fmt);
len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap);
if (len == -1)
goto out;
}
va_end(ap);
ms->o.ptr += len;
ms->o.left -= len;
return 0;
out:
file_error(ms, errno, "vsnprintf failed");
return -1;
}
/*
@@ -164,59 +173,73 @@ protected int
file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
size_t nb)
{
int m;
int m;
int mime = ms->flags & MAGIC_MIME;
if (nb == 0) {
if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
file_printf(ms, mime ? "application/x-empty" :
"empty") == -1)
return -1;
return 1;
} else if (nb == 1) {
if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
file_printf(ms, mime ? "application/octet-stream" :
"very short file (no magic)") == -1)
return -1;
return 1;
}
#ifdef __EMX__
if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
switch (file_os2_apptype(ms, inname, buf, nb)) {
case -1:
return -1;
case 0:
break;
default:
return 1;
if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
switch (file_os2_apptype(ms, inname, buf, nb)) {
case -1:
return -1;
case 0:
break;
default:
return 1;
}
}
}
#endif
/* try compression stuff */
if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) != 0 ||
(m = file_zmagic(ms, fd, inname, buf, nb)) == 0) {
/* Check if we have a tar file */
if ((ms->flags & MAGIC_NO_CHECK_TAR) != 0 ||
(m = file_is_tar(ms, buf, nb)) == 0) {
/* try tests in /etc/magic (or surrogate magic file) */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) != 0 ||
(m = file_softmagic(ms, buf, nb)) == 0) {
/* try known keywords, check whether it is ASCII */
if ((ms->flags & MAGIC_NO_CHECK_ASCII) != 0 ||
(m = file_ascmagic(ms, buf, nb)) == 0) {
/* abandon hope, all ye who remain here */
if (file_printf(ms, ms->flags & MAGIC_MIME ?
(nb ? "application/octet-stream" :
"application/empty") :
(nb ? "data" :
"empty")) == -1)
return -1;
m = 1;
/* try compression stuff */
if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) != 0 ||
(m = file_zmagic(ms, fd, inname, buf, nb)) == 0) {
/* Check if we have a tar file */
if ((ms->flags & MAGIC_NO_CHECK_TAR) != 0 ||
(m = file_is_tar(ms, buf, nb)) == 0) {
/* try tests in /etc/magic (or surrogate magic file) */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) != 0 ||
(m = file_softmagic(ms, buf, nb)) == 0) {
/* try known keywords, check whether it is ASCII */
if ((ms->flags & MAGIC_NO_CHECK_ASCII) != 0 ||
(m = file_ascmagic(ms, buf, nb)) == 0) {
/* abandon hope, all ye who remain here */
if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
file_printf(ms, mime ? "application/octet-stream" :
"data") == -1)
return -1;
m = 1;
}
}
}
}
}
#ifdef BUILTIN_ELF
if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 && nb > 5 && fd != -1) {
/*
* We matched something in the file, so this *might*
* be an ELF file, and the file is at least 5 bytes
* long, so if it's an ELF file it has at least one
* byte past the ELF magic number - try extracting
* information from the ELF headers that cannot easily
* be extracted with rules in the magic file.
*/
(void)file_tryelf(ms, fd, buf, nb);
}
if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 &&
nb > 5 && fd != -1) {
/*
* We matched something in the file, so this *might*
* be an ELF file, and the file is at least 5 bytes
* long, so if it's an ELF file it has at least one
* byte past the ELF magic number - try extracting
* information from the ELF headers that cannot easily
* be extracted with rules in the magic file.
*/
(void)file_tryelf(ms, fd, buf, nb);
}
#endif
return m;
return m;
}
#endif
+263 -79
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-05-14.22
scriptversion=2006-10-14.15
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,15 +39,24 @@ scriptversion=2005-05-14.22
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# put in absolute paths if you don't have them in your path; or use env. vars.
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
@@ -58,7 +67,13 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
posix_glob=
posix_mkdir=
# Desired mode of installed file.
mode=0755
chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
@@ -95,7 +110,7 @@ Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
while test $# -ne 0; do
case $1 in
-c) shift
continue;;
@@ -111,9 +126,15 @@ while test -n "$1"; do
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
-m) mode=$2
shift
shift
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
continue;;
-o) chowncmd="$chownprog $2"
@@ -136,25 +157,33 @@ while test -n "$1"; do
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
done
if test -z "$1"; then
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
@@ -164,6 +193,33 @@ if test -z "$1"; then
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
@@ -173,15 +229,11 @@ do
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
@@ -208,53 +260,188 @@ do
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
obsolete_mkdir_used=false
# Make sure that the destination directory exists.
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
pathcomp=
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix=/ ;;
-*) prefix=./ ;;
*) prefix= ;;
esac
case $posix_glob in
'')
if (set -f) 2>/dev/null; then
posix_glob=true
else
posix_glob=false
fi ;;
esac
oIFS=$IFS
IFS=/
$posix_glob && set -f
set fnord $dstdir
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
$posix_glob && set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
pathcomp=$pathcomp/
done
fi
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
@@ -262,10 +449,9 @@ do
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@@ -276,10 +462,10 @@ do
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
@@ -291,11 +477,12 @@ do
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
if test -f "$dst"; then
$doit $rmcmd -f "$dst" 2>/dev/null \
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
else
@@ -304,16 +491,13 @@ do
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
$doit $mvcmd "$dsttmp" "$dst"
}
}
fi || { (exit 1); exit 1; }
done
} || exit 1
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
+19 -20
View File
@@ -45,7 +45,7 @@
#include "tar.h"
#ifndef lint
FILE_RCSID("@(#)$File: is_tar.c,v 1.27 2007/01/12 17:38:28 christos Exp $")
FILE_RCSID("@(#)$File: is_tar.c,v 1.29 2007/10/17 19:33:31 christos Exp $")
#endif
#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
@@ -53,6 +53,12 @@ FILE_RCSID("@(#)$File: is_tar.c,v 1.27 2007/01/12 17:38:28 christos Exp $")
private int is_tar(const unsigned char *, size_t);
private int from_oct(int, const char *); /* Decode octal number */
static const char *tartype[] = {
"tar archive",
"POSIX tar archive",
"POSIX tar archive (GNU)",
};
protected int
file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
{
@@ -60,26 +66,19 @@ file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
* Do the tar test first, because if the first file in the tar
* archive starts with a dot, we can confuse it with an nroff file.
*/
switch (is_tar(buf, nbytes)) {
case 1:
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
"application/x-tar" : "tar archive") == -1)
return -1;
return 1;
case 2:
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
"application/x-tar, POSIX" : "POSIX tar archive") == -1)
return -1;
return 1;
case 3:
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
"application/x-tar, POSIX (GNU)" :
"POSIX tar archive (GNU)") == -1)
return -1;
return 1;
default:
int tar = is_tar(buf, nbytes);
int mime = ms->flags & MAGIC_MIME;
if (tar < 1 || tar > 3)
return 0;
}
if (mime == MAGIC_MIME_ENCODING)
return 0;
if (file_printf(ms, mime ? "application/x-tar" :
tartype[tar - 1]) == -1)
return -1;
return 1;
}
/*
+29 -6
View File
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd March 22, 2003
.Dd November 15, 2006
.Dt MAGIC 3
.Os
.Sh NAME
@@ -87,8 +87,10 @@ If the file is compressed, unpack it and look at the contents.
.It Dv MAGIC_DEVICES
If the file is a block or character special device, then open the device
and try to look in its contents.
.It Dv MAGIC_MIME
Return a mime string, instead of a textual description.
.It Dv MAGIC_MIME_TYPE
Return a MIME type string, instead of a textual description.
.It Dv MAGIC_MIME_ENCODING
Return a MIME encoding, instead of a textual description.
.It Dv MAGIC_CONTINUE
Return all matches, not just the first.
.It Dv MAGIC_CHECK
@@ -104,6 +106,26 @@ Don't translate unprintable characters to a \eooo octal representation.
.It Dv MAGIC_ERROR
Treat operating system errors while trying to open files and follow symlinks
as real errors, instead of printing them in the magic buffer.
.It Dv MAGIC_NO_CHECK_APPTYPE
Check for
.Dv EMX
application type (only on EMX).
.It Dv MAGIC_NO_CHECK_ASCII
Check for various types of ascii files.
.It Dv MAGIC_NO_CHECK_COMPRESS
Don't look for, or inside compressed files.
.It Dv MAGIC_NO_CHECK_ELF
Don't print elf details.
.It Dv MAGIC_NO_CHECK_FORTRAN
Don't look for fortran sequences inside ascii files.
.It Dv MAGIC_NO_CHECK_SOFT
Don't consult magic files.
.It Dv MAGIC_NO_CHECK_TAR
Don't examine tar files.
.It Dv MAGIC_NO_CHECK_TOKENS
Don't look for known tokens inside ascii files.
.It Dv MAGIC_NO_CHECK_TROFF
Don't look for troff sequences inside ascii files.
.El
.Pp
The
@@ -119,8 +141,8 @@ no error.
.Pp
The
.Fn magic_errno
function returns the last operating system error number (
.Xr errno 3 )
function returns the last operating system error number
.Pq Xr errno 2
that was encountered by a system call.
.Pp
The
@@ -144,7 +166,8 @@ The
.Fn magic_setflags
function, sets the
.Ar flags
described above.
described above. Note that using both MIME flags together can also
return extra information on the charset.
.Pp
The
.Fn magic_check
+33 -23
View File
@@ -63,7 +63,7 @@
#include "patchlevel.h"
#ifndef lint
FILE_RCSID("@(#)$File: magic.c,v 1.41 2007/03/26 17:59:50 christos Exp $")
FILE_RCSID("@(#)$File: magic.c,v 1.45 2007/12/27 16:35:59 christos Exp $")
#endif /* lint */
#ifdef __EMX__
@@ -76,6 +76,9 @@ private void free_mlist(struct mlist *);
private void close_and_restore(const struct magic_set *, const char *, int,
const struct stat *);
private int info_from_stat(struct magic_set *, mode_t);
#ifndef COMPILE_ONLY
private const char *file_or_fd(struct magic_set *, const char *, int);
#endif
#ifndef STDIN_FILENO
#define STDIN_FILENO 0
@@ -215,6 +218,7 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
*/
#ifdef HAVE_UTIMES
struct timeval utsbuf[2];
memset(utsbuf, 0, sizeof(struct timeval) * 2);
utsbuf[0].tv_sec = sb->st_atime;
utsbuf[1].tv_sec = sb->st_mtime;
@@ -222,6 +226,7 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
#elif defined(HAVE_UTIME_H) || defined(HAVE_SYS_UTIME_H)
struct utimbuf utbuf;
memset(&utbuf, 0, sizeof(struct utimbuf));
utbuf.actime = sb->st_atime;
utbuf.modtime = sb->st_mtime;
(void) utime(name, &utbuf); /* don't care if loses */
@@ -230,13 +235,28 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
}
#ifndef COMPILE_ONLY
/*
* find type of descriptor
*/
public const char *
magic_descriptor(struct magic_set *ms, int fd)
{
return file_or_fd(ms, NULL, fd);
}
/*
* find type of named file
*/
public const char *
magic_file(struct magic_set *ms, const char *inname)
{
int fd = 0;
return file_or_fd(ms, inname, STDIN_FILENO);
}
private const char *
file_or_fd(struct magic_set *ms, const char *inname, int fd)
{
int rv = -1;
unsigned char *buf;
struct stat sb;
@@ -265,7 +285,6 @@ magic_file(struct magic_set *ms, const char *inname)
}
if (inname == NULL) {
fd = STDIN_FILENO;
if (fstat(fd, &sb) == 0 && S_ISFIFO(sb.st_mode))
ispipe = 1;
} else {
@@ -279,16 +298,16 @@ magic_file(struct magic_set *ms, const char *inname)
errno = 0;
if ((fd = open(inname, flags)) < 0) {
#ifdef __CYGWIN__
char *tmp = alloca(strlen(inname) + 5);
(void)strcat(strcpy(tmp, inname), ".exe");
if ((fd = open(tmp, flags)) < 0) {
char *tmp = alloca(strlen(inname) + 5);
(void)strcat(strcpy(tmp, inname), ".exe");
if ((fd = open(tmp, flags)) < 0) {
#endif
if (info_from_stat(ms, sb.st_mode) == -1)
goto done;
rv = 0;
goto done;
if (info_from_stat(ms, sb.st_mode) == -1)
goto done;
rv = 0;
goto done;
#ifdef __CYGWIN__
}
}
#endif
}
#ifdef O_NONBLOCK
@@ -326,18 +345,9 @@ magic_file(struct magic_set *ms, const char *inname)
}
}
if (nbytes == 0) {
if (file_printf(ms, (ms->flags & MAGIC_MIME) ?
"application/x-empty" : "empty") == -1)
goto done;
} else if (nbytes == 1) {
if (file_printf(ms, "very short file (no magic)") == -1)
goto done;
} else {
(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
goto done;
}
(void)memset(buf + nbytes, 0, SLOP); /* NUL terminate */
if (file_buffer(ms, fd, inname, buf, (size_t)nbytes) == -1)
goto done;
rv = 0;
done:
free(buf);
+16 -11
View File
@@ -34,21 +34,25 @@
#define MAGIC_SYMLINK 0x000002 /* Follow symlinks */
#define MAGIC_COMPRESS 0x000004 /* Check inside compressed files */
#define MAGIC_DEVICES 0x000008 /* Look at the contents of devices */
#define MAGIC_MIME 0x000010 /* Return a mime string */
#define MAGIC_MIME_TYPE 0x000010 /* Return only the MIME type */
#define MAGIC_CONTINUE 0x000020 /* Return all matches */
#define MAGIC_CHECK 0x000040 /* Print warnings to stderr */
#define MAGIC_PRESERVE_ATIME 0x000080 /* Restore access time on exit */
#define MAGIC_RAW 0x000100 /* Don't translate unprintable chars */
#define MAGIC_RAW 0x000100 /* Don't translate unprint chars */
#define MAGIC_ERROR 0x000200 /* Handle ENOENT etc as real errors */
#define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */
#define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */
#define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */
#define MAGIC_NO_CHECK_APPTYPE 0x008000 /* Don't check application type */
#define MAGIC_NO_CHECK_ELF 0x010000 /* Don't check for elf details */
#define MAGIC_NO_CHECK_ASCII 0x020000 /* Don't check for ascii files */
#define MAGIC_NO_CHECK_TROFF 0x040000 /* Don't check ascii/troff */
#define MAGIC_NO_CHECK_FORTRAN 0x080000 /* Don't check ascii/fortran */
#define MAGIC_NO_CHECK_TOKENS 0x100000 /* Don't check ascii/tokens */
#define MAGIC_MIME_ENCODING 0x000400 /* Return only the MIME encoding */
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
#define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */
#define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */
#define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */
#define MAGIC_NO_CHECK_APPTYPE 0x008000 /* Don't check application type */
#define MAGIC_NO_CHECK_ELF 0x010000 /* Don't check for elf details */
#define MAGIC_NO_CHECK_ASCII 0x020000 /* Don't check for ascii files */
#define MAGIC_NO_CHECK_TROFF 0x040000 /* Don't check ascii/troff */
#define MAGIC_NO_CHECK_TOKENS 0x100000 /* Don't check ascii/tokens */
/* Defined for backwards compatibility; does nothing */
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
#ifdef __cplusplus
extern "C" {
@@ -59,6 +63,7 @@ magic_t magic_open(int);
void magic_close(magic_t);
const char *magic_file(magic_t, const char *);
const char *magic_descriptor(magic_t, int);
const char *magic_buffer(magic_t, const void *, size_t);
const char *magic_error(magic_t);
+282 -211
View File
@@ -1,389 +1,460 @@
.TH MAGIC __FSECTION__ "Public Domain"
.\" $File: magic.man,v 1.39 2007/11/08 00:31:37 christos Exp $
.Dd January 10, 2007
.Dt MAGIC __FSECTION__
.Os
.\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems.
.SH NAME
magic \- file command's magic number file
.SH DESCRIPTION
.Sh NAME
.Nm magic
.Nd file command's magic number file
.Sh DESCRIPTION
This manual page documents the format of the magic file as
used by the
.BR file (__CSECTION__)
.Xr file __CSECTION__
command, version __VERSION__.
The
.BR file
.Xr file __CSECTION__
command identifies the type of a file using,
among other tests,
a test for whether the file begins with a certain
.IR "magic number" .
.Dq "magic number" .
The file
.I __MAGIC__
.Pa __MAGIC__
specifies what magic numbers are to be tested for,
what message to print if a particular magic number is found,
and additional information to extract from the file.
.PP
.Pp
Each line of the file specifies a test to be performed.
A test compares the data starting at a particular offset
in the file with a 1-byte, 2-byte, or 4-byte numeric value or
a string.
If the test succeeds, a message is printed.
The line consists of the following fields:
.IP offset \w'message'u+2n
.Bl -tag -width ".Dv message"
.It Dv offset
A number specifying the offset, in bytes, into the file of the data
which is to be tested.
.IP type
.It Dv type
The type of the data to be tested.
The possible values are:
.RS
.IP byte \w'message'u+2n
.Bl -tag -width ".Dv lestring16"
.It Dv byte
A one-byte value.
.IP short
.It Dv short
A two-byte value (on most systems) in this machine's native byte order.
.IP long
.It Dv long
A four-byte value (on most systems) in this machine's native byte order.
.IP string
.It Dv quad
An eight-byte value (on most systems) in this machine's native byte order.
.It Dv float
A 32-bit (on most systems) single precision IEEE floating point number in this machine's native byte order.
.It Dv double
A 64-bit (on most systems) double precision IEEE floating point number in this machine's native byte order.
.It Dv string
A string of bytes.
The string type specification can be optionally followed
by /[Bbc]*.
The ``B'' flag compacts whitespace in the target, which must
The
.Dq B
flag compacts whitespace in the target, which must
contain at least one whitespace character.
If the magic has
.I n
.Dv n
consecutive blanks, the target needs at least
.I n
.Dv n
consecutive blanks to match.
The ``b'' flag treats every blank in the target as an optional blank.
Finally the ``c'' flag, specifies case insensitive matching: lowercase
The
.Dq b
flag treats every blank in the target as an optional blank.
Finally the
.Dq c
flag, specifies case insensitive matching: lowercase
characters in the magic match both lower and upper case characters in the
targer, whereas upper case characters in the magic, only much uppercase
characters in the target.
.IP pstring
.It Dv pstring
A pascal style string where the first byte is interpreted as the an
unsigned length. The string is not NUL terminated.
.IP date
unsigned length.
The string is not NUL terminated.
.It Dv date
A four-byte value interpreted as a UNIX date.
.IP ldate
.It Dv qdate
A eight-byte value interpreted as a UNIX date.
.It Dv ldate
A four-byte value interpreted as a UNIX-style date, but interpreted as
local time rather than UTC.
.IP beshort
.It Dv qldate
An eight-byte value interpreted as a UNIX-style date, but interpreted as
local time rather than UTC.
.It Dv beshort
A two-byte value (on most systems) in big-endian byte order.
.IP belong
.It Dv belong
A four-byte value (on most systems) in big-endian byte order.
.IP bedate
.It Dv bequad
An eight-byte value (on most systems) in big-endian byte order.
.It Dv befloat
A 32-bit (on most systems) single precision IEEE floating point number in big-endian byte order.
.It Dv bedouble
A 64-bit (on most systems) double precision IEEE floating point number in big-endian byte order.
.It Dv bedate
A four-byte value (on most systems) in big-endian byte order,
interpreted as a Unix date.
.IP beldate
.It Dv beqdate
An eight-byte value (on most systems) in big-endian byte order,
interpreted as a Unix date.
.It Dv beldate
A four-byte value (on most systems) in big-endian byte order,
interpreted as a UNIX-style date, but interpreted as local time rather
than UTC.
.IP bestring16
.It Dv beqldate
An eight-byte value (on most systems) in big-endian byte order,
interpreted as a UNIX-style date, but interpreted as local time rather
than UTC.
.It Dv bestring16
A two-byte unicode (UCS16) string in big-endian byte order.
.IP leshort
.It Dv leshort
A two-byte value (on most systems) in little-endian byte order.
.IP lelong
.It Dv lelong
A four-byte value (on most systems) in little-endian byte order.
.IP ledate
.It Dv lequad
An eight-byte value (on most systems) in little-endian byte order.
.It Dv lefloat
A 32-bit (on most systems) single precision IEEE floating point number in little-endian byte order.
.It Dv ledouble
A 64-bit (on most systems) double precision IEEE floating point number in little-endian byte order.
.It Dv ledate
A four-byte value (on most systems) in little-endian byte order,
interpreted as a UNIX date.
.IP leldate
.It Dv leqdate
An eight-byte value (on most systems) in little-endian byte order,
interpreted as a UNIX date.
.It Dv leldate
A four-byte value (on most systems) in little-endian byte order,
interpreted as a UNIX-style date, but interpreted as local time rather
than UTC.
.IP lestring16
.It Dv leqldate
An eight-byte value (on most systems) in little-endian byte order,
interpreted as a UNIX-style date, but interpreted as local time rather
than UTC.
.It Dv lestring16
A two-byte unicode (UCS16) string in little-endian byte order.
.IP melong
.It Dv melong
A four-byte value (on most systems) in middle-endian (PDP-11) byte order.
.IP medate
.It Dv medate
A four-byte value (on most systems) in middle-endian (PDP-11) byte order,
interpreted as a UNIX date.
.IP meldate
.It Dv meldate
A four-byte value (on most systems) in middle-endian (PDP-11) byte order,
interpreted as a UNIX-style date, but interpreted as local time rather
than UTC.
.IP regex
.It Dv regex
A regular expression match in extended POSIX regular expression syntax
(much like egrep).
The type specification can be optionally followed by
.B /c
for case-insensitive matches.
The regular expression is always
tested against the first
.B N
The type specification can be optionally followed by /[cse]*.
The
.Dq c
flag makes the match case insensitive, while the
.Dq s
or
.Dq e
flags update the offset to the starting or ending offsets of the
match (only one should be used).
By default, regex does not update the offset.
The regular expression is always tested against the first
.Dv N
lines, where
.B N
.Dv N
is the given offset, thus it
is only useful for (single-byte encoded) text.
.B ^
.Dv ^
and
.B $
.Dv $
will match the beginning and end of individual lines, respectively,
not beginning and end of file.
.IP search
A literal string search starting at the given offset. It must be followed by
.B /<number>
.It Dv search
A literal string search starting at the given offset.
It must be followed by
.Dv \*[Lt]number\*[Gt]
which specifies how many matches shall be attempted (the range).
This is suitable for searching larger binary expressions with variable
offsets, using
.B \e
.Dv \e
escapes for special characters.
.RE
.PP
.It Dv default
This is intended to be used with the text
.Dv x
(which is always true) and a message that is to be used if there are
no other matches.
.El
.El
.Pp
The numeric types may optionally be followed by
.B &
.Dv \*[Am]
and a numeric value,
to specify that the value is to be AND'ed with the
numeric value before any comparisons are done.
Prepending a
.B u
.Dv u
to the type indicates that ordered comparisons should be unsigned.
.IP test
.Bl -tag -width ".Dv message"
.It Dv test
The value to be compared with the value from the file.
If the type is
numeric, this value
is specified in C form; if it is a string, it is specified as a C string
with the usual escapes permitted (e.g. \en for new-line).
.IP
.Pp
Numeric values
may be preceded by a character indicating the operation to be performed.
It may be
.BR = ,
.Dv = ,
to specify that the value from the file must equal the specified value,
.BR < ,
.Dv \*[Lt] ,
to specify that the value from the file must be less than the specified
value,
.BR > ,
.Dv \*[Gt] ,
to specify that the value from the file must be greater than the specified
value,
.BR & ,
.Dv \*[Am] ,
to specify that the value from the file must have set all of the bits
that are set in the specified value,
.BR ^ ,
.Dv ^ ,
to specify that the value from the file must have clear any of the bits
that are set in the specified value, or
.BR ~ ,
.Dv ~ ,
the value specified after is negated before tested.
.BR x ,
.Dv x ,
to specify that any value will match.
If the character is omitted, it is assumed to be
.BR = .
For all tests except
.B string
.Dv = .
Operators
.Dv \*[Am] ,
.Dv ^ ,
and
.B regex,
.Dv ~
don't work with floats and doubles.
For all tests except
.Em string
and
.Em regex ,
operation
.BR !
.Dv !
specifies that the line matches if the test does
.B not
.Em not
succeed.
.IP
.Pp
Numeric values are specified in C form; e.g.
.B 13
.Dv 13
is decimal,
.B 013
.Dv 013
is octal, and
.B 0x13
.Dv 0x13
is hexadecimal.
.IP
.Pp
For string values, the byte string from the
file must match the specified byte string.
The operators
.BR = ,
.B <
.Dv = ,
.Dv \*[Lt]
and
.B >
.Dv \*[Gt]
(but not
.BR & )
.Dv \*[Am] )
can be applied to strings.
The length used for matching is that of the string argument
in the magic file.
This means that a line can match any string, and
then presumably print that string, by doing
.B >\e0
.Em \*[Gt]\e0
(because all strings are greater than the null string).
.IP message
The message to be printed if the comparison succeeds. If the string
contains a
.BR printf (3)
.Pp
The special test
.Em x
always evaluates to true.
.Dv message
The message to be printed if the comparison succeeds.
If the string contains a
.Xr printf 3
format specification, the value from the file (with any specified masking
performed) is printed using the message as the format string.
.PP
If the string begins with ``\\b'', the message printed is the
remainder of the string with no whitespace added before it: multiple
matches are normally separated by a single space.
.El
.Pp
Some file formats contain additional information which is to be printed
along with the file type or need additional tests to determine the true
file type.
These additional tests are introduced by one or more
.B >
.Em \*[Gt]
characters preceding the offset.
The number of
.B >
.Em \*[Gt]
on the line indicates the level of the test; a line with no
.B >
.Em \*[Gt]
at the beginning is considered to be at level 0.
Tests are arranged in a tree-like hierarchy:
If a the test on a line at level
.IB n
.Em n
succeeds, all following tests at level
.IB n+1
.Em n+1
are performed, and the messages printed if the tests succeed, untile a line
with level
.IB n
.Em n
(or less) appears.
For more complex files, one can use empty messages to get just the
"if/then" effect, in the following way:
.sp
.nf
0 string MZ
>0x18 leshort <0x40 MS-DOS executable
>0x18 leshort >0x3f extended PC executable (e.g., MS Windows)
.fi
.PP
.Bd -literal -offset indent
0 string MZ
\*[Gt]0x18 leshort \*[Lt]0x40 MS-DOS executable
\*[Gt]0x18 leshort \*[Gt]0x3f extended PC executable (e.g., MS Windows)
.Ed
.Pp
Offsets do not need to be constant, but can also be read from the file
being examined.
If the first character following the last
.B >
.Em \*[Gt]
is a
.B (
.Em (
then the string after the parenthesis is interpreted as an indirect offset.
That means that the number after the parenthesis is used as an offset in
the file.
The value at that offset is read, and is used again as an offset
in the file.
Indirect offsets are of the form:
.BI (( x [.[bslBSL]][+\-][ y ]).
.Em (( x [.[bslBSL]][+\-][ y ]) .
The value of
.I x
is used as an offset in the file. A byte, short or long is read at that offset
depending on the
.B [bslBSLm]
.Em x
is used as an offset in the file.
A byte, short or long is read at that offset depending on the
.Em [bslBSLm]
type specifier.
The capitalized types interpret the number as a big endian
value, whereas the small letter versions interpret the number as a little
endian value;
the
.B m
.Em m
type interprets the number as a middle endian (PDP-11) value.
To that number the value of
.I y
.Em y
is added and the result is used as an offset in the file.
The default type if one is not specified is long.
.PP
.Pp
That way variable length structures can be examined:
.sp
.nf
# MS Windows executables are also valid MS-DOS executables
0 string MZ
>0x18 leshort <0x40 MZ executable (MS-DOS)
# skip the whole block below if it is not an extended executable
>0x18 leshort >0x3f
>>(0x3c.l) string PE\e0\e0 PE executable (MS-Windows)
>>(0x3c.l) string LX\e0\e0 LX executable (OS/2)
.fi
.PP
.Bd -literal -offset indent
# MS Windows executables are also valid MS-DOS executables
0 string MZ
\*[Gt]0x18 leshort \*[Lt]0x40 MZ executable (MS-DOS)
# skip the whole block below if it is not an extended executable
\*[Gt]0x18 leshort \*[Gt]0x3f
\*[Gt]\*[Gt](0x3c.l) string PE\e0\e0 PE executable (MS-Windows)
\*[Gt]\*[Gt](0x3c.l) string LX\e0\e0 LX executable (OS/2)
.Ed
.Pp
This strategy of examining has one drawback: You must make sure that
you eventually print something, or users may get empty output (like, when
there is neither PE\e0\e0 nor LE\e0\e0 in the above example)
.PP
.Pp
If this indirect offset cannot be used as-is, there are simple calculations
possible: appending
.BI [+-*/%&|^]<number>
.Em [+-*/%\*[Am]|^]\*[Lt]number\*[Gt]
inside parentheses allows one to modify
the value read from the file before it is used as an offset:
.sp
.nf
# MS Windows executables are also valid MS-DOS executables
0 string MZ
# sometimes, the value at 0x18 is less that 0x40 but there's still an
# extended executable, simply appended to the file
>0x18 leshort <0x40
>>(4.s*512) leshort 0x014c COFF executable (MS-DOS, DJGPP)
>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
.fi
.PP
.Bd -literal -offset indent
# MS Windows executables are also valid MS-DOS executables
0 string MZ
# sometimes, the value at 0x18 is less that 0x40 but there's still an
# extended executable, simply appended to the file
\*[Gt]0x18 leshort \*[Lt]0x40
\*[Gt]\*[Gt](4.s*512) leshort 0x014c COFF executable (MS-DOS, DJGPP)
\*[Gt]\*[Gt](4.s*512) leshort !0x014c MZ executable (MS-DOS)
.Ed
.Pp
Sometimes you do not know the exact offset as this depends on the length or
position (when indirection was used before) of preceding fields. You can
specify an offset relative to the end of the last uplevel field using
.BI &
position (when indirection was used before) of preceding fields.
You can specify an offset relative to the end of the last up-level
field using
.Sq \*[Am]
as a prefix to the offset:
.sp
.nf
0 string MZ
>0x18 leshort >0x3f
>>(0x3c.l) string PE\e0\e0 PE executable (MS-Windows)
# immediately following the PE signature is the CPU type
>>>&0 leshort 0x14c for Intel 80386
>>>&0 leshort 0x184 for DEC Alpha
.fi
.PP
.Bd -literal -offset indent
0 string MZ
\*[Gt]0x18 leshort \*[Gt]0x3f
\*[Gt]\*[Gt](0x3c.l) string PE\e0\e0 PE executable (MS-Windows)
# immediately following the PE signature is the CPU type
\*[Gt]\*[Gt]\*[Gt]\*[Am]0 leshort 0x14c for Intel 80386
\*[Gt]\*[Gt]\*[Gt]\*[Am]0 leshort 0x184 for DEC Alpha
.Ed
.Pp
Indirect and relative offsets can be combined:
.sp
.nf
0 string MZ
>0x18 leshort <0x40
>>(4.s*512) leshort !0x014c MZ executable (MS-DOS)
# if it's not COFF, go back 512 bytes and add the offset taken
# from byte 2/3, which is yet another way of finding the start
# of the extended executable
>>>&(2.s-514) string LE LE executable (MS Windows VxD driver)
.fi
.PP
.Bd -literal -offset indent
0 string MZ
\*[Gt]0x18 leshort \*[Lt]0x40
\*[Gt]\*[Gt](4.s*512) leshort !0x014c MZ executable (MS-DOS)
# if it's not COFF, go back 512 bytes and add the offset taken
# from byte 2/3, which is yet another way of finding the start
# of the extended executable
\*[Gt]\*[Gt]\*[Gt]\*[Am](2.s-514) string LE LE executable (MS Windows VxD driver)
.Ed
.Pp
Or the other way around:
.sp
.nf
0 string MZ
>0x18 leshort >0x3f
>>(0x3c.l) string LE\e0\e0 LE executable (MS-Windows)
# at offset 0x80 (-4, since relative offsets start at the end
# of the uplevel match) inside the LE header, we find the absolute
# offset to the code area, where we look for a specific signature
>>>(&0x7c.l+0x26) string UPX \eb, UPX compressed
.fi
.PP
.Bd -literal -offset indent
0 string MZ
\*[Gt]0x18 leshort \*[Gt]0x3f
\*[Gt]\*[Gt](0x3c.l) string LE\e0\e0 LE executable (MS-Windows)
# at offset 0x80 (-4, since relative offsets start at the end
# of the up-level match) inside the LE header, we find the absolute
# offset to the code area, where we look for a specific signature
\*[Gt]\*[Gt]\*[Gt](\*[Am]0x7c.l+0x26) string UPX \eb, UPX compressed
.Ed
.Pp
Or even both!
.sp
.nf
0 string MZ
>0x18 leshort >0x3f
>>(0x3c.l) string LE\e0\e0 LE executable (MS-Windows)
# at offset 0x58 inside the LE header, we find the relative offset
# to a data area where we look for a specific signature
>>>&(&0x54.l-3) string UNACE \eb, ACE self-extracting archive
.fi
.PP
.Bd -literal -offset indent
0 string MZ
\*[Gt]0x18 leshort \*[Gt]0x3f
\*[Gt]\*[Gt](0x3c.l) string LE\e0\e0 LE executable (MS-Windows)
# at offset 0x58 inside the LE header, we find the relative offset
# to a data area where we look for a specific signature
\*[Gt]\*[Gt]\*[Gt]\*[Am](\*[Am]0x54.l-3) string UNACE \eb, ACE self-extracting archive
.Ed
.Pp
Finally, if you have to deal with offset/length pairs in your file, even the
second value in a parenthesed expression can be taken from the file itself,
using another set of parentheses. Note that this additional indirect offset
is always relative to the start of the main indirect offset.
.sp
.nf
0 string MZ
>0x18 leshort >0x3f
>>(0x3c.l) string PE\e0\e0 PE executable (MS-Windows)
# search for the PE section called ".idata"...
>>>&0xf4 search/0x140 .idata
# ...and go to the end of it, calculated from start+length;
# these are located 14 and 10 bytes after the section name
>>>>(&0xe.l+(-4)) string PK\e3\e4 \eb, ZIP self-extracting archive
.fi
.SH BUGS
second value in a parenthesized expression can be taken from the file itself,
using another set of parentheses.
Note that this additional indirect offset is always relative to the
start of the main indirect offset.
.Bd -literal -offset indent
0 string MZ
\*[Gt]0x18 leshort \*[Gt]0x3f
\*[Gt]\*[Gt](0x3c.l) string PE\e0\e0 PE executable (MS-Windows)
# search for the PE section called ".idata"...
\*[Gt]\*[Gt]\*[Gt]\*[Am]0xf4 search/0x140 .idata
# ...and go to the end of it, calculated from start+length;
# these are located 14 and 10 bytes after the section name
\*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string PK\e3\e4 \eb, ZIP self-extracting archive
.Ed
.Sh SEE ALSO
.Xr file __CSECTION__
\- the command that reads this file.
.Sh BUGS
The formats
.IR long ,
.IR belong ,
.IR lelong ,
.IR melong ,
.IR short ,
.IR beshort ,
.IR leshort ,
.IR date ,
.IR bedate ,
.IR medate ,
.IR ledate ,
.IR beldate ,
.IR leldate ,
.Dv long ,
.Dv belong ,
.Dv lelong ,
.Dv melong ,
.Dv short ,
.Dv beshort ,
.Dv leshort ,
.Dv date ,
.Dv bedate ,
.Dv medate ,
.Dv ledate ,
.Dv beldate ,
.Dv leldate ,
and
.I meldate
.Dv meldate
are system-dependent; perhaps they should be specified as a number
of bytes (2B, 4B, etc),
since the files being recognized typically come from
a system on which the lengths are invariant.
.SH SEE ALSO
.BR file (__CSECTION__)
\- the command that reads this file.
.\"
.\" From: [email protected] (Guy Harris)
.\" Newsgroups: net.bugs.usg
@@ -397,4 +468,4 @@ a system on which the lengths are invariant.
.\" the changes I posted to the S5R2 version.
.\"
.\" Modified for Ian Darwin's version of the file command.
.\" @(#)$Id: magic.man,v 1.30 2006/02/19 18:16:03 christos Exp $
.\" @(#)$Id: magic.man,v 1.39 2007/11/08 00:31:37 christos Exp $
+92 -58
View File
@@ -1,5 +1,25 @@
# Magic data for KMimeMagic (originally for file(1) command)
#
# Note on adding additional MIME types:
#
# [RFC2045,RFC2046] specifies that Content Types, Content Subtypes, Character
# Sets, Access Types, and conversion values for MIME mail will be assigned and
# listed by the IANA.
# http://www.iana.org/assignments/media-types/
#
# Any unregistered file type should be listed with a preceding x-, as in
# application/x-foo (RFC2045 5.1), or a x., as in application/x.foo (RFC4288
# 4.3). Any non x-prefixed type should be registered with IANA and listed at
# the above address. Any other behavior is a MIME standards violation!
#
# It is preferred that when a registered MIME type exists, that
# the registered Content-Type and Subtype be used to refer to a file of
# that type, so don't use application/x-zip when application/zip is
# registered.
#
# If an active RFC suggests that a MIME registration for a new type is in
# progress, make a note of it pointing to that RFC.
#
# The format is 4-5 columns:
# Column #1: byte number to begin checking from, ">" indicates continuation
# Column #2: type of data to match
@@ -101,6 +121,10 @@
38 string \<\!DOCTYPE\040svg image/svg+xml
0 belong 0xfeedfeed application/x-java-keystore
0 belong 0xcececece application/x-java-jce-keystore
# xml
0 string \<?xml text/xml
@@ -110,7 +134,8 @@
# Java
0 beshort 0xcafe
>2 beshort 0xbabe application/java
>2 beshort 0xbabe application/x-java-applet
>2 beshort 0xd00d application/x-java-pack200
#------------------------------------------------------------------------------
# audio: file(1) magic for sound formats
@@ -156,15 +181,15 @@
# Creative Labs AUDIO stuff
# Standard MIDI data
0 string MThd audio/unknown
0 string MThd audio/x-midi
#>9 byte >0 (format %d)
#>11 byte >1 using %d channels
# Creative Music (CMF) data
0 string CTMF audio/unknown
0 string CTMF audio/x-unknown
# SoundBlaster instrument data
0 string SBI audio/unknown
0 string SBI audio/x-unknown
# Creative Labs voice data
0 string Creative\ Voice\ File audio/unknown
0 string Creative\ Voice\ File audio/x-unknown
## is this next line right? it came this way...
#>19 byte 0x1A
#>23 byte >0 - version %d
@@ -210,7 +235,7 @@
# XPM icons (Greg Roelofs, [email protected])
# ideally should go into "images", but entries below would tag XPM as C source
0 string /*\ XPM image/x-xpmi 7bit
0 string /*\ XPM image/x-xpmi
# 3DS (3d Studio files) Conflicts with diff output 0x3d '='
#16 beshort 0x3d3d image/x-3ds
@@ -273,7 +298,8 @@
0 string #!/usr/bin/awk application/x-awk
0 string #!\ /usr/bin/awk application/x-awk
# update to distinguish from *.vcf files by Joerg Jenderek: joerg dot jenderek at web dot de
0 regex BEGIN[[:space:]]*[{] application/x-awk
# Too general, \EBEGIN matches in postscript
#0 regex BEGIN[[:space:]]*[{] application/x-awk
# For Larry Wall's perl language. The ``eval'' line recognizes an
# outrageously clever hack for USG systems.
@@ -303,7 +329,7 @@
# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
0 string \037\213 application/x-gzip
0 string PK\003\004 application/x-zip
0 string PK\003\004 application/zip
# RAR archiver (Greg Roelofs, [email protected])
0 string Rar! application/x-rar
@@ -389,13 +415,16 @@
# This stuff came on a FrameMaker demo tape, most of which is
# copyright, but this file is "published" as witness the following:
#
0 string \<MakerFile application/x-frame
0 string \<MIFFile application/x-frame
0 string \<MakerDictionary application/x-frame
0 string \<MakerScreenFon application/x-frame
0 string \<MML application/x-frame
0 string \<Book application/x-frame
0 string \<Maker application/x-frame
# Note that this is the Framemaker Maker Interchange Format, not the
# Normal format which would be application/vnd.framemaker.
#
0 string \<MakerFile application/x-mif
0 string \<MIFFile application/x-mif
0 string \<MakerDictionary application/x-mif
0 string \<MakerScreenFon application/x-mif
0 string \<MML application/x-mif
0 string \<Book application/x-mif
0 string \<Maker application/x-mif
#------------------------------------------------------------------------------
# html: file(1) magic for HTML (HyperText Markup Language) docs
@@ -429,11 +458,11 @@
# PBMPLUS
# PBM file
0 string P1 image/x-portable-bitmap 7bit
0 string P1 image/x-portable-bitmap
# PGM file
0 string P2 image/x-portable-greymap 7bit
0 string P2 image/x-portable-greymap
# PPM file
0 string P3 image/x-portable-pixmap 7bit
0 string P3 image/x-portable-pixmap
# PBM "rawbits" file
0 string P4 image/x-portable-bitmap
# PGM "rawbits" file
@@ -456,16 +485,16 @@
#
# GRR 950115: this was mine ("Zip GIF"):
# ZIF image (GIF+deflate alpha)
0 string GIF94z image/unknown
0 string GIF94z image/x-unknown
#
# GRR 950115: this is Jeremy Wohl's Free Graphics Format (better):
# FGF image (GIF+deflate beta)
0 string FGF95a image/unknown
0 string FGF95a image/x-unknown
#
# GRR 950115: this is Thomas Boutell's Portable Bitmap Format proposal
# (best; not yet implemented):
# PBF image (deflate compression)
0 string PBF image/unknown
0 string PBF image/x-unknown
# GIF
0 string GIF image/gif
@@ -485,7 +514,7 @@
#0 string BA bitmap array
# CDROM Filesystems
32769 string CD001 application/x-iso9660
32769 string CD001 application/x-iso9660-image
# Newer StuffIt archives ([email protected])
0 string StuffIt application/x-stuffit
@@ -501,7 +530,7 @@
# lisp: file(1) magic for lisp programs
#
# various lisp types, from Daniel Quinlan ([email protected])
0 string ;; text/plain 8bit
0 string ;; text/plain
# Emacs 18 - this is always correct, but not very magical.
0 string \012( application/x-elc
# Emacs 19
@@ -511,17 +540,17 @@
# mail.news: file(1) magic for mail and news
#
# There are tests to ascmagic.c to cope with mail and news.
0 string Relay-Version: message/rfc822 7bit
0 string #!\ rnews message/rfc822 7bit
0 string N#!\ rnews message/rfc822 7bit
0 string Forward\ to message/rfc822 7bit
0 string Pipe\ to message/rfc822 7bit
0 string Return-Path: message/rfc822 7bit
0 string Relay-Version: message/rfc822
0 string #!\ rnews message/rfc822
0 string N#!\ rnews message/rfc822
0 string Forward\ to message/rfc822
0 string Pipe\ to message/rfc822
0 string Return-Path: message/rfc822
0 string Received: message/rfc822
0 string Path: message/news 8bit
0 string Xref: message/news 8bit
0 string From: message/rfc822 7bit
0 string Article message/news 8bit
0 string Path: message/news
0 string Xref: message/news
0 string From: message/rfc822
0 string Article message/news
#------------------------------------------------------------------------------
# msword: file(1) magic for MS Word files
#
@@ -618,13 +647,13 @@
>4 byte&0x1F 0x07 video/h264
# FLI animation format
0 leshort 0xAF11 video/fli
0 leshort 0xAF11 video/x-fli
# FLC animation format
0 leshort 0xAF12 video/flc
0 leshort 0xAF12 video/x-flc
#
# SGI and Apple formats
# Added ISO mimes
0 string MOVI video/sgi
0 string MOVI video/x-sgi-movie
4 string moov video/quicktime
4 string mdat video/quicktime
4 string wide video/quicktime
@@ -632,7 +661,7 @@
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 pckg application/x-quicktime-player
4 string/B jP image/jp2
4 string ftyp
>8 string isom video/mp4
@@ -654,8 +683,8 @@
# 255 (hex FF)! DL format SUCKS BIG ROCKS.
#
# DL file version 1 , medium format (160x100, 4 images/screen)
0 byte 1 video/unknown
0 byte 2 video/unknown
0 byte 1 video/x-unknown
0 byte 2 video/x-unknown
#
# Databases
#
@@ -689,7 +718,7 @@
0 string [KDE\ Desktop\ Entry] application/x-kdelnk
0 string #\ KDE\ Config\ File application/x-kdelnk
# xmcd database file for kscd
0 string #\ xmcd text/xmcd
0 string #\ xmcd text/x-xmcd
#------------------------------------------------------------------------------
# pkgadd: file(1) magic for SysV R4 PKG Datastreams
@@ -710,7 +739,7 @@
0 string \211HDF\r\n\032 Hierarchical Data Format (version 5) data
# Adobe Photoshop
0 string 8BPS image/x-photoshop
0 string 8BPS image/vnd.adobe.photoshop
# Felix von Leitner <[email protected]>
0 string d8:announce application/x-bittorrent
@@ -721,7 +750,7 @@
0 belong 0x00000200 application/x-123
# MS Access database
4 string Standard\ Jet\ DB application/msaccess
4 string Standard\ Jet\ DB application/x-msaccess
## magic for XBase files
#0 byte 0x02
@@ -777,10 +806,10 @@
# Debian has entries for the old PGP formats:
# pgp: file(1) magic for Pretty Good Privacy
# see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
0 beshort 0x9900 text/PGP key public ring
0 beshort 0x9501 text/PGP key security ring
0 beshort 0x9500 text/PGP key security ring
0 beshort 0xa600 text/PGP encrypted data
0 beshort 0x9900 application/x-pgp-keyring
0 beshort 0x9501 application/x-pgp-keyring
0 beshort 0x9500 application/x-pgp-keyring
0 beshort 0xa600 application/pgp-encrypted
0 string -----BEGIN\040PGP text/PGP armored data
>15 string PUBLIC\040KEY\040BLOCK- public key block
>15 string MESSAGE- message
@@ -790,7 +819,7 @@
#
# GnuPG Magic:
#
0 beshort 0x9901 text/GnuPG key public ring
0 beshort 0x9901 application/x-gnupg-keyring
0 beshort 0x8501 text/OpenPGP data
# flash: file(1) magic for Macromedia Flash file format
@@ -801,6 +830,9 @@
#
0 string FWS
>3 byte x application/x-shockwave-flash
# Flash Video
0 string FLV video/x-flv
# The following paramaters are created for Namazu.
# <http://www.namazu.org/>
@@ -822,14 +854,14 @@
#
0 string DOC
>43 byte 0x14 application/ichitaro4
>144 string JDASH application/ichitaro4
>43 byte 0x14 application/x-ichitaro4
>144 string JDASH application/x-ichitaro4
0 string DOC
>43 byte 0x15 application/ichitaro5
>43 byte 0x15 application/x-ichitaro5
0 string DOC
>43 byte 0x16 application/ichitaro6
>43 byte 0x16 application/x-ichitaro6
#------------------------------------------------------------------------------
# office97: file(1) magic for MicroSoft Office files
@@ -841,8 +873,8 @@
#0 string \320\317\021\340\241\261\032\341
#>48 byte 0x1B application/excel
2080 string Microsoft\ Excel\ 5.0\ Worksheet application/excel
2114 string Biff5 application/excel
2080 string Microsoft\ Excel\ 5.0\ Worksheet application/vnd.ms-excel
2114 string Biff5 application/vnd.ms-excel
0 string \224\246\056 application/msword
@@ -883,10 +915,10 @@
>24 string @ application/octet-stream
0 string MZ
>30 string Copyright\ 1989-1990\ PKWARE\ Inc. application/x-zip
>30 string Copyright\ 1989-1990\ PKWARE\ Inc. application/zip
0 string MZ
>30 string PKLITE\ Copr. application/x-zip
>30 string PKLITE\ Copr. application/zip
0 string MZ
>36 string LHa's\ SFX application/x-lha
@@ -910,11 +942,11 @@
0 lelong&0x8080ffff 0x0000061a application/x-arc
# Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
0 lelong 0x223e9f78 application/ms-tnef
0 lelong 0x223e9f78 application/vnd.ms-tnef
# From: [email protected]
# http://www.djvuzone.org/
0 string AT&TFORM image/x.djvu
0 string AT&TFORM image/vnd.djvu
# Danny Milosavljevic <[email protected]>
# this are adrift (adventure game standard) game files, extension .taf
@@ -947,7 +979,7 @@
0 string/c BEGIN:VCARD text/x-vcard
0 string WordPro\0 application/vnd.lotus-wordpro
0 string WordPro\r\373 application/vnd.lotus-wordpro
0 string CPC\262 image/cpi
0 string CPC\262 image/x-cpi
#
128 string DICM application/dicom
@@ -955,3 +987,5 @@
# Symbian installation files
8 lelong 0x10000419 application/vnd.symbian.install
0 lelong 0x10201A7A x-epoc/x-sisx-app
# FORTRAN source
0 string/c c\ text/x-fortran
View File
Whitespace-only changes.
+4 -1
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2005-06-29.22
scriptversion=2006-05-11.19
# Original author: Noah Friedman <[email protected]>
# Created: 1993-05-16
@@ -11,6 +11,9 @@ scriptversion=2005-06-29.22
# bugs to <[email protected]> or send patches to
# <[email protected]>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
+13 -15
View File
@@ -32,7 +32,7 @@
* appear at fixed offsets into the file. Don't make HOWMANY
* too high unless you have a very fast CPU.
*
* $File: names.h,v 1.27 2007/05/08 16:47:03 christos Exp $
* $File: names.h,v 1.29 2007/12/27 20:30:35 christos Exp $
*/
/*
@@ -43,19 +43,18 @@
/* these types are used to index the table 'types': keep em in sync! */
#define L_C 0 /* first and foremost on UNIX */
#define L_CC 1 /* Bjarne's postincrement */
#define L_FORT 2 /* the oldest one */
#define L_MAKE 3 /* Makefiles */
#define L_PLI 4 /* PL/1 */
#define L_MACH 5 /* some kinda assembler */
#define L_ENG 6 /* English */
#define L_PAS 7 /* Pascal */
#define L_MAIL 8 /* Electronic mail */
#define L_NEWS 9 /* Usenet Netnews */
#define L_JAVA 10 /* Java code */
#define L_HTML 11 /* HTML */
#define L_BCPL 12 /* BCPL */
#define L_M4 13 /* M4 */
#define L_PO 14 /* PO */
#define L_MAKE 2 /* Makefiles */
#define L_PLI 3 /* PL/1 */
#define L_MACH 4 /* some kinda assembler */
#define L_ENG 5 /* English */
#define L_PAS 6 /* Pascal */
#define L_MAIL 7 /* Electronic mail */
#define L_NEWS 8 /* Usenet Netnews */
#define L_JAVA 9 /* Java code */
#define L_HTML 10 /* HTML */
#define L_BCPL 11 /* BCPL */
#define L_M4 12 /* M4 */
#define L_PO 13 /* PO */
static const struct {
const char *human;
@@ -63,7 +62,6 @@ static const struct {
} types[] = {
{ "C program", "text/x-c", },
{ "C++ program", "text/x-c++" },
{ "FORTRAN program", "text/x-fortran" },
{ "make commands", "text/x-makefile" },
{ "PL/1 program", "text/x-pl1" },
{ "assembler program", "text/x-asm" },
+8 -2
View File
@@ -1,11 +1,17 @@
#define FILE_VERSION_MAJOR 4
#define patchlevel 21
#define patchlevel 23
/*
* Patchlevel file for Ian Darwin's MAGIC command.
* $File: patchlevel.h,v 1.65 2007/05/24 17:22:27 christos Exp $
* $File: patchlevel.h,v 1.67 2007/12/28 20:08:40 christos Exp $
*
* $Log: patchlevel.h,v $
* Revision 1.67 2007/12/28 20:08:40 christos
* welcome to 4.23.
*
* Revision 1.66 2007/12/27 16:38:24 christos
* welcome to 4.22
*
* Revision 1.65 2007/05/24 17:22:27 christos
* Welcome to 4.21
*
+13 -4
View File
@@ -41,7 +41,7 @@
#include <time.h>
#ifndef lint
FILE_RCSID("@(#)$File: print.c,v 1.59 2007/03/05 02:41:29 christos Exp $")
FILE_RCSID("@(#)$File: print.c,v 1.61 2007/12/27 16:35:59 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
@@ -157,6 +157,16 @@ file_mdump(struct magic *m)
(void)fprintf(stderr, "%s,",
file_fmttime((uint32_t)m->value.q, 0));
break;
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
(void) fprintf(stderr, "%G", m->value.f);
break;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
(void) fprintf(stderr, "%G", m->value.d);
break;
case FILE_DEFAULT:
/* XXX - do anything here? */
break;
@@ -189,7 +199,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
protected const char *
file_fmttime(uint32_t v, int local)
{
char *pp, *rt;
char *pp;
time_t t = (time_t)v;
struct tm *tm;
@@ -219,7 +229,6 @@ file_fmttime(uint32_t v, int local)
pp = asctime(tm);
}
if ((rt = strchr(pp, '\n')) != NULL)
*rt = '\0';
pp[strcspn(pp, "\n")] = '\0';
return pp;
}
+38 -21
View File
@@ -37,7 +37,7 @@
#include "readelf.h"
#ifndef lint
FILE_RCSID("@(#)$File: readelf.c,v 1.63 2007/01/16 14:56:45 ljt Exp $")
FILE_RCSID("@(#)$File: readelf.c,v 1.68 2007/12/27 16:13:26 christos Exp $")
#endif
#ifdef ELFCORE
@@ -191,15 +191,15 @@ getu64(int swap, uint64_t value)
#ifdef ELFCORE
size_t prpsoffsets32[] = {
8, /* FreeBSD */
28, /* Linux 2.0.36 (short name) */
44, /* Linux (path name) */
28, /* Linux 2.0.36 (short name) */
84, /* SunOS 5.x */
};
size_t prpsoffsets64[] = {
16, /* FreeBSD, 64-bit */
40, /* Linux (tested on core from 2.4.x, short name) */
56, /* Linux (path name) */
40, /* Linux (tested on core from 2.4.x, short name) */
120, /* SunOS 5.x, 64-bit */
};
@@ -241,6 +241,7 @@ private const char *os_style_names[] = {
#define FLAGS_DID_CORE 1
#define FLAGS_DID_NOTE 2
#define FLAGS_DID_CORE_STYLE 4
private int
dophn_core(struct magic_set *ms, int class, int swap, int fd, off_t off,
@@ -587,10 +588,11 @@ core:
if ((*flags & FLAGS_DID_CORE) != 0)
return size;
if (os_style != -1) {
if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {
if (file_printf(ms, ", %s-style", os_style_names[os_style])
== -1)
return size;
*flags |= FLAGS_DID_CORE_STYLE;
}
switch (os_style) {
@@ -615,6 +617,7 @@ core:
if (file_printf(ms, " (signal %u)",
getu32(swap, signo)) == -1)
return size;
*flags |= FLAGS_DID_CORE;
return size;
}
break;
@@ -629,11 +632,12 @@ core:
* is in SunOS 5.x and Linux).
*
* Unfortunately, it's at a different offset
* in varous OSes, so try multiple offsets.
* in various OSes, so try multiple offsets.
* If the characters aren't all printable,
* reject it.
*/
for (i = 0; i < NOFFSETS; i++) {
unsigned char *cname, *cp;
size_t reloffset = prpsoffsets(i);
size_t noffset = doff + reloffset;
for (j = 0; j < 16; j++, noffset++,
@@ -681,9 +685,16 @@ core:
/*
* Well, that worked.
*/
if (file_printf(ms, ", from '%.16s'",
&nbuf[doff + prpsoffsets(i)]) == -1)
cname = (unsigned char *)
&nbuf[doff + prpsoffsets(i)];
for (cp = cname; *cp && isprint(*cp); cp++)
continue;
if (cp > cname)
cp--;
if (file_printf(ms, ", from '%.*s'",
(int)(cp - cname), cname) == -1)
return size;
*flags |= FLAGS_DID_CORE;
return size;
tryanother:
@@ -693,7 +704,6 @@ core:
break;
}
#endif
*flags |= FLAGS_DID_CORE;
return offset;
}
@@ -884,6 +894,8 @@ dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off,
return -1;
}
break;
default:
break;
}
}
if (file_printf(ms, ", %s linked%s", linking_style, shared_libraries)
@@ -935,6 +947,8 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
if (class == ELFCLASS32) {
Elf32_Ehdr elfhdr;
uint16_t type;
if (nbytes <= sizeof (Elf32_Ehdr))
return 0;
@@ -943,33 +957,36 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf,
(void) memcpy(&elfhdr, buf, sizeof elfhdr);
swap = (u.c[sizeof(int32_t) - 1] + 1) != elfhdr.e_ident[EI_DATA];
if (getu16(swap, elfhdr.e_type) == ET_CORE) {
type = getu16(swap, elfhdr.e_type);
switch (type) {
#ifdef ELFCORE
case ET_CORE:
if (dophn_core(ms, class, swap, fd,
(off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
(size_t)getu16(swap, elfhdr.e_phentsize),
fsize, &flags) == -1)
return -1;
#else
;
break;
#endif
} else {
if (getu16(swap, elfhdr.e_type) == ET_EXEC) {
if (dophn_exec(ms, class, swap,
fd, (off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
(size_t)getu16(swap, elfhdr.e_phentsize),
fsize, &flags)
== -1)
return -1;
}
case ET_EXEC:
case ET_DYN:
if (dophn_exec(ms, class, swap,
fd, (off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
(size_t)getu16(swap, elfhdr.e_phentsize),
fsize, &flags) == -1)
return -1;
if (doshn(ms, class, swap, fd,
(off_t)getu32(swap, elfhdr.e_shoff),
getu16(swap, elfhdr.e_shnum),
(size_t)getu16(swap, elfhdr.e_shentsize),
&flags) == -1)
return -1;
break;
default:
break;
}
return 1;
}
+3 -6
View File
@@ -97,6 +97,7 @@ typedef struct {
/* e_type */
#define ET_EXEC 2
#define ET_DYN 3
#define ET_CORE 4
/* sh_type */
@@ -190,12 +191,6 @@ typedef struct {
Elf64_Off sh_entsize;
} Elf64_Shdr;
/* Notes used in ET_CORE */
#define NT_PRSTATUS 1
#define NT_PRFPREG 2
#define NT_PRPSINFO 3
#define NT_TASKSTRUCT 4
#define NT_NETBSD_CORE_PROCINFO 1
/* Note header in a PT_NOTE section */
@@ -211,10 +206,12 @@ typedef struct {
Elf64_Word n_type;
} Elf64_Nhdr;
/* Notes used in ET_CORE */
#define NT_PRSTATUS 1
#define NT_PRFPREG 2
#define NT_PRPSINFO 3
#define NT_PRXREG 4
#define NT_TASKSTRUCT 4
#define NT_PLATFORM 5
#define NT_AUXV 6
+195 -12
View File
@@ -38,7 +38,7 @@
#ifndef lint
FILE_RCSID("@(#)$File: softmagic.c,v 1.99 2007/05/08 14:44:18 christos Exp $")
FILE_RCSID("@(#)$File: softmagic.c,v 1.103 2007/12/27 16:35:59 christos Exp $")
#endif /* lint */
private int match(struct magic_set *, struct magic *, uint32_t,
@@ -254,9 +254,10 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
break;
}
}
firstline = 0;
if (printed_something)
if (printed_something) {
firstline = 0;
returnval = 1;
}
if ((ms->flags & MAGIC_CONTINUE) == 0 && printed_something) {
return 1; /* don't keep searching */
}
@@ -310,6 +311,8 @@ private int32_t
mprint(struct magic_set *ms, struct magic *m)
{
uint64_t v;
float vf;
double vd;
int64_t t = 0;
char buf[512];
union VALUETYPE *p = &ms->ms_value;
@@ -398,11 +401,8 @@ mprint(struct magic_set *ms, struct magic *m)
t = ms->offset + m->vallen;
}
else {
if (*m->value.s == '\0') {
char *cp = strchr(p->s,'\n');
if (cp)
*cp = '\0';
}
if (*m->value.s == '\0')
p->s[strcspn(p->s, "\n")] = '\0';
if (file_printf(ms, m->desc, p->s) == -1)
return -1;
t = ms->offset + strlen(p->s);
@@ -445,6 +445,48 @@ mprint(struct magic_set *ms, struct magic *m)
t = ms->offset + sizeof(uint64_t);
break;
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
vf = p->f;
switch (check_fmt(ms, m)) {
case -1:
return -1;
case 1:
if (snprintf(buf, sizeof(buf), "%g", vf) < 0)
return -1;
if (file_printf(ms, m->desc, buf) == -1)
return -1;
break;
default:
if (file_printf(ms, m->desc, vf) == -1)
return -1;
break;
}
t = ms->offset + sizeof(float);
break;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
vd = p->d;
switch (check_fmt(ms, m)) {
case -1:
return -1;
case 1:
if (snprintf(buf, sizeof(buf), "%g", vd) < 0)
return -1;
if (file_printf(ms, m->desc, buf) == -1)
return -1;
break;
default:
if (file_printf(ms, m->desc, vd) == -1)
return -1;
break;
}
t = ms->offset + sizeof(double);
break;
case FILE_REGEX: {
char *cp;
int rval;
@@ -545,6 +587,35 @@ cvt_64(union VALUETYPE *p, const struct magic *m)
DO_CVT(q, (uint64_t));
}
#define DO_CVT2(fld, cast) \
if (m->num_mask) \
switch (m->mask_op & FILE_OPS_MASK) { \
case FILE_OPADD: \
p->fld += cast m->num_mask; \
break; \
case FILE_OPMINUS: \
p->fld -= cast m->num_mask; \
break; \
case FILE_OPMULTIPLY: \
p->fld *= cast m->num_mask; \
break; \
case FILE_OPDIVIDE: \
p->fld /= cast m->num_mask; \
break; \
} \
private void
cvt_float(union VALUETYPE *p, const struct magic *m)
{
DO_CVT2(f, (float));
}
private void
cvt_double(union VALUETYPE *p, const struct magic *m)
{
DO_CVT2(d, (double));
}
/*
* Convert the byte order of the data we are looking at
* While we're here, let's apply the mask operation
@@ -644,6 +715,36 @@ mconvert(struct magic_set *ms, struct magic *m)
((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2]));
cvt_32(p, m);
return 1;
case FILE_FLOAT:
cvt_float(p, m);
return 1;
case FILE_BEFLOAT:
p->l = ((uint32_t)p->hl[0]<<24)|((uint32_t)p->hl[1]<<16)|
((uint32_t)p->hl[2]<<8) |((uint32_t)p->hl[3]);
cvt_float(p, m);
return 1;
case FILE_LEFLOAT:
p->l = ((uint32_t)p->hl[3]<<24)|((uint32_t)p->hl[2]<<16)|
((uint32_t)p->hl[1]<<8) |((uint32_t)p->hl[0]);
cvt_float(p, m);
return 1;
case FILE_DOUBLE:
cvt_double(p, m);
return 1;
case FILE_BEDOUBLE:
p->q = ((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)|
((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)|
((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)|
((uint64_t)p->hq[6]<<8) |((uint64_t)p->hq[7]);
cvt_double(p, m);
return 1;
case FILE_LEDOUBLE:
p->q = ((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)|
((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)|
((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)|
((uint64_t)p->hq[1]<<8) |((uint64_t)p->hq[0]);
cvt_double(p, m);
return 1;
case FILE_REGEX:
case FILE_SEARCH:
case FILE_DEFAULT:
@@ -730,13 +831,17 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
offset);
return -1;
}
for (/*EMPTY*/; src < esrc; src++, dst++) {
for (/*EMPTY*/; src < esrc; src += 2, dst++) {
if (dst < edst)
*dst = *src++;
*dst = *src;
else
break;
if (*dst == '\0')
*dst = ' ';
if (*dst == '\0') {
if (type == FILE_BESTRING16 ?
*(src - 1) != '\0' :
*(src + 1) != '\0')
*dst = ' ';
}
}
*edst = '\0';
return 0;
@@ -1289,10 +1394,20 @@ mget(struct magic_set *ms, const unsigned char *s,
case FILE_BELDATE:
case FILE_LELDATE:
case FILE_MELDATE:
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
if (nbytes < (offset + 4))
return 0;
break;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
if (nbytes < (offset + 8))
return 0;
break;
case FILE_STRING:
case FILE_PSTRING:
case FILE_SEARCH:
@@ -1395,6 +1510,8 @@ magiccheck(struct magic_set *ms, struct magic *m)
{
uint64_t l = m->value.q;
uint64_t v;
float fl, fv;
double dl, dv;
int matched;
union VALUETYPE *p = &ms->ms_value;
@@ -1436,6 +1553,72 @@ magiccheck(struct magic_set *ms, struct magic *m)
v = p->q;
break;
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
fl = m->value.f;
fv = p->f;
switch (m->reln) {
case 'x':
matched = 1;
break;
case '!':
matched = fv != fl;
break;
case '=':
matched = fv == fl;
break;
case '>':
matched = fv > fl;
break;
case '<':
matched = fv < fl;
break;
default:
matched = 0;
file_magerror(ms, "cannot happen with float: invalid relation `%c'", m->reln);
return -1;
}
return matched;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
dl = m->value.d;
dv = p->d;
switch (m->reln) {
case 'x':
matched = 1;
break;
case '!':
matched = dv != dl;
break;
case '=':
matched = dv == dl;
break;
case '>':
matched = dv > dl;
break;
case '<':
matched = dv < dl;
break;
default:
matched = 0;
file_magerror(ms, "cannot happen with double: invalid relation `%c'", m->reln);
return -1;
}
return matched;
case FILE_DEFAULT:
l = 0;
v = 0;
-1
View File
@@ -1 +0,0 @@
timestamp
+7 -4
View File
@@ -152,9 +152,12 @@ __gthrw(pthread_setschedparam)
it is passed so we cannot pretend that the interface is active if -pthreads
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
we need to play the usual game with weak symbols. On Solaris 10 and up, a
working interface is always exposed. */
working interface is always exposed. On FreeBSD 6 and later, libc also
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
which means the alternate __gthread_active_p below cannot be used there. */
#if defined(__sun) && defined(__svr4__)
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
static volatile int __gthread_active = -1;
@@ -197,7 +200,7 @@ __gthread_active_p (void)
return __gthread_active_latest_value != 0;
}
#else /* not Solaris */
#else /* neither FreeBSD nor Solaris */
static inline int
__gthread_active_p (void)
@@ -207,7 +210,7 @@ __gthread_active_p (void)
return __gthread_active_ptr != 0;
}
#endif /* Solaris */
#endif /* FreeBSD or Solaris */
#else /* not SUPPORTS_WEAK */
+2 -1
View File
@@ -25,6 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* $FreeBSD$ */
#include <openssl/objects.h>
#include <openssl/engine.h>
@@ -32,7 +33,7 @@
#include <openssl/bn.h>
#if (defined(__unix__) || defined(unix)) && !defined(USG) && \
(defined(OpenBSD) || defined(__FreeBSD_version))
(defined(OpenBSD) || defined(__FreeBSD__))
#include <sys/param.h>
# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041)
# define HAVE_CRYPTODEV
+16 -16
View File
@@ -78,12 +78,12 @@ FREEBSD=COPYRIGHT
afterinstall:
.if ${MK_MAN} != "no"
cd ${.CURDIR}/../share/man; ${MAKE} makedb
${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb
.endif
distribute:
cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION}
cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
${_+_}cd ${.CURDIR} ; ${MAKE} install DESTDIR=${DISTDIR}/${DISTRIBUTION}
${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
.include <bsd.endian.mk>
.if ${TARGET_ENDIANNESS} == "1234"
@@ -112,15 +112,15 @@ distribution:
master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
${DESTDIR}/etc/master.passwd
cd ${.CURDIR}/bluetooth; ${MAKE} install
cd ${.CURDIR}/defaults; ${MAKE} install
cd ${.CURDIR}/gss; ${MAKE} install
cd ${.CURDIR}/periodic; ${MAKE} install
cd ${.CURDIR}/rc.d; ${MAKE} install
cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall
cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
cd ${.CURDIR}/pam.d; ${MAKE} install
${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
${_+_}cd ${.CURDIR}/gss; ${MAKE} install
${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
${_+_}cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall
${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR}
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \
@@ -128,7 +128,7 @@ distribution:
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \
${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR}
.if ${MK_I4B} != "no"
cd ${.CURDIR}/isdn; ${MAKE} install
${_+_}cd ${.CURDIR}/isdn; ${MAKE} install
.endif
.if ${MK_BIND_MTREE} != "no"
@if [ ! -e ${DESTDIR}/etc/namedb ]; then \
@@ -137,10 +137,10 @@ distribution:
fi
.endif
.if ${MK_BIND_ETC} != "no"
cd ${.CURDIR}/namedb; ${MAKE} install
${_+_}cd ${.CURDIR}/namedb; ${MAKE} install
.endif
.if ${MK_SENDMAIL} != "no"
cd ${.CURDIR}/sendmail; ${MAKE} distribution
${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
.endif
.if ${MK_OPENSSH} != "no"
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
@@ -239,7 +239,7 @@ etc-examples:
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${BIN1} ${BIN2} nsmb.conf opieaccess \
${DESTDIR}/usr/share/examples/etc
cd ${.CURDIR}/defaults; ${MAKE} install \
${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \
DESTDIR=${DESTDIR}/usr/share/examples
.include <bsd.prog.mk>
+1 -3
View File
@@ -163,8 +163,6 @@ pfsync_ifconfig="" # Additional options to ifconfig(8) for pfsync
tcp_extensions="YES" # Set to NO to turn off RFC1323 extensions.
log_in_vain="0" # >=1 to log connects to ports w/o listeners.
tcp_keepalive="YES" # Enable stale TCP connection timeout (or NO).
# For the following option you need to have TCP_DROP_SYNFIN set in your
# kernel. Please refer to LINT and NOTES for details.
tcp_drop_synfin="NO" # Set to YES to drop TCP packets with SYN+FIN
# NOTE: this violates the TCP specification
icmp_drop_redirect="NO" # Set to YES to ignore ICMP REDIRECT packets
@@ -238,7 +236,7 @@ named_symlink_enable="YES" # Symlink the chrooted pid file
#
kerberos5_server_enable="NO" # Run a kerberos 5 master server (or NO).
kerberos5_server="/usr/libexec/kdc" # path to kerberos 5 KDC
kerberos5_server_flags="" # Additional flags to the kerberos 5 server
kerberos5_server_flags="--detach" # Additional flags to the kerberos 5 server
kadmind5_server_enable="NO" # Run kadmind (or NO)
kadmind5_server="/usr/libexec/kadmind" # path to kerberos 5 admin daemon
kpasswdd_server_enable="NO" # Run kpasswdd (or NO)
+1 -1
View File
@@ -1,4 +1,4 @@
# $FreeBSD$
#
# Name OID Library name Kernel module
kerberosv5 1.2.840.113554.1.2.2 /usr/lib/libgssapi_krb5.so.8 -
kerberosv5 1.2.840.113554.1.2.2 /usr/lib/libgssapi_krb5.so.9 -
-8
View File
@@ -121,14 +121,6 @@ zone "0.ip6.arpa" { type master; file "master/localhost-reverse.db"; };
// "This" Network (RFCs 1912 and 3330)
zone "0.in-addr.arpa" { type master; file "master/empty.db"; };
// IANA Reserved - Unlikely to ever be assigned
zone "1.in-addr.arpa" { type master; file "master/empty.db"; };
zone "2.in-addr.arpa" { type master; file "master/empty.db"; };
zone "223.in-addr.arpa" { type master; file "master/empty.db"; };
// Public Data Networks (RFC 3330)
zone "14.in-addr.arpa" { type master; file "master/empty.db"; };
// Private Use Networks (RFC 1918)
zone "10.in-addr.arpa" { type master; file "master/empty.db"; };
zone "16.172.in-addr.arpa" { type master; file "master/empty.db"; };
+8 -3
View File
@@ -13,14 +13,14 @@
; on server FTP.INTERNIC.NET
; -OR- RS.INTERNIC.NET
;
; last update: Nov 01, 2007
; related version of root zone: 2007110100
;
; last update: Feb 04, 2008
; related version of root zone: 2008020400
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30
;
; formerly NS1.ISI.EDU
;
@@ -46,6 +46,7 @@ E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f
;
; formerly NS.NIC.DDN.MIL
;
@@ -56,6 +57,7 @@ G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803f:235
;
; formerly NIC.NORDU.NET
;
@@ -66,11 +68,13 @@ I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30
;
; operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1
;
; operated by ICANN
;
@@ -81,4 +85,5 @@ L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35
; End of File
+1 -1
View File
@@ -44,7 +44,7 @@ case "$daily_status_security_chksetuid_enable" in
echo ""
echo 'Checking setuid files and devices:'
# XXX Note that there is the possibility of overrunning the args to ls
MP=`mount -t ufs | egrep -v " no(suid|exec)" | awk '{ print $3 }' | sort`
MP=`mount -t ufs,zfs | egrep -v " no(suid|exec)" | awk '{ print $3 }' | sort`
if [ -n "${MP}" ]
then
set ${MP}
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
+1 -2
View File
@@ -1,4 +1,3 @@
# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $
# $FreeBSD$
.include <bsd.own.mk>
@@ -25,7 +24,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \
named natd netif netoptions \
network_ipv6 newsyslog nfsclient nfsd \
nfslocking nfsserver nisdomain nsswitch ntpd ntpdate \
nfsserver nisdomain nsswitch ntpd ntpdate \
othermta \
pf pflog pfsync \
powerd power_profile ppp pppoed pwcheck \
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: apmd,v 1.5 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
-82
View File
@@ -1,82 +0,0 @@
#!/bin/sh
#
# $NetBSD: bootconf.sh,v 1.5 2002/03/25 03:22:10 wiz Exp $
# $FreeBSD$
#
# PROVIDE: bootconf
# REQUIRE: FILESYSTEMS
bootconf_start()
{
# Refer to newbtconf(8) for more information
#
if [ ! -e /etc/etc.current ]; then
return 0
fi
if [ -L /etc/etc.default ]; then
def=`ls -ld /etc/etc.default 2>&1`
default="${def##*-> etc.}"
else
default=current
fi
if [ "$default" = "current" ]; then
def=`ls -ld /etc/etc.current 2>&1`
default="${def##*-> etc.}"
fi
spc=""
for i in /etc/etc.*; do
name="${i##/etc/etc.}"
case $name in
current|default|\*)
continue
;;
*)
if [ "$name" = "$default" ]; then
echo -n "${spc}[${name}]"
else
echo -n "${spc}${name}"
fi
spc=" "
;;
esac
done
echo
master=$$
DUMMY=/etc/passwd
conf=${DUMMY}
while [ ! -d /etc/etc.$conf/. ]; do
trap "conf=$default; echo; echo Using default of $conf" ALRM
echo -n "Which configuration [$default] ? "
(sleep 30 && kill -ALRM $master) >/dev/null 2>&1 &
read conf
trap : ALRM
if [ -z $conf ]; then
conf=$default
fi
if [ ! -d /etc/etc.$conf/. ]; then
conf=${DUMMY}
fi
done
case $conf in
current|default)
;;
*)
rm -f /etc/etc.current
ln -s /etc/etc.$conf /etc/etc.current
;;
esac
if [ -f /etc/rc.conf ]; then
. /etc/rc.conf
fi
}
case "$1" in
*start)
bootconf_start
;;
esac
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: bootparams,v 1.6 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: ccd,v 1.3 2000/05/13 08:45:06 lukem Exp $
# $FreeBSD$
#
-1
View File
@@ -1,6 +1,5 @@
#!/bin/sh
#
# $NetBSD: cron,v 1.5 2000/09/19 13:04:38 lukem Exp $
# $FreeBSD$
#
-2
View File
@@ -1,12 +1,10 @@
#!/bin/sh
#
# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dhclient
# KEYWORD: nojail nostart
#
. /etc/rc.subr
. /etc/network.subr
+1 -2
View File
@@ -1,13 +1,12 @@
#!/bin/sh
#
# $NetBSD: dmesg,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dmesg
# REQUIRE: mountcritremote cleanvar
# BEFORE: DAEMON
# KEYWORD: Daemon nojail
# KEYWORD: nojail
. /etc/rc.subr
Loaded 100 of 430 files, more files were not shown because too many files have changed in this diff. Show more