| Zeile 129 | Zeile 129 |
|---|
*/ public $keep_alive = false;
|
*/ public $keep_alive = false;
|
| | /** * Whether to use TLS encryption. * * @var boolean */ public $use_tls = false;
|
function __construct() { global $mybb;
| function __construct() { global $mybb;
|
| Zeile 140 | Zeile 147 |
|---|
$protocol = 'ssl://'; break; case MYBB_TLS:
|
$protocol = 'ssl://'; break; case MYBB_TLS:
|
$protocol = 'tls://';
| $this->use_tls = true;
|
break; }
| break; }
|
| Zeile 185 | Zeile 192 |
|---|
if(!$this->connected()) {
|
if(!$this->connected()) {
|
$this->connect();
| if(!$this->connect()) { $this->close(); }
|
} if($this->connected())
| } if($this->connected())
|
| Zeile 274 | Zeile 284 |
|---|
return false; }
|
return false; }
|
if(!empty($this->username) && !empty($this->password))
| if($this->use_tls || (!empty($this->username) && !empty($this->password)))
|
{
|
{
|
$data = $this->send_data('EHLO ' . $this->helo, '250'); if(!$data)
| $helo = 'EHLO'; } else { $helo = 'HELO'; }
$data = $this->send_data("{$helo} {$this->helo}", '250'); if(!$data) { $this->fatal_error("The server did not understand the {$helo} command"); return false; }
if($this->use_tls && preg_match("#250( |-)STARTTLS#mi", $data)) { if(!$this->send_data('STARTTLS', '220'))
|
{
|
{
|
$this->fatal_error("The server did not understand the EHLO command");
| $this->fatal_error("The server did not understand the STARTTLS command. Reason: ".$this->get_error()); return false; } if(!@stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { $this->fatal_error("Failed to start TLS encryption");
|
return false; }
|
return false; }
|
preg_match("#250-AUTH( |=)(.+)$#mi", $data, $matches); if(!$this->auth($matches[2]))
| // Resend EHLO to get updated service list $data = $this->send_data("{$helo} {$this->helo}", '250'); if(!$data)
|
{
|
{
|
$this->fatal_error("MyBB was unable to authenticate you against the SMTP server");
| $this->fatal_error("The server did not understand the EHLO command");
|
return false; } }
|
return false; } }
|
else
| if(!empty($this->username) && !empty($this->password))
|
{
|
{
|
if(!$this->send_data('HELO ' . $this->helo, '250'))
| preg_match("#250( |-)AUTH( |=)(.+)$#mi", $data, $matches); if(!$this->auth($matches[3]))
|
{
|
{
|
$this->fatal_error("The server did not understand the HELO command");
| |
return false; } }
| return false; } }
|
| Zeile 316 | Zeile 348 |
|---|
{ global $lang, $mybb;
|
{ global $lang, $mybb;
|
$auth_methods = explode(" ", $auth_methods);
| $auth_methods = explode(" ", trim($auth_methods));
|
if(in_array("LOGIN", $auth_methods)) {
| if(in_array("LOGIN", $auth_methods)) {
|
| Zeile 387 | Zeile 419 |
|---|
break; } }
|
break; } }
|
| | $string = trim($string);
|
$this->data = $string;
|
$this->data = $string;
|
$this->code = substr(trim($this->data), 0, 3);
| $this->code = substr($this->data, 0, 3);
|
return $string; }
| return $string; }
|