<!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> </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. 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] </FONT></SPAN></DIV>
<DIV><SPAN class=989195813-07012011></SPAN> </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> </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> </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> </DIV>
<DIV><FONT color=#0000ff><SPAN class=989195813-07012011><FONT size=2
face=Arial>Rick</FONT> </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 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 238 2010-10-15 18:58 zall-wcprops<BR>-rw-r-----
1 postfix www-data 23100 2010-10-15 18:58
zbeyond3g.jpg<BR>-rw-r----- 1 postfix www-data 26180 2010-10-15
18:58 zchi_button-02.jpg<BR>-rw-r----- 1 postfix www-data 2472
2010-10-15 23:33 zchi_button-reset.jpg<BR>-rw-r----- 1 postfix
www-data 2478 2010-10-15 23:33
zchi_button-submit.jpg<BR>-rw-r----- 1 postfix www-data 6042
2010-10-18 15:34 zchi_edm.html<BR>-rw-r----- 1 postfix
www-data 4345 2010-10-18 15:35 zchi_web.html<BR>-rw-r----- 1
postfix www-data 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 2010-09-06
19:10:28.000000000 +0800<BR>+++
ms/Message.pm 2011-01-07 10:41:19.107764413
+0800<BR>@@ -3346,7 +3346,12 @@<BR> next if
$onlycheckencryption;<BR><BR> # Untaint member's
attributes.<BR>-
$member->unixFileAttributes(0600);<BR>+
#$member->unixFileAttributes(0600);<BR>+ my $workperms =
MailScanner::Config::Value('workperms') || '0600';<BR>+ #Make
it octal with a leading zero if necessary<BR>+ $workperms =
sprintf "0%lo", $workperms unless $workperms =~ /^0/;<BR>+
$workperms = oct($workperms); # and back to decimal for
chmod<BR>+
$member->unixFileAttributes($workperms);<BR><BR>
$name = $member->fileName();<BR> # Trim off any
leading directory
path<BR>====================================================================<BR><BR>
<DIV class=gmail_quote>2011/1/7 Rick Cooper <SPAN dir=ltr><<A
href="mailto:rcooper@dwford.com"
target=_blank>rcooper@dwford.com</A>></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>> I just checked:<BR>><BR>>
/opt/MailScanner-4.82.3-1/lib/MailScanner/MessageBatch.pm<BR>><BR>> I am
using 4.82.3-1 and this modification is there. It does not solve<BR>> the
problem. I haven't tried running clamd under root since it would<BR>>
violate our security principles.<BR>><BR>> Are you guys sure it is not a
problem with clamd itself? Clamav<BR>> 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> # Untaint
member's attributes.<BR>
$member->unixFileAttributes(0600);<BR><BR>Should be<BR><BR>
# Untaint member's attributes.<BR> my
$workperms = MailScanner::Config::Value('workperms') || '0600';<BR>
$member->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>><BR>> Regards,<BR>><BR>> Naz Snidanko<BR>> Desktop
& Network Support<BR>> Harper Power Products Inc.<BR>> (p) 416 201-
7506<BR>> <A href="mailto:nsnidanko@harperpowerproducts.com"
target=_blank>nsnidanko@harperpowerproducts.com</A><BR>><BR>>
-----Original Message-----<BR>> From: <A
href="mailto:mailscanner-bounces@lists.mailscanner.info"
target=_blank>mailscanner-bounces@lists.mailscanner.info</A><BR>>
[mailto:<A href="mailto:mailscanner-bounces@lists.mailscanner.info"
target=_blank>mailscanner-bounces@lists.mailscanner.info</A>] On Behalf
Of<BR>> Iulian L Dragomir<BR>> Sent: January 6, 2011 6:05 AM<BR>> To:
MailScanner discussion<BR>> Subject: Re: weird mailscanner clamd
error<BR>><BR>> On Thu, Jan 6, 2011 at 12:24 PM, Randal, Phil<BR>>
<<A href="mailto:prandal@herefordshire.gov.uk"
target=_blank>prandal@herefordshire.gov.uk</A>> wrote:<BR>>> The only
workaround I've found is to run clamd as
root.<BR>>><BR>>><BR>>><BR>>> I've seen the same issue
with MailScanner / sendmail on CentOS.<BR>><BR>> If it is the same
problem then try this:<BR>><BR>> <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>>
ml<BR>> --<BR>> 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>> --<BR>>
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><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>