From 48f39628d0f4b32233575e79678f9c42bc010377 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Aug 2018 14:16:33 +0200 Subject: [PATCH 1/3] use dir instead of allinfo where possible --- .../3rdparty/icewind/smb/src/Share.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/files_external/3rdparty/icewind/smb/src/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Share.php index be1ba02550837..23b28f16eda74 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Share.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Share.php @@ -138,6 +138,18 @@ public function dir($path) { * @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 05131490a75d1a33ba40fbf975c0bd79607702c8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Aug 2018 14:22:52 +0200 Subject: [PATCH 2/3] 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 fcdf7e3e879b5..8d53c0d5f0642 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 @@ public function get() { 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 5d18d142a625738bba7e6605b0a6b4cf0feab69e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Aug 2018 14:25:04 +0200 Subject: [PATCH 3/3] 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 8d53c0d5f0642..385d8fccdffec 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 @@ public function __construct($host, System $system) { 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)