]> git.mjollnir.org Git - moodle.git/commitdiff
Better attempts for handlevirus to find files to deal with them, added an instruction.
authormjollnir_ <mjollnir_>
Mon, 20 Sep 2004 01:36:16 +0000 (01:36 +0000)
committermjollnir_ <mjollnir_>
Mon, 20 Sep 2004 01:36:16 +0000 (01:36 +0000)
These patches are maintained in an publicly accessible Arch repository, see: http://lists.eduforge.org/cgi-bin/archzoom.cgi/arch-eduforge@catalyst.net.nz--2004-MIRROR/moodle--eduforge--1.3.3

Index of arch patches in this commit:

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-82
    2004-09-20 00:52:11 GMT
    Penny Leach <penny@catalyst.net.nz>
    better attempt to find files in handlevirus.php based on output from clam
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-83
    2004-09-20 01:16:22 GMT
    Penny Leach <penny@catalyst.net.nz>
    better instructions for handlevirus.php running

Full logs:

Revision: moodle--eduforge--1.3.3--patch-82
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 20 12:52:11 NZST 2004
Standard-date: 2004-09-20 00:52:11 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-82
Summary: better attempt to find files in handlevirus.php based on output from clam
Keywords:

Revision: moodle--eduforge--1.3.3--patch-83
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 20 13:16:22 NZST 2004
Standard-date: 2004-09-20 01:16:22 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-83
Summary: better instructions for handlevirus.php running
Keywords:

admin/handlevirus.php

index 159dbee5203efa5df61785fdf50602b6cd540e64..d8aadfe33ea20bb4afac5773194b515ad146c766 100644 (file)
@@ -3,6 +3,7 @@
  * clamscan -r --infected --no-summary <files> 2>&1 | php -d error_log=/path/to/log thisfile.php 
  * also it's important that the output of clamscan prints the FULL PATH to each infected file, so use absolute paths for area to scan
  * also it should be run as root, or whatever the webserver runs as so that it has the right permissions in the quarantine dir etc.
+ * php -d error_log=/path/to/log thisfile.php will override the default error log for php cli, which is stderr, so if you want this script to just print stuff out, use php thisfile.php instead.
  */
 
 
@@ -85,6 +86,7 @@ function notify_admins_unknown($file,$a) {
 }
 
 function validate_line($line) {
+    global $CFG;
     if (strpos($line,"FOUND") === false) {
         return false;
     }
@@ -92,7 +94,16 @@ function validate_line($line) {
     $file = substr($line,0,$index);
     $file = preg_replace('/\/\//','/',$file);
     if (!file_exists($file)) {
-        return false;
+        // try and prepend dataroot, that might fix it (maybe) 
+        if ($file{0} == "/") {
+            $file = $CFG->dataroot.$file;
+        }
+        else {
+            $file = $CFG->dataroot."/".$file;
+        }
+        if (!file_exists($file)) {
+            return false;
+        }
     }
     return $file;
 }