Browse code

add skeleton support for PST files

git-svn: trunk@1921

Tomasz Kojm authored on 2006/04/25 01:28:05
Showing 7 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Apr 24 18:22:22 CEST 2006 (tk)
2
+----------------------------------
3
+  * libclamav: add skeleton support for PST files (patch from NJH)
4
+
1 5
 Sun Apr 23 13:58:31 BST 2006 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Ensure that the quarantine location reported in
... ...
@@ -150,6 +150,8 @@ libclamav_la_SOURCES = \
150 150
 	sis.c \
151 151
 	sis.h \
152 152
 	uuencode.c \
153
-	uuencode.h
153
+	uuencode.h \
154
+	pst.c \
155
+	pst.h
154 156
 
155 157
 lib_LTLIBRARIES = libclamav.la
... ...
@@ -87,7 +87,7 @@ am_libclamav_la_OBJECTS = matcher-ac.lo matcher-bm.lo matcher.lo \
87 87
 	chmunpack.lo rebuildpe.lo petite.lo fsg.lo line.lo untar.lo \
88 88
 	special.lo binhex.lo is_tar.lo tnef.lo unrar15.lo unrarvm.lo \
89 89
 	unrar.lo unrarfilter.lo unrarppm.lo unrar20.lo unrarcmd.lo \
90
-	pdf.lo spin.lo yc.lo elf.lo sis.lo uuencode.lo
90
+	pdf.lo spin.lo yc.lo elf.lo sis.lo uuencode.lo pst.lo
91 91
 libclamav_la_OBJECTS = $(am_libclamav_la_OBJECTS)
92 92
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
93 93
 depcomp = $(SHELL) $(top_srcdir)/depcomp
... ...
@@ -344,7 +344,9 @@ libclamav_la_SOURCES = \
344 344
 	sis.c \
345 345
 	sis.h \
346 346
 	uuencode.c \
347
-	uuencode.h
347
+	uuencode.h \
348
+	pst.c \
349
+	pst.h
348 350
 
349 351
 lib_LTLIBRARIES = libclamav.la
350 352
 all: all-am
... ...
@@ -442,6 +444,7 @@ distclean-compile:
442 442
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdf.Plo@am__quote@
443 443
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe.Plo@am__quote@
444 444
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/petite.Plo@am__quote@
445
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pst.Plo@am__quote@
445 446
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qtmd.Plo@am__quote@
446 447
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readdb.Plo@am__quote@
447 448
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rebuildpe.Plo@am__quote@
... ...
@@ -100,6 +100,7 @@ static const struct cli_magic_s cli_magic[] = {
100 100
     {0,  "\170\237\076\042",		 4, "TNEF",               CL_TYPE_TNEF},
101 101
 
102 102
     {0,  "begin ",			6,  "UUencoded",	  CL_TYPE_UUENCODED},
103
+    {0, "\116\104\102\031",		4, "PST",		  CL_TYPE_PST},
103 104
 
104 105
     /* Graphics (may contain exploits against MS systems) */
105 106
 
... ...
@@ -52,6 +52,7 @@ typedef enum {
52 52
     CL_TYPE_CRYPTFF,
53 53
     CL_TYPE_PDF,
54 54
     CL_TYPE_UUENCODED,
55
+    CL_TYPE_PST,	/* Microsoft Outlook binary email folder (.pst file) */
55 56
 
56 57
     /* bigger numbers have higher priority (in o-t-f detection) */
57 58
     CL_TYPE_HTML, /* on the fly */
... ...
@@ -16,9 +16,10 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: pst.c,v 1.1 2006/04/24 15:03:51 nigelhorne Exp $";
19
+static	char	const	rcsid[] = "$Id: pst.c,v 1.2 2006/04/24 16:28:05 kojm Exp $";
20 20
 
21 21
 #include "clamav.h"
22
+#include "others.h"
22 23
 
23 24
 #if HAVE_CONFIG_H
24 25
 #include "clamav-config.h"
... ...
@@ -1470,6 +1470,30 @@ static int cli_scanuuencoded(int desc, cli_ctx *ctx)
1470 1470
     return ret;
1471 1471
 }
1472 1472
 
1473
+/* Outlook PST file */
1474
+static int cli_scanpst(int desc, cli_ctx *ctx)
1475
+{
1476
+	int ret;
1477
+	char *dir = cli_gentemp(NULL);
1478
+
1479
+    if(mkdir(dir, 0700)) {
1480
+	cli_dbgmsg("Can't create temporary directory for PST file %s\n", dir);
1481
+	free(dir);
1482
+	return CL_ETMPDIR;
1483
+    }
1484
+
1485
+    ret = cli_pst(dir, desc);
1486
+
1487
+    if(ret == CL_SUCCESS)
1488
+	ret = cli_scandir(dir, ctx);
1489
+
1490
+    if(!cli_leavetemps_flag)
1491
+	cli_rmdirs(dir);
1492
+
1493
+    free(dir);
1494
+    return ret;
1495
+}
1496
+
1473 1497
 static int cli_scanmail(int desc, cli_ctx *ctx)
1474 1498
 {
1475 1499
 	char *dir;
... ...
@@ -1697,6 +1721,11 @@ int cli_magic_scandesc(int desc, cli_ctx *ctx)
1697 1697
 		ret = cli_scanuuencoded(desc, ctx);
1698 1698
 	    break;
1699 1699
 
1700
+	case CL_TYPE_PST:
1701
+	    if(SCAN_MAIL)
1702
+		ret = cli_scanpst(desc, ctx);
1703
+	    break;
1704
+
1700 1705
 	case CL_TYPE_MSCHM:
1701 1706
 	    if(SCAN_ARCHIVE)
1702 1707
 		ret = cli_scanmschm(desc, ctx);