Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update icewind/smb to 3.4.1 #26627

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
},
"require": {
"icewind/streams": "0.7.3",
"icewind/smb": "3.4.0"
"icewind/smb": "3.4.1"
}
}
14 changes: 7 additions & 7 deletions apps/files_external/3rdparty/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions apps/files_external/3rdparty/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '62929cc646134fbd409cfb4eacb7039d15763b96',
'reference' => '9a69b8839389f133db55a41e1c2ba4435fd50c19',
'name' => 'files_external/3rdparty',
),
'versions' =>
Expand All @@ -42,16 +42,16 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '62929cc646134fbd409cfb4eacb7039d15763b96',
'reference' => '9a69b8839389f133db55a41e1c2ba4435fd50c19',
),
'icewind/smb' =>
array (
'pretty_version' => 'v3.4.0',
'version' => '3.4.0.0',
'pretty_version' => 'v3.4.1',
'version' => '3.4.1.0',
'aliases' =>
array (
),
'reference' => 'b5c6921f2e91229c9f71556a4713b4fac91fd394',
'reference' => '9dba42ab2a3990de29e18cc62b0a8270aceb74e3',
),
'icewind/streams' =>
array (
Expand Down
14 changes: 7 additions & 7 deletions apps/files_external/3rdparty/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "icewind/smb",
"version": "v3.4.0",
"version_normalized": "3.4.0.0",
"version": "v3.4.1",
"version_normalized": "3.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
"reference": "b5c6921f2e91229c9f71556a4713b4fac91fd394"
"reference": "9dba42ab2a3990de29e18cc62b0a8270aceb74e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/b5c6921f2e91229c9f71556a4713b4fac91fd394",
"reference": "b5c6921f2e91229c9f71556a4713b4fac91fd394",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/9dba42ab2a3990de29e18cc62b0a8270aceb74e3",
"reference": "9dba42ab2a3990de29e18cc62b0a8270aceb74e3",
"shasum": ""
},
"require": {
Expand All @@ -25,7 +25,7 @@
"phpunit/phpunit": "^8.5|^9.3.8",
"psalm/phar": "^4.3"
},
"time": "2021-03-10T14:00:37+00:00",
"time": "2021-04-19T13:53:08+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -46,7 +46,7 @@
"description": "php wrapper for smbclient and libsmbclient-php",
"support": {
"issues": "https://github.com/icewind1991/SMB/issues",
"source": "https://github.com/icewind1991/SMB/tree/v3.4.0"
"source": "https://github.com/icewind1991/SMB/tree/v3.4.1"
},
"install-path": "../icewind/smb"
},
Expand Down
10 changes: 5 additions & 5 deletions apps/files_external/3rdparty/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '62929cc646134fbd409cfb4eacb7039d15763b96',
'reference' => '9a69b8839389f133db55a41e1c2ba4435fd50c19',
'name' => 'files_external/3rdparty',
),
'versions' =>
Expand All @@ -18,16 +18,16 @@
'aliases' =>
array (
),
'reference' => '62929cc646134fbd409cfb4eacb7039d15763b96',
'reference' => '9a69b8839389f133db55a41e1c2ba4435fd50c19',
),
'icewind/smb' =>
array (
'pretty_version' => 'v3.4.0',
'version' => '3.4.0.0',
'pretty_version' => 'v3.4.1',
'version' => '3.4.1.0',
'aliases' =>
array (
),
'reference' => 'b5c6921f2e91229c9f71556a4713b4fac91fd394',
'reference' => '9dba42ab2a3990de29e18cc62b0a8270aceb74e3',
),
'icewind/streams' =>
array (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

namespace Icewind\SMB;

use Icewind\SMB\Exception\Exception;

class AnonymousAuth implements IAuth {
public function getUsername(): ?string {
return null;
Expand All @@ -39,6 +41,8 @@ public function getExtraCommandLineArguments(): string {
}

public function setExtraSmbClientOptions($smbClientState): void {
smbclient_option_set($smbClientState, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, true);
if (smbclient_option_set($smbClientState, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, true) === false) {
throw new Exception("Failed to set smbclient options for anonymous auth");
}
}
}
10 changes: 8 additions & 2 deletions apps/files_external/3rdparty/icewind/smb/src/KerberosAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

namespace Icewind\SMB;

use Icewind\SMB\Exception\Exception;

/**
* Use existing kerberos ticket to authenticate
*/
Expand All @@ -42,7 +44,11 @@ public function getExtraCommandLineArguments(): string {
}

public function setExtraSmbClientOptions($smbClientState): void {
smbclient_option_set($smbClientState, SMBCLIENT_OPT_USE_KERBEROS, true);
smbclient_option_set($smbClientState, SMBCLIENT_OPT_FALLBACK_AFTER_KERBEROS, false);
$success = (bool)smbclient_option_set($smbClientState, SMBCLIENT_OPT_USE_KERBEROS, true);
$success = $success && smbclient_option_set($smbClientState, SMBCLIENT_OPT_FALLBACK_AFTER_KERBEROS, false);

if (!$success) {
throw new Exception("Failed to set smbclient options for kerberos auth");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,13 @@ public function init(IAuth $auth, IOptions $options) {
/** @var resource $state */
$state = smbclient_state_new();
$this->state = $state;
/** @psalm-suppress UnusedFunctionCall */
smbclient_option_set($this->state, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, false);
/** @psalm-suppress UnusedFunctionCall */
smbclient_option_set($this->state, SMBCLIENT_OPT_TIMEOUT, $options->getTimeout() * 1000);

if (function_exists('smbclient_client_protocols')) {
$maxProtocol = $options->getMaxProtocol();
$minProtocol = $options->getMinProtocol();

smbclient_client_protocols($this->state, $minProtocol, $maxProtocol);
smbclient_client_protocols($this->state, $options->getMinProtocol(), $options->getMaxProtocol());
}

$auth->setExtraSmbClientOptions($this->state);
Expand Down Expand Up @@ -357,7 +356,9 @@ public function setxattr(string $uri, string $key, string $value, int $flags = 0

public function __destruct() {
if ($this->connected) {
smbclient_state_free($this->state);
if (smbclient_state_free($this->state) === false) {
throw new Exception("Failed to free smb state");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ abstract class NativeStream implements File {
* @return resource
*/
protected static function wrapClass(NativeState $state, $smbStream, string $mode, string $url, string $class) {
stream_wrapper_register('nativesmb', $class);
if (stream_wrapper_register('nativesmb', $class) === false) {
throw new Exception("Failed to register stream wrapper");
}
$context = stream_context_create([
'nativesmb' => [
'state' => $state,
Expand All @@ -61,7 +63,9 @@ protected static function wrapClass(NativeState $state, $smbStream, string $mode
]
]);
$fh = fopen('nativesmb://', $mode, false, $context);
stream_wrapper_unregister('nativesmb');
if (stream_wrapper_unregister('nativesmb') === false) {
throw new Exception("Failed to unregister stream wrapper");
}
return $fh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function remaining(): int {
}

public function read(int $count): string {
$chunk = substr($this->buffer, $this->pos, $this->pos + $count);
$chunk = substr($this->buffer, $this->pos, $count);
$this->pos += strlen($chunk);
return $chunk;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function listShares(): array {
$shareNames = $parser->parseListShares($output);

$shares = [];
foreach ($shareNames as $name => $description) {
foreach ($shareNames as $name => $_description) {
$shares[] = $this->getShare($name);
}
return $shares;
Expand Down