Skip to content

Commit 565cd39

Browse files
icewind1991backportbot[bot]
authored andcommitted
update icewind/smb to 3.2.3
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 3d24b56 commit 565cd39

File tree

8 files changed

+52
-13
lines changed

8 files changed

+52
-13
lines changed

apps/files_external/3rdparty/composer/autoload_classmap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
'Icewind\\SMB\\Exception\\AlreadyExistsException' => $vendorDir . '/icewind/smb/src/Exception/AlreadyExistsException.php',
1616
'Icewind\\SMB\\Exception\\AuthenticationException' => $vendorDir . '/icewind/smb/src/Exception/AuthenticationException.php',
1717
'Icewind\\SMB\\Exception\\ConnectException' => $vendorDir . '/icewind/smb/src/Exception/ConnectException.php',
18+
'Icewind\\SMB\\Exception\\ConnectionAbortedException' => $vendorDir . '/icewind/smb/src/Exception/ConnectionAbortedException.php',
1819
'Icewind\\SMB\\Exception\\ConnectionException' => $vendorDir . '/icewind/smb/src/Exception/ConnectionException.php',
1920
'Icewind\\SMB\\Exception\\ConnectionRefusedException' => $vendorDir . '/icewind/smb/src/Exception/ConnectionRefusedException.php',
21+
'Icewind\\SMB\\Exception\\ConnectionResetException' => $vendorDir . '/icewind/smb/src/Exception/ConnectionResetException.php',
2022
'Icewind\\SMB\\Exception\\DependencyException' => $vendorDir . '/icewind/smb/src/Exception/DependencyException.php',
2123
'Icewind\\SMB\\Exception\\Exception' => $vendorDir . '/icewind/smb/src/Exception/Exception.php',
2224
'Icewind\\SMB\\Exception\\FileInUseException' => $vendorDir . '/icewind/smb/src/Exception/FileInUseException.php',

apps/files_external/3rdparty/composer/autoload_static.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
4545
'Icewind\\SMB\\Exception\\AlreadyExistsException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AlreadyExistsException.php',
4646
'Icewind\\SMB\\Exception\\AuthenticationException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AuthenticationException.php',
4747
'Icewind\\SMB\\Exception\\ConnectException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectException.php',
48+
'Icewind\\SMB\\Exception\\ConnectionAbortedException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectionAbortedException.php',
4849
'Icewind\\SMB\\Exception\\ConnectionException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectionException.php',
4950
'Icewind\\SMB\\Exception\\ConnectionRefusedException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectionRefusedException.php',
51+
'Icewind\\SMB\\Exception\\ConnectionResetException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ConnectionResetException.php',
5052
'Icewind\\SMB\\Exception\\DependencyException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/DependencyException.php',
5153
'Icewind\\SMB\\Exception\\Exception' => __DIR__ . '/..' . '/icewind/smb/src/Exception/Exception.php',
5254
'Icewind\\SMB\\Exception\\FileInUseException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/FileInUseException.php',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright (c) 2020 Robin Appelman <icewind@owncloud.com>
4+
* This file is licensed under the Licensed under the MIT license:
5+
* http://opensource.org/licenses/MIT
6+
*/
7+
8+
namespace Icewind\SMB\Exception;
9+
10+
class ConnectionAbortedException extends ConnectException {
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright (c) 2020 Robin Appelman <icewind@owncloud.com>
4+
* This file is licensed under the Licensed under the MIT license:
5+
* http://opensource.org/licenses/MIT
6+
*/
7+
8+
namespace Icewind\SMB\Exception;
9+
10+
class ConnectionResetException extends ConnectException {
11+
}

apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,14 @@ public function rename($from, $to) {
198198
*/
199199
public function put($source, $target) {
200200
$sourceHandle = fopen($source, 'rb');
201-
$targetHandle = $this->getState()->create($this->buildUrl($target));
201+
$targetUrl = $this->buildUrl($target);
202+
203+
$targetHandle = $this->getState()->create($targetUrl);
202204

203205
while ($data = fread($sourceHandle, NativeReadStream::CHUNK_SIZE)) {
204-
$this->getState()->write($targetHandle, $data);
206+
$this->getState()->write($targetHandle, $data, $targetUrl);
205207
}
206-
$this->getState()->close($targetHandle);
208+
$this->getState()->close($targetHandle, $targetUrl);
207209
return true;
208210
}
209211

@@ -243,7 +245,7 @@ public function get($source, $target) {
243245
while ($data = $this->getState()->read($sourceHandle, NativeReadStream::CHUNK_SIZE)) {
244246
fwrite($targetHandle, $data);
245247
}
246-
$this->getState()->close($sourceHandle);
248+
$this->getState()->close($sourceHandle, $this->buildUrl($source));
247249
return true;
248250
}
249251

apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Icewind\SMB\Exception\HostDownException;
1616
use Icewind\SMB\Exception\InvalidArgumentException;
1717
use Icewind\SMB\Exception\InvalidTypeException;
18+
use Icewind\SMB\Exception\ConnectionAbortedException;
1819
use Icewind\SMB\Exception\NoRouteToHostException;
1920
use Icewind\SMB\Exception\NotEmptyException;
2021
use Icewind\SMB\Exception\NotFoundException;
@@ -236,13 +237,14 @@ public function read($file, $bytes) {
236237
/**
237238
* @param resource $file
238239
* @param string $data
240+
* @param string $path
239241
* @param int $length
240242
* @return int
241243
*/
242-
public function write($file, $data, $length = null) {
244+
public function write($file, $data, $path, $length = null) {
243245
$result = @smbclient_write($this->state, $file, $data, $length);
244246

245-
$this->testResult($result, $file);
247+
$this->testResult($result, $path);
246248
return $result;
247249
}
248250

@@ -271,10 +273,10 @@ public function ftruncate($file, $size) {
271273
return $result;
272274
}
273275

274-
public function close($file) {
276+
public function close($file, $path) {
275277
$result = @smbclient_close($this->state, $file);
276278

277-
$this->testResult($result, $file);
279+
$this->testResult($result, $path);
278280
return $result;
279281
}
280282

apps/files_external/3rdparty/icewind/smb/src/Native/NativeStream.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ public static function wrap($state, $smbStream, $mode, $url) {
6161
}
6262

6363
public function stream_close() {
64-
return $this->state->close($this->handle);
64+
try {
65+
return $this->state->close($this->handle, $this->url);
66+
} catch (\Exception $e) {
67+
return false;
68+
}
6569
}
6670

6771
public function stream_eof() {
@@ -110,7 +114,7 @@ public function stream_tell() {
110114
}
111115

112116
public function stream_write($data) {
113-
return $this->state->write($this->handle, $data);
117+
return $this->state->write($this->handle, $data, $this->url);
114118
}
115119

116120
public function stream_truncate($size) {

apps/files_external/3rdparty/icewind/smb/src/Native/NativeWriteStream.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function stream_seek($offset, $whence = SEEK_SET) {
6161

6262
private function flushWrite() {
6363
rewind($this->writeBuffer);
64-
$this->state->write($this->handle, stream_get_contents($this->writeBuffer));
64+
$this->state->write($this->handle, stream_get_contents($this->writeBuffer), $this->url);
6565
$this->writeBuffer = fopen('php://memory', 'r+');
6666
$this->bufferSize = 0;
6767
}
@@ -79,8 +79,13 @@ public function stream_write($data) {
7979
}
8080

8181
public function stream_close() {
82-
$this->flushWrite();
83-
return parent::stream_close();
82+
try {
83+
$this->flushWrite();
84+
$flushResult = true;
85+
} catch (\Exception $e) {
86+
$flushResult = false;
87+
}
88+
return parent::stream_close() && $flushResult;
8489
}
8590

8691
public function stream_tell() {

0 commit comments

Comments
 (0)