tojja@Safe-mail.net wrote:
Passing --fdpass or --stream to clamdscan works for calling up a scan on the command prompt however calling it through mediawiki (via the chrooted web user www) still fails with an error 127. If I make a file called test.php containing:
<?php define("MEDIAWIKI", "mediawiki"); require_once("/htdocs/w/includes/GlobalFunctions.php" ); $output = wfShellExec( "command=/usr/local/bin/clamdscan --fdpass --no-summary '/htdocs/file.txt' 2>&1, $exitCode ); echo "exitcode is $exitCode"; ?>
Executing "chroot -u www /var/www /usr/local/bin/clamdscan --fdpass --no-summary '/htdocs/file.txt' 2>&1" will work just fine but running the script will always fail with error 127. Even substituting in the $output line something like wfShellExec( "/bin/echo 'hello world' > world.txt" ); will always fail with error 127 as well, despite echo being at /var/www/bin/echo and permissions readable and executable by the proper www user. Appears that there may be something up with how mediawiki is executing shell commands, maybe I'm going about testing this the wrong way.
Thanks for the insight.
Exit code 127 is usually the shell not finding out the executable. Try removing command= from the beginning (you also miss the closing of the double quotes, by that seems an overlook on copying).