diff options
author | Robin Appelman <robin@icewind.nl> | 2022-01-20 16:09:41 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-01-20 16:09:41 +0100 |
commit | a33e1dc5bbdc16d4d0f117de1e89e21281ca2223 (patch) | |
tree | ed9ff39a960bb74175620cf21a7016a62ffc2bad /apps | |
parent | 0bed61f949bc7a8c69cd154919e78b704e28c99e (diff) | |
download | nextcloud-server-a33e1dc5bbdc16d4d0f117de1e89e21281ca2223.tar.gz nextcloud-server-a33e1dc5bbdc16d4d0f117de1e89e21281ca2223.zip |
update icewind/smb to 3.5.2
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
6 files changed, 72 insertions, 53 deletions
diff --git a/apps/files_external/3rdparty/composer.json b/apps/files_external/3rdparty/composer.json index 21ae38a9996..e343521add3 100644 --- a/apps/files_external/3rdparty/composer.json +++ b/apps/files_external/3rdparty/composer.json @@ -9,6 +9,6 @@ }, "require": { "icewind/streams": "0.7.4", - "icewind/smb": "3.5.1" + "icewind/smb": "3.5.2" } } diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock index 6235bf98e5c..918dd7da08d 100644 --- a/apps/files_external/3rdparty/composer.lock +++ b/apps/files_external/3rdparty/composer.lock @@ -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": "ed821b15824934fd2d245faca1f35aad", + "content-hash": "524c99fd87297e01d004eb5a4e53b04c", "packages": [ { "name": "icewind/smb", - "version": "v3.5.1", + "version": "v3.5.2", "source": { "type": "git", "url": "https://github.com/icewind1991/SMB.git", - "reference": "c1ce4fbb2ff1786846d9d0b3850b395ca94cf563" + "reference": "0a425bd21acf7ae112b135dca34640e1b1a825c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/SMB/zipball/c1ce4fbb2ff1786846d9d0b3850b395ca94cf563", - "reference": "c1ce4fbb2ff1786846d9d0b3850b395ca94cf563", + "url": "https://api.github.com/repos/icewind1991/SMB/zipball/0a425bd21acf7ae112b135dca34640e1b1a825c3", + "reference": "0a425bd21acf7ae112b135dca34640e1b1a825c3", "shasum": "" }, "require": { @@ -49,9 +49,9 @@ "description": "php wrapper for smbclient and libsmbclient-php", "support": { "issues": "https://github.com/icewind1991/SMB/issues", - "source": "https://github.com/icewind1991/SMB/tree/v3.5.1" + "source": "https://github.com/icewind1991/SMB/tree/v3.5.2" }, - "time": "2021-11-04T14:28:18+00:00" + "time": "2022-01-20T14:51:51+00:00" }, { "name": "icewind/streams", @@ -107,5 +107,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/apps/files_external/3rdparty/composer/ClassLoader.php b/apps/files_external/3rdparty/composer/ClassLoader.php index 0cd6055d1b7..afef3fa2ad8 100644 --- a/apps/files_external/3rdparty/composer/ClassLoader.php +++ b/apps/files_external/3rdparty/composer/ClassLoader.php @@ -149,7 +149,7 @@ class ClassLoader /** * @return string[] Array of classname => path - * @psalm-var array<string, string> + * @psalm-return array<string, string> */ public function getClassMap() { diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json index c2e3ffb0e4b..2c9b1c087df 100644 --- a/apps/files_external/3rdparty/composer/installed.json +++ b/apps/files_external/3rdparty/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "icewind/smb", - "version": "v3.5.1", - "version_normalized": "3.5.1.0", + "version": "v3.5.2", + "version_normalized": "3.5.2.0", "source": { "type": "git", "url": "https://github.com/icewind1991/SMB.git", - "reference": "c1ce4fbb2ff1786846d9d0b3850b395ca94cf563" + "reference": "0a425bd21acf7ae112b135dca34640e1b1a825c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/icewind1991/SMB/zipball/c1ce4fbb2ff1786846d9d0b3850b395ca94cf563", - "reference": "c1ce4fbb2ff1786846d9d0b3850b395ca94cf563", + "url": "https://api.github.com/repos/icewind1991/SMB/zipball/0a425bd21acf7ae112b135dca34640e1b1a825c3", + "reference": "0a425bd21acf7ae112b135dca34640e1b1a825c3", "shasum": "" }, "require": { @@ -25,7 +25,7 @@ "phpunit/phpunit": "^8.5|^9.3.8", "psalm/phar": "^4.3" }, - "time": "2021-11-04T14:28:18+00:00", + "time": "2022-01-20T14:51:51+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -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.5.1" + "source": "https://github.com/icewind1991/SMB/tree/v3.5.2" }, "install-path": "../icewind/smb" }, diff --git a/apps/files_external/3rdparty/composer/installed.php b/apps/files_external/3rdparty/composer/installed.php index 2b4e3329b36..255420e1003 100644 --- a/apps/files_external/3rdparty/composer/installed.php +++ b/apps/files_external/3rdparty/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'reference' => 'cd72330b8f669e3dc81388be5a92171404f36fec', + 'reference' => '0bed61f949bc7a8c69cd154919e78b704e28c99e', 'name' => 'files_external/3rdparty', 'dev' => true, ), @@ -16,16 +16,16 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'reference' => 'cd72330b8f669e3dc81388be5a92171404f36fec', + 'reference' => '0bed61f949bc7a8c69cd154919e78b704e28c99e', 'dev_requirement' => false, ), 'icewind/smb' => array( - 'pretty_version' => 'v3.5.1', - 'version' => '3.5.1.0', + 'pretty_version' => 'v3.5.2', + 'version' => '3.5.2.0', 'type' => 'library', 'install_path' => __DIR__ . '/../icewind/smb', 'aliases' => array(), - 'reference' => 'c1ce4fbb2ff1786846d9d0b3850b395ca94cf563', + 'reference' => '0a425bd21acf7ae112b135dca34640e1b1a825c3', 'dev_requirement' => false, ), 'icewind/streams' => array( diff --git a/apps/files_external/3rdparty/icewind/smb/src/KerberosApacheAuth.php b/apps/files_external/3rdparty/icewind/smb/src/KerberosApacheAuth.php index 03551aa6f34..c49918be114 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/KerberosApacheAuth.php +++ b/apps/files_external/3rdparty/icewind/smb/src/KerberosApacheAuth.php @@ -31,35 +31,65 @@ class KerberosApacheAuth extends KerberosAuth implements IAuth { /** @var string */ private $ticketPath = ""; - // only working with specific library (mod_auth_kerb, krb5, smbclient) versions - /** @var bool */ - private $saveTicketInMemory = false; - /** @var bool */ private $init = false; + /** @var string|false */ + private $ticketName; + + public function __construct() { + $this->ticketName = getenv("KRB5CCNAME"); + } + + + /** + * Copy the ticket to a temporary location and use that ticket for authentication + * + * @return void + */ + public function copyTicket(): void { + if (!$this->checkTicket()) { + return; + } + $krb5 = new \KRB5CCache(); + $krb5->open($this->ticketName); + $tmpFilename = tempnam("/tmp", "krb5cc_php_"); + $tmpCacheFile = "FILE:" . $tmpFilename; + $krb5->save($tmpCacheFile); + $this->ticketPath = $tmpFilename; + $this->ticketName = $tmpCacheFile; + } + /** - * @param bool $saveTicketInMemory + * Pass the ticket to smbclient by memory instead of path + * + * @return void */ - public function __construct(bool $saveTicketInMemory = false) { - $this->saveTicketInMemory = $saveTicketInMemory; + public function passTicketFromMemory(): void { + if (!$this->checkTicket()) { + return; + } + $krb5 = new \KRB5CCache(); + $krb5->open($this->ticketName); + $this->ticketName = (string)$krb5->getName(); } /** * Check if a valid kerberos ticket is present * * @return bool + * @psalm-assert-if-true string $this->ticketName */ public function checkTicket(): bool { //read apache kerberos ticket cache - $cacheFile = getenv("KRB5CCNAME"); - if (!$cacheFile) { + if (!$this->ticketName) { return false; } $krb5 = new \KRB5CCache(); - $krb5->open($cacheFile); - return (bool)$krb5->isValid(); + $krb5->open($this->ticketName); + /** @psalm-suppress MixedArgument */ + return count($krb5->getEntries()) > 0; } private function init(): void { @@ -75,28 +105,13 @@ class KerberosApacheAuth extends KerberosAuth implements IAuth { } //read apache kerberos ticket cache - $cacheFile = getenv("KRB5CCNAME"); - if (!$cacheFile) { + if (!$this->checkTicket()) { throw new Exception('No kerberos ticket cache environment variable (KRB5CCNAME) found.'); } - $krb5 = new \KRB5CCache(); - $krb5->open($cacheFile); - if (!$krb5->isValid()) { - throw new Exception('Kerberos ticket cache is not valid.'); - } - - - if ($this->saveTicketInMemory) { - putenv("KRB5CCNAME=" . (string)$krb5->getName()); - } else { - //workaround: smbclient is not working with the original apache ticket cache. - $tmpFilename = tempnam("/tmp", "krb5cc_php_"); - $tmpCacheFile = "FILE:" . $tmpFilename; - $krb5->save($tmpCacheFile); - $this->ticketPath = $tmpFilename; - putenv("KRB5CCNAME=" . $tmpCacheFile); - } + // note that even if the ticketname is the value we got from `getenv("KRB5CCNAME")` we still need to set the env variable ourselves + // this is because `getenv` also reads the variables passed from the SAPI (apache-php) and we need to set the variable in the OS's env + putenv("KRB5CCNAME=" . $this->ticketName); } public function getExtraCommandLineArguments(): string { @@ -106,7 +121,11 @@ class KerberosApacheAuth extends KerberosAuth implements IAuth { public function setExtraSmbClientOptions($smbClientState): void { $this->init(); - parent::setExtraSmbClientOptions($smbClientState); + try { + parent::setExtraSmbClientOptions($smbClientState); + } catch (Exception $e) { + // suppress + } } public function __destruct() { |