[pLog-svn] r3537 - plog/trunk/class/data/validator/rules
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Jun 5 23:41:45 GMT 2006
Author: jondaley
Date: 2006-06-05 23:41:45 +0000 (Mon, 05 Jun 2006)
New Revision: 3537
Modified:
plog/trunk/class/data/validator/rules/emaildnsrule.class.php
Log:
needs more testing, but we need some changes like this to make LT better at detecting temporary email failures, and also bypassing some spam checks
Modified: plog/trunk/class/data/validator/rules/emaildnsrule.class.php
===================================================================
--- plog/trunk/class/data/validator/rules/emaildnsrule.class.php 2006-06-05 23:38:33 UTC (rev 3536)
+++ plog/trunk/class/data/validator/rules/emaildnsrule.class.php 2006-06-05 23:41:45 UTC (rev 3537)
@@ -3,8 +3,10 @@
include_once(PLOG_CLASS_PATH."class/data/validator/rules/rule.class.php");
include_once(PLOG_CLASS_PATH."class/net/dns.class.php");
include_once(PLOG_CLASS_PATH."class/net/http/httpvars.class.php");
+ include_once(PLOG_CLASS_PATH."class/config/config.class.php");
define( "ERROR_RULE_EMAIL_DNS_SERVER_UNREACHABLE", "error_rule_email_dns_server_unreachable");
+ define( "ERROR_RULE_EMAIL_DNS_SERVER_TEMP_FAIL", "error_rule_email_dns_server_temp_fail");
define( "ERROR_RULE_EMAIL_DNS_NOT_PERMITTED", "error_rule_email_dns_not_permitted");
/**
@@ -56,15 +58,20 @@
if ($connect = fsockopen($connectAddress, 25))
{
- $out = fgets($connect, 1024);
+ $greetin = fgets($connect, 1024);
- if (ereg("^220", $out))
+ if (ereg("^220", $greeting))
{
$server = &HttpVars::getServer();
fputs($connect, "HELO " . $server["HTTP_HOST"] . "\r\n");
- $out = fgets($connect, 1024);
+ $helo = fgets($connect, 1024);
- fputs($connect, "MAIL FROM: <" . $value . ">\r\n");
+ $config =& Config::getConfig();
+ $lt_from = $config->getValue("post_notification_source_address");
+ if($lt_from == "")
+ $lt_from = $value;
+
+ fputs($connect, "MAIL FROM: <" . $lt_from . ">\r\n");
$from = fgets($connect, 1024);
fputs($connect, "RCPT TO: <" . $value .">\r\n");
@@ -75,10 +82,20 @@
if (!ereg("^250", $from) || !ereg ("^250", $to))
{
- $this->_setError(ERROR_RULE_EMAIL_DNS_NOT_PERMITTED);
- return false;
+ if(ereg("^4[0-9][0-9]", $helo) || ereg("^4[0-9][0-9]", $from) || ereg ("^4[0-9][0-9]", $to)){
+ $this->_setError(ERROR_RULE_EMAIL_DNS_SERVER_TEMP_FAIL);
+ return false;
+ }
+ else{
+ $this->_setError(ERROR_RULE_EMAIL_DNS_NOT_PERMITTED);
+ return false;
+ }
}
}
+ else if(ereg("^4[0-9][0-9]", $greeting)){
+ $this->_setError(ERROR_RULE_EMAIL_DNS_SERVER_TEMP_FAIL);
+ return false;
+ }
}
else
{
More information about the pLog-svn
mailing list