]> granicus.if.org Git - file/commitdiff
recognize encrypted documents.
authorChristos Zoulas <christos@zoulas.com>
Wed, 27 Aug 2014 06:59:35 +0000 (06:59 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 27 Aug 2014 06:59:35 +0000 (06:59 +0000)
src/cdf.c
src/cdf.h
src/readcdf.c

index 99c0d25f5e8fa0be4f7f833f83064670ffd65a72..6cd4d819b1775abafb91fdb822ebb6112b0faf60 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.65 2014/08/07 09:38:35 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.66 2014/08/27 06:59:35 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -733,15 +733,6 @@ cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h,
            "\05SummaryInformation", scn);
 }
 
-int
-cdf_read_catalog(cdf_info_t *info, const cdf_header_t *h,
-    const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
-    const cdf_dir_t *dir, cdf_stream_t *scn)
-{
-       return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
-           "Catalog", scn);
-}
-
 int
 cdf_read_user_stream(const cdf_info_t *info, const cdf_header_t *h,
     const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
index 16459997056e887b2fbca24ee832082fe618cb46..64e3648ca15cc0b8c5239e6640be10f83a31d449 100644 (file)
--- a/src/cdf.h
+++ b/src/cdf.h
@@ -314,9 +314,12 @@ int cdf_read_property_info(const cdf_stream_t *, const cdf_header_t *, uint32_t,
 int cdf_read_user_stream(const cdf_info_t *, const cdf_header_t *,
     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
     const cdf_dir_t *, const char *, cdf_stream_t *);
-int cdf_read_catalog(cdf_info_t *, const cdf_header_t *,
-    const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
-    const cdf_dir_t *, cdf_stream_t *);
+#define cdf_read_catalog(info, header, sat, ssat, stream, dir, scn) \
+    cdf_read_user_stream(info, header, sat, ssat, stream, dir, "Catalog", \
+    scn)
+#define cdf_read_encrypted_package(info, header, sat, ssat, stream, dir, scn) \
+    cdf_read_user_stream(info, header, sat, ssat, stream, dir, \
+    "EncryptedPackage", scn)
 int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
     const cdf_dir_t *, cdf_stream_t *);
index d5f0521c9902f64d87d6347e26a2621204e2bfcf..2addd78fd276f40bc8e17a925453437d18c40373 100644 (file)
@@ -26,7 +26,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.45 2014/07/24 19:35:39 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.46 2014/08/27 06:59:35 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -439,7 +439,13 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
                        if ((i = cdf_read_catalog(&info, &h, &sat, &ssat, &sst,
                            &dir, &scn)) == -1) {
                                corrupt = expn;
-                               expn = "No summary info";
+                               if ((i = cdf_read_encrypted_package(&info, &h,
+                                   &sat, &ssat, &sst, &dir, &scn)) == -1)
+                                       expn = "No summary info";
+                               else {
+                                       expn = "Encrypted";
+                                       i = -1;
+                               }
                                goto out4;
                        }
 #ifdef CDF_DEBUG