summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2018-03-11 01:25:11 +0000
committerChristos Zoulas <christos@zoulas.com>2018-03-11 01:25:11 +0000
commitcea6359e8aad609573076b189dd58361e52bc715 (patch)
tree6bc515622aa4ac233963d4f5fce8c2002969be56
parentfd83d6ff56456c56ddef510d3c935ee123de62fd (diff)
downloadfile-git-cea6359e8aad609573076b189dd58361e52bc715.tar.gz
Detect Microsoft Office XML files generated with different file order
in ZIP (Dennis Birkholz)
-rw-r--r--magic/Magdir/msooxml23
1 files changed, 15 insertions, 8 deletions
diff --git a/magic/Magdir/msooxml b/magic/Magdir/msooxml
index 80bdf13f..3b80b2bc 100644
--- a/magic/Magdir/msooxml
+++ b/magic/Magdir/msooxml
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: msooxml,v 1.4 2014/01/06 18:16:24 rrt Exp $
+# $File: msooxml,v 1.6 2018/03/11 01:25:11 christos Exp $
# msooxml: file(1) magic for Microsoft Office XML
# From: Ralf Brown <ralf.brown@gmail.com>
@@ -12,6 +12,14 @@
# file of ePub or OpenDocument, we'll have to scan for a filename
# which can distinguish between the three types
+0 name msooxml
+>0 string word/ Microsoft Word 2007+
+!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
+>0 string ppt/ Microsoft PowerPoint 2007+
+!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
+>0 string xl/ Microsoft Excel 2007+
+!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+
# start by checking for ZIP local file header signature
0 string PK\003\004
!:strength +10
@@ -27,10 +35,9 @@
# and check the subdirectory name to determine which type of OOXML
# file we have. Correct the mimetype with the registered ones:
# http://technet.microsoft.com/en-us/library/cc179224.aspx
->>>>&26 string word/ Microsoft Word 2007+
-!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
->>>>&26 string ppt/ Microsoft PowerPoint 2007+
-!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
->>>>&26 string xl/ Microsoft Excel 2007+
-!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
->>>>&26 default x Microsoft OOXML
+>>>>&26 use msooxml
+>>>>&26 default x
+# OpenOffice/Libreoffice orders ZIP entry differently, so check the 4th file
+>>>>>&26 search/1000 PK\003\004 got
+>>>>>>&26 use msooxml
+>>>>>>&26 default x Microsoft OOXML