Browse code

libclamav: SCAN_ALL support for HFS+/HFSX

David Raynor authored on 2013/09/24 03:39:30
Showing 1 changed files
... ...
@@ -547,6 +547,7 @@ static int hfsplus_walk_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hf
547 547
     hfsHeaderRecord *extHeader, const char *dirname)
548 548
 {
549 549
     int ret = CL_CLEAN;
550
+    unsigned int has_alerts = 0;
550 551
     uint32_t thisNode, nodeLimit, nodesScanned = 0;
551 552
     uint16_t nodeSize, recordNum, topOfOffsets;
552 553
     uint16_t distance, recordStart, nextDist, nextStart;
... ...
@@ -659,6 +660,13 @@ static int hfsplus_walk_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hf
659 659
                 }
660 660
                 if (ret != CL_CLEAN) {
661 661
                     cli_dbgmsg("hfsplus_walk_catalog: data fork retcode %d", ret);
662
+                    if (ret == CL_VIRUS) {
663
+                        has_alerts = 1;
664
+                        if (SCAN_ALL) {
665
+                            /* Continue scanning in SCAN_ALL mode */
666
+                            ret = CL_CLEAN;
667
+                        }
668
+                    }
662 669
                     break;
663 670
                 }
664 671
                 forkdata_to_host(&(fileRec.resourceFork));
... ...
@@ -668,6 +676,13 @@ static int hfsplus_walk_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hf
668 668
                 }
669 669
                 if (ret != CL_CLEAN) {
670 670
                     cli_dbgmsg("hfsplus_walk_catalog: resource fork retcode %d", ret);
671
+                    if (ret == CL_VIRUS) {
672
+                        has_alerts = 1;
673
+                        if (SCAN_ALL) {
674
+                            /* Continue scanning in SCAN_ALL mode */
675
+                            ret = CL_CLEAN;
676
+                        }
677
+                    }
671 678
                     break;
672 679
                 }
673 680
             }
... ...
@@ -690,6 +705,9 @@ static int hfsplus_walk_catalog(cli_ctx *ctx, hfsPlusVolumeHeader *volHeader, hf
690 690
     }
691 691
 
692 692
     free(nodeBuf);
693
+    if (has_alerts) {
694
+        ret = CL_VIRUS;
695
+    }
693 696
     return ret;
694 697
 }
695 698