From: Christos Zoulas Date: Wed, 27 Aug 2014 06:59:35 +0000 (+0000) Subject: recognize encrypted documents. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18cffc37358e185973e2c23d9974019fe74bfd72;p=file recognize encrypted documents. --- diff --git a/src/cdf.c b/src/cdf.c index 99c0d25f..6cd4d819 100644 --- 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 @@ -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, diff --git a/src/cdf.h b/src/cdf.h index 16459997..64e3648c 100644 --- 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 *); diff --git a/src/readcdf.c b/src/readcdf.c index d5f0521c..2addd78f 100644 --- a/src/readcdf.c +++ b/src/readcdf.c @@ -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 @@ -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