clam wrapper

Jerry Benton jerry.benton at mailborder.com
Fri Jan 29 21:26:18 UTC 2016


This is how the is setup:

TempDir=$(mktemp)

That makes a tmp file ….

Then …

# Check if the tmpdir exists, if so delete so we start with a clean slate
if [ -x "${TempDir}" ]; then
	rm -rf ${TempDir} >/dev/null 2>&1
fi


… What the fuck?


# Make the Temp dir
umask 0077
mkdir "${TempDir}" >/dev/null 2>&1


 … uhhhh … now we are doing it twice


then …


if [ $? ]; then 
  ExtraScanOptions="$ExtraScanOptions --tempdir=${TempDir}"
  # If we are root chown it to the clamav user/group
  if [ `whoami` = "root" ]; then
    chown ${ClamUser}:${ClamGroup} "${TempDir}"
  fi
 fi


… why? the process that creates the /tmp/blah already owns /tmp/blah


In short … the logic is wrong.

Going to fix it. I suspect more items will need fixing. 

-
Jerry Benton
www.mailborder.com



> On Jan 29, 2016, at 4:18 PM, Shawn Iverson <iversons at rushville.k12.in.us> wrote:
> 
> So the script only needs the path in the variable, right?  If so, that should be fine.
> 
> On Fri, Jan 29, 2016 at 4:11 PM, Jerry Benton <jerry.benton at mailborder.com <mailto:jerry.benton at mailborder.com>> wrote:
> So i noticed errors creating /tmp/blah
> 
> wrapper code:
> 
> TempDir=$(mktemp)
> 
> should be:
> 
> TempDir=$(mktemp -u)
> 
> based on how the wrapper is structured. Errors then go away.
> 
> 
> Comments?
> 
> -
> Jerry Benton
> www.mailborder.com <http://www.mailborder.com/>
> 
> 
> 
> 
> 
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info <mailto:mailscanner at lists.mailscanner.info>
> http://lists.mailscanner.info/listinfo/mailscanner <http://lists.mailscanner.info/listinfo/mailscanner>
> 
> 
> 
> 
> -- 
> Shawn Iverson
> Director of Technology
> Rush County Schools
> 765-932-3901 x271
> iversons at rushville.k12.in.us <mailto:iversons at rushville.k12.in.us>
> 
> 
> 
> 
> -- 
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/listinfo/mailscanner
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mailscanner.info/pipermail/mailscanner/attachments/20160129/a8d34706/attachment.html>


More information about the MailScanner mailing list