diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index eda2399a780f9..14ef0fad7782d 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -66,9 +66,12 @@ public function beforeHandler(RequestInterface $request) { } $minimumSupportedDesktopVersion = $this->config->getSystemValue('minimum.supported.desktop.version', '2.3.0'); + $maximumSupportedDesktopVersion = $this->config->getSystemValueString('maximum.supported.desktop.version', ''); preg_match(IRequest::USER_AGENT_CLIENT_DESKTOP, $userAgent, $versionMatches); if (isset($versionMatches[1]) && - version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { + version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1 || + !empty($maximumSupportedDesktopVersion) && + version_compare($versionMatches[1], $maximumSupportedDesktopVersion) === 1) { throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.'); } } diff --git a/config/config.sample.php b/config/config.sample.php index 39cb0adea9476..273696aa2ec3c 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -2002,6 +2002,17 @@ */ 'minimum.supported.desktop.version' => '2.3.0', +/** + * The maximum Nextcloud desktop client version that will be allowed to sync with + * this server instance. All connections made from later clients will be denied + * by the server. Defaults to the maximum officially supported Nextcloud desktop + * client version at the time of release of this server version. + * + * + * Defaults to empty + */ +'maximum.supported.desktop.version' => '', + /** * Option to allow local storage to contain symlinks. * WARNING: Not recommended. This would make it possible for Nextcloud to access