Page MenuHomePhabricator

Fixed Upload Form for Usin an Antivirus Program on Windows
Closed, ResolvedPublic

Description

Author: philipwgustafson

Description:
Fixed uploadbase.php

As you may or may not know, using an antivirus program on windows currently does not work because of the way the php code is implemented, it uses a method of capturing the $errorcode$ in a method incompatible with windows. Although there was a note that someone had found a 50 line work around to make it work. I contacted him, copied in his code, and now clamscan is tested and working on windows server 2008 r2. Is it possible to replace the old uploadbase.php in the svn with this one so that all future users will have this option.


Version: 1.16.x
Severity: enhancement
Platform: PC
URL: http://festiva.bntbtc.com

attachment UploadBase.php ignored as obsolete

Details

Reference
bz21140

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:56 PM
bzimport set Reference to bz21140.

Michael, want to take a peek at this since you've been poking up the upload code?

philipwgustafson wrote:

basically it added the function suggested by the user who is already commented in some stuff there, I contacted him and he sent me his function from the php manual site: http://www.php.net/manual/de/function.shell-exec.php#52826, so I added that all inside the antivirus function

mike.lifeguard+bugs wrote:

(In reply to comment #0)

Created an attachment (id=6668) [details]
Fixed uploadbase.php

Could you provide that as a patch against trunk so they can review it?

philipwgustafson wrote:

If I knew how, a quick explanation on how and I could probably do it

mdale wrote:

(In reply to comment #4)

If I knew how, a quick explanation on how and I could probably do it

You can Make a diff by checking out the trunk from the svn and then running svn diff and putting the output of that into a file you post here.

Improved patch

Philip's version had several issues: it called the AV twice, discarded the output and defined the helper runExternal function inside detectVirus().
Here's a patch against trunk of the solution, fixing the above issues.

Attached:

mdale wrote:

I don't actually have a windows server setup to test but "looks good" added in r57728

mdale wrote:

followup in r57729 we want to try and use the wfShellExec function. Let us know if that works on windows.

philipwgustafson wrote:

after some messing around with svn, patching it twice, and realizing it would add the same code twice if I did that, lol, I finally patched your patch, and it works! yay I say submit it to the svn trunk!