Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12] update icewind/smb to 2.0.3 #7774

Merged
merged 1 commit into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"classmap-authoritative": true
},
"require": {
"icewind/smb": "2.0.2",
"icewind/smb": "2.0.3",
"icewind/streams": "0.5.2"
}
}
Expand Down
12 changes: 6 additions & 6 deletions apps/files_external/3rdparty/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions apps/files_external/3rdparty/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $firstCharsPsr4 = array();
private $prefixLengthsPsr4 = array(); // For BC with legacy static maps
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();

Expand Down Expand Up @@ -170,11 +171,10 @@ public function addPsr4($prefix, $paths, $prepend = false)
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
if ('\\' !== substr($prefix, -1)) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->firstCharsPsr4[$prefix[0]] = true;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
Expand Down Expand Up @@ -221,11 +221,10 @@ public function setPsr4($prefix, $paths)
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
if ('\\' !== substr($prefix, -1)) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->firstCharsPsr4[$prefix[0]] = true;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
Expand Down Expand Up @@ -373,15 +372,15 @@ private function findFileWithExtension($class, $ext)
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
if (isset($this->firstCharsPsr4[$first]) || isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$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;
}
}
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/3rdparty/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'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\\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',
'Icewind\\SMB\\Exception\\InvalidRequestException' => $vendorDir . '/icewind/smb/src/Exception/InvalidRequestException.php',
'Icewind\\SMB\\Exception\\InvalidResourceException' => $vendorDir . '/icewind/smb/src/Exception/InvalidResourceException.php',
Expand All @@ -30,6 +31,8 @@
'Icewind\\SMB\\Exception\\NoRouteToHostException' => $vendorDir . '/icewind/smb/src/Exception/NoRouteToHostException.php',
'Icewind\\SMB\\Exception\\NotEmptyException' => $vendorDir . '/icewind/smb/src/Exception/NotEmptyException.php',
'Icewind\\SMB\\Exception\\NotFoundException' => $vendorDir . '/icewind/smb/src/Exception/NotFoundException.php',
'Icewind\\SMB\\Exception\\OutOfSpaceException' => $vendorDir . '/icewind/smb/src/Exception/OutOfSpaceException.php',
'Icewind\\SMB\\Exception\\RevisionMismatchException' => $vendorDir . '/icewind/smb/src/Exception/RevisionMismatchException.php',
'Icewind\\SMB\\Exception\\TimedOutException' => $vendorDir . '/icewind/smb/src/Exception/TimedOutException.php',
'Icewind\\SMB\\FileInfo' => $vendorDir . '/icewind/smb/src/FileInfo.php',
'Icewind\\SMB\\IFileInfo' => $vendorDir . '/icewind/smb/src/IFileInfo.php',
Expand Down
15 changes: 6 additions & 9 deletions apps/files_external/3rdparty/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@

class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
{
public static $prefixLengthsPsr4 = array (
'I' =>
array (
'Icewind\\Streams\\Tests\\' => 22,
'Icewind\\Streams\\' => 16,
'Icewind\\SMB\\Test\\' => 17,
'Icewind\\SMB\\' => 12,
),
public static $firstCharsPsr4 = array (
'I' => true,
);

public static $prefixDirsPsr4 = array (
Expand Down Expand Up @@ -52,6 +46,7 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
'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\\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',
'Icewind\\SMB\\Exception\\InvalidRequestException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidRequestException.php',
'Icewind\\SMB\\Exception\\InvalidResourceException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/InvalidResourceException.php',
Expand All @@ -60,6 +55,8 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
'Icewind\\SMB\\Exception\\NoRouteToHostException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NoRouteToHostException.php',
'Icewind\\SMB\\Exception\\NotEmptyException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NotEmptyException.php',
'Icewind\\SMB\\Exception\\NotFoundException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/NotFoundException.php',
'Icewind\\SMB\\Exception\\OutOfSpaceException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/OutOfSpaceException.php',
'Icewind\\SMB\\Exception\\RevisionMismatchException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/RevisionMismatchException.php',
'Icewind\\SMB\\Exception\\TimedOutException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/TimedOutException.php',
'Icewind\\SMB\\FileInfo' => __DIR__ . '/..' . '/icewind/smb/src/FileInfo.php',
'Icewind\\SMB\\IFileInfo' => __DIR__ . '/..' . '/icewind/smb/src/IFileInfo.php',
Expand Down Expand Up @@ -120,7 +117,7 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$prefixLengthsPsr4;
$loader->firstCharsPsr4 = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$firstCharsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::$classMap;

Expand Down
60 changes: 30 additions & 30 deletions apps/files_external/3rdparty/composer/installed.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
[
{
"name": "icewind/streams",
"version": "0.5.2",
"version_normalized": "0.5.2.0",
"name": "icewind/smb",
"version": "v2.0.3",
"version_normalized": "2.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/Streams.git",
"reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e"
"url": "https://github.com/icewind1991/SMB.git",
"reference": "8394551bf29a37b884edb33dae8acde369177f32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/6bfd2fdbd99319f5e010d0a684409189a562cb1e",
"reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/8394551bf29a37b884edb33dae8acde369177f32",
"reference": "8394551bf29a37b884edb33dae8acde369177f32",
"shasum": ""
},
"require": {
"php": ">=5.3"
"icewind/streams": ">=0.2.0",
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
"phpunit/phpunit": "^4.8"
},
"time": "2016-12-02T14:21:23+00:00",
"time": "2017-10-18T16:21:10+00:00",
"type": "library",
"installation-source": "dist",
"installation-source": "source",
"autoload": {
"psr-4": {
"Icewind\\Streams\\Tests\\": "tests/",
"Icewind\\Streams\\": "src/"
"Icewind\\SMB\\": "src/",
"Icewind\\SMB\\Test\\": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
Expand All @@ -40,37 +40,37 @@
"email": "icewind@owncloud.com"
}
],
"description": "A set of generic stream wrappers"
"description": "php wrapper for smbclient and libsmbclient-php"
},
{
"name": "icewind/smb",
"version": "v2.0.2",
"version_normalized": "2.0.2.0",
"name": "icewind/streams",
"version": "0.5.2",
"version_normalized": "0.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
"reference": "6691355d9314ac3a8cb9ec9446e4c26e8aab09d0"
"url": "https://github.com/icewind1991/Streams.git",
"reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/6691355d9314ac3a8cb9ec9446e4c26e8aab09d0",
"reference": "6691355d9314ac3a8cb9ec9446e4c26e8aab09d0",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/6bfd2fdbd99319f5e010d0a684409189a562cb1e",
"reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e",
"shasum": ""
},
"require": {
"icewind/streams": ">=0.2.0",
"php": ">=5.4"
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2017-08-16T16:08:57+00:00",
"time": "2016-12-02T14:21:23+00:00",
"type": "library",
"installation-source": "source",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Icewind\\SMB\\": "src/",
"Icewind\\SMB\\Test\\": "tests/"
"Icewind\\Streams\\Tests\\": "tests/",
"Icewind\\Streams\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
Expand All @@ -83,6 +83,6 @@
"email": "icewind@owncloud.com"
}
],
"description": "php wrapper for smbclient and libsmbclient-php"
"description": "A set of generic stream wrappers"
}
]
4 changes: 3 additions & 1 deletion apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ErrorCodes {
const BadHostName = 'NT_STATUS_BAD_NETWORK_NAME';
const Unsuccessful = 'NT_STATUS_UNSUCCESSFUL';
const ConnectionRefused = 'NT_STATUS_CONNECTION_REFUSED';
const NoLogonServers = 'NT_STATUS_NO_LOGON_SERVERS';
const NoLogonServers = 'NT_STATUS_NO_LOGON_SERVERS';

const PathNotFound = 'NT_STATUS_OBJECT_PATH_NOT_FOUND';
const NoSuchFile = 'NT_STATUS_NO_SUCH_FILE';
Expand All @@ -26,4 +26,6 @@ class ErrorCodes {
const FileIsADirectory = 'NT_STATUS_FILE_IS_A_DIRECTORY';
const NotADirectory = 'NT_STATUS_NOT_A_DIRECTORY';
const SharingViolation = 'NT_STATUS_SHARING_VIOLATION';
const InvalidParameter = 'NT_STATUS_INVALID_PARAMETER';
const RevisionMismatch = 'NT_STATUS_REVISION_MISMATCH';
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static public function unknown($path, $error) {
$message .= ' for ' . $path;
}

return new Exception($message, $error);
return new Exception($message, is_string($error) ? 0 : $error);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Licensed under the MIT license:
* http://opensource.org/licenses/MIT
*/

namespace Icewind\SMB\Exception;

class InvalidParameterException extends InvalidRequestException {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Licensed under the MIT license:
* http://opensource.org/licenses/MIT
*/

namespace Icewind\SMB\Exception;

class OutOfSpaceException extends InvalidRequestException {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Licensed under the MIT license:
* http://opensource.org/licenses/MIT
*/

namespace Icewind\SMB\Exception;

use Throwable;

class RevisionMismatchException extends Exception {
public function __construct($message = 'Protocol version mismatch', $code = 0, Throwable $previous = null) {
parent::__construct($message, $code, $previous);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class NativeState {
17 => '\Icewind\SMB\Exception\AlreadyExistsException',
20 => '\Icewind\SMB\Exception\InvalidTypeException',
21 => '\Icewind\SMB\Exception\InvalidTypeException',
28 => '\Icewind\SMB\Exception\OutOfSpaceException',
39 => '\Icewind\SMB\Exception\NotEmptyException',
110 => '\Icewind\SMB\Exception\TimedOutException',
111 => '\Icewind\SMB\Exception\ConnectionRefusedException',
Expand Down
17 changes: 17 additions & 0 deletions apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace Icewind\SMB;


use Icewind\SMB\Exception\Exception;

class NotifyHandler implements INotifyHandler {
/**
* @var Connection
Expand All @@ -22,6 +24,12 @@ class NotifyHandler implements INotifyHandler {

private $listening = true;

// todo replace with static once <5.6 support is dropped
// see error.h
private static $exceptionMap = [
ErrorCodes::RevisionMismatch => '\Icewind\SMB\Exception\RevisionMismatchException',
];

/**
* @param Connection $connection
* @param string $path
Expand All @@ -43,6 +51,7 @@ public function getChanges() {
stream_set_blocking($this->connection->getOutputStream(), 0);
$lines = [];
while (($line = $this->connection->readLine())) {
$this->checkForError($line);
$lines[] = $line;
}
stream_set_blocking($this->connection->getOutputStream(), 1);
Expand All @@ -59,6 +68,7 @@ public function getChanges() {
public function listen($callback) {
if ($this->listening) {
$this->connection->read(function ($line) use ($callback) {
$this->checkForError($line);
$change = $this->parseChangeLine($line);
if ($change) {
return $callback($change);
Expand All @@ -80,6 +90,13 @@ private function parseChangeLine($line) {
}
}

private function checkForError($line) {
if (substr($line, 0, 16) === 'notify returned ') {
$error = substr($line, 16);
throw Exception::fromMap(self::$exceptionMap, $error, 'Notify is not supported with the used smb version');
}
}

public function stop() {
$this->listening = false;
$this->connection->close();
Expand Down
Loading