1.10 beta

This commit is contained in:
RainLoop Team 2016-05-02 23:42:29 +03:00
parent 116de6fd45
commit ecf23a4f6d
27 changed files with 259 additions and 158 deletions

View file

@ -2357,30 +2357,30 @@ END;
}
/**
* @param string $sData
* @param string $sKey
* @param string $sData
* @param string $sKey
*
* @return string
*/
public static function Hmac($sData, $sKey)
{
if (\function_exists('hash_hmac'))
* @return string
*/
public static function Hmac($sData, $sKey)
{
if (\function_exists('hash_hmac'))
{
return \hash_hmac('md5', $sData, $sKey);
}
return \hash_hmac('md5', $sData, $sKey);
}
$iLen = 64;
if ($iLen < \strlen($sKey))
$iLen = 64;
if ($iLen < \strlen($sKey))
{
$sKey = \pack('H*', \md5($sKey));
}
$sKey = \pack('H*', \md5($sKey));
}
$sKey = \str_pad($sKey, $iLen, \chr(0x00));
$sIpad = \str_pad('', $iLen, \chr(0x36));
$sOpad = \str_pad('', $iLen, \chr(0x5c));
$sKey = \str_pad($sKey, $iLen, \chr(0x00));
$sIpad = \str_pad('', $iLen, \chr(0x36));
$sOpad = \str_pad('', $iLen, \chr(0x5c));
return \md5(($sKey ^ $sOpad).\pack('H*', \md5(($sKey ^ $sIpad).$sData)));
}
return \md5(($sKey ^ $sOpad).\pack('H*', \md5(($sKey ^ $sIpad).$sData)));
}
/**
* @param string $sDomain

View file

@ -172,6 +172,16 @@ class ImapClient extends \MailSo\Net\NetClient
return $this;
}
protected function _xor($string, $string2)
{
$result = '';
$size = strlen($string);
for ($i=0; $i<$size; $i++) {
$result .= chr(ord($string[$i]) ^ ord($string2[$i]));
}
return $result;
}
/**
* @param string $sLogin
* @param string $sPassword
@ -204,7 +214,6 @@ class ImapClient extends \MailSo\Net\NetClient
try
{
$bUseAuthCramMd5IfSupported = false; // TODO
if ($bUseAuthCramMd5IfSupported && $this->IsSupported('AUTH=CRAM-MD5'))
{
$this->SendRequest('AUTHENTICATE', array('CRAM-MD5'));
@ -222,10 +231,20 @@ class ImapClient extends \MailSo\Net\NetClient
}
}
if ($oContinuationResponse && false)
if ($oContinuationResponse && !empty($oContinuationResponse->ResponseList[1]))
{
// TODO
$this->Logger()->WriteDump($aResponse);
$sTiken = @\base64_decode($oContinuationResponse->ResponseList[1]);
$this->oLogger->Write('tiket: '.$sTiken);
$sToken = \base64_encode($sLogin.' '.\MailSo\Base\Utils::Hmac($sPassword, $sTiken));
if ($this->oLogger)
{
$this->oLogger->AddSecret($sToken);
}
$this->sendRaw($sToken, true, '*******');
$this->parseResponseWithValidation();
}
else
{
@ -234,6 +253,12 @@ class ImapClient extends \MailSo\Net\NetClient
\MailSo\Log\Enumerations\Type::NOTICE, true);
}
}
else
{
$this->writeLogException(
new \MailSo\Imap\Exceptions\LoginException(),
\MailSo\Log\Enumerations\Type::NOTICE, true);
}
}
else if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN'))
{