Logging to catch some hex2bin exceptions with 2/109

This commit is contained in:
Deon George 2023-10-05 20:49:58 +11:00
parent 614d332fae
commit c86d8d8952

View File

@ -1153,12 +1153,15 @@ final class Binkp extends BaseProtocol
$this->capSet(self::F_COMP,self::O_THEY|self::O_EXT);
} elseif (! strncmp($p,'CRAM-MD5-',9) && $this->originate && $this->capGet(self::F_MD,self::O_WANT)) {
if (($x=strlen(substr($p,9))) > 64 ) {
Log::error(sprintf('%s:! The challenge string is TOO LONG [%d] (%s)',self::LOGKEY,$x,$p));
if (strlen($hex=substr($p,9)) > 64 ) {
Log::error(sprintf('%s:! The challenge string is TOO LONG [%d] (%s)',self::LOGKEY,strlen($hex),$p));
} elseif (strlen($hex)%2) {
Log::error(sprintf('%s:! The challenge string is an odd size [%d] (%s)',self::LOGKEY,strlen($hex),$hex));
} else {
Log::info(sprintf('%s:- Remote wants MD5 auth',self::LOGKEY));
$this->md_challenge = hex2bin(substr($p,9));
Log::info(sprintf('%s:- Remote wants MD5 auth with [%s]',self::LOGKEY,$hex));
$this->md_challenge = hex2bin($hex);
if ($this->md_challenge)
$this->capSet(self::F_MD,self::O_THEY);
@ -1385,6 +1388,8 @@ final class Binkp extends BaseProtocol
// We dont have anything to send
} else {
Log::info(sprintf('%s:- Nothing left to send in this batch',self::LOGKEY));
// @todo We should look for more mail/files before thinking about sending an EOB
// IE: When we are set to only send X messages, but we have > X to send, get the next batch.
$this->sessionSet(self::SE_NOFILES);
}
}