Ticket #39714: 39714-1.diff
File 39714-1.diff, 4.8 KB (added by , 8 years ago) |
---|
-
wp-includes/class-smtp.php
378 378 * @see hello() 379 379 * @param string $username The user name 380 380 * @param string $password The password 381 * @param string $authtype The auth type (PLAIN, LOGIN, CRAM-MD5)381 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2) 382 382 * @param string $realm The auth realm for NTLM 383 383 * @param string $workstation The auth workstation for NTLM 384 384 * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth) … … 414 414 ); 415 415 416 416 if (empty($authtype)) { 417 foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN' ) as $method) {417 foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) { 418 418 if (in_array($method, $this->server_caps['AUTH'])) { 419 419 $authtype = $method; 420 420 break; … … 462 462 return false; 463 463 } 464 464 break; 465 case 'XOAUTH2': 466 //If the OAuth Instance is not set. Can be a case when PHPMailer is used 467 //instead of PHPMailerOAuth 468 if (is_null($OAuth)) { 469 return false; 470 } 471 $oauth = $OAuth->getOauth64(); 472 473 // Start authentication 474 if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { 475 return false; 476 } 477 break; 478 case 'NTLM': 479 /* 480 * ntlm_sasl_client.php 481 * Bundled with Permission 482 * 483 * How to telnet in windows: 484 * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx 485 * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication 486 */ 487 require_once 'extras/ntlm_sasl_client.php'; 488 $temp = new stdClass; 489 $ntlm_client = new ntlm_sasl_client_class; 490 //Check that functions are available 491 if (!$ntlm_client->initialize($temp)) { 492 $this->setError($temp->error); 493 $this->edebug( 494 'You need to enable some modules in your php.ini file: ' 495 . $this->error['error'], 496 self::DEBUG_CLIENT 497 ); 498 return false; 499 } 500 //msg1 501 $msg1 = $ntlm_client->typeMsg1($realm, $workstation); //msg1 502 503 if (!$this->sendCommand( 504 'AUTH NTLM', 505 'AUTH NTLM ' . base64_encode($msg1), 506 334 507 ) 508 ) { 509 return false; 510 } 511 //Though 0 based, there is a white space after the 3 digit number 512 //msg2 513 $challenge = substr($this->last_reply, 3); 514 $challenge = base64_decode($challenge); 515 $ntlm_res = $ntlm_client->NTLMResponse( 516 substr($challenge, 24, 8), 517 $password 518 ); 519 //msg3 520 $msg3 = $ntlm_client->typeMsg3( 521 $ntlm_res, 522 $username, 523 $realm, 524 $workstation 525 ); 526 // send encoded username 527 return $this->sendCommand('Username', base64_encode($msg3), 235); 465 528 case 'CRAM-MD5': 466 529 // Start authentication 467 530 if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { … … 1183 1246 1184 1247 return false; 1185 1248 } 1186 } 1249 } 1250 No newline at end of file -
wp-includes/class-phpmailer.php
288 288 289 289 /** 290 290 * SMTP auth type. 291 * Options are CRAM-MD5, LOGIN, PLAIN, attempted in that order if not specified291 * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified 292 292 * @var string 293 293 */ 294 294 public $AuthType = ''; … … 1517 1517 public function getSMTPInstance() 1518 1518 { 1519 1519 if (!is_object($this->smtp)) { 1520 require_once( 'class-smtp.php' );1521 1520 $this->smtp = new SMTP; 1522 1521 } 1523 1522 return $this->smtp; … … 4037 4036 $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n"; 4038 4037 return $errorMsg; 4039 4038 } 4040 } 4039 } 4040 No newline at end of file