]> granicus.if.org Git - file/commitdiff
add a demo entry to show shortcomings with the current file magic language.
authorChristos Zoulas <christos@zoulas.com>
Wed, 10 Dec 2014 18:45:43 +0000 (18:45 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 10 Dec 2014 18:45:43 +0000 (18:45 +0000)
TODO
magic/Magdir/kerberos [new file with mode: 0644]
magic/Makefile.am

diff --git a/TODO b/TODO
index f78893f49392814266ccebda8dbc2d97d1fd2848..eef01edb241bbc1bb09f96ee3ca6153ef13fdb6c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,3 +15,5 @@ small amount of C is needed (because fast execution is typically only
 required for soft magic, not the more detailed information given by
 hard-wired routines). In this regard, note that hplip, which is
 BSD-licensed, has a magic reimplementation in Python.
+
+Read the kerberos magic entry for more ideas.
diff --git a/magic/Magdir/kerberos b/magic/Magdir/kerberos
new file mode 100644 (file)
index 0000000..cb07fed
--- /dev/null
@@ -0,0 +1,45 @@
+
+#------------------------------------------------------------------------------
+# $File: kerberos,v 1.1 2014/12/10 18:45:43 christos Exp $
+# kerberos: MIT kerberos file binary formats
+#
+
+# This magic entry is for demonstration purposes and could be improved
+# if the following features were implemented in file:
+#
+# Strings inside [[ .. ]] in the descriptions have special meanings and
+# are not printed.
+#
+#      - Provide some form of iteration in number of components
+#              [[${counter}=%d]] in the description
+#              then append
+#              [${counter}--] in the offset of the entries
+#      - Provide a way to round the next offset
+#              Add [R:4] after the offset?
+#      - Provide a way to have optional entries
+#              XXX: Syntax:
+#      - Provide a way to "save" entries to print them later.
+#              if the description is [[${name}=%s]], then nothing is
+#              printed and a subsequent entry in the same magic file
+#              can refer to ${name}
+#      - Provide a way to format strings as hex values
+#
+# http://www.gnu.org/software/shishi/manual/html_node/\
+#      The-Keytab-Binary-File-Format.html
+#
+
+0              name            keytab_entry
+#>0            beshort         x               \b, size=%d
+#>2            beshort         x               \b, components=%d
+>4             pstring/H       x               \b, realm=%s
+>>&0           pstring/H       x               \b, principal=%s/
+>>>&0          pstring/H       x               \b%s
+>>>>&0         belong          x               \b, type=%d
+>>>>>&0                bedate          x               \b, date=%s
+>>>>>>&0       byte            x               \b, kvno=%u
+#>>>>>>>&0     pstring/H       x
+#>>>>>>>>&0    belong          x       
+#>>>>>>>>>>&0  use             keytab_entry
+
+0              belong          0x05020000      Kerberos Keytab file
+>4             use             keytab_entry
index 15d8197187491429857c9f608e507ddbaa99bc2d..22972e0ba7e3bece39192f69ad7ecb26fbda58a8 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $File: Makefile.am,v 1.99 2014/08/04 06:26:16 christos Exp $
+# $File: Makefile.am,v 1.100 2014/12/10 18:45:43 christos Exp $
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
@@ -117,6 +117,7 @@ $(MAGIC_FRAGMENT_DIR)/jpeg \
 $(MAGIC_FRAGMENT_DIR)/karma \
 $(MAGIC_FRAGMENT_DIR)/kde \
 $(MAGIC_FRAGMENT_DIR)/keepass \
+$(MAGIC_FRAGMENT_DIR)/kerberos \
 $(MAGIC_FRAGMENT_DIR)/kml \
 $(MAGIC_FRAGMENT_DIR)/lecter \
 $(MAGIC_FRAGMENT_DIR)/lex \