From c1389070fad5c84158d46ca784ba5e63af88d283 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Aug 2018 14:16:33 +0200 Subject: [PATCH 1/4] use dir instead of allinfo where possible --- .../3rdparty/icewind/smb/src/Wrapped/Share.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php index ca88af219a8..ce1c4b85778 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php @@ -153,6 +153,18 @@ class Share extends AbstractShare { * @return \Icewind\SMB\IFileInfo */ public function stat($path) { + // some windows server setups don't seem to like the allinfo command + // use the dir command instead to get the file info where possible + if ($path !== "" && $path !== "/") { + $parent = dirname($path); + $dir = $this->dir($parent); + $file = array_values(array_filter($dir, function(IFileInfo $info) use ($path) { + return $info->getPath() === $path; + })); + if ($file) { + return $file[0]; + } + } $escapedPath = $this->escapePath($path); $output = $this->execute('allinfo ' . $escapedPath); // Windows and non Windows Fileserver may respond different From 50463e2d13acdeaf6bb2fd9973c597ae40642dbb Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Aug 2018 14:22:52 +0200 Subject: [PATCH 2/4] improved fallback of timezone detection Signed-off-by: Robin Appelman --- .../3rdparty/icewind/smb/src/TimeZoneProvider.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php index fcdf7e3e879..4438ee5bf7c 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php +++ b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php @@ -41,7 +41,10 @@ class TimeZoneProvider { escapeshellarg($this->host) ); $this->timeZone = exec($command); - } else { // fallback to server timezone + } + + if ($this->timeZone) { + // fallback to server timezone $this->timeZone = date_default_timezone_get(); } } From bf7fb2b0a2a927c4b5d16ac658f6304665833ccc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Aug 2018 14:25:04 +0200 Subject: [PATCH 3/4] assume the same timezone when using local domain names for smb Signed-off-by: Robin Appelman --- .../3rdparty/icewind/smb/src/TimeZoneProvider.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php index 4438ee5bf7c..8dce76cb774 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php +++ b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php @@ -35,7 +35,8 @@ class TimeZoneProvider { public function get() { if (!$this->timeZone) { $net = $this->system->getNetPath(); - if ($net) { + // for local domain names we can assume same timezone + if ($net && strpos($this->host, '.') !== false) { $command = sprintf('%s time zone -S %s', $net, escapeshellarg($this->host) From 4ff1d287d2f5c22b3cf9f6cfa0bfa7574d2d02b9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Aug 2018 17:34:36 +0200 Subject: [PATCH 4/4] fix missing import Signed-off-by: Robin Appelman --- apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php index ce1c4b85778..4ef0be583d5 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php @@ -13,6 +13,7 @@ use Icewind\SMB\Exception\DependencyException; use Icewind\SMB\Exception\FileInUseException; use Icewind\SMB\Exception\InvalidTypeException; use Icewind\SMB\Exception\NotFoundException; +use Icewind\SMB\IFileInfo; use Icewind\SMB\INotifyHandler; use Icewind\SMB\IServer; use Icewind\SMB\System;