Fix: Can provide ip address on smtps. Better error reporting.
This commit is contained in:
parent
b48377312b
commit
c86db093be
@ -25,6 +25,7 @@ For users:
|
|||||||
- Fix: Format number was wrong for ar_AR language.
|
- Fix: Format number was wrong for ar_AR language.
|
||||||
- Fix: Can change password if has only permission change password.
|
- Fix: Can change password if has only permission change password.
|
||||||
- Fix: Project PDF document show the tasks.
|
- Fix: Project PDF document show the tasks.
|
||||||
|
- Fix: bug #29278 : SMTP fails with IP
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- More comments in code.
|
- More comments in code.
|
||||||
|
|||||||
@ -627,7 +627,11 @@ class SMTPs
|
|||||||
$host=$this->getHost();
|
$host=$this->getHost();
|
||||||
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
||||||
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
||||||
if ( (gethostbyname ( $host )) == $host )
|
|
||||||
|
// DOL_CHANGE LDR
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php');
|
||||||
|
|
||||||
|
if ( (! is_ip($host)) && ((gethostbyname ( $host )) == $host) )
|
||||||
{
|
{
|
||||||
$this->_setErr ( 99, $host . ' is either offline or is an invalid host name.' );
|
$this->_setErr ( 99, $host . ' is either offline or is an invalid host name.' );
|
||||||
$_retVal = false;
|
$_retVal = false;
|
||||||
@ -1996,7 +2000,7 @@ class SMTPs
|
|||||||
*/
|
*/
|
||||||
//$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
//$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
||||||
$content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
$content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
||||||
|
|
||||||
// TODO Restore
|
// TODO Restore
|
||||||
// . "\r\n"
|
// . "\r\n"
|
||||||
// . 'This is a multi-part message in MIME format.' . "\r\n";
|
// . 'This is a multi-part message in MIME format.' . "\r\n";
|
||||||
@ -2513,6 +2517,9 @@ class SMTPs
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.12 2010/04/13 20:30:25 eldy
|
||||||
|
* Fix: Can provide ip address on smtps. Better error reporting.
|
||||||
|
*
|
||||||
* Revision 1.11 2010/01/12 13:02:07 hregis
|
* Revision 1.11 2010/01/12 13:02:07 hregis
|
||||||
* Fix: missing attach-files
|
* Fix: missing attach-files
|
||||||
*
|
*
|
||||||
|
|||||||
@ -401,7 +401,10 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
|
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
|
||||||
$result=$this->smtps->sendMsg();
|
$result=$this->smtps->sendMsg();
|
||||||
//print $resultvalue;
|
if (! $result)
|
||||||
|
{
|
||||||
|
$this->error=$this->smtps->getErrors();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
||||||
|
|||||||
@ -1101,7 +1101,7 @@ function getListOfModels($db,$type)
|
|||||||
*/
|
*/
|
||||||
function is_ip($ip)
|
function is_ip($ip)
|
||||||
{
|
{
|
||||||
if (!ereg("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$", $ip)) return 0;
|
if (!preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip)) return 0;
|
||||||
if (sprintf("%u",ip2long($ip)) == sprintf("%u",ip2long('255.255.255.255'))) return 0;
|
if (sprintf("%u",ip2long($ip)) == sprintf("%u",ip2long('255.255.255.255'))) return 0;
|
||||||
if (sprintf("%u",ip2long('10.0.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('10.255.255.255'))) return 2;
|
if (sprintf("%u",ip2long('10.0.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('10.255.255.255'))) return 2;
|
||||||
if (sprintf("%u",ip2long('172.16.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('172.31.255.255'))) return 2;
|
if (sprintf("%u",ip2long('172.16.0.0')) <= sprintf("%u",ip2long($ip)) and sprintf("%u",ip2long($ip)) <= sprintf("%u",ip2long('172.31.255.255'))) return 2;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user