| 440 | | case 'XOAUTH2': |
| 441 | | //If the OAuth Instance is not set. Can be a case when PHPMailer is used |
| 442 | | //instead of PHPMailerOAuth |
| 443 | | if (is_null($OAuth)) { |
| 444 | | return false; |
| 445 | | } |
| 446 | | $oauth = $OAuth->getOauth64(); |
| 447 | | |
| 448 | | // Start authentication |
| 449 | | if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { |
| 450 | | return false; |
| 451 | | } |
| 452 | | break; |
| 453 | | case 'NTLM': |
| 454 | | /* |
| 455 | | * ntlm_sasl_client.php |
| 456 | | * Bundled with Permission |
| 457 | | * |
| 458 | | * How to telnet in windows: |
| 459 | | * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx |
| 460 | | * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication |
| 461 | | */ |
| 462 | | require_once 'extras/ntlm_sasl_client.php'; |
| 463 | | $temp = new stdClass; |
| 464 | | $ntlm_client = new ntlm_sasl_client_class; |
| 465 | | //Check that functions are available |
| 466 | | if (!$ntlm_client->Initialize($temp)) { |
| 467 | | $this->setError($temp->error); |
| 468 | | $this->edebug( |
| 469 | | 'You need to enable some modules in your php.ini file: ' |
| 470 | | . $this->error['error'], |
| 471 | | self::DEBUG_CLIENT |
| 472 | | ); |
| 473 | | return false; |
| 474 | | } |
| 475 | | //msg1 |
| 476 | | $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 |
| 477 | | |
| 478 | | if (!$this->sendCommand( |
| 479 | | 'AUTH NTLM', |
| 480 | | 'AUTH NTLM ' . base64_encode($msg1), |
| 481 | | 334 |
| 482 | | ) |
| 483 | | ) { |
| 484 | | return false; |
| 485 | | } |
| 486 | | //Though 0 based, there is a white space after the 3 digit number |
| 487 | | //msg2 |
| 488 | | $challenge = substr($this->last_reply, 3); |
| 489 | | $challenge = base64_decode($challenge); |
| 490 | | $ntlm_res = $ntlm_client->NTLMResponse( |
| 491 | | substr($challenge, 24, 8), |
| 492 | | $password |
| 493 | | ); |
| 494 | | //msg3 |
| 495 | | $msg3 = $ntlm_client->TypeMsg3( |
| 496 | | $ntlm_res, |
| 497 | | $username, |
| 498 | | $realm, |
| 499 | | $workstation |
| 500 | | ); |
| 501 | | // send encoded username |
| 502 | | return $this->sendCommand('Username', base64_encode($msg3), 235); |