Qmail-scanner-general/Cooker readers,

It seems that qmail-scanner is not a perl 5.6 fan ! As far as I can see
the tainted mode is more restrictive and it is causing problems :

Hit RETURN to create initial directory structure under
/var/spool/qmailscan, and install qmail-scanner-queue.pl under /usr/bin:
X-Qmail-Scanner-0.96: cannot open for write
/var/spool/qmailscan/quarantine-attachments.db.tmp - Permission denied
Insecure $ENV{ENV} while running setuid at
/usr/bin/qmail-scanner-queue.pl line 680.

Even revoving the -T is not helping ! I still get the second problem !

Hit RETURN to create initial directory structure under
/var/spool/qmailscan, and install qmail-scanner-queue.pl under /usr/bin:
X-Qmail-Scanner-0.96: cannot open for write
/var/spool/qmailscan/quarantine-attachments.db.tmp - Permission denied
/bin/rm: cannot remove directory `/var/spool/qmailscan': Permission
denied

Ok let see what strace say:

[...]
unlink("/var/tmp/qmail-scanner-root/var/spool/qmailscan/quarantine-attachments.db.tmp")
= -1 ENOENT (No such file or directory)
open("/var/tmp/qmail-scanner-root/var/spool/qmailscan/quarantine-attachments.db.tmp",
O_RDWR|O_CREAT|O_EXCL, 0640) = 3
shmat(3, 0x3, 0x2ptrace: umoven: Input/output error ) = ?
fstat64(3, {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
read(3, "", 512) = 0
close(3) = 0
stat64("/root/tmp", 0xbfffed00) = -1 EACCES (Permission denied)
[...]

It seems that the file can be created (open with file descriptor 3) !
Can it be the shared memory problem or file creation !!.

The 0.95 version which was used to work perfectly under Mandrake 7.2
have the same problem, so I suspect perl 5.6 !!

My guess is that perl try to use file if shm fails but then why the hell
the direcotry is /root/tmp !! /var/tmp would make more sense to me !!

Any idea ?

To increase your testing speed here is my SRPM ;*) 
(I have a patch to add support for a client of AVPDAEMON so useless for
most, the second one is to remove the -T of suidperl.)

Name:           qmail-scanner
Summary:        An antivirus wrapper to be used with qmail
Version:        0.96
Release:        1
Serial:         1
Group:          Applications/Mail
Copyright:      GPL
Packager:       Thomas Mangin <[EMAIL PROTECTED]>
URL:            http://qmail-scanner.sourceforge.net/
Source0:        qmail-scanner-%{version}.tgz
Patch0:         qmail-scanner-avp-%{version}.patch
Patch1:         qmail-scanner-perl-%{version}.patch
BuildRoot:      %{_tmppath}/%{name}-root
Requires:       perl-Time-HiRes
Requires:       perl-DB_File
Requires:       qmail
Requires:       maildrop
Requires:       maildrop >= 1.3.0
Requires:       tnef >= 0.16
Requires:       perl > 5.5
Prereq:         /sbin/service
Provides:       virus-scanning-wrapper
#Conflicts: virus-scanning-wrapper

%description
Qmail-Scanner, (also known as scan4virus) is an addon that enables a
Qmail
Email server to scan all gatewayed Email for certain characteristics.
It is typically used for its anti-virus protection functions, in which
case
it is used in conjunction with commercial virus scanners.
but also enables a site to react to Email (at a server/site level)
that contains specific strings in particular headers.
It also can be used as an archiving tool for auditing or backup
purposes.

%prep
%setup -q
%patch0 -p1 
%patch1 -p1 
 
%build

rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}/var/spool/qmailscan/archives

# The configure is not very RPM friendly ..

( echo YY ; echo ) | ./configure \
        --qmaildir /var/qmail \
        --spooldir %{buildroot}/var/spool/qmailscan \
        --bindir %{buildroot}%{_bindir} \
        --admin systems-virus \
        --domain legend.net.uk \
        --notify all \
        --lang en_GB \
        --archive archives \
        --redundant yes \
        --log-details yes \
        --add-dscr-hdrs yes \
        --debug yes \
        --install

%install

# Correct the path in the perl scanner
# The best would be to have an optional field for install prefix

sed_root="`echo %{buildroot} | sed -e 's/\//\\\\\//g'`"

cp %{buildroot}%{_bindir}/qmail-scanner-queue.pl
%{buildroot}%{_bindir}/scanner.tmp
cat %{buildroot}%{_bindir}/scanner.tmp | \
        sed -e "s/$sed_root//g" | \
        cat > %{buildroot}%{_bindir}/qmail-scanner-queue.pl
rm -f %{buildroot}%{_bindir}/scanner.tmp

%preun

test "`/etc/init.d/qmail stop 2> /dev/null`" != "impossible"

%postun

export QBIN=%{_bindir}
export SMTPD=/var/qmail/supervise/qmail-smtpd
export QMQPD=/var/qmail/supervise/qmail-qmqpd

if [ -e $SMTPD/run -o -e $QMQPD/run ]; then
        if [ -e $QMQPD/run ]; then
                mv $QMQPD/run   $QMQPD/run.rpmsave
                cat $QMQPD/run.rpmsave | \
                        grep -v "QMAILQUEUE" | \
                        cat > $QMQPD/run
                        chgrp qmail $QMQPD/run
                        chmod 755 $QMQPD/run
        fi

        if [ -e $SMTPD/run ]; then
                mv $SMTPD/run $SMTPD/run.rpmsave
                cat $SMTPD/run.rpmsave | \
                        grep -v "QMAILQUEUE" | \
                        cat > $SMTPD/run
                chgrp qmail $SMTPD/run
                chmod 755 $SMTPD/run
        fi

else
        if [ $QBIN/qmail-real-queue ]; then
                rm -f $QBIN/qmail-queue
                mv $QBIN/qmail-real-queue $QBIN/qmail-queue
        else
                echo "No previous install found"
        fi
fi

rm -f /var/log/scan

test "`/etc/init.d/qmail start 2> /dev/null`" != "impossible"

%pre

test "`/etc/init.d/qmail stop 2> /dev/null`" != "impossible"

%post

export QBIN=%{_bindir}
export SMTPD=/var/qmail/supervise/qmail-smtpd
export QMQPD=/var/qmail/supervise/qmail-qmqpd

if [ ! -e $SMTPD/run ] ; then
        echo "Qmail patched renaming the binaries"

        declare -i IS_BIN
        IS_BIN=0
        IS_BIN=`file $QBIN/qmail-queue | grep ELF | wc -l`

        if [ ! -e $QBIN/qmail-real-queue -o $IS_BIN -eq 1 ]; then 
                mv $QBIN/qmail-queue $QBIN/qmail-real-queue

                cat $QBIN/qmail-scanner-queue.pl | \
                        sed -e "s/qmail-queue/qmail-real-queue/g" | \
                        cat > $QBIN/qmail-queue
        fi

        chown qmailq:qmail $QBIN/qmail-scanner-queue.pl
        chmod 4755 $QBIN/qmail-scanner.pl
        ln -s $QBIN/qmail-scanner.pl $QBIN/qmail-queue
else
        echo "Qmail patched using QMAILQUEUE environment modification"
        mv  $SMTPD/run $SMTPD/run.rpmsave
        ( \
                echo "##/bin/sh" | sed -e "s/##/#\!/g" ; 
                echo 'QMAILQUEUE="%{_bindir}/qmail-scanner-queue.pl"' ; 
                echo "export QMAILQUEUE" ; 
                cat $SMTPD/run.rpmsave | \
                        grep -v "#\!" | \
                        grep -v "QMAILQUEUE" 
        ) > $SMTPD/run
        chgrp qmail $SMTPD/run
        chmod 755 $SMTPD/run

        mv  $QMQPD/run $QMQPD/run.rpmsave
        ( \
                echo "##/bin/sh" | sed -e "s/##/#\!/g" ; 
                echo 'QMAILQUEUE="%{_bindir}/qmail-scanner-queue.pl"' ; 
                echo "export QMAILQUEUE" ; 
                cat $QMQPD/run.rpmsave | \
                        grep -v "#\!" | \
                        grep -v "QMAILQUEUE" 
        ) > $QMQPD/run
        chgrp qmail $QMQPD/run
        chmod 755 $QMQPD/run            


fi

ln -s /var/spool/qmailscan /var/log/scan

test "`/etc/init.d/qmail start 2> /dev/null`" != "impossible"

echo "Do not re-install Qmail, without reinstalling Qmail-Scanner"

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root)
%doc COPYING README README.html
%doc FAQ.php index.php manual-install.php perlscanner.php TODO.php
/usr/bin/*
/var/spool/*

%changelog
* Thu May 24 2001 Thomas Mangin <[EMAIL PROTECTED]>
- Modified for the new qmail RPMS based on Mandrake

* Fri Mar 16 2001 Thomas Mangin <[EMAIL PROTECTED]>
- Added a test for Corrupted attachment

* Mon Mar 05 2001 Thomas Mangin <[EMAIL PROTECTED]>
- Changed $description of the avp_daemon sub to not include all the junk
for AvpLinux
- As well, removed the report description text in the code

* Tue Feb 27 2001 Thomas Mangin <[EMAIL PROTECTED]>
- Initial spec file.

Reply via email to