diff --git a/apps/files_external/3rdparty/composer.json b/apps/files_external/3rdparty/composer.json index 307a062c7e..b556de7c39 100644 --- a/apps/files_external/3rdparty/composer.json +++ b/apps/files_external/3rdparty/composer.json @@ -8,7 +8,7 @@ "classmap-authoritative": true }, "require": { - "icewind/smb": "2.0.3", + "icewind/smb": "2.0.4", "icewind/streams": "0.5.2" } } diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock index e00a7bd80e..2ec6ee94c8 100644 --- a/apps/files_external/3rdparty/composer.lock +++ b/apps/files_external/3rdparty/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b6a304e8ab2effa3791b513007fadcbc", + "content-hash": "8b87ff18cd1c30945c631607fbfbf8b7", "packages": [ { "name": "icewind/smb", - "version": "v2.0.3", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/icewind1991/SMB.git", - "reference": "8394551bf29a37b884edb33dae8acde369177f32" + "reference": "f258947a6f840cc9655ba81744872f9bb292a7dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/SMB/zipball/8394551bf29a37b884edb33dae8acde369177f32", - "reference": "8394551bf29a37b884edb33dae8acde369177f32", + "url": "https://api.github.com/repos/icewind1991/SMB/zipball/f258947a6f840cc9655ba81744872f9bb292a7dd", + "reference": "f258947a6f840cc9655ba81744872f9bb292a7dd", "shasum": "" }, "require": { @@ -45,7 +45,7 @@ } ], "description": "php wrapper for smbclient and libsmbclient-php", - "time": "2017-10-18T16:21:10+00:00" + "time": "2018-01-19T14:36:36+00:00" }, { "name": "icewind/streams", diff --git a/apps/files_external/3rdparty/composer/ClassLoader.php b/apps/files_external/3rdparty/composer/ClassLoader.php index 2c72175e77..dc02dfb114 100644 --- a/apps/files_external/3rdparty/composer/ClassLoader.php +++ b/apps/files_external/3rdparty/composer/ClassLoader.php @@ -379,9 +379,9 @@ class ClassLoader $subPath = substr($subPath, 0, $lastPos); $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } diff --git a/apps/files_external/3rdparty/composer/autoload_classmap.php b/apps/files_external/3rdparty/composer/autoload_classmap.php index 257bdb64eb..d51895234b 100644 --- a/apps/files_external/3rdparty/composer/autoload_classmap.php +++ b/apps/files_external/3rdparty/composer/autoload_classmap.php @@ -21,6 +21,7 @@ return array( 'Icewind\\SMB\\Exception\\FileInUseException' => $vendorDir . '/icewind/smb/src/Exception/FileInUseException.php', 'Icewind\\SMB\\Exception\\ForbiddenException' => $vendorDir . '/icewind/smb/src/Exception/ForbiddenException.php', 'Icewind\\SMB\\Exception\\HostDownException' => $vendorDir . '/icewind/smb/src/Exception/HostDownException.php', + 'Icewind\\SMB\\Exception\\InvalidArgumentException' => $vendorDir . '/icewind/smb/src/Exception/InvalidArgumentException.php', 'Icewind\\SMB\\Exception\\InvalidHostException' => $vendorDir . '/icewind/smb/src/Exception/InvalidHostException.php', 'Icewind\\SMB\\Exception\\InvalidParameterException' => $vendorDir . '/icewind/smb/src/Exception/InvalidParameterException.php', 'Icewind\\SMB\\Exception\\InvalidPathException' => $vendorDir . '/icewind/smb/src/Exception/InvalidPathException.php', @@ -51,13 +52,13 @@ return array( 'Icewind\\SMB\\Server' => $vendorDir . '/icewind/smb/src/Server.php', 'Icewind\\SMB\\Share' => $vendorDir . '/icewind/smb/src/Share.php', 'Icewind\\SMB\\System' => $vendorDir . '/icewind/smb/src/System.php', - 'Icewind\\SMB\\Test\\AbstractShare' => $vendorDir . '/icewind/smb/tests/AbstractShare.php', - 'Icewind\\SMB\\Test\\NativeShare' => $vendorDir . '/icewind/smb/tests/NativeShare.php', - 'Icewind\\SMB\\Test\\NativeStream' => $vendorDir . '/icewind/smb/tests/NativeStream.php', + 'Icewind\\SMB\\Test\\AbstractShareTest' => $vendorDir . '/icewind/smb/tests/AbstractShareTest.php', + 'Icewind\\SMB\\Test\\NativeShareTestTest' => $vendorDir . '/icewind/smb/tests/NativeShareTestTest.php', + 'Icewind\\SMB\\Test\\NativeStreamTest' => $vendorDir . '/icewind/smb/tests/NativeStreamTest.php', 'Icewind\\SMB\\Test\\NotifyHandlerTest' => $vendorDir . '/icewind/smb/tests/NotifyHandlerTest.php', - 'Icewind\\SMB\\Test\\Parser' => $vendorDir . '/icewind/smb/tests/Parser.php', - 'Icewind\\SMB\\Test\\Server' => $vendorDir . '/icewind/smb/tests/Server.php', - 'Icewind\\SMB\\Test\\Share' => $vendorDir . '/icewind/smb/tests/Share.php', + 'Icewind\\SMB\\Test\\ParserTest' => $vendorDir . '/icewind/smb/tests/ParserTest.php', + 'Icewind\\SMB\\Test\\ServerTest' => $vendorDir . '/icewind/smb/tests/ServerTest.php', + 'Icewind\\SMB\\Test\\ShareTestTest' => $vendorDir . '/icewind/smb/tests/ShareTestTest.php', 'Icewind\\SMB\\Test\\TestCase' => $vendorDir . '/icewind/smb/tests/TestCase.php', 'Icewind\\SMB\\TimeZoneProvider' => $vendorDir . '/icewind/smb/src/TimeZoneProvider.php', 'Icewind\\Streams\\CallbackWrapper' => $vendorDir . '/icewind/streams/src/CallbackWrapper.php', diff --git a/apps/files_external/3rdparty/composer/autoload_static.php b/apps/files_external/3rdparty/composer/autoload_static.php index 62be2df6a0..51739b6b6c 100644 --- a/apps/files_external/3rdparty/composer/autoload_static.php +++ b/apps/files_external/3rdparty/composer/autoload_static.php @@ -51,6 +51,7 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3 'Icewind\\SMB\\Exception\\FileInUseException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/FileInUseException.php', 'Icewind\\SMB\\Exception\\ForbiddenException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/ForbiddenException.php', 'Icewind\\SMB\\Exception\\HostDownException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/HostDownException.php', + 'Icewind\\SMB\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidArgumentException.php', 'Icewind\\SMB\\Exception\\InvalidHostException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidHostException.php', 'Icewind\\SMB\\Exception\\InvalidParameterException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidParameterException.php', 'Icewind\\SMB\\Exception\\InvalidPathException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidPathException.php', @@ -81,13 +82,13 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3 'Icewind\\SMB\\Server' => __DIR__ . '/..' . '/icewind/smb/src/Server.php', 'Icewind\\SMB\\Share' => __DIR__ . '/..' . '/icewind/smb/src/Share.php', 'Icewind\\SMB\\System' => __DIR__ . '/..' . '/icewind/smb/src/System.php', - 'Icewind\\SMB\\Test\\AbstractShare' => __DIR__ . '/..' . '/icewind/smb/tests/AbstractShare.php', - 'Icewind\\SMB\\Test\\NativeShare' => __DIR__ . '/..' . '/icewind/smb/tests/NativeShare.php', - 'Icewind\\SMB\\Test\\NativeStream' => __DIR__ . '/..' . '/icewind/smb/tests/NativeStream.php', + 'Icewind\\SMB\\Test\\AbstractShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/AbstractShareTest.php', + 'Icewind\\SMB\\Test\\NativeShareTestTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeShareTestTest.php', + 'Icewind\\SMB\\Test\\NativeStreamTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeStreamTest.php', 'Icewind\\SMB\\Test\\NotifyHandlerTest' => __DIR__ . '/..' . '/icewind/smb/tests/NotifyHandlerTest.php', - 'Icewind\\SMB\\Test\\Parser' => __DIR__ . '/..' . '/icewind/smb/tests/Parser.php', - 'Icewind\\SMB\\Test\\Server' => __DIR__ . '/..' . '/icewind/smb/tests/Server.php', - 'Icewind\\SMB\\Test\\Share' => __DIR__ . '/..' . '/icewind/smb/tests/Share.php', + 'Icewind\\SMB\\Test\\ParserTest' => __DIR__ . '/..' . '/icewind/smb/tests/ParserTest.php', + 'Icewind\\SMB\\Test\\ServerTest' => __DIR__ . '/..' . '/icewind/smb/tests/ServerTest.php', + 'Icewind\\SMB\\Test\\ShareTestTest' => __DIR__ . '/..' . '/icewind/smb/tests/ShareTestTest.php', 'Icewind\\SMB\\Test\\TestCase' => __DIR__ . '/..' . '/icewind/smb/tests/TestCase.php', 'Icewind\\SMB\\TimeZoneProvider' => __DIR__ . '/..' . '/icewind/smb/src/TimeZoneProvider.php', 'Icewind\\Streams\\CallbackWrapper' => __DIR__ . '/..' . '/icewind/streams/src/CallbackWrapper.php', diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json index 6855971a9f..640bebc917 100644 --- a/apps/files_external/3rdparty/composer/installed.json +++ b/apps/files_external/3rdparty/composer/installed.json @@ -1,4 +1,47 @@ [ + { + "name": "icewind/smb", + "version": "v2.0.4", + "version_normalized": "2.0.4.0", + "source": { + "type": "git", + "url": "https://github.com/icewind1991/SMB.git", + "reference": "f258947a6f840cc9655ba81744872f9bb292a7dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/icewind1991/SMB/zipball/f258947a6f840cc9655ba81744872f9bb292a7dd", + "reference": "f258947a6f840cc9655ba81744872f9bb292a7dd", + "shasum": "" + }, + "require": { + "icewind/streams": ">=0.2.0", + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, + "time": "2018-01-19T14:36:36+00:00", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-4": { + "Icewind\\SMB\\": "src/", + "Icewind\\SMB\\Test\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robin Appelman", + "email": "icewind@owncloud.com" + } + ], + "description": "php wrapper for smbclient and libsmbclient-php" + }, { "name": "icewind/streams", "version": "0.5.2", @@ -41,48 +84,5 @@ } ], "description": "A set of generic stream wrappers" - }, - { - "name": "icewind/smb", - "version": "v2.0.3", - "version_normalized": "2.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/icewind1991/SMB.git", - "reference": "8394551bf29a37b884edb33dae8acde369177f32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/icewind1991/SMB/zipball/8394551bf29a37b884edb33dae8acde369177f32", - "reference": "8394551bf29a37b884edb33dae8acde369177f32", - "shasum": "" - }, - "require": { - "icewind/streams": ">=0.2.0", - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "time": "2017-10-18T16:21:10+00:00", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-4": { - "Icewind\\SMB\\": "src/", - "Icewind\\SMB\\Test\\": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Robin Appelman", - "email": "icewind@owncloud.com" - } - ], - "description": "php wrapper for smbclient and libsmbclient-php" } ] diff --git a/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php b/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php index a5cfe59a3c..0af03ff569 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php +++ b/apps/files_external/3rdparty/icewind/smb/src/AbstractShare.php @@ -23,4 +23,8 @@ abstract class AbstractShare implements IShare { } } } + + public function setForbiddenChars(array $charList) { + $this->forbiddenCharacters = $charList; + } } diff --git a/apps/files_external/3rdparty/icewind/smb/src/Connection.php b/apps/files_external/3rdparty/icewind/smb/src/Connection.php index c1ebb86171..0196231b08 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Connection.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Connection.php @@ -34,6 +34,15 @@ class Connection extends RawConnection { parent::write($input . PHP_EOL); } + public function clearTillPrompt() { + $this->write(''); + do { + $promptLine = $this->readLine(); + } while (!$this->isPrompt($promptLine)); + $this->write(''); + $this->readLine(); + } + /** * get all unprocessed output from smbclient until the next prompt * diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php b/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php index 228d9cd7d2..9653e6064b 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php +++ b/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php @@ -34,7 +34,6 @@ class NativeShare extends AbstractShare { parent::__construct(); $this->server = $server; $this->name = $name; - $this->state = new NativeState(); } /** @@ -42,12 +41,14 @@ class NativeShare extends AbstractShare { * @throws \Icewind\SMB\Exception\AuthenticationException * @throws \Icewind\SMB\Exception\InvalidHostException */ - protected function connect() { - if ($this->state and $this->state instanceof NativeShare) { - return; + protected function getState() { + if ($this->state and $this->state instanceof NativeState) { + return $this->state; } + $this->state = new NativeState(); $this->state->init($this->server->getWorkgroup(), $this->server->getUser(), $this->server->getPassword()); + return $this->state; } /** @@ -60,7 +61,6 @@ class NativeShare extends AbstractShare { } private function buildUrl($path) { - $this->connect(); $this->verifyPath($path); $url = sprintf('smb://%s/%s', $this->server->getHost(), $this->name); if ($path) { @@ -83,15 +83,15 @@ class NativeShare extends AbstractShare { public function dir($path) { $files = array(); - $dh = $this->state->opendir($this->buildUrl($path)); - while ($file = $this->state->readdir($dh)) { + $dh = $this->getState()->opendir($this->buildUrl($path)); + while ($file = $this->getState()->readdir($dh)) { $name = $file['name']; if ($name !== '.' and $name !== '..') { $files [] = new NativeFileInfo($this, $path . '/' . $name, $name); } } - $this->state->closedir($dh); + $this->getState()->closedir($dh); return $files; } @@ -104,7 +104,7 @@ class NativeShare extends AbstractShare { } public function getStat($path) { - return $this->state->stat($this->buildUrl($path)); + return $this->getState()->stat($this->buildUrl($path)); } /** @@ -117,7 +117,7 @@ class NativeShare extends AbstractShare { * @throws \Icewind\SMB\Exception\AlreadyExistsException */ public function mkdir($path) { - return $this->state->mkdir($this->buildUrl($path)); + return $this->getState()->mkdir($this->buildUrl($path)); } /** @@ -130,7 +130,7 @@ class NativeShare extends AbstractShare { * @throws \Icewind\SMB\Exception\InvalidTypeException */ public function rmdir($path) { - return $this->state->rmdir($this->buildUrl($path)); + return $this->getState()->rmdir($this->buildUrl($path)); } /** @@ -143,7 +143,7 @@ class NativeShare extends AbstractShare { * @throws \Icewind\SMB\Exception\InvalidTypeException */ public function del($path) { - return $this->state->unlink($this->buildUrl($path)); + return $this->getState()->unlink($this->buildUrl($path)); } /** @@ -157,7 +157,7 @@ class NativeShare extends AbstractShare { * @throws \Icewind\SMB\Exception\AlreadyExistsException */ public function rename($from, $to) { - return $this->state->rename($this->buildUrl($from), $this->buildUrl($to)); + return $this->getState()->rename($this->buildUrl($from), $this->buildUrl($to)); } /** @@ -172,12 +172,12 @@ class NativeShare extends AbstractShare { */ public function put($source, $target) { $sourceHandle = fopen($source, 'rb'); - $targetHandle = $this->state->create($this->buildUrl($target)); + $targetHandle = $this->getState()->create($this->buildUrl($target)); while ($data = fread($sourceHandle, NativeReadStream::CHUNK_SIZE)) { - $this->state->write($targetHandle, $data); + $this->getState()->write($targetHandle, $data); } - $this->state->close($targetHandle); + $this->getState()->close($targetHandle); return true; } @@ -208,16 +208,16 @@ class NativeShare extends AbstractShare { throw new InvalidResourceException('Failed opening local file "' . $target . '" for writing: ' . $reason); } - $sourceHandle = $this->state->open($this->buildUrl($source), 'r'); + $sourceHandle = $this->getState()->open($this->buildUrl($source), 'r'); if (!$sourceHandle) { fclose($targetHandle); throw new InvalidResourceException('Failed opening remote file "' . $source . '" for reading'); } - while ($data = $this->state->read($sourceHandle, NativeReadStream::CHUNK_SIZE)) { + while ($data = $this->getState()->read($sourceHandle, NativeReadStream::CHUNK_SIZE)) { fwrite($targetHandle, $data); } - $this->state->close($sourceHandle); + $this->getState()->close($sourceHandle); return true; } @@ -232,8 +232,8 @@ class NativeShare extends AbstractShare { */ public function read($source) { $url = $this->buildUrl($source); - $handle = $this->state->open($url, 'r'); - return NativeReadStream::wrap($this->state, $handle, 'r', $url); + $handle = $this->getState()->open($url, 'r'); + return NativeReadStream::wrap($this->getState(), $handle, 'r', $url); } /** @@ -247,8 +247,8 @@ class NativeShare extends AbstractShare { */ public function write($source) { $url = $this->buildUrl($source); - $handle = $this->state->create($url); - return NativeWriteStream::wrap($this->state, $handle, 'w', $url); + $handle = $this->getState()->create($url); + return NativeWriteStream::wrap($this->getState(), $handle, 'w', $url); } /** @@ -259,7 +259,7 @@ class NativeShare extends AbstractShare { * @return string the attribute value */ public function getAttribute($path, $attribute) { - return $this->state->getxattr($this->buildUrl($path), $attribute); + return $this->getState()->getxattr($this->buildUrl($path), $attribute); } /** @@ -276,7 +276,7 @@ class NativeShare extends AbstractShare { $value = '0x' . dechex($value); } - return $this->state->setxattr($this->buildUrl($path), $attribute, $value); + return $this->getState()->setxattr($this->buildUrl($path), $attribute, $value); } /** diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeState.php b/apps/files_external/3rdparty/icewind/smb/src/NativeState.php index 45e0441d25..036a025504 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/NativeState.php +++ b/apps/files_external/3rdparty/icewind/smb/src/NativeState.php @@ -10,7 +10,7 @@ namespace Icewind\SMB; use Icewind\SMB\Exception\Exception; /** - * Low level wrapper for libsmbclient-php for error handling + * Low level wrapper for libsmbclient-php with error handling */ class NativeState { /** @@ -28,9 +28,11 @@ class NativeState { 1 => '\Icewind\SMB\Exception\ForbiddenException', 2 => '\Icewind\SMB\Exception\NotFoundException', 13 => '\Icewind\SMB\Exception\ForbiddenException', + 16 => '\Icewind\SMB\Exception\FileInUseException', 17 => '\Icewind\SMB\Exception\AlreadyExistsException', 20 => '\Icewind\SMB\Exception\InvalidTypeException', 21 => '\Icewind\SMB\Exception\InvalidTypeException', + 22 => '\Icewind\SMB\Exception\InvalidArgumentException', 28 => '\Icewind\SMB\Exception\OutOfSpaceException', 39 => '\Icewind\SMB\Exception\NotEmptyException', 110 => '\Icewind\SMB\Exception\TimedOutException', @@ -71,6 +73,7 @@ class NativeState { return true; } $this->state = smbclient_state_new(); + smbclient_option_set($this->state, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, false); $result = @smbclient_state_init($this->state, $workGroup, $user, $password); $this->testResult($result, ''); diff --git a/apps/files_external/3rdparty/icewind/smb/src/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Share.php index 542eaf0887..8f1dace2be 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Share.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Share.php @@ -72,6 +72,8 @@ class Share extends AbstractShare { if (!$connection->isValid()) { throw new ConnectionException($connection->readLine()); } + // some versions of smbclient add a help message in first of the first prompt + $connection->clearTillPrompt(); return $connection; } @@ -125,6 +127,7 @@ class Share extends AbstractShare { //check output for errors $this->parseOutput($output, $path); $output = $this->execute('dir'); + $this->execute('cd /'); return $this->parser->parseDir($output, $path);