[pLog-svn] r3684 - plog/trunk/class/data/validator/rules

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Tue Jul 4 20:19:27 GMT 2006


Author: jondaley
Date: 2006-07-04 20:19:26 +0000 (Tue, 04 Jul 2006)
New Revision: 3684

Modified:
   plog/trunk/class/data/validator/rules/emaildnsrule.class.php
Log:
arguably this check is taken care of in the EmailFormatRule, but it is a little safer to check it here anyway, particularly since on windows the value gets passed to an exec call

Modified: plog/trunk/class/data/validator/rules/emaildnsrule.class.php
===================================================================
--- plog/trunk/class/data/validator/rules/emaildnsrule.class.php	2006-07-03 18:27:45 UTC (rev 3683)
+++ plog/trunk/class/data/validator/rules/emaildnsrule.class.php	2006-07-04 20:19:26 UTC (rev 3684)
@@ -4,10 +4,12 @@
     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");
+    include_once(PLOG_CLASS_PATH."class/data/textfilter.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");
+    define( "ERROR_RULE_EMAIL_DNS_BAD_DOMAIN", "error_rule_email_dns_bad_domain");
 
     /**
 	 * \ingroup Validator_Rules
@@ -43,6 +45,14 @@
             }
 
             list($userName, $domain) = explode("@", $value);
+
+                // check input
+            $clean_domain = Textfilter::domainize($domain);
+            if($clean_domain != $domain){
+                $this->_setError(ERROR_RULE_EMAIL_DNS_BAD_DOMAIN);
+                return false;
+            }
+
             $connectAddress          = $domain;
 
             if (!Dns::checkdnsrr($domain, "A"))



More information about the pLog-svn mailing list