update icewind/smb to 3.2.4

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-05-12 14:39:08 +02:00
parent 703d716a32
commit 42019c0f4f
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
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,40 +116,60 @@ class NativeFileInfo implements IFileInfo {
*/
public function isDirectory() {
$mode = $this->getMode();
if ($mode > 0x80) {
return (bool)($mode & 0x4000); // 0x80: unix directory flag
} else {
return (bool)($mode & IFileInfo::MODE_DIRECTORY);
}
}
/**
* @return bool
*/
public function isReadOnly() {
$mode = $this->getMode();
if ($mode > 0x80) {
return !(bool)($mode & 0x80); // 0x80: owner write permissions
} else {
return (bool)($mode & IFileInfo::MODE_READONLY);
}
}
/**
* @return bool
*/
public function isHidden() {
$mode = $this->getMode();
if ($mode > 0x80) {
return $this->name[0] === '.';
} else {
return (bool)($mode & IFileInfo::MODE_HIDDEN);
}
}
/**
* @return bool
*/
public function isSystem() {
$mode = $this->getMode();
if ($mode > 0x80) {
return false;
} else {
return (bool)($mode & IFileInfo::MODE_SYSTEM);
}
}
/**
* @return bool
*/
public function isArchived() {
$mode = $this->getMode();
if ($mode > 0x80) {
return false;
} else {
return (bool)($mode & IFileInfo::MODE_ARCHIVE);
}
}
/**
* @return ACL[]
@ -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);