<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16700"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial></FONT>&nbsp;</DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> mailscanner-bounces@lists.mailscanner.info 
[mailto:mailscanner-bounces@lists.mailscanner.info] <B>On Behalf Of </B>Curu 
Wong<BR><B>Sent:</B> Thursday, January 06, 2011 10:15 PM<BR><B>To:</B> 
MailScanner discussion<BR><B>Subject:</B> Re: weird mailscanner clamd 
error<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Thank you Rick, the code you provided works.&nbsp; but I think the argument 
of unixFileAttributes() should be octal number, instead of string. so I modified 
the code a little.<BR>This finally works for my MailScanner version 
4.81.4-1.<BR><SPAN class=989195813-07012011><FONT color=#0000ff size=2 
face=Arial>[Rick Cooper]&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=989195813-07012011></SPAN>&nbsp;</DIV>
<DIV><SPAN class=989195813-07012011><FONT color=#0000ff size=2 face=Arial>I just 
looked at the Archive::Zip documentation and it appears it that should have 
worked as is. The documentation states:</FONT></SPAN></DIV>
<DIV><SPAN class=989195813-07012011><FONT size=2 face=Arial><FONT 
color=#0000ff>&nbsp;&nbsp; </FONT><A 
name=unixFileAttributes(_[$newAttributes]_)><FONT color=#0000ff size=3 
face="Times New Roman">unixFileAttributes( [$newAttributes] 
)</FONT></A></FONT></SPAN></DIV>
<DIV><FONT color=#0000ff><SPAN 
class=989195813-07012011>&nbsp;</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff><SPAN class=989195813-07012011><FONT size=2 
face=Arial>In any event that might explain the issues on other systems and 
hopefully Julian will make the changes for the next release. The person to thank 
is you, you are the one who caught the unexplained permission change on the 
extracted files, I just looked at the code that performs the action and 
unixFileAttributes(600) kind of stuck out like a sore 
thumb</FONT></SPAN></FONT></DIV>
<DIV><FONT color=#0000ff><SPAN 
class=989195813-07012011></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff><SPAN class=989195813-07012011><FONT size=2 
face=Arial>Rick</FONT>&nbsp;</SPAN><BR><BR></FONT>after apply this patch, the 
permission is OK:<BR></DIV>
<DIV><BR>Send an email with zip 
attachment<BR></DIV>==============================
<DIV>===============================<BR>/var/spool/MailScanner/incoming/18174/8E435803B9.AB3BB:<BR>total 
3376<BR>-rw-r----- 1 postfix www-data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 
2011-01-07 10:49 nmsg-18174-1.txt<BR>-rw-r----- 1 postfix www-data 1665916 
2011-01-07 10:49 ntest.zip<BR>-rw-r----- 1 postfix 
www-data&nbsp;&nbsp;&nbsp;&nbsp; 238 2010-10-15 18:58 zall-wcprops<BR>-rw-r----- 
1 postfix www-data&nbsp;&nbsp; 23100 2010-10-15 18:58 
zbeyond3g.jpg<BR>-rw-r----- 1 postfix www-data&nbsp;&nbsp; 26180 2010-10-15 
18:58 zchi_button-02.jpg<BR>-rw-r----- 1 postfix www-data&nbsp;&nbsp;&nbsp; 2472 
2010-10-15 23:33 zchi_button-reset.jpg<BR>-rw-r----- 1 postfix 
www-data&nbsp;&nbsp;&nbsp; 2478 2010-10-15 23:33 
zchi_button-submit.jpg<BR>-rw-r----- 1 postfix www-data&nbsp;&nbsp;&nbsp; 6042 
2010-10-18 15:34 zchi_edm.html<BR>-rw-r----- 1 postfix 
www-data&nbsp;&nbsp;&nbsp; 4345 2010-10-18 15:35 zchi_web.html<BR>-rw-r----- 1 
postfix www-data&nbsp;&nbsp;&nbsp;&nbsp; 890 2010-10-15 18:58 
zcw.jpeg<BR>==============================================================<BR>and 
there's no error message in maillog any 
more.</DIV><BR>mailscanner_zip_permission.patch<BR>===================================================================<BR>--- 
MailScanner/Message.pm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2010-09-06 
19:10:28.000000000 +0800<BR>+++ 
ms/Message.pm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2011-01-07 10:41:19.107764413 
+0800<BR>@@ -3346,7 +3346,12 @@<BR>&nbsp;&nbsp;&nbsp;&nbsp; next if 
$onlycheckencryption;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp; # Untaint member's 
attributes.<BR>-&nbsp;&nbsp;&nbsp; 
$member-&gt;unixFileAttributes(0600);<BR>+&nbsp;&nbsp;&nbsp; 
#$member-&gt;unixFileAttributes(0600);<BR>+&nbsp;&nbsp;&nbsp; my $workperms = 
MailScanner::Config::Value('workperms') || '0600';<BR>+&nbsp;&nbsp;&nbsp; #Make 
it octal with a leading zero if necessary<BR>+&nbsp;&nbsp;&nbsp; $workperms = 
sprintf "0%lo", $workperms unless $workperms =~ /^0/;<BR>+&nbsp;&nbsp;&nbsp; 
$workperms = oct($workperms); # and back to decimal for 
chmod<BR>+&nbsp;&nbsp;&nbsp; 
$member-&gt;unixFileAttributes($workperms);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp; 
$name = $member-&gt;fileName();<BR>&nbsp;&nbsp;&nbsp;&nbsp; # Trim off any 
leading directory 
path<BR>====================================================================<BR><BR>
<DIV class=gmail_quote>2011/1/7 Rick Cooper <SPAN dir=ltr>&lt;<A 
href="mailto:rcooper@dwford.com" 
target=_blank>rcooper@dwford.com</A>&gt;</SPAN><BR>
<BLOCKQUOTE 
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV>Naz Snidanko wrote:<BR>&gt; I just checked:<BR>&gt;<BR>&gt; 
  /opt/MailScanner-4.82.3-1/lib/MailScanner/MessageBatch.pm<BR>&gt;<BR>&gt; I am 
  using 4.82.3-1 and this modification is there. It does not solve<BR>&gt; the 
  problem. I haven't tried running clamd under root since it would<BR>&gt; 
  violate our security principles.<BR>&gt;<BR>&gt; Are you guys sure it is not a 
  problem with clamd itself? Clamav<BR>&gt; doesn't get this 
  error.<BR><BR></DIV>Actually the more I looked at this, I believe the code in 
  Message.pm<BR>beginning at line 3348 that reads<BR><BR>&nbsp; &nbsp;# Untaint 
  member's attributes.<BR>&nbsp; 
  &nbsp;$member-&gt;unixFileAttributes(0600);<BR><BR>Should be<BR><BR>&nbsp; 
  &nbsp;# Untaint member's attributes.<BR>&nbsp; &nbsp; &nbsp; &nbsp;my 
  $workperms = MailScanner::Config::Value('workperms') || '0600';<BR>&nbsp; 
  &nbsp;$member-&gt;unixFileAttributes($workperms);<BR>For some reason it 
  appears Julian forced the extracted files to 0600 in the<BR>original code. The 
  change I have listed above would set them to what ever<BR>the mailscanner 
  config has for the work permissions or 600 if no 
  value<BR>exists.<BR><BR>Julian any comment?<BR><FONT 
  color=#888888><BR><BR>Rick<BR></FONT>
  <DIV>
  <DIV></DIV>
  <DIV><BR>&gt;<BR>&gt; Regards,<BR>&gt;<BR>&gt; Naz Snidanko<BR>&gt; Desktop 
  &amp; Network Support<BR>&gt; Harper Power Products Inc.<BR>&gt; (p) 416 201- 
  7506<BR>&gt; &nbsp;<A href="mailto:nsnidanko@harperpowerproducts.com" 
  target=_blank>nsnidanko@harperpowerproducts.com</A><BR>&gt;<BR>&gt; 
  -----Original Message-----<BR>&gt; From: <A 
  href="mailto:mailscanner-bounces@lists.mailscanner.info" 
  target=_blank>mailscanner-bounces@lists.mailscanner.info</A><BR>&gt; 
  [mailto:<A href="mailto:mailscanner-bounces@lists.mailscanner.info" 
  target=_blank>mailscanner-bounces@lists.mailscanner.info</A>] On Behalf 
  Of<BR>&gt; Iulian L Dragomir<BR>&gt; Sent: January 6, 2011 6:05 AM<BR>&gt; To: 
  MailScanner discussion<BR>&gt; Subject: Re: weird mailscanner clamd 
  error<BR>&gt;<BR>&gt; On Thu, Jan 6, 2011 at 12:24 PM, Randal, Phil<BR>&gt; 
  &lt;<A href="mailto:prandal@herefordshire.gov.uk" 
  target=_blank>prandal@herefordshire.gov.uk</A>&gt; wrote:<BR>&gt;&gt; The only 
  workaround I've found is to run clamd as 
  root.<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; I've seen the same issue 
  with MailScanner / sendmail on CentOS.<BR>&gt;<BR>&gt; If it is the same 
  problem then try this:<BR>&gt;<BR>&gt; <A 
  href="http://lists.mailscanner.info/pipermail/mailscanner/2010-April/095611.ht" 
  target=_blank>http://lists.mailscanner.info/pipermail/mailscanner/2010-April/095611.ht</A><BR>&gt; 
  ml<BR>&gt; --<BR>&gt; MailScanner mailing list<BR>&gt; <A 
  href="mailto:mailscanner@lists.mailscanner.info" 
  target=_blank>mailscanner@lists.mailscanner.info</A><BR>&gt; <A 
  href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" 
  target=_blank>http://lists.mailscanner.info/mailman/listinfo/mailscanner</A><BR>&gt;<BR>&gt; 
  Before posting, read <A href="http://wiki.mailscanner.info/posting" 
  target=_blank>http://wiki.mailscanner.info/posting</A><BR>&gt;<BR>&gt; Support 
  MailScanner development - buy the book off the website!<BR>&gt; --<BR>&gt; 
  MailScanner mailing list<BR>&gt; <A 
  href="mailto:mailscanner@lists.mailscanner.info" 
  target=_blank>mailscanner@lists.mailscanner.info</A><BR>&gt; <A 
  href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" 
  target=_blank>http://lists.mailscanner.info/mailman/listinfo/mailscanner</A><BR>&gt;<BR>&gt; 
  Before posting, read <A href="http://wiki.mailscanner.info/posting" 
  target=_blank>http://wiki.mailscanner.info/posting</A><BR>&gt;<BR>&gt; Support 
  MailScanner development - buy the book off the 
  website!<BR><BR><BR><BR></DIV></DIV>
  <DIV>--<BR>This message has been scanned for viruses and<BR>dangerous content 
  by MailScanner, and is<BR>believed to be clean.<BR><BR><BR>--<BR></DIV>
  <DIV>
  <DIV></DIV>
  <DIV>MailScanner mailing list<BR><A 
  href="mailto:mailscanner@lists.mailscanner.info" 
  target=_blank>mailscanner@lists.mailscanner.info</A><BR><A 
  href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" 
  target=_blank>http://lists.mailscanner.info/mailman/listinfo/mailscanner</A><BR><BR>Before 
  posting, read <A href="http://wiki.mailscanner.info/posting" 
  target=_blank>http://wiki.mailscanner.info/posting</A><BR><BR>Support 
  MailScanner development - buy the book off the 
website!<BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR>-- <BR>This message has been 
scanned for viruses and <BR>dangerous content by <A 
href="http://www.mailscanner.info/"><B>MailScanner</B></A>, and is <BR>believed 
to be clean. </BODY><br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.

</HTML>