[pLog-svn] r7262 - in plog/branches/lifetype-1.2/class/data/validator: . rules

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Jan 10 07:11:43 EST 2024


Author: jondaley
Date: 2024-01-10 07:11:43 -0500 (Wed, 10 Jan 2024)
New Revision: 7262

Modified:
   plog/branches/lifetype-1.2/class/data/validator/rules/emaildnsrule.class.php
   plog/branches/lifetype-1.2/class/data/validator/validation.class.php
Log:
have some email servers that return multiple greeting lines, so need to throw those away before processing FROM/TO, etc

Modified: plog/branches/lifetype-1.2/class/data/validator/rules/emaildnsrule.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/validator/rules/emaildnsrule.class.php	2023-11-01 02:41:03 UTC (rev 7261)
+++ plog/branches/lifetype-1.2/class/data/validator/rules/emaildnsrule.class.php	2024-01-10 12:11:43 UTC (rev 7262)
@@ -68,7 +68,13 @@
 
             if ($connect = fsockopen($connectAddress, 25))
             {
-                $greeting = fgets($connect, 1024);
+                  // TODO: what is a reasonable timeout?
+              stream_set_timeout($connect, 3);
+                  // get first line of initial greeting
+              $greeting = fgets($connect, 1024);
+                  // throw away any further lines
+              while($str = fgets($connect, 1024));
+
                     // TODO: these non-regexp preg_matches should all be changed to strpos === 0
                 if (preg_match("/^220/", $greeting))
                 {
@@ -98,7 +104,7 @@
                             return true;
                         }
                         else{
-                            $this->_setError(ERROR_RULE_EMAIL_DNS_NOT_PERMITTED);
+                          $this->_setError(ERROR_RULE_EMAIL_DNS_NOT_PERMITTED/* . ": HELO: $helo, FROM: $from, TO: $to"*/);
                             return false;
                         }
                     }

Modified: plog/branches/lifetype-1.2/class/data/validator/validation.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/validator/validation.class.php	2023-11-01 02:41:03 UTC (rev 7261)
+++ plog/branches/lifetype-1.2/class/data/validator/validation.class.php	2024-01-10 12:11:43 UTC (rev 7262)
@@ -29,7 +29,12 @@
          * @param error The new error code
          */
         function _setError($error)
-        {
+          {
+            lt_include( PLOG_CLASS_PATH."class/logger/loggermanager.class.php" );
+
+            $logger =& LoggerManager::getLogger( "debug" );
+            $logger->debug( $error );
+
             $this->_error = $error;
         }
 



More information about the pLog-svn mailing list