#! /usr/local/bin/php * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *** * * $Id: badrcptto.php,v 1.1 2004/07/06 17:19:24 pavcio Exp $ * */ /*** configuration ***/ /* full path to badrcptto file */ $badrcptto_file = '/var/qmail/control/badrcptto'; /*********************/ error_reporting(0); if ($_ENV['NOBADRCPTTO'] !== NULL) exit(); /* plugin disabled */ /* read badrcptto file */ if (!file_exists($badrcptto_file)) exit("E451 badrcptto file does not exist (#4.3.0)\n"); if (($badrcptto = file($badrcptto_file)) === FALSE) exit("E451 badrcptto file read error (#4.3.0)\n"); if (!count($badrcptto)) exit(); /* file empty */ /* search */ foreach ($badrcptto as $line) { $line = trim($line); switch ($line[0]) { case '#': continue; /* skip comments */ case '@': $line = '*' . $line; /* just to be qmail-badmailfrom-compatible */ } if (fnmatch($line, $_ENV['SMTPRCPTTO'])) { fwrite(STDERR, "invalid RCPT TO address: $_ENV[SMTPRCPTTO]\n"); exit("E553 sorry, your envelope recipient is in my badrcptto list (#5.7.1)\n"); } } ?>