Merge pull request #20991 from nextcloud/backport/20941/stable19

[stable19] update icewind/smb to 3.2.4
This commit is contained in:
Morris Jobke 2020-05-18 11:03:39 +02:00 committed by GitHub
commit 231eaf6ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 26 deletions

View File

@ -9,6 +9,6 @@
},
"require": {
"icewind/streams": "0.7.1",
"icewind/smb": "3.2.3"
"icewind/smb": "3.2.4"
}
}

View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ef0d9929f5f25696e010d5733eb51fbb",
"content-hash": "9454f546b6ab8865140c991e8f197951",
"packages": [
{
"name": "icewind/smb",
"version": "v3.2.3",
"version": "v3.2.4",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4"
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/999d6687ca9d4ac2600185c935b45206e47e604a",
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a",
"shasum": ""
},
"require": {
@ -46,7 +46,7 @@
}
],
"description": "php wrapper for smbclient and libsmbclient-php",
"time": "2020-04-08T15:20:22+00:00"
"time": "2020-05-11T14:12:35+00:00"
},
{
"name": "icewind/streams",

View File

@ -1,17 +1,17 @@
[
{
"name": "icewind/smb",
"version": "v3.2.3",
"version_normalized": "3.2.3.0",
"version": "v3.2.4",
"version_normalized": "3.2.4.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4"
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/999d6687ca9d4ac2600185c935b45206e47e604a",
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a",
"shasum": ""
},
"require": {
@ -22,7 +22,7 @@
"friendsofphp/php-cs-fixer": "^2.13",
"phpunit/phpunit": "^7.0"
},
"time": "2020-04-08T15:20:22+00:00",
"time": "2020-05-11T14:12:35+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {

View File

@ -31,11 +31,6 @@ class NativeFileInfo implements IFileInfo {
*/
protected $attributeCache = null;
/**
* @var int
*/
protected $modeCache;
/**
* @param NativeShare $share
* @param string $path
@ -69,7 +64,7 @@ class NativeFileInfo implements IFileInfo {
$rawAttributes = explode(',', $this->share->getAttribute($this->path, 'system.dos_attr.*'));
$this->attributeCache = [];
foreach ($rawAttributes as $rawAttribute) {
[$name, $value] = explode(':', $rawAttribute);
list($name, $value) = explode(':', $rawAttribute);
$name = strtolower($name);
if ($name == 'mode') {
$this->attributeCache[$name] = (int)hexdec(substr($value, 2));
@ -97,6 +92,18 @@ class NativeFileInfo implements IFileInfo {
return $stat['change_time'];
}
/**
* On "mode":
*
* different smbclient versions seem to return different mode values for 'system.dos_attr.mode'
*
* older versions return the dos permissions mask as defined in `IFileInfo::MODE_*` while
* newer versions return the equivalent unix permission mask.
*
* Since the unix mask doesn't contain the proper hidden/archive/system flags we have to assume them
* as false (except for `hidden` where we use the unix dotfile convention)
*/
/**
* @return int
*/
@ -109,7 +116,11 @@ class NativeFileInfo implements IFileInfo {
*/
public function isDirectory() {
$mode = $this->getMode();
return (bool)($mode & IFileInfo::MODE_DIRECTORY);
if ($mode > 0x80) {
return (bool)($mode & 0x4000); // 0x80: unix directory flag
} else {
return (bool)($mode & IFileInfo::MODE_DIRECTORY);
}
}
/**
@ -117,7 +128,11 @@ class NativeFileInfo implements IFileInfo {
*/
public function isReadOnly() {
$mode = $this->getMode();
return (bool)($mode & IFileInfo::MODE_READONLY);
if ($mode > 0x80) {
return !(bool)($mode & 0x80); // 0x80: owner write permissions
} else {
return (bool)($mode & IFileInfo::MODE_READONLY);
}
}
/**
@ -125,7 +140,11 @@ class NativeFileInfo implements IFileInfo {
*/
public function isHidden() {
$mode = $this->getMode();
return (bool)($mode & IFileInfo::MODE_HIDDEN);
if ($mode > 0x80) {
return $this->name[0] === '.';
} else {
return (bool)($mode & IFileInfo::MODE_HIDDEN);
}
}
/**
@ -133,7 +152,11 @@ class NativeFileInfo implements IFileInfo {
*/
public function isSystem() {
$mode = $this->getMode();
return (bool)($mode & IFileInfo::MODE_SYSTEM);
if ($mode > 0x80) {
return false;
} else {
return (bool)($mode & IFileInfo::MODE_SYSTEM);
}
}
/**
@ -141,7 +164,11 @@ class NativeFileInfo implements IFileInfo {
*/
public function isArchived() {
$mode = $this->getMode();
return (bool)($mode & IFileInfo::MODE_ARCHIVE);
if ($mode > 0x80) {
return false;
} else {
return (bool)($mode & IFileInfo::MODE_ARCHIVE);
}
}
/**
@ -152,8 +179,8 @@ class NativeFileInfo implements IFileInfo {
$attribute = $this->share->getAttribute($this->path, 'system.nt_sec_desc.acl.*+');
foreach (explode(',', $attribute) as $acl) {
[$user, $permissions] = explode(':', $acl, 2);
[$type, $flags, $mask] = explode('/', $permissions);
list($user, $permissions) = explode(':', $acl, 2);
list($type, $flags, $mask) = explode('/', $permissions);
$mask = hexdec($mask);
$acls[$user] = new ACL($type, $flags, $mask);