From ef0c84283fa48e8081b2d0f5d4a8a04aa2414a22 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Fri, 7 Oct 2011 22:58:38 +0000 Subject: [PATCH] list-virtual.php: - delivery to mailbox with a recipient delimiter (mailbox+foo@domain) was marked as "forward only" This fixes https://sourceforge.net/tracker/?func=detail&aid=3420440&group_id=191583&atid=937964 reported by on #postfixadmin (backport of trunk r1198) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/branches/postfixadmin-2.3@1199 a1433add-5e2c-0410-b055-b7f2511e0802 --- CHANGELOG.TXT | 1 + list-virtual.php | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 7c87d98d..d1430b24 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -15,6 +15,7 @@ SVN changes since 2.3.4 release (postfixadmin-2.3 branch) - create-domain: fix SQL injection (only exploitable by superadmins) - add missing $LANG['pAdminDelete_admin_error'] + - don't mark mailbox targets with recipient delimiter as "forward only" Version 2.3.4 - 2011/09/16 - SVN r1180 (postfixadmin-2.3 branch) ---------------------------------------------------------------- diff --git a/list-virtual.php b/list-virtual.php index ff609a26..39f8b404 100644 --- a/list-virtual.php +++ b/list-virtual.php @@ -243,6 +243,9 @@ $result = db_query ($query); if ($result['rows'] > 0) { + $delimiter = preg_quote($CONF['recipient_delimiter'], "/"); + $goto_single_rec_del = ""; + while ($row = db_array ($result['result'])) { if ($display_mailbox_aliases) { @@ -251,7 +254,11 @@ if ($result['rows'] > 0) $row['goto_other'] = array(); foreach ($goto_split as $goto_single) { - if ($goto_single == $row['username']) { # delivers to mailbox + if (!empty($CONF['recipient_delimiter'])) { + $goto_single_rec_del = preg_replace('/' .$delimiter. '[^' .$delimiter. '@]*@/', "@", $goto_single); + } + + if ($goto_single == $row['username'] || $goto_single_rec_del == $row['username']) { # delivers to mailbox $row['goto_mailbox'] = 1; } elseif (boolconf('vacation') && strstr($goto_single, '@' . $CONF['vacation_domain']) ) { # vacation alias - TODO: check for full vacation alias # skip the vacation alias, vacation status is detected otherwise