summaryrefslogtreecommitdiffstats
path: root/apps/files_external/3rdparty
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-06-21 16:02:51 +0200
committerRobin Appelman <robin@icewind.nl>2018-06-21 16:02:51 +0200
commit4a424f86db7ceeb9f90e925cd76d890c5487af64 (patch)
tree227e1a2b75c5dc438f5db51c1fa59ccba6cad7d7 /apps/files_external/3rdparty
parenta10690c1e9cb3a4b2c84f97e53b798640aae5101 (diff)
downloadnextcloud-server-4a424f86db7ceeb9f90e925cd76d890c5487af64.tar.gz
nextcloud-server-4a424f86db7ceeb9f90e925cd76d890c5487af64.zip
update icewind/smb to 3.0.0
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/3rdparty')
-rw-r--r--apps/files_external/3rdparty/composer.json2
-rw-r--r--apps/files_external/3rdparty/composer.lock18
-rw-r--r--apps/files_external/3rdparty/composer/autoload_classmap.php41
-rw-r--r--apps/files_external/3rdparty/composer/autoload_static.php41
-rw-r--r--apps/files_external/3rdparty/composer/installed.json16
-rw-r--r--apps/files_external/3rdparty/icewind/smb/README.md115
-rw-r--r--apps/files_external/3rdparty/icewind/smb/composer.json4
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/AbstractServer.php85
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/AnonymousAuth.php45
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/BasicAuth.php66
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/IAuth.php53
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php13
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/IServer.php64
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/KerberosAuth.php49
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeFileInfo.php)16
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeReadStream.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeReadStream.php)4
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeServer.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeServer.php)32
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeShare.php)19
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeState.php)59
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeStream.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeStream.php)6
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Native/NativeWriteStream.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NativeWriteStream.php)4
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Server.php166
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/ServerFactory.php64
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/System.php4
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php (renamed from apps/files_external/3rdparty/icewind/smb/src/Connection.php)2
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/ErrorCodes.php (renamed from apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php)2
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/FileInfo.php (renamed from apps/files_external/3rdparty/icewind/smb/src/FileInfo.php)27
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/NotifyHandler.php (renamed from apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php)12
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php (renamed from apps/files_external/3rdparty/icewind/smb/src/Parser.php)55
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/RawConnection.php (renamed from apps/files_external/3rdparty/icewind/smb/src/RawConnection.php)7
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/Server.php90
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php (renamed from apps/files_external/3rdparty/icewind/smb/src/Share.php)53
32 files changed, 815 insertions, 419 deletions
diff --git a/apps/files_external/3rdparty/composer.json b/apps/files_external/3rdparty/composer.json
index 9655a8f1564..537159bbf66 100644
--- a/apps/files_external/3rdparty/composer.json
+++ b/apps/files_external/3rdparty/composer.json
@@ -9,6 +9,6 @@
},
"require": {
"icewind/streams": "0.5.2",
- "icewind/smb": "2.0.5"
+ "icewind/smb": "3.0.0"
}
}
diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock
index f3987e2c1e3..7bfcdba3d2f 100644
--- a/apps/files_external/3rdparty/composer.lock
+++ b/apps/files_external/3rdparty/composer.lock
@@ -1,31 +1,31 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "53a1e7ab19e98c20c720cab0340bc56a",
+ "content-hash": "0235b6f1a4131c9312afef7a58f3a80e",
"packages": [
{
"name": "icewind/smb",
- "version": "v2.0.5",
+ "version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
- "reference": "b888dd81bd05532677e1469849d9065011256a33"
+ "reference": "0d31da4757a37d322e1e181f2286e8a4c89fbc0c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/icewind1991/SMB/zipball/b888dd81bd05532677e1469849d9065011256a33",
- "reference": "b888dd81bd05532677e1469849d9065011256a33",
+ "url": "https://api.github.com/repos/icewind1991/SMB/zipball/0d31da4757a37d322e1e181f2286e8a4c89fbc0c",
+ "reference": "0d31da4757a37d322e1e181f2286e8a4c89fbc0c",
"shasum": ""
},
"require": {
"icewind/streams": ">=0.2.0",
- "php": ">=5.4"
+ "php": ">=5.6"
},
"require-dev": {
- "phpunit/phpunit": "^4.8"
+ "phpunit/phpunit": "^5.7"
},
"type": "library",
"autoload": {
@@ -45,7 +45,7 @@
}
],
"description": "php wrapper for smbclient and libsmbclient-php",
- "time": "2018-03-28T13:51:31+00:00"
+ "time": "2018-05-24T09:48:51+00:00"
},
{
"name": "icewind/streams",
diff --git a/apps/files_external/3rdparty/composer/autoload_classmap.php b/apps/files_external/3rdparty/composer/autoload_classmap.php
index b4a1d64eb0f..d2e658d9f61 100644
--- a/apps/files_external/3rdparty/composer/autoload_classmap.php
+++ b/apps/files_external/3rdparty/composer/autoload_classmap.php
@@ -6,10 +6,11 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = $vendorDir;
return array(
+ 'Icewind\\SMB\\AbstractServer' => $vendorDir . '/icewind/smb/src/AbstractServer.php',
'Icewind\\SMB\\AbstractShare' => $vendorDir . '/icewind/smb/src/AbstractShare.php',
+ 'Icewind\\SMB\\AnonymousAuth' => $vendorDir . '/icewind/smb/src/AnonymousAuth.php',
+ 'Icewind\\SMB\\BasicAuth' => $vendorDir . '/icewind/smb/src/BasicAuth.php',
'Icewind\\SMB\\Change' => $vendorDir . '/icewind/smb/src/Change.php',
- 'Icewind\\SMB\\Connection' => $vendorDir . '/icewind/smb/src/Connection.php',
- 'Icewind\\SMB\\ErrorCodes' => $vendorDir . '/icewind/smb/src/ErrorCodes.php',
'Icewind\\SMB\\Exception\\AccessDeniedException' => $vendorDir . '/icewind/smb/src/Exception/AccessDeniedException.php',
'Icewind\\SMB\\Exception\\AlreadyExistsException' => $vendorDir . '/icewind/smb/src/Exception/AlreadyExistsException.php',
'Icewind\\SMB\\Exception\\AuthenticationException' => $vendorDir . '/icewind/smb/src/Exception/AuthenticationException.php',
@@ -35,32 +36,38 @@ return array(
'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\\IAuth' => $vendorDir . '/icewind/smb/src/IAuth.php',
'Icewind\\SMB\\IFileInfo' => $vendorDir . '/icewind/smb/src/IFileInfo.php',
'Icewind\\SMB\\INotifyHandler' => $vendorDir . '/icewind/smb/src/INotifyHandler.php',
+ 'Icewind\\SMB\\IServer' => $vendorDir . '/icewind/smb/src/IServer.php',
'Icewind\\SMB\\IShare' => $vendorDir . '/icewind/smb/src/IShare.php',
- 'Icewind\\SMB\\NativeFileInfo' => $vendorDir . '/icewind/smb/src/NativeFileInfo.php',
- 'Icewind\\SMB\\NativeReadStream' => $vendorDir . '/icewind/smb/src/NativeReadStream.php',
- 'Icewind\\SMB\\NativeServer' => $vendorDir . '/icewind/smb/src/NativeServer.php',
- 'Icewind\\SMB\\NativeShare' => $vendorDir . '/icewind/smb/src/NativeShare.php',
- 'Icewind\\SMB\\NativeState' => $vendorDir . '/icewind/smb/src/NativeState.php',
- 'Icewind\\SMB\\NativeStream' => $vendorDir . '/icewind/smb/src/NativeStream.php',
- 'Icewind\\SMB\\NativeWriteStream' => $vendorDir . '/icewind/smb/src/NativeWriteStream.php',
- 'Icewind\\SMB\\NotifyHandler' => $vendorDir . '/icewind/smb/src/NotifyHandler.php',
- 'Icewind\\SMB\\Parser' => $vendorDir . '/icewind/smb/src/Parser.php',
- 'Icewind\\SMB\\RawConnection' => $vendorDir . '/icewind/smb/src/RawConnection.php',
- 'Icewind\\SMB\\Server' => $vendorDir . '/icewind/smb/src/Server.php',
- 'Icewind\\SMB\\Share' => $vendorDir . '/icewind/smb/src/Share.php',
+ 'Icewind\\SMB\\KerberosAuth' => $vendorDir . '/icewind/smb/src/KerberosAuth.php',
+ 'Icewind\\SMB\\Native\\NativeFileInfo' => $vendorDir . '/icewind/smb/src/Native/NativeFileInfo.php',
+ 'Icewind\\SMB\\Native\\NativeReadStream' => $vendorDir . '/icewind/smb/src/Native/NativeReadStream.php',
+ 'Icewind\\SMB\\Native\\NativeServer' => $vendorDir . '/icewind/smb/src/Native/NativeServer.php',
+ 'Icewind\\SMB\\Native\\NativeShare' => $vendorDir . '/icewind/smb/src/Native/NativeShare.php',
+ 'Icewind\\SMB\\Native\\NativeState' => $vendorDir . '/icewind/smb/src/Native/NativeState.php',
+ 'Icewind\\SMB\\Native\\NativeStream' => $vendorDir . '/icewind/smb/src/Native/NativeStream.php',
+ 'Icewind\\SMB\\Native\\NativeWriteStream' => $vendorDir . '/icewind/smb/src/Native/NativeWriteStream.php',
+ 'Icewind\\SMB\\ServerFactory' => $vendorDir . '/icewind/smb/src/ServerFactory.php',
'Icewind\\SMB\\System' => $vendorDir . '/icewind/smb/src/System.php',
'Icewind\\SMB\\Test\\AbstractShareTest' => $vendorDir . '/icewind/smb/tests/AbstractShareTest.php',
- 'Icewind\\SMB\\Test\\NativeShareTestTest' => $vendorDir . '/icewind/smb/tests/NativeShareTestTest.php',
+ 'Icewind\\SMB\\Test\\NativeShareTest' => $vendorDir . '/icewind/smb/tests/NativeShareTest.php',
'Icewind\\SMB\\Test\\NativeStreamTest' => $vendorDir . '/icewind/smb/tests/NativeStreamTest.php',
'Icewind\\SMB\\Test\\NotifyHandlerTest' => $vendorDir . '/icewind/smb/tests/NotifyHandlerTest.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\\ShareTest' => $vendorDir . '/icewind/smb/tests/ShareTest.php',
'Icewind\\SMB\\Test\\TestCase' => $vendorDir . '/icewind/smb/tests/TestCase.php',
'Icewind\\SMB\\TimeZoneProvider' => $vendorDir . '/icewind/smb/src/TimeZoneProvider.php',
+ 'Icewind\\SMB\\Wrapped\\Connection' => $vendorDir . '/icewind/smb/src/Wrapped/Connection.php',
+ 'Icewind\\SMB\\Wrapped\\ErrorCodes' => $vendorDir . '/icewind/smb/src/Wrapped/ErrorCodes.php',
+ 'Icewind\\SMB\\Wrapped\\FileInfo' => $vendorDir . '/icewind/smb/src/Wrapped/FileInfo.php',
+ 'Icewind\\SMB\\Wrapped\\NotifyHandler' => $vendorDir . '/icewind/smb/src/Wrapped/NotifyHandler.php',
+ 'Icewind\\SMB\\Wrapped\\Parser' => $vendorDir . '/icewind/smb/src/Wrapped/Parser.php',
+ 'Icewind\\SMB\\Wrapped\\RawConnection' => $vendorDir . '/icewind/smb/src/Wrapped/RawConnection.php',
+ 'Icewind\\SMB\\Wrapped\\Server' => $vendorDir . '/icewind/smb/src/Wrapped/Server.php',
+ 'Icewind\\SMB\\Wrapped\\Share' => $vendorDir . '/icewind/smb/src/Wrapped/Share.php',
'Icewind\\Streams\\CallbackWrapper' => $vendorDir . '/icewind/streams/src/CallbackWrapper.php',
'Icewind\\Streams\\Directory' => $vendorDir . '/icewind/streams/src/Directory.php',
'Icewind\\Streams\\DirectoryFilter' => $vendorDir . '/icewind/streams/src/DirectoryFilter.php',
diff --git a/apps/files_external/3rdparty/composer/autoload_static.php b/apps/files_external/3rdparty/composer/autoload_static.php
index 68698ad1bf8..3234d89e5b9 100644
--- a/apps/files_external/3rdparty/composer/autoload_static.php
+++ b/apps/files_external/3rdparty/composer/autoload_static.php
@@ -36,10 +36,11 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
);
public static $classMap = array (
+ 'Icewind\\SMB\\AbstractServer' => __DIR__ . '/..' . '/icewind/smb/src/AbstractServer.php',
'Icewind\\SMB\\AbstractShare' => __DIR__ . '/..' . '/icewind/smb/src/AbstractShare.php',
+ 'Icewind\\SMB\\AnonymousAuth' => __DIR__ . '/..' . '/icewind/smb/src/AnonymousAuth.php',
+ 'Icewind\\SMB\\BasicAuth' => __DIR__ . '/..' . '/icewind/smb/src/BasicAuth.php',
'Icewind\\SMB\\Change' => __DIR__ . '/..' . '/icewind/smb/src/Change.php',
- 'Icewind\\SMB\\Connection' => __DIR__ . '/..' . '/icewind/smb/src/Connection.php',
- 'Icewind\\SMB\\ErrorCodes' => __DIR__ . '/..' . '/icewind/smb/src/ErrorCodes.php',
'Icewind\\SMB\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AccessDeniedException.php',
'Icewind\\SMB\\Exception\\AlreadyExistsException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AlreadyExistsException.php',
'Icewind\\SMB\\Exception\\AuthenticationException' => __DIR__ . '/..' . '/icewind/smb/src/Exception/AuthenticationException.php',
@@ -65,32 +66,38 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
'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\\IAuth' => __DIR__ . '/..' . '/icewind/smb/src/IAuth.php',
'Icewind\\SMB\\IFileInfo' => __DIR__ . '/..' . '/icewind/smb/src/IFileInfo.php',
'Icewind\\SMB\\INotifyHandler' => __DIR__ . '/..' . '/icewind/smb/src/INotifyHandler.php',
+ 'Icewind\\SMB\\IServer' => __DIR__ . '/..' . '/icewind/smb/src/IServer.php',
'Icewind\\SMB\\IShare' => __DIR__ . '/..' . '/icewind/smb/src/IShare.php',
- 'Icewind\\SMB\\NativeFileInfo' => __DIR__ . '/..' . '/icewind/smb/src/NativeFileInfo.php',
- 'Icewind\\SMB\\NativeReadStream' => __DIR__ . '/..' . '/icewind/smb/src/NativeReadStream.php',
- 'Icewind\\SMB\\NativeServer' => __DIR__ . '/..' . '/icewind/smb/src/NativeServer.php',
- 'Icewind\\SMB\\NativeShare' => __DIR__ . '/..' . '/icewind/smb/src/NativeShare.php',
- 'Icewind\\SMB\\NativeState' => __DIR__ . '/..' . '/icewind/smb/src/NativeState.php',
- 'Icewind\\SMB\\NativeStream' => __DIR__ . '/..' . '/icewind/smb/src/NativeStream.php',
- 'Icewind\\SMB\\NativeWriteStream' => __DIR__ . '/..' . '/icewind/smb/src/NativeWriteStream.php',
- 'Icewind\\SMB\\NotifyHandler' => __DIR__ . '/..' . '/icewind/smb/src/NotifyHandler.php',
- 'Icewind\\SMB\\Parser' => __DIR__ . '/..' . '/icewind/smb/src/Parser.php',
- 'Icewind\\SMB\\RawConnection' => __DIR__ . '/..' . '/icewind/smb/src/RawConnection.php',
- 'Icewind\\SMB\\Server' => __DIR__ . '/..' . '/icewind/smb/src/Server.php',
- 'Icewind\\SMB\\Share' => __DIR__ . '/..' . '/icewind/smb/src/Share.php',
+ 'Icewind\\SMB\\KerberosAuth' => __DIR__ . '/..' . '/icewind/smb/src/KerberosAuth.php',
+ 'Icewind\\SMB\\Native\\NativeFileInfo' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeFileInfo.php',
+ 'Icewind\\SMB\\Native\\NativeReadStream' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeReadStream.php',
+ 'Icewind\\SMB\\Native\\NativeServer' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeServer.php',
+ 'Icewind\\SMB\\Native\\NativeShare' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeShare.php',
+ 'Icewind\\SMB\\Native\\NativeState' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeState.php',
+ 'Icewind\\SMB\\Native\\NativeStream' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeStream.php',
+ 'Icewind\\SMB\\Native\\NativeWriteStream' => __DIR__ . '/..' . '/icewind/smb/src/Native/NativeWriteStream.php',
+ 'Icewind\\SMB\\ServerFactory' => __DIR__ . '/..' . '/icewind/smb/src/ServerFactory.php',
'Icewind\\SMB\\System' => __DIR__ . '/..' . '/icewind/smb/src/System.php',
'Icewind\\SMB\\Test\\AbstractShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/AbstractShareTest.php',
- 'Icewind\\SMB\\Test\\NativeShareTestTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeShareTestTest.php',
+ 'Icewind\\SMB\\Test\\NativeShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeShareTest.php',
'Icewind\\SMB\\Test\\NativeStreamTest' => __DIR__ . '/..' . '/icewind/smb/tests/NativeStreamTest.php',
'Icewind\\SMB\\Test\\NotifyHandlerTest' => __DIR__ . '/..' . '/icewind/smb/tests/NotifyHandlerTest.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\\ShareTest' => __DIR__ . '/..' . '/icewind/smb/tests/ShareTest.php',
'Icewind\\SMB\\Test\\TestCase' => __DIR__ . '/..' . '/icewind/smb/tests/TestCase.php',
'Icewind\\SMB\\TimeZoneProvider' => __DIR__ . '/..' . '/icewind/smb/src/TimeZoneProvider.php',
+ 'Icewind\\SMB\\Wrapped\\Connection' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/Connection.php',
+ 'Icewind\\SMB\\Wrapped\\ErrorCodes' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/ErrorCodes.php',
+ 'Icewind\\SMB\\Wrapped\\FileInfo' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/FileInfo.php',
+ 'Icewind\\SMB\\Wrapped\\NotifyHandler' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/NotifyHandler.php',
+ 'Icewind\\SMB\\Wrapped\\Parser' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/Parser.php',
+ 'Icewind\\SMB\\Wrapped\\RawConnection' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/RawConnection.php',
+ 'Icewind\\SMB\\Wrapped\\Server' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/Server.php',
+ 'Icewind\\SMB\\Wrapped\\Share' => __DIR__ . '/..' . '/icewind/smb/src/Wrapped/Share.php',
'Icewind\\Streams\\CallbackWrapper' => __DIR__ . '/..' . '/icewind/streams/src/CallbackWrapper.php',
'Icewind\\Streams\\Directory' => __DIR__ . '/..' . '/icewind/streams/src/Directory.php',
'Icewind\\Streams\\DirectoryFilter' => __DIR__ . '/..' . '/icewind/streams/src/DirectoryFilter.php',
diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json
index 0ae6be99ffd..3b2870a13bf 100644
--- a/apps/files_external/3rdparty/composer/installed.json
+++ b/apps/files_external/3rdparty/composer/installed.json
@@ -1,27 +1,27 @@
[
{
"name": "icewind/smb",
- "version": "v2.0.5",
- "version_normalized": "2.0.5.0",
+ "version": "v3.0.0",
+ "version_normalized": "3.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
- "reference": "b888dd81bd05532677e1469849d9065011256a33"
+ "reference": "0d31da4757a37d322e1e181f2286e8a4c89fbc0c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/icewind1991/SMB/zipball/b888dd81bd05532677e1469849d9065011256a33",
- "reference": "b888dd81bd05532677e1469849d9065011256a33",
+ "url": "https://api.github.com/repos/icewind1991/SMB/zipball/0d31da4757a37d322e1e181f2286e8a4c89fbc0c",
+ "reference": "0d31da4757a37d322e1e181f2286e8a4c89fbc0c",
"shasum": ""
},
"require": {
"icewind/streams": ">=0.2.0",
- "php": ">=5.4"
+ "php": ">=5.6"
},
"require-dev": {
- "phpunit/phpunit": "^4.8"
+ "phpunit/phpunit": "^5.7"
},
- "time": "2018-03-28T13:51:31+00:00",
+ "time": "2018-05-24T09:48:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
diff --git a/apps/files_external/3rdparty/icewind/smb/README.md b/apps/files_external/3rdparty/icewind/smb/README.md
index c8f31193c83..fd47f1a4393 100644
--- a/apps/files_external/3rdparty/icewind/smb/README.md
+++ b/apps/files_external/3rdparty/icewind/smb/README.md
@@ -16,45 +16,58 @@ PHP wrapper for `smbclient` and [`libsmbclient-php`](https://github.com/eduardok
Examples
----
-### Upload a file ###
+### Connect to a share ###
```php
<?php
-use Icewind\SMB\Server;
+use Icewind\SMB\ServerFactory;
+use Icewind\SMB\BasicAuth;
require('vendor/autoload.php');
-$fileToUpload = __FILE__;
+$serverFactory = new ServerFactory();
+$auth = new BasicAuth('test', 'workgroup', 'test');
+$server = $serverFactory->createServer('localhost', $auth);
-$server = new Server('localhost', 'test', 'test');
$share = $server->getShare('test');
-$share->put($fileToUpload, 'example.txt');
```
-### Download a file ###
+The server factory will automatically pick between the `smbclient` and `libsmbclient-php`
+based backend depending on what is available.
+
+### Using anonymous authentication ###
```php
-<?php
-use Icewind\SMB\Server;
+$serverFactory = new ServerFactory();
+$auth = new AnonymousAuth();
+$server = $serverFactory->createServer('localhost', $auth);
+```
-require('vendor/autoload.php');
+### Using kerberos authentication ###
+
+```php
+$serverFactory = new ServerFactory();
+$auth = new KerberosAuth();
+$server = $serverFactory->createServer('localhost', $auth);
+```
-$target = __DIR__ . '/target.txt';
+Note that this requires a valid kerberos ticket to already be available for php
-$server = new Server('localhost', 'test', 'test');
-$share = $server->getShare('test');
-$share->get('example.txt', $target);
+### Upload a file ###
+
+```php
+$share->put($fileToUpload, 'example.txt');
```
-### List shares on the remote server ###
+### Download a file ###
```php
-<?php
-use Icewind\SMB\Server;
+$share->get('example.txt', $target);
+```
-require('vendor/autoload.php');
+### List shares on the remote server ###
-$server = new Server('localhost', 'test', 'test');
+```php
$shares = $server->listShares();
foreach ($shares as $share) {
@@ -65,13 +78,6 @@ foreach ($shares as $share) {
### List the content of a folder ###
```php
-<?php
-use Icewind\SMB\Server;
-
-require('vendor/autoload.php');
-
-$server = new Server('localhost', 'test', 'test');
-$share = $server->getShare('test');
$content = $share->dir('test');
foreach ($content as $info) {
@@ -83,14 +89,6 @@ foreach ($content as $info) {
### Using read streams
```php
-<?php
-use Icewind\SMB\Server;
-
-require('vendor/autoload.php');
-
-$server = new Server('localhost', 'test', 'test');
-$share = $server->getShare('test');
-
$fh = $share->read('test.txt');
echo fread($fh, 4086);
fclose($fh);
@@ -99,54 +97,27 @@ fclose($fh);
### Using write streams
```php
-<?php
-use Icewind\SMB\Server;
-
-require('vendor/autoload.php');
-
-$server = new Server('localhost', 'test', 'test');
-$share = $server->getShare('test');
-
$fh = $share->write('test.txt');
fwrite($fh, 'bar');
fclose($fh);
```
-### Using libsmbclient-php ###
-
-Install [libsmbclient-php](https://github.com/eduardok/libsmbclient-php)
-
-```php
-<?php
-use Icewind\SMB\Server;
-use Icewind\SMB\NativeServer;
-
-require('vendor/autoload.php');
-
-$fileToUpload = __FILE__;
-
-if (Server::NativeAvailable()) {
- $server = new NativeServer('localhost', 'test', 'test');
-} else {
- echo 'libsmbclient-php not available, falling back to wrapping smbclient';
- $server = new Server('localhost', 'test', 'test');
-}
-$share = $server->getShare('test');
-$share->put($fileToUpload, 'example.txt');
-```
-
### Using notify
```php
-<?php
-use Icewind\SMB\Server;
-
-require('vendor/autoload.php');
-
-$server = new Server('localhost', 'test', 'test');
-$share = $server->getShare('test');
-
$share->notify('')->listen(function (\Icewind\SMB\Change $change) {
echo $change->getCode() . ': ' . $change->getPath() . "\n";
});
```
+
+## Testing SMB
+
+Use the following steps to check if the library can connect to your SMB share.
+
+1. Clone this repository or download the source as [zip](https://github.com/icewind1991/SMB/archive/master.zip)
+2. Make sure [composer](https://getcomposer.org/) is installed
+3. Run `composer install` in the root of the repository
+4. Edit `example.php` with the relevant settings for your share.
+5. Run `php example.php`
+
+If everything works correctly then the contents of the share should be outputted.
diff --git a/apps/files_external/3rdparty/icewind/smb/composer.json b/apps/files_external/3rdparty/icewind/smb/composer.json
index 8374f564bf1..708c59bc725 100644
--- a/apps/files_external/3rdparty/icewind/smb/composer.json
+++ b/apps/files_external/3rdparty/icewind/smb/composer.json
@@ -9,11 +9,11 @@
}
],
"require" : {
- "php": ">=5.4",
+ "php": ">=5.6",
"icewind/streams": ">=0.2.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.8"
+ "phpunit/phpunit": "^5.7"
},
"autoload" : {
"psr-4": {
diff --git a/apps/files_external/3rdparty/icewind/smb/src/AbstractServer.php b/apps/files_external/3rdparty/icewind/smb/src/AbstractServer.php
new file mode 100644
index 00000000000..7fa87a59573
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/AbstractServer.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+
+abstract class AbstractServer implements IServer {
+ const LOCALE = 'en_US.UTF-8';
+
+ /**
+ * @var string $host
+ */
+ protected $host;
+
+ /**
+ * @var IAuth $user
+ */
+ protected $auth;
+
+ /**
+ * @var \Icewind\SMB\System
+ */
+ protected $system;
+
+ /**
+ * @var TimeZoneProvider
+ */
+ protected $timezoneProvider;
+
+ /**
+ * @param string $host
+ * @param IAuth $auth
+ * @param System $system
+ * @param TimeZoneProvider $timeZoneProvider
+ */
+ public function __construct($host, IAuth $auth, System $system, TimeZoneProvider $timeZoneProvider) {
+ $this->host = $host;
+ $this->auth = $auth;
+ $this->system = $system;
+ $this->timezoneProvider = $timeZoneProvider;
+ }
+
+ /**
+ * @return IAuth
+ */
+ public function getAuth() {
+ return $this->auth;
+ }
+
+ /**
+ * return string
+ */
+ public function getHost() {
+ return $this->host;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTimeZone() {
+ return $this->timezoneProvider->get();
+ }
+
+ public function getSystem() {
+ return $this->system;
+ }
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/AnonymousAuth.php b/apps/files_external/3rdparty/icewind/smb/src/AnonymousAuth.php
new file mode 100644
index 00000000000..6d1feacf1ee
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/AnonymousAuth.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+
+class AnonymousAuth implements IAuth {
+ public function getUsername() {
+ return null;
+ }
+
+ public function getWorkgroup() {
+ return 'dummy';
+ }
+
+ public function getPassword() {
+ return null;
+ }
+
+ public function getExtraCommandLineArguments() {
+ return '-N';
+ }
+
+ public function setExtraSmbClientOptions($smbClientState) {
+ smbclient_option_set($smbClientState, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, true);
+ }
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/BasicAuth.php b/apps/files_external/3rdparty/icewind/smb/src/BasicAuth.php
new file mode 100644
index 00000000000..0032dc53034
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/BasicAuth.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+
+class BasicAuth implements IAuth {
+ /** @var string */
+ private $username;
+ /** @var string */
+ private $workgroup;
+ /** @var string */
+ private $password;
+
+ /**
+ * BasicAuth constructor.
+ *
+ * @param string $username
+ * @param string $workgroup
+ * @param string $password
+ */
+ public function __construct($username, $workgroup, $password) {
+ $this->username = $username;
+ $this->workgroup = $workgroup;
+ $this->password = $password;
+ }
+
+ public function getUsername() {
+ return $this->username;
+ }
+
+ public function getWorkgroup() {
+ return $this->workgroup;
+ }
+
+ public function getPassword() {
+ return $this->password;
+ }
+
+ public function getExtraCommandLineArguments() {
+ return ($this->workgroup) ? '-W ' . escapeshellarg($this->workgroup) : '';
+ }
+
+ public function setExtraSmbClientOptions($smbClientState) {
+ // noop
+ }
+
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/IAuth.php b/apps/files_external/3rdparty/icewind/smb/src/IAuth.php
new file mode 100644
index 00000000000..731b315ebaa
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/IAuth.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+interface IAuth {
+ /**
+ * @return string|null
+ */
+ public function getUsername();
+
+ /**
+ * @return string|null
+ */
+ public function getWorkgroup();
+
+ /**
+ * @return string|null
+ */
+ public function getPassword();
+
+ /**
+ * Any extra command line option for smbclient that are required
+ *
+ * @return string
+ */
+ public function getExtraCommandLineArguments();
+
+ /**
+ * Set any extra options for libsmbclient that are required
+ *
+ * @param resource $smbClientState
+ */
+ public function setExtraSmbClientOptions($smbClientState);
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php b/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php
index 16ea8cfbd04..ae8acd3a3db 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/IFileInfo.php
@@ -8,6 +8,19 @@
namespace Icewind\SMB;
interface IFileInfo {
+ /*
+ * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
+ * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
+ * "system.*") is specified.
+ */
+ const MODE_READONLY = 0x01;
+ const MODE_HIDDEN = 0x02;
+ const MODE_SYSTEM = 0x04;
+ const MODE_VOLUME_ID = 0x08;
+ const MODE_DIRECTORY = 0x10;
+ const MODE_ARCHIVE = 0x20;
+ const MODE_NORMAL = 0x80;
+
/**
* @return string
*/
diff --git a/apps/files_external/3rdparty/icewind/smb/src/IServer.php b/apps/files_external/3rdparty/icewind/smb/src/IServer.php
new file mode 100644
index 00000000000..2c8d5c67de2
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/IServer.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+interface IServer {
+ /**
+ * @return IAuth
+ */
+ public function getAuth();
+
+ /**
+ * @return string
+ */
+ public function getHost();
+
+ /**
+ * @return \Icewind\SMB\IShare[]
+ *
+ * @throws \Icewind\SMB\Exception\AuthenticationException
+ * @throws \Icewind\SMB\Exception\InvalidHostException
+ */
+ public function listShares();
+
+ /**
+ * @param string $name
+ * @return \Icewind\SMB\IShare
+ */
+ public function getShare($name);
+
+ /**
+ * @return string
+ */
+ public function getTimeZone();
+
+ /**
+ * @return System
+ */
+ public function getSystem();
+
+ /**
+ * @param System $system
+ * @return bool
+ */
+ public static function available(System $system);
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/KerberosAuth.php b/apps/files_external/3rdparty/icewind/smb/src/KerberosAuth.php
new file mode 100644
index 00000000000..9510a6dc277
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/KerberosAuth.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+/**
+ * Use existing kerberos ticket to authenticate
+ */
+class KerberosAuth implements IAuth {
+ public function getUsername() {
+ return 'dummy';
+ }
+
+ public function getWorkgroup() {
+ return 'dummy';
+ }
+
+ public function getPassword() {
+ return null;
+ }
+
+ public function getExtraCommandLineArguments() {
+ return '-k';
+ }
+
+ public function setExtraSmbClientOptions($smbClientState) {
+ smbclient_option_set($smbClientState, SMBCLIENT_OPT_USE_KERBEROS, true);
+ smbclient_option_set($smbClientState, SMBCLIENT_OPT_FALLBACK_AFTER_KERBEROS, false);
+ }
+
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeFileInfo.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php
index 6cb070196a6..3466797e21b 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeFileInfo.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php
@@ -5,7 +5,9 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
+
+use Icewind\SMB\IFileInfo;
class NativeFileInfo implements IFileInfo {
const MODE_FILE = 0100000;
@@ -21,7 +23,7 @@ class NativeFileInfo implements IFileInfo {
protected $name;
/**
- * @var \Icewind\SMB\NativeShare
+ * @var NativeShare
*/
protected $share;
@@ -36,7 +38,7 @@ class NativeFileInfo implements IFileInfo {
protected $modeCache;
/**
- * @param \Icewind\SMB\NativeShare $share
+ * @param NativeShare $share
* @param string $path
* @param string $name
* @param array $stat
@@ -113,7 +115,7 @@ class NativeFileInfo implements IFileInfo {
*/
public function isReadOnly() {
$mode = $this->getMode();
- return (bool)($mode & FileInfo::MODE_READONLY);
+ return (bool)($mode & IFileInfo::MODE_READONLY);
}
/**
@@ -121,7 +123,7 @@ class NativeFileInfo implements IFileInfo {
*/
public function isHidden() {
$mode = $this->getMode();
- return (bool)($mode & FileInfo::MODE_HIDDEN);
+ return (bool)($mode & IFileInfo::MODE_HIDDEN);
}
/**
@@ -129,7 +131,7 @@ class NativeFileInfo implements IFileInfo {
*/
public function isSystem() {
$mode = $this->getMode();
- return (bool)($mode & FileInfo::MODE_SYSTEM);
+ return (bool)($mode & IFileInfo::MODE_SYSTEM);
}
/**
@@ -137,6 +139,6 @@ class NativeFileInfo implements IFileInfo {
*/
public function isArchived() {
$mode = $this->getMode();
- return (bool)($mode & FileInfo::MODE_ARCHIVE);
+ return (bool)($mode & IFileInfo::MODE_ARCHIVE);
}
}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeReadStream.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeReadStream.php
index 6fd4f5b7f35..3ef5b21639f 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeReadStream.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeReadStream.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
/**
* Stream optimized for read only usage
@@ -38,7 +38,7 @@ class NativeReadStream extends NativeStream {
* @return resource
*/
public static function wrap($state, $smbStream, $mode, $url) {
- stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeReadStream');
+ stream_wrapper_register('nativesmb', NativeReadStream::class);
$context = stream_context_create(array(
'nativesmb' => array(
'state' => $state,
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeServer.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeServer.php
index ce8e6d636a9..c6274e59b5f 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeServer.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeServer.php
@@ -5,26 +5,32 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
-class NativeServer extends Server {
+use Icewind\SMB\AbstractServer;
+use Icewind\SMB\IAuth;
+use Icewind\SMB\System;
+use Icewind\SMB\TimeZoneProvider;
+
+class NativeServer extends AbstractServer {
/**
- * @var \Icewind\SMB\NativeState
+ * @var NativeState
*/
protected $state;
/**
* @param string $host
- * @param string $user
- * @param string $password
+ * @param IAuth $auth
+ * @param System $system
+ * @param TimeZoneProvider $timeZoneProvider
*/
- public function __construct($host, $user, $password) {
- parent::__construct($host, $user, $password);
+ public function __construct($host, IAuth $auth, System $system, TimeZoneProvider $timeZoneProvider) {
+ parent::__construct($host, $auth, $system, $timeZoneProvider);
$this->state = new NativeState();
}
protected function connect() {
- $this->state->init($this->getWorkgroup(), $this->getUser(), $this->getPassword());
+ $this->state->init($this->getAuth());
}
/**
@@ -52,4 +58,14 @@ class NativeServer extends Server {
public function getShare($name) {
return new NativeShare($this, $name);
}
+
+ /**
+ * Check if the smbclient php extension is available
+ *
+ * @param System $system
+ * @return bool
+ */
+ public static function available(System $system) {
+ return function_exists('smbclient_state_new');
+ }
}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php
index 9653e6064b2..130a5a070ff 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeShare.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php
@@ -5,14 +5,20 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
+use Icewind\SMB\AbstractShare;
+use Icewind\SMB\Exception\DependencyException;
use Icewind\SMB\Exception\InvalidPathException;
use Icewind\SMB\Exception\InvalidResourceException;
+use Icewind\SMB\INotifyHandler;
+use Icewind\SMB\IServer;
+use Icewind\SMB\Wrapped\Server;
+use Icewind\SMB\Wrapped\Share;
class NativeShare extends AbstractShare {
/**
- * @var Server $server
+ * @var IServer $server
*/
private $server;
@@ -22,12 +28,12 @@ class NativeShare extends AbstractShare {
private $name;
/**
- * @var \Icewind\SMB\NativeState $state
+ * @var NativeState $state
*/
private $state;
/**
- * @param Server $server
+ * @param IServer $server
* @param string $name
*/
public function __construct($server, $name) {
@@ -47,7 +53,7 @@ class NativeShare extends AbstractShare {
}
$this->state = new NativeState();
- $this->state->init($this->server->getWorkgroup(), $this->server->getUser(), $this->server->getPassword());
+ $this->state->init($this->server->getAuth());
return $this->state;
}
@@ -295,6 +301,9 @@ class NativeShare extends AbstractShare {
public function notify($path) {
// php-smbclient does support notify (https://github.com/eduardok/libsmbclient-php/issues/29)
// so we use the smbclient based backend for this
+ if (!Server::available($this->server->getSystem())) {
+ throw new DependencyException('smbclient not found in path for notify command');
+ }
$share = new Share($this->server, $this->getName());
return $share->notify($path);
}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeState.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php
index 036a0255048..179ba95beac 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeState.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php
@@ -5,9 +5,22 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
+use Icewind\SMB\Exception\AlreadyExistsException;
+use Icewind\SMB\Exception\ConnectionRefusedException;
use Icewind\SMB\Exception\Exception;
+use Icewind\SMB\Exception\FileInUseException;
+use Icewind\SMB\Exception\ForbiddenException;
+use Icewind\SMB\Exception\HostDownException;
+use Icewind\SMB\Exception\InvalidArgumentException;
+use Icewind\SMB\Exception\InvalidTypeException;
+use Icewind\SMB\Exception\NoRouteToHostException;
+use Icewind\SMB\Exception\NotEmptyException;
+use Icewind\SMB\Exception\NotFoundException;
+use Icewind\SMB\Exception\OutOfSpaceException;
+use Icewind\SMB\Exception\TimedOutException;
+use Icewind\SMB\IAuth;
/**
* Low level wrapper for libsmbclient-php with error handling
@@ -22,23 +35,22 @@ class NativeState {
protected $connected = false;
- // todo replace with static once <5.6 support is dropped
// see error.h
- private static $exceptionMap = [
- 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',
- 111 => '\Icewind\SMB\Exception\ConnectionRefusedException',
- 112 => '\Icewind\SMB\Exception\HostDownException',
- 113 => '\Icewind\SMB\Exception\NoRouteToHostException'
+ const EXCEPTION_MAP = [
+ 1 => ForbiddenException::class,
+ 2 => NotFoundException::class,
+ 13 => ForbiddenException::class,
+ 16 => FileInUseException::class,
+ 17 => AlreadyExistsException::class,
+ 20 => InvalidTypeException::class,
+ 21 => InvalidTypeException::class,
+ 22 => InvalidArgumentException::class,
+ 28 => OutOfSpaceException::class,
+ 39 => NotEmptyException::class,
+ 110 => TimedOutException::class,
+ 111 => ConnectionRefusedException::class,
+ 112 => HostDownException::class,
+ 113 => NoRouteToHostException::class
];
protected function handleError($path) {
@@ -46,13 +58,13 @@ class NativeState {
if ($error === 0) {
return;
}
- throw Exception::fromMap(self::$exceptionMap, $error, $path);
+ throw Exception::fromMap(self::EXCEPTION_MAP, $error, $path);
}
protected function testResult($result, $uri) {
if ($result === false or $result === null) {
// smb://host/share/path
- if (is_string($uri)) {
+ if (is_string($uri) && count(explode('/', $uri, 5)) > 4) {
list(, , , , $path) = explode('/', $uri, 5);
$path = '/' . $path;
} else {
@@ -63,18 +75,17 @@ class NativeState {
}
/**
- * @param string $workGroup
- * @param string $user
- * @param string $password
+ * @param IAuth $auth
* @return bool
*/
- public function init($workGroup, $user, $password) {
+ public function init(IAuth $auth) {
if ($this->connected) {
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);
+ $auth->setExtraSmbClientOptions($this->state);
+ $result = @smbclient_state_init($this->state, $auth->getWorkgroup(), $auth->getUsername(), $auth->getPassword());
$this->testResult($result, '');
$this->connected = true;
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeStream.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeStream.php
index bce72001b5a..3b3c65de276 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeStream.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeStream.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\InvalidRequestException;
@@ -18,7 +18,7 @@ class NativeStream implements File {
public $context;
/**
- * @var \Icewind\SMB\NativeState
+ * @var NativeState
*/
protected $state;
@@ -47,7 +47,7 @@ class NativeStream implements File {
* @return resource
*/
public static function wrap($state, $smbStream, $mode, $url) {
- stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeStream');
+ stream_wrapper_register('nativesmb', NativeStream::class);
$context = stream_context_create(array(
'nativesmb' => array(
'state' => $state,
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NativeWriteStream.php b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeWriteStream.php
index 69a270f160f..f5143a09ae2 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NativeWriteStream.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Native/NativeWriteStream.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Native;
/**
* Stream optimized for write only usage
@@ -38,7 +38,7 @@ class NativeWriteStream extends NativeStream {
* @return resource
*/
public static function wrap($state, $smbStream, $mode, $url) {
- stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeWriteStream');
+ stream_wrapper_register('nativesmb', NativeWriteStream::class);
$context = stream_context_create(array(
'nativesmb' => array(
'state' => $state,
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Server.php b/apps/files_external/3rdparty/icewind/smb/src/Server.php
deleted file mode 100644
index 21cc605ed1f..00000000000
--- a/apps/files_external/3rdparty/icewind/smb/src/Server.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?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;
-
-use Icewind\SMB\Exception\AuthenticationException;
-use Icewind\SMB\Exception\InvalidHostException;
-
-class Server {
- const LOCALE = 'en_US.UTF-8';
-
- /**
- * @var string $host
- */
- protected $host;
-
- /**
- * @var string $user
- */
- protected $user;
-
- /**
- * @var string $password
- */
- protected $password;
-
- /**
- * @var string $workgroup
- */
- protected $workgroup;
-
- /**
- * @var \Icewind\SMB\System
- */
- private $system;
-
- /**
- * @var TimeZoneProvider
- */
- private $timezoneProvider;
-
- /**
- * Check if the smbclient php extension is available
- *
- * @return bool
- */
- public static function NativeAvailable() {
- return function_exists('smbclient_state_new');
- }
-
- /**
- * @param string $host
- * @param string $user
- * @param string $password
- */
- public function __construct($host, $user, $password) {
- $this->host = $host;
- list($workgroup, $user) = $this->splitUser($user);
- $this->user = $user;
- $this->workgroup = $workgroup;
- $this->password = $password;
- $this->system = new System();
- $this->timezoneProvider = new TimeZoneProvider($host, $this->system);
- }
-
- /**
- * Split workgroup from username
- *
- * @param $user
- * @return string[] [$workgroup, $user]
- */
- public function splitUser($user) {
- if (strpos($user, '/')) {
- return explode('/', $user, 2);
- } elseif (strpos($user, '\\')) {
- return explode('\\', $user);
- } else {
- return array(null, $user);
- }
- }
-
- /**
- * @return string
- */
- public function getAuthString() {
- return $this->user . '%' . $this->password;
- }
-
- /**
- * @return string
- */
- public function getUser() {
- return $this->user;
- }
-
- /**
- * @return string
- */
- public function getPassword() {
- return $this->password;
- }
-
- /**
- * return string
- */
- public function getHost() {
- return $this->host;
- }
-
- /**
- * @return string
- */
- public function getWorkgroup() {
- return $this->workgroup;
- }
-
- /**
- * @return \Icewind\SMB\IShare[]
- *
- * @throws \Icewind\SMB\Exception\AuthenticationException
- * @throws \Icewind\SMB\Exception\InvalidHostException
- */
- public function listShares() {
- $workgroupArgument = ($this->workgroup) ? ' -W ' . escapeshellarg($this->workgroup) : '';
- $command = sprintf('%s %s --authentication-file=%s -gL %s',
- $this->system->getSmbclientPath(),
- $workgroupArgument,
- System::getFD(3),
- escapeshellarg($this->getHost())
- );
- $connection = new RawConnection($command);
- $connection->writeAuthentication($this->getUser(), $this->getPassword());
- $connection->connect();
- $output = $connection->readAll();
- $parser = new Parser($this->timezoneProvider);
-
- $parser->checkConnectionError($output[0]);
-
- $shareNames = $parser->parseListShares($output);
-
- $shares = array();
- foreach ($shareNames as $name => $description) {
- $shares[] = $this->getShare($name);
- }
- return $shares;
- }
-
- /**
- * @param string $name
- * @return \Icewind\SMB\IShare
- */
- public function getShare($name) {
- return new Share($this, $name, $this->system);
- }
-
- /**
- * @return string
- */
- public function getTimeZone() {
- return $this->timezoneProvider->get();
- }
-}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/ServerFactory.php b/apps/files_external/3rdparty/icewind/smb/src/ServerFactory.php
new file mode 100644
index 00000000000..b54168a520c
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/ServerFactory.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Icewind\SMB;
+
+
+use Icewind\SMB\Exception\DependencyException;
+use Icewind\SMB\Native\NativeServer;
+use Icewind\SMB\Wrapped\Server;
+
+class ServerFactory {
+ const BACKENDS = [
+ NativeServer::class,
+ Server::class
+ ];
+
+ /** @var System|null */
+ private $system = null;
+
+ /**
+ * @param $host
+ * @param IAuth $credentials
+ * @return IServer
+ * @throws DependencyException
+ */
+ public function createServer($host, IAuth $credentials) {
+ foreach (self::BACKENDS as $backend) {
+ if (call_user_func("$backend::available", $this->getSystem())) {
+ return new $backend($host, $credentials, $this->getSystem(), new TimeZoneProvider($host, $this->getSystem()));
+ }
+ }
+
+ throw new DependencyException('No valid backend available, ensure smbclient is in the path or php-smbclient is installed');
+ }
+
+ /**
+ * @return System
+ */
+ private function getSystem() {
+ if (is_null($this->system)) {
+ $this->system = new System();
+ }
+
+ return $this->system;
+ }
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/System.php b/apps/files_external/3rdparty/icewind/smb/src/System.php
index 7c519988aa5..30592dd2627 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/System.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/System.php
@@ -17,10 +17,10 @@ class System {
private $stdbuf;
public static function getFD($num) {
- $folders = array(
+ $folders = [
'/proc/self/fd',
'/dev/fd'
- );
+ ];
foreach ($folders as $folder) {
if (file_exists($folder)) {
return $folder . '/' . $num;
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Connection.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php
index 661a361ec54..7eddb85ac4f 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Connection.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
use Icewind\SMB\Exception\AuthenticationException;
use Icewind\SMB\Exception\ConnectException;
diff --git a/apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/ErrorCodes.php
index d36cdaf2c7d..7df83b268d8 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/ErrorCodes.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/ErrorCodes.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
class ErrorCodes {
/**
diff --git a/apps/files_external/3rdparty/icewind/smb/src/FileInfo.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/FileInfo.php
index ef9121a8f57..094e665a935 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/FileInfo.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/FileInfo.php
@@ -5,22 +5,11 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
-class FileInfo implements IFileInfo {
- /*
- * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
- * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
- * "system.*") is specified.
- */
- const MODE_READONLY = 0x01;
- const MODE_HIDDEN = 0x02;
- const MODE_SYSTEM = 0x04;
- const MODE_VOLUME_ID = 0x08;
- const MODE_DIRECTORY = 0x10;
- const MODE_ARCHIVE = 0x20;
- const MODE_NORMAL = 0x80;
+use Icewind\SMB\IFileInfo;
+class FileInfo implements IFileInfo {
/**
* @var string
*/
@@ -93,34 +82,34 @@ class FileInfo implements IFileInfo {
* @return bool
*/
public function isDirectory() {
- return (bool)($this->mode & self::MODE_DIRECTORY);
+ return (bool)($this->mode & IFileInfo::MODE_DIRECTORY);
}
/**
* @return bool
*/
public function isReadOnly() {
- return (bool)($this->mode & self::MODE_READONLY);
+ return (bool)($this->mode & IFileInfo::MODE_READONLY);
}
/**
* @return bool
*/
public function isHidden() {
- return (bool)($this->mode & self::MODE_HIDDEN);
+ return (bool)($this->mode & IFileInfo::MODE_HIDDEN);
}
/**
* @return bool
*/
public function isSystem() {
- return (bool)($this->mode & self::MODE_SYSTEM);
+ return (bool)($this->mode & IFileInfo::MODE_SYSTEM);
}
/**
* @return bool
*/
public function isArchived() {
- return (bool)($this->mode & self::MODE_ARCHIVE);
+ return (bool)($this->mode & IFileInfo::MODE_ARCHIVE);
}
}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/NotifyHandler.php
index 20ada5cf320..a32ae3cafa4 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/NotifyHandler.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/NotifyHandler.php
@@ -6,10 +6,13 @@
*
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
+use Icewind\SMB\Change;
use Icewind\SMB\Exception\Exception;
+use Icewind\SMB\Exception\RevisionMismatchException;
+use Icewind\SMB\INotifyHandler;
class NotifyHandler implements INotifyHandler {
/**
@@ -24,10 +27,9 @@ 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',
+ const EXCEPTION_MAP = [
+ ErrorCodes::RevisionMismatch => RevisionMismatchException::class,
];
/**
@@ -93,7 +95,7 @@ class NotifyHandler implements INotifyHandler {
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');
+ throw Exception::fromMap(array_merge(self::EXCEPTION_MAP, Parser::EXCEPTION_MAP), $error, 'Notify is not supported with the used smb version');
}
}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Parser.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php
index a30032178b1..c446ae85b30 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Parser.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
use Icewind\SMB\Exception\AccessDeniedException;
use Icewind\SMB\Exception\AlreadyExistsException;
@@ -13,11 +13,13 @@ use Icewind\SMB\Exception\AuthenticationException;
use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\FileInUseException;
use Icewind\SMB\Exception\InvalidHostException;
+use Icewind\SMB\Exception\InvalidParameterException;
use Icewind\SMB\Exception\InvalidResourceException;
use Icewind\SMB\Exception\InvalidTypeException;
use Icewind\SMB\Exception\NoLoginServerException;
use Icewind\SMB\Exception\NotEmptyException;
use Icewind\SMB\Exception\NotFoundException;
+use Icewind\SMB\TimeZoneProvider;
class Parser {
const MSG_NOT_FOUND = 'Error opening local file ';
@@ -29,22 +31,31 @@ class Parser {
// todo replace with static once <5.6 support is dropped
// see error.h
- private static $exceptionMap = [
- ErrorCodes::LogonFailure => '\Icewind\SMB\Exception\AuthenticationException',
- ErrorCodes::PathNotFound => '\Icewind\SMB\Exception\NotFoundException',
- ErrorCodes::ObjectNotFound => '\Icewind\SMB\Exception\NotFoundException',
- ErrorCodes::NoSuchFile => '\Icewind\SMB\Exception\NotFoundException',
- ErrorCodes::NameCollision => '\Icewind\SMB\Exception\AlreadyExistsException',
- ErrorCodes::AccessDenied => '\Icewind\SMB\Exception\AccessDeniedException',
- ErrorCodes::DirectoryNotEmpty => '\Icewind\SMB\Exception\NotEmptyException',
- ErrorCodes::FileIsADirectory => '\Icewind\SMB\Exception\InvalidTypeException',
- ErrorCodes::NotADirectory => '\Icewind\SMB\Exception\InvalidTypeException',
- ErrorCodes::SharingViolation => '\Icewind\SMB\Exception\FileInUseException',
- ErrorCodes::InvalidParameter => '\Icewind\SMB\Exception\InvalidParameterException'
+ const EXCEPTION_MAP = [
+ ErrorCodes::LogonFailure => AuthenticationException::class,
+ ErrorCodes::PathNotFound => NotFoundException::class,
+ ErrorCodes::ObjectNotFound => NotFoundException::class,
+ ErrorCodes::NoSuchFile => NotFoundException::class,
+ ErrorCodes::NameCollision => AlreadyExistsException::class,
+ ErrorCodes::AccessDenied => AccessDeniedException::class,
+ ErrorCodes::DirectoryNotEmpty => NotEmptyException::class,
+ ErrorCodes::FileIsADirectory => InvalidTypeException::class,
+ ErrorCodes::NotADirectory => InvalidTypeException::class,
+ ErrorCodes::SharingViolation => FileInUseException::class,
+ ErrorCodes::InvalidParameter => InvalidParameterException::class
+ ];
+
+ const MODE_STRINGS = [
+ 'R' => FileInfo::MODE_READONLY,
+ 'H' => FileInfo::MODE_HIDDEN,
+ 'S' => FileInfo::MODE_SYSTEM,
+ 'D' => FileInfo::MODE_DIRECTORY,
+ 'A' => FileInfo::MODE_ARCHIVE,
+ 'N' => FileInfo::MODE_NORMAL
];
/**
- * @param \Icewind\SMB\TimeZoneProvider $timeZoneProvider
+ * @param TimeZoneProvider $timeZoneProvider
*/
public function __construct(TimeZoneProvider $timeZoneProvider) {
$this->timeZoneProvider = $timeZoneProvider;
@@ -71,7 +82,7 @@ class Parser {
throw new InvalidResourceException('Failed opening local file "' . $localPath . '" for writing');
}
- throw Exception::fromMap(self::$exceptionMap, $error, $path);
+ throw Exception::fromMap(self::EXCEPTION_MAP, $error, $path);
}
/**
@@ -107,15 +118,7 @@ class Parser {
public function parseMode($mode) {
$result = 0;
- $modeStrings = array(
- 'R' => FileInfo::MODE_READONLY,
- 'H' => FileInfo::MODE_HIDDEN,
- 'S' => FileInfo::MODE_SYSTEM,
- 'D' => FileInfo::MODE_DIRECTORY,
- 'A' => FileInfo::MODE_ARCHIVE,
- 'N' => FileInfo::MODE_NORMAL
- );
- foreach ($modeStrings as $char => $val) {
+ foreach (self::MODE_STRINGS as $char => $val) {
if (strpos($mode, $char) !== false) {
$result |= $val;
}
@@ -168,6 +171,10 @@ class Parser {
if (strtolower($type) === 'disk') {
$shareNames[$name] = $description;
}
+ } else if (strpos($line, 'Disk')) {
+ // new output format
+ list($name, $description) = explode('Disk', $line);
+ $shareNames[trim($name)] = trim($description);
}
}
return $shareNames;
diff --git a/apps/files_external/3rdparty/icewind/smb/src/RawConnection.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/RawConnection.php
index 42923f09eda..f29cf60eb66 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/RawConnection.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/RawConnection.php
@@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
use Icewind\SMB\Exception\ConnectException;
use Icewind\SMB\Exception\ConnectionException;
@@ -49,6 +49,9 @@ class RawConnection {
$this->env = $env;
}
+ /**
+ * @throws ConnectException
+ */
public function connect() {
if (is_null($this->getAuthStream())) {
throw new ConnectException('Authentication not set before connecting');
@@ -125,7 +128,7 @@ class RawConnection {
* @return array
*/
public function readAll() {
- $output = array();
+ $output = [];
while ($line = $this->readLine()) {
$output[] = $line;
}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Server.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Server.php
new file mode 100644
index 00000000000..cc0f13f3606
--- /dev/null
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Server.php
@@ -0,0 +1,90 @@
+<?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\Wrapped;
+
+use Icewind\SMB\AbstractServer;
+use Icewind\SMB\Exception\AuthenticationException;
+use Icewind\SMB\Exception\ConnectException;
+use Icewind\SMB\Exception\ConnectionException;
+use Icewind\SMB\Exception\InvalidHostException;
+use Icewind\SMB\IShare;
+use Icewind\SMB\System;
+
+class Server extends AbstractServer {
+ /**
+ * Check if the smbclient php extension is available
+ *
+ * @param System $system
+ * @return bool
+ */
+ public static function available(System $system) {
+ return $system->getSmbclientPath();
+ }
+
+ private function getAuthFileArgument() {
+ if ($this->getAuth()->getUsername()) {
+ return '--authentication-file=' . System::getFD(3);
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * @return IShare[]
+ *
+ * @throws AuthenticationException
+ * @throws InvalidHostException
+ * @throws ConnectException
+ */
+ public function listShares() {
+ $command = sprintf('%s %s %s -L %s',
+ $this->system->getSmbclientPath(),
+ $this->getAuthFileArgument(),
+ $this->getAuth()->getExtraCommandLineArguments(),
+ escapeshellarg('//' . $this->getHost())
+ );
+ $connection = new RawConnection($command);
+ $connection->writeAuthentication($this->getAuth()->getUsername(), $this->getAuth()->getPassword());
+ $connection->connect();
+ if (!$connection->isValid()) {
+ throw new ConnectionException($connection->readLine());
+ }
+
+ $parser = new Parser($this->timezoneProvider);
+
+ $output = $connection->readAll();
+ if (isset($output[0])) {
+ $parser->checkConnectionError($output[0]);
+ }
+
+ // sometimes we get an empty line first
+ if (count($output) < 2) {
+ $output = $connection->readAll();
+ }
+
+ if (isset($output[0])) {
+ $parser->checkConnectionError($output[0]);
+ }
+
+ $shareNames = $parser->parseListShares($output);
+
+ $shares = array();
+ foreach ($shareNames as $name => $description) {
+ $shares[] = $this->getShare($name);
+ }
+ return $shares;
+ }
+
+ /**
+ * @param string $name
+ * @return IShare
+ */
+ public function getShare($name) {
+ return new Share($this, $name, $this->system);
+ }
+}
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php
index be1ba025508..ca88af219a8 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Share.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php
@@ -5,18 +5,23 @@
* http://opensource.org/licenses/MIT
*/
-namespace Icewind\SMB;
+namespace Icewind\SMB\Wrapped;
+use Icewind\SMB\AbstractShare;
use Icewind\SMB\Exception\ConnectionException;
use Icewind\SMB\Exception\DependencyException;
use Icewind\SMB\Exception\FileInUseException;
use Icewind\SMB\Exception\InvalidTypeException;
use Icewind\SMB\Exception\NotFoundException;
+use Icewind\SMB\INotifyHandler;
+use Icewind\SMB\IServer;
+use Icewind\SMB\System;
+use Icewind\SMB\TimeZoneProvider;
use Icewind\Streams\CallbackWrapper;
class Share extends AbstractShare {
/**
- * @var Server $server
+ * @var IServer $server
*/
private $server;
@@ -31,21 +36,28 @@ class Share extends AbstractShare {
public $connection;
/**
- * @var \Icewind\SMB\Parser
+ * @var Parser
*/
protected $parser;
/**
- * @var \Icewind\SMB\System
+ * @var System
*/
private $system;
+ const MODE_MAP = [
+ FileInfo::MODE_READONLY => 'r',
+ FileInfo::MODE_HIDDEN => 'h',
+ FileInfo::MODE_ARCHIVE => 'a',
+ FileInfo::MODE_SYSTEM => 's'
+ ];
+
/**
- * @param Server $server
+ * @param IServer $server
* @param string $name
* @param System $system
*/
- public function __construct($server, $name, System $system = null) {
+ public function __construct(IServer $server, $name, System $system = null) {
parent::__construct();
$this->server = $server;
$this->name = $name;
@@ -53,21 +65,24 @@ class Share extends AbstractShare {
$this->parser = new Parser(new TimeZoneProvider($this->server->getHost(), $this->system));
}
- protected function getConnection() {
- $workgroupArgument = ($this->server->getWorkgroup()) ? ' -W ' . escapeshellarg($this->server->getWorkgroup()) : '';
- $smbClientPath = $this->system->getSmbclientPath();
- if (!$smbClientPath) {
- throw new DependencyException('Can\'t find smbclient binary in path');
+ private function getAuthFileArgument() {
+ if ($this->server->getAuth()->getUsername()) {
+ return '--authentication-file=' . System::getFD(3);
+ } else {
+ return '';
}
- $command = sprintf('%s%s %s --authentication-file=%s %s',
+ }
+
+ protected function getConnection() {
+ $command = sprintf('%s%s %s %s %s',
$this->system->hasStdBuf() ? 'stdbuf -o0 ' : '',
$this->system->getSmbclientPath(),
- $workgroupArgument,
- System::getFD(3),
+ $this->getAuthFileArgument(),
+ $this->server->getAuth()->getExtraCommandLineArguments(),
escapeshellarg('//' . $this->server->getHost() . '/' . $this->name)
);
$connection = new Connection($command, $this->parser);
- $connection->writeAuthentication($this->server->getUser(), $this->server->getPassword());
+ $connection->writeAuthentication($this->server->getAuth()->getUsername(), $this->server->getAuth()->getPassword());
$connection->connect();
if (!$connection->isValid()) {
throw new ConnectionException($connection->readLine());
@@ -319,13 +334,7 @@ class Share extends AbstractShare {
*/
public function setMode($path, $mode) {
$modeString = '';
- $modeMap = array(
- FileInfo::MODE_READONLY => 'r',
- FileInfo::MODE_HIDDEN => 'h',
- FileInfo::MODE_ARCHIVE => 'a',
- FileInfo::MODE_SYSTEM => 's'
- );
- foreach ($modeMap as $modeByte => $string) {
+ foreach (self::MODE_MAP as $modeByte => $string) {
if ($mode & $modeByte) {
$modeString .= $string;
}