From nobody@FreeBSD.org  Wed Aug  4 00:30:07 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id EE74416A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  4 Aug 2004 00:30:07 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C8E7343D5A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  4 Aug 2004 00:30:07 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i740U6bF098235
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 4 Aug 2004 00:30:06 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i740U6Oo098234;
	Wed, 4 Aug 2004 00:30:06 GMT
	(envelope-from nobody)
Message-Id: <200408040030.i740U6Oo098234@www.freebsd.org>
Date: Wed, 4 Aug 2004 00:30:06 GMT
From: Claudiu Bosioc <claudiu@casi.ro>
To: freebsd-gnats-submit@FreeBSD.org
Subject: vpopmail default setup doesn't allow use of maildrop filters in virtual domains.
X-Send-Pr-Version: www-2.3

>Number:         69969
>Category:       ports
>Synopsis:       vpopmail default setup doesn't allow use of maildrop filters in virtual domains.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    roam
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 04 00:30:27 GMT 2004
>Closed-Date:    Fri Jul 01 16:57:41 GMT 2005
>Last-Modified:  Fri Jul 01 16:57:41 GMT 2005
>Originator:     Claudiu Bosioc
>Release:        4.10-STABLE
>Organization:
>Environment:
FreeBSD jerry.li-net.ro 4.10-STABLE FreeBSD 4.10-STABLE #1: Fri Jul 23 15:18:00 EEST 2004     root@jerry.li-net.ro:/usr/src/sys/compile/JERRY  i386

>Description:
I have FreeBSD box running qmail-1.03, vpopmail-5.4.3, qmailadmin-1.0.20, sqwebmail-4.0.6, maildrop-1.6.3

I want users from virtual domains to be able to use maildrop filtering (configured by each of them from sqwebmail and enabled/disabled by me from qmailadmin.

short version of problem:
maildrop fails delivering a message for a virtual domain user when using mail filters (with to or cc rules) because it wants to run qmail-inject using $SHELL: execle(shell, q, "-c", cmd, (const char *)0, env);
$SHELL seen by maildrop in this case is the shell of the vpopmail user

long version:
the file: /usr/local/share/sqwebmail/maildirfilterconfig contains:
MAILDIRFILTER=../.mailfilter
MAILDIR=./Maildir
this allows one to edit mail filtering rules, located in (e.g.) /usr/local/vpopmail/domains/domain.com/postmaster/.mailfilter

but, vdelivermail from /usr/local/vpopmail/domains/domain.com/.qmail-default ignores the .mailfilter
this is why I activated SPAM_DETECTION in qmailadmin, with the SPAM_COMMAND="| preline /usr/local/bin/maildrop .mailfilter"

so far so good. I add a virtual account test@domain.com from qmailadmin, with spam detection enabled. I login from sqwebmail go to "Edit Mail Filters" and I click on save all changes. this creates the file .mailfilter

when I send a test message to the account I get the following error in qmail logs:
delivery xxx: failure: Unable_to_execute_/nonexistent/

>How-To-Repeat:

>Fix:
quick fix: pw user mod vpopmail -s /bin/sh

fix #1: empower vpopmail user /bin/sh instead of /nonexistent
root@jerry:/usr/ports/mail/vpopmail# diff pkg-install.orig pkg-install
64c64
<               $result = system ("/usr/sbin/pw useradd $user -g $users{$user} -d \"$ENV{PKG_PREFIX}\" -s /nonexistent $x");
---
>               $result = system ("/usr/sbin/pw useradd $user -g $users{$user} -d \"$ENV{PKG_PREFIX}\" -s /bin/sh $x");

fix #2: modify vdelivermail from vpopmail in order to set env variable SHELL to /bin/sh - in case the program (maildrop) needs to run another program (qmail-inject, in case of to or cc rules), using $SHELL env variable

I know fix #2 is not FreeBSD related; I will send this informations to vpopmail mailing-list also.
but, I guess this is what ports is all about: tweaking software in order to run on FreeBSD without problems.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->oliver 
Responsible-Changed-By: vs 
Responsible-Changed-When: Thu Aug 5 13:02:28 GMT 2004 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69969 
Responsible-Changed-From-To: oliver->roam 
Responsible-Changed-By: oliver 
Responsible-Changed-When: Sun Aug 8 09:01:08 GMT 2004 
Responsible-Changed-Why:  
Assign to the maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69969 
State-Changed-From-To: open->closed 
State-Changed-By: roam 
State-Changed-When: Fri Jul 1 16:57:13 GMT 2005 
State-Changed-Why:  
The FreeBSD port of vpopmail now has vdelivermail set SHELL to /bin/sh. 
Thanks for the problem report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69969 
>Unformatted:
