Dont send an M_GET when we are not in NR mode, or we are offered a file from a zero offset.

This commit is contained in:
Deon George 2023-07-09 11:18:57 +10:00
parent faeec61aeb
commit d4439a6b58
2 changed files with 13 additions and 10 deletions

View File

@ -261,6 +261,7 @@ final class Receive extends Item
return Protocol::FOP_SUSPEND;
} else {
// @todo I dont think we are enabling resumable sessions - need to check
Log::debug(sprintf('%s:- Opening [%s]',self::LOGKEY,$this->file));
}

View File

@ -247,8 +247,10 @@ final class Binkp extends BaseProtocol
*/
// No dupes mode is preferred on BINKP 1.1
if ($this->capGet(self::F_NODUPE,self::O_WE) || ($this->originate && $this->capGet(self::F_NOREL,self::O_WANT) && $this->node->get_versionint() > 100))
if ($this->capGet(self::F_NODUPE,self::O_WE) || ($this->originate && $this->capGet(self::F_NOREL,self::O_WANT) && $this->node->get_versionint() > 100)) {
Log::debug(sprintf('%s:/ NR mode enabled, because we are in NDA mode, or I want NDA and the remote is version [%d]',self::LOGKEY,$this->node->get_versionint()));
$this->capSet(self::F_NOREL,self::O_YES);
}
$this->capSet(self::F_MULTIBATCH,(($this->node->get_versionint() > 100) || $this->capGet(self::F_MULTIBATCH,self::O_WE)) ? self::O_YES : self::O_NO);
@ -896,14 +898,14 @@ final class Binkp extends BaseProtocol
case self::FOP_OK:
Log::debug(sprintf('%s:- Getting file from offset [%ld]',self::LOGKEY,$file['offs']));
$this->msgs(self::BPM_GET,sprintf('%s %ld',$this->recv->name_size_time,($file['offs'] < 0) ? 0 : $file['offs']));
//$this->msgs(self::BPM_GET,sprintf('%s %ld',$this->recv->name_size_time,($file['offs'] < 0) ? 0 : $file['offs']));
if ((int)$file['offs'] !== -1) {
if (! $this->capGet(self::F_NOREL,self::O_THEY))
$this->capSet(self::F_NOREL,self::O_THEY);
break;
if (((int)$file['offs'] !== -1) && (! $this->capGet(self::F_NOREL,self::O_THEY))) {
Log::debug(sprintf('%s:- Assuming the remote wants NR mode, since offset is [%d] and they didnt specify an OPT with it',self::LOGKEY,$file['offs']));
$this->capSet(self::F_NOREL,self::O_THEY);
}
break;
}
} catch (\Exception $e) {
@ -976,7 +978,7 @@ final class Binkp extends BaseProtocol
{
// @todo Commit our mail transaction if the remote end confirmed receipt of the file.
if ($this->sessionGet(self::SE_SENDFILE)) {
Log::debug(sprintf('%s:Packet/File [%s] sent. (%s)',self::LOGKEY,$this->send->sendas,$this->send->name));
Log::info(sprintf('%s:= Packet/File [%s] sent.',self::LOGKEY,$this->send->name));
$this->sessionClear(self::SE_SENDFILE);
$this->send->close(TRUE);
@ -984,7 +986,7 @@ final class Binkp extends BaseProtocol
}
if ($this->sessionGet(self::SE_WAITGOT)) {
Log::debug(sprintf('%s:Packet/File [%s] sent. (%s)',self::LOGKEY,$this->send->sendas,$this->send->name));
Log::info(sprintf('%s:= Packet/File [%s] sent.',self::LOGKEY,$this->send->name));
$this->sessionClear(self::SE_WAITGOT);
$this->send->close(TRUE);
@ -1234,7 +1236,7 @@ final class Binkp extends BaseProtocol
}
// We dont use crypt if we dont have an MD5 sessions
if (! $have_pwd || (! $this->capGet(self::F_MD,self::O_YES))) {
if (! $have_pwd && (! $this->capGet(self::F_MD,self::O_YES))) {
Log::notice(sprintf('%s:= CRYPT disabled, since we have no password or not MD5',self::LOGKEY));
$this->capSet(self::F_CRYPT,self::O_NO);
}