Browse code

do not scan mail files twice; separate archive and mail recursion limits

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@650 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/07/04 23:56:48
Showing 4 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sun Jul  4 16:52:45 CEST 2004 (tk)
2
+----------------------------------
3
+  * libclamav: Do not scan mail files twice. Separate archive and mail
4
+	       recursion limits.
5
+
1 6
 Sat Jul  3 17:20:45 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * libclamav: use new method to detect mail files
... ...
@@ -46,7 +46,7 @@ while test $# -gt 0; do
46 46
 	;;
47 47
 
48 48
     --version)
49
-	echo devel-20040703
49
+	echo devel-20040704
50 50
 	exit 0
51 51
 	;;
52 52
 
... ...
@@ -112,8 +112,8 @@ static const struct cli_magic_s cli_magic[] = {
112 112
 
113 113
 static const struct cli_smagic_s cli_smagic[] = {
114 114
 
115
-    /* <html>*<body> */
116
-    {"3c68746d6c3e*3c626f64793e",    "HTML data", CL_HTMLFILE},
115
+    /* <html>*<body */
116
+    {"3c68746d6c3e*3c626f6479",    "HTML data", CL_HTMLFILE},
117 117
 
118 118
     /* "From: " * "Content-Type: " */
119 119
     {"46726f6d3a20*436f6e74656e742d547970653a20",    "Mail file", CL_MAILFILE},
... ...
@@ -73,9 +73,11 @@ extern short cli_leavetemps_flag;
73 73
 #define DISABLE_RAR	    (options & CL_DISABLERAR)
74 74
 #define DETECT_ENCRYPTED    (options & CL_ENCRYPTED)
75 75
 
76
+#define MAX_MAIL_RECURSION  10
76 77
 
77
-static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev);
78
-static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev);
78
+
79
+static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec);
80
+static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec);
79 81
 
80 82
 static int cli_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, int typerec)
81 83
 {
... ...
@@ -144,7 +146,7 @@ static void cli_unlock_mutex(void *mtx)
144 144
 }
145 145
 #endif
146 146
 
147
-static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
147
+static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
148 148
 {
149 149
 	FILE *tmp = NULL;
150 150
 	int files = 0, fd, ret = CL_CLEAN, afiles;
... ...
@@ -247,7 +249,7 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const
247 247
 	    }
248 248
 
249 249
 	    lseek(fd, 0, SEEK_SET);
250
-	    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, reclev)) == CL_VIRUS ) {
250
+	    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec)) == CL_VIRUS ) {
251 251
 		cli_dbgmsg("RAR -> Found %s virus.\n", *virname);
252 252
 
253 253
 		fclose(tmp);
... ...
@@ -286,7 +288,7 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const
286 286
 }
287 287
 
288 288
 #ifdef HAVE_ZLIB_H
289
-static int cli_scanzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
289
+static int cli_scanzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
290 290
 {
291 291
 	ZZIP_DIR *zdir;
292 292
 	ZZIP_DIRENT zdirent;
... ...
@@ -408,7 +410,7 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
408 408
 	fd = fileno(tmp);
409 409
 
410 410
 	lseek(fd, 0, SEEK_SET);
411
-	if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, reclev)) == CL_VIRUS ) {
411
+	if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec)) == CL_VIRUS ) {
412 412
 	    cli_dbgmsg("Zip -> Found %s virus.\n", *virname);
413 413
 	    ret = CL_VIRUS;
414 414
 	    break;
... ...
@@ -440,7 +442,7 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
440 440
     return ret;
441 441
 }
442 442
 
443
-static int cli_scangzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
443
+static int cli_scangzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
444 444
 {
445 445
 	int fd, bytes, ret = CL_CLEAN;
446 446
 	long int size = 0;
... ...
@@ -497,7 +499,7 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const
497 497
     }
498 498
 
499 499
     lseek(fd, 0, SEEK_SET);
500
-    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, reclev)) == CL_VIRUS ) {
500
+    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec)) == CL_VIRUS ) {
501 501
 	cli_dbgmsg("Gzip -> Found %s virus.\n", *virname);
502 502
 	fclose(tmp);
503 503
 	return CL_VIRUS;
... ...
@@ -516,7 +518,7 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const
516 516
 #define BZ2_bzRead bzRead
517 517
 #endif
518 518
 
519
-static int cli_scanbzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
519
+static int cli_scanbzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
520 520
 {
521 521
 	int fd, bytes, ret = CL_CLEAN, bzerror = 0;
522 522
 	short memlim = 0;
... ...
@@ -587,7 +589,7 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const
587 587
     }
588 588
 
589 589
     lseek(fd, 0, SEEK_SET);
590
-    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, reclev)) == CL_VIRUS ) {
590
+    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec)) == CL_VIRUS ) {
591 591
 	cli_dbgmsg("Bzip2 -> Found %s virus.\n", *virname);
592 592
     }
593 593
     fclose(tmp);
... ...
@@ -597,7 +599,7 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const
597 597
 }
598 598
 #endif
599 599
 
600
-static int cli_scanmscomp(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
600
+static int cli_scanmscomp(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
601 601
 {
602 602
 	int fd, ret = CL_CLEAN;
603 603
 	FILE *tmp = NULL, *in;
... ...
@@ -629,7 +631,7 @@ static int cli_scanmscomp(int desc, const char **virname, long int *scanned, con
629 629
 
630 630
     fd = fileno(tmp);
631 631
     lseek(fd, 0, SEEK_SET);
632
-    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, reclev)) == CL_VIRUS) {
632
+    if((ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec)) == CL_VIRUS) {
633 633
 	cli_dbgmsg("MSCompress -> Found %s virus.\n", *virname);
634 634
 	fclose(tmp);
635 635
 	return CL_VIRUS;
... ...
@@ -639,7 +641,7 @@ static int cli_scanmscomp(int desc, const char **virname, long int *scanned, con
639 639
     return ret;
640 640
 }
641 641
 
642
-static int cli_scanmscab(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
642
+static int cli_scanmscab(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
643 643
 {
644 644
 	struct mscab_decompressor *cabd = NULL;
645 645
 	struct mscabd_cabinet *base, *cab;
... ...
@@ -676,7 +678,7 @@ static int cli_scanmscab(int desc, const char **virname, long int *scanned, cons
676 676
 	    if(cabd->extract(cabd, file, tempname)) {
677 677
 		cli_dbgmsg("libmscab error code: %d\n", cabd->last_error(cabd));
678 678
 	    } else {
679
-		ret = cli_scanfile(tempname, virname, scanned, root, limits, options, reclev);
679
+		ret = cli_scanfile(tempname, virname, scanned, root, limits, options, arec, mrec);
680 680
 	    }
681 681
 	    if(!cli_leavetemps_flag)
682 682
 		unlink(tempname);
... ...
@@ -694,7 +696,7 @@ static int cli_scanmscab(int desc, const char **virname, long int *scanned, cons
694 694
     return ret;
695 695
 }
696 696
 
697
-static int cli_scanhtml(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
697
+static int cli_scanhtml(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
698 698
 {
699 699
 	unsigned char *membuff, *newbuff, *newbuff2;
700 700
 	struct stat statbuf;
... ...
@@ -741,7 +743,7 @@ static int cli_scanhtml(int desc, const char **virname, long int *scanned, const
741 741
     return ret;
742 742
 }
743 743
 
744
-static int cli_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
744
+static int cli_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
745 745
 {
746 746
 	DIR *dd;
747 747
 	struct dirent *dent;
... ...
@@ -763,14 +765,14 @@ static int cli_scandir(const char *dirname, const char **virname, long int *scan
763 763
 		    /* stat the file */
764 764
 		    if(lstat(fname, &statbuf) != -1) {
765 765
 			if(S_ISDIR(statbuf.st_mode) && !S_ISLNK(statbuf.st_mode)) {
766
-			    if (cli_scandir(fname, virname, scanned, root, limits, options, reclev) == CL_VIRUS) {
766
+			    if (cli_scandir(fname, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS) {
767 767
 				free(fname);
768 768
 				closedir(dd);
769 769
 				return CL_VIRUS;
770 770
 			    }
771 771
 			} else
772 772
 			    if(S_ISREG(statbuf.st_mode))
773
-				if(cli_scanfile(fname, virname, scanned, root, limits, options, reclev) == CL_VIRUS) {
773
+				if(cli_scanfile(fname, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS) {
774 774
 				    free(fname);
775 775
 				    closedir(dd);
776 776
 				    return CL_VIRUS;
... ...
@@ -790,7 +792,7 @@ static int cli_scandir(const char *dirname, const char **virname, long int *scan
790 790
     return 0;
791 791
 }
792 792
 
793
-static int cli_vba_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
793
+static int cli_vba_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
794 794
 {
795 795
 	int ret = CL_CLEAN, i, fd, data_len;
796 796
 	vba_project_t *vba_project;
... ...
@@ -838,7 +840,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
838 838
 	free(vba_project->offset);
839 839
 	free(vba_project);
840 840
     } else if ((fullname = ppt_vba_read(dirname))) {
841
-    	if(cli_scandir(fullname, virname, scanned, root, limits, options, reclev) == CL_VIRUS) {
841
+    	if(cli_scandir(fullname, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS) {
842 842
 	    ret = CL_VIRUS;
843 843
 	}
844 844
 	cli_rmdirs(fullname);
... ...
@@ -897,7 +899,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
897 897
 		    /* stat the file */
898 898
 		    if(lstat(fname, &statbuf) != -1) {
899 899
 			if(S_ISDIR(statbuf.st_mode) && !S_ISLNK(statbuf.st_mode))
900
-			    if (cli_vba_scandir(fname, virname, scanned, root, limits, options, reclev) == CL_VIRUS) {
900
+			    if (cli_vba_scandir(fname, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS) {
901 901
 			    	ret = CL_VIRUS;
902 902
 				free(fname);
903 903
 				break;
... ...
@@ -916,7 +918,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
916 916
     return ret;
917 917
 }
918 918
 
919
-static int cli_scanole2(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
919
+static int cli_scanole2(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
920 920
 {
921 921
 	const char *tmpdir;
922 922
 	char *dir;
... ...
@@ -945,8 +947,8 @@ static int cli_scanole2(int desc, const char **virname, long int *scanned, const
945 945
 	return ret;
946 946
     }
947 947
 
948
-    if((ret = cli_vba_scandir(dir, virname, scanned, root, limits, options, reclev)) != CL_VIRUS) {
949
-	if(cli_scandir(dir, virname, scanned, root, limits, options, reclev) == CL_VIRUS) {
948
+    if((ret = cli_vba_scandir(dir, virname, scanned, root, limits, options, arec, mrec)) != CL_VIRUS) {
949
+	if(cli_scandir(dir, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS) {
950 950
 	    ret = CL_VIRUS;
951 951
 	}
952 952
     }
... ...
@@ -956,17 +958,14 @@ static int cli_scanole2(int desc, const char **virname, long int *scanned, const
956 956
     return ret;
957 957
 }
958 958
 
959
-static int cli_scanmail(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
959
+static int cli_scanmail(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
960 960
 {
961 961
 	const char *tmpdir;
962 962
 	char *dir;
963 963
 	int ret;
964 964
 
965 965
 
966
-    cli_dbgmsg("Starting cli_scanmail(), reclev %d\n", *reclev);
967
-
968
-    if(*reclev > 5) /* FIXME: a temporary workaround */
969
-	return CL_CLEAN;
966
+    cli_dbgmsg("Starting cli_scanmail(), mrec == %d, arec == %d\n", mrec, arec);
970 967
 
971 968
     if((tmpdir = getenv("TMPDIR")) == NULL)
972 969
 #ifdef P_tmpdir
... ...
@@ -988,7 +987,7 @@ static int cli_scanmail(int desc, const char **virname, long int *scanned, const
988 988
 	ret = cl_mbox(dir, desc);
989 989
 	/* FIXME: check mbox return code */
990 990
 
991
-	ret = cli_scandir(dir, virname, scanned, root, limits, options, reclev);
991
+	ret = cli_scandir(dir, virname, scanned, root, limits, options, arec, mrec);
992 992
 
993 993
 	cli_rmdirs(dir);
994 994
 	free(dir);
... ...
@@ -996,7 +995,7 @@ static int cli_scanmail(int desc, const char **virname, long int *scanned, const
996 996
 	return ret;
997 997
 }
998 998
 
999
-static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
999
+static int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1000 1000
 {
1001 1001
 	char magic[MAGIC_BUFFER_SIZE+1];
1002 1002
 	int ret = CL_CLEAN, nret;
... ...
@@ -1017,10 +1016,18 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
1017 1017
     }
1018 1018
 
1019 1019
     if(SCAN_ARCHIVE && limits && limits->maxreclevel)
1020
-	if(*reclev > limits->maxreclevel)
1020
+	if(*arec > limits->maxreclevel) {
1021
+	    cli_dbgmsg("Archive recursion limit exceeded (arec == %d).\n", *arec);
1021 1022
 	    /* return CL_EMAXREC; */
1022 1023
 	    return CL_CLEAN;
1024
+	}
1023 1025
 
1026
+    if(SCAN_MAIL)
1027
+	if(*mrec > MAX_MAIL_RECURSION) {
1028
+	    cli_dbgmsg("Mail recursion level exceeded (mrec == %d).\n", *mrec);
1029
+	    /* return CL_EMAXREC; */
1030
+	    return CL_CLEAN;
1031
+	}
1024 1032
 
1025 1033
     lseek(desc, 0, SEEK_SET);
1026 1034
     bread = read(desc, magic, MAGIC_BUFFER_SIZE);
... ...
@@ -1037,54 +1044,54 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
1037 1037
 
1038 1038
     type = cli_filetype(magic, bread);
1039 1039
 
1040
-    (*reclev)++;
1040
+    type == CL_MAILFILE ? (*mrec)++ : (*arec)++;
1041 1041
 
1042 1042
     switch(type) {
1043 1043
 	case CL_DOSEXE:
1044 1044
 	    /* temporarily the return code is ignored */
1045
-	    cli_scanpe(desc, virname, scanned, root, limits, options, reclev);
1045
+	    cli_scanpe(desc, virname, scanned, root, limits, options, arec, mrec);
1046 1046
 	    break;
1047 1047
 
1048 1048
 	case CL_RARFILE:
1049 1049
 	    if(!DISABLE_RAR && SCAN_ARCHIVE && !cli_scanrar_inuse)
1050
-		ret = cli_scanrar(desc, virname, scanned, root, limits, options, reclev);
1050
+		ret = cli_scanrar(desc, virname, scanned, root, limits, options, arec, mrec);
1051 1051
 	    break;
1052 1052
 
1053 1053
 	case CL_ZIPFILE:
1054 1054
 	    if(SCAN_ARCHIVE)
1055
-		ret = cli_scanzip(desc, virname, scanned, root, limits, options, reclev);
1055
+		ret = cli_scanzip(desc, virname, scanned, root, limits, options, arec, mrec);
1056 1056
 	    break;
1057 1057
 
1058 1058
 	case CL_GZFILE:
1059 1059
 	    if(SCAN_ARCHIVE)
1060
-		ret = cli_scangzip(desc, virname, scanned, root, limits, options, reclev);
1060
+		ret = cli_scangzip(desc, virname, scanned, root, limits, options, arec, mrec);
1061 1061
 	    break;
1062 1062
 
1063 1063
 	case CL_BZFILE:
1064 1064
 #ifdef HAVE_BZLIB_H
1065 1065
 	    if(SCAN_ARCHIVE)
1066
-		ret = cli_scanbzip(desc, virname, scanned, root, limits, options, reclev);
1066
+		ret = cli_scanbzip(desc, virname, scanned, root, limits, options, arec, mrec);
1067 1067
 #endif
1068 1068
 	    break;
1069 1069
 
1070 1070
 	case CL_MSCFILE:
1071 1071
 	    if(SCAN_ARCHIVE)
1072
-		ret = cli_scanmscomp(desc, virname, scanned, root, limits, options, reclev);
1072
+		ret = cli_scanmscomp(desc, virname, scanned, root, limits, options, arec, mrec);
1073 1073
 	    break;
1074 1074
 
1075 1075
 	case CL_MSCABFILE:
1076 1076
 	    if(SCAN_ARCHIVE)
1077
-		ret = cli_scanmscab(desc, virname, scanned, root, limits, options, reclev);
1077
+		ret = cli_scanmscab(desc, virname, scanned, root, limits, options, arec, mrec);
1078 1078
 	    break;
1079 1079
 
1080 1080
 	case CL_MAILFILE:
1081 1081
 	    if(SCAN_MAIL)
1082
-		ret = cli_scanmail(desc, virname, scanned, root, limits, options, reclev);
1082
+		ret = cli_scanmail(desc, virname, scanned, root, limits, options, arec, mrec);
1083 1083
 	    break;
1084 1084
 
1085 1085
 	case CL_OLE2FILE:
1086 1086
 	    if(SCAN_OLE2)
1087
-		ret = cli_scanole2(desc, virname, scanned, root, limits, options, reclev);
1087
+		ret = cli_scanole2(desc, virname, scanned, root, limits, options, arec, mrec);
1088 1088
 	    break;
1089 1089
 
1090 1090
 	case CL_DATAFILE:
... ...
@@ -1099,12 +1106,14 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
1099 1099
 	    break;
1100 1100
     }
1101 1101
 
1102
-    (*reclev)--;
1102
+    type == CL_MAILFILE ? (*mrec)-- : (*arec)--;
1103 1103
 
1104 1104
     if(type != CL_DATAFILE && ret != CL_VIRUS) { /* scan the raw file */
1105 1105
 	lseek(desc, 0, SEEK_SET);
1106 1106
 
1107
-	if((nret = cli_scandesc(desc, virname, scanned, root, 1)) == CL_VIRUS) {
1107
+	type == CL_UNKNOWN_TYPE ? (type = 1) : (type = 0);
1108
+
1109
+	if((nret = cli_scandesc(desc, virname, scanned, root, type)) == CL_VIRUS) {
1108 1110
 	    cli_dbgmsg("%s virus found in descriptor %d.\n", *virname, desc);
1109 1111
 	    return CL_VIRUS;
1110 1112
 
... ...
@@ -1114,13 +1123,13 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
1114 1114
 	    switch(nret) {
1115 1115
 		case CL_HTMLFILE:
1116 1116
 		    if(SCAN_HTML)
1117
-			if(cli_scanhtml(desc, virname, scanned, root, limits, options, reclev) == CL_VIRUS)
1117
+			if(cli_scanhtml(desc, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS)
1118 1118
 			    return CL_VIRUS;
1119 1119
 		    break;
1120 1120
 
1121 1121
 		case CL_MAILFILE:
1122 1122
 		    if(SCAN_MAIL)
1123
-			if(cli_scanmail(desc, virname, scanned, root, limits, options, reclev) == CL_VIRUS)
1123
+			if(cli_scanmail(desc, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS)
1124 1124
 			    return CL_VIRUS;
1125 1125
 		    break;
1126 1126
 	    }
... ...
@@ -1132,20 +1141,20 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
1132 1132
 
1133 1133
 int cl_scandesc(int desc, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options)
1134 1134
 {
1135
-	int reclev = 0;
1135
+	int arec = 0, mrec = 0;
1136 1136
 
1137
-    return cli_magic_scandesc(desc, virname, scanned, root, limits, options, &reclev);
1137
+    return cli_magic_scandesc(desc, virname, scanned, root, limits, options, &arec, &mrec);
1138 1138
 }
1139 1139
 
1140
-static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
1140
+static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1141 1141
 {
1142 1142
 	int fd, ret;
1143 1143
 
1144
-    /* internal version of cl_scanfile with reclev preserved */
1144
+    /* internal version of cl_scanfile with arec/mrec preserved */
1145 1145
     if((fd = open(filename, O_RDONLY)) == -1)
1146 1146
 	return CL_EOPEN;
1147 1147
 
1148
-    ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, reclev);
1148
+    ret = cli_magic_scandesc(fd, virname, scanned, root, limits, options, arec, mrec);
1149 1149
 
1150 1150
     close(fd);
1151 1151
     return ret;