mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
allow setting protocol levels
This commit is contained in:
parent
b69c20d21a
commit
61012e6196
9 changed files with 149 additions and 60 deletions
|
|
@ -8,6 +8,8 @@
|
|||
namespace Icewind\SMB\Test;
|
||||
|
||||
use Icewind\SMB\BasicAuth;
|
||||
use Icewind\SMB\Exception\InvalidArgumentException;
|
||||
use Icewind\SMB\IOptions;
|
||||
use Icewind\SMB\Native\NativeServer;
|
||||
use Icewind\SMB\Options;
|
||||
use Icewind\SMB\System;
|
||||
|
|
@ -20,6 +22,9 @@ class NativeShareTest extends AbstractShareTest {
|
|||
$this->markTestSkipped('libsmbclient php extension not installed');
|
||||
}
|
||||
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
|
||||
$options = new Options();
|
||||
$options->setMinProtocol(IOptions::PROTOCOL_SMB2);
|
||||
$options->setMaxProtocol(IOptions::PROTOCOL_SMB3);
|
||||
$this->server = new NativeServer(
|
||||
$this->config->host,
|
||||
new BasicAuth(
|
||||
|
|
@ -29,7 +34,7 @@ class NativeShareTest extends AbstractShareTest {
|
|||
),
|
||||
new System(),
|
||||
new TimeZoneProvider(new System()),
|
||||
new Options()
|
||||
$options
|
||||
);
|
||||
$this->share = $this->server->getShare($this->config->share);
|
||||
if ($this->config->root) {
|
||||
|
|
@ -39,4 +44,41 @@ class NativeShareTest extends AbstractShareTest {
|
|||
}
|
||||
$this->share->mkdir($this->root);
|
||||
}
|
||||
|
||||
public function testProtocolMatch() {
|
||||
$options = new Options();
|
||||
$options->setMinProtocol(IOptions::PROTOCOL_SMB2);
|
||||
$options->setMaxProtocol(IOptions::PROTOCOL_SMB3);
|
||||
$server = new NativeServer(
|
||||
$this->config->host,
|
||||
new BasicAuth(
|
||||
$this->config->user,
|
||||
'test',
|
||||
$this->config->password
|
||||
),
|
||||
new System(),
|
||||
new TimeZoneProvider(new System()),
|
||||
$options
|
||||
);
|
||||
$server->listShares();
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testToLowMaxProtocol() {
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$options = new Options();
|
||||
$options->setMaxProtocol(IOptions::PROTOCOL_NT1);
|
||||
$server = new NativeServer(
|
||||
$this->config->host,
|
||||
new BasicAuth(
|
||||
$this->config->user,
|
||||
'test',
|
||||
$this->config->password
|
||||
),
|
||||
new System(),
|
||||
new TimeZoneProvider(new System()),
|
||||
$options
|
||||
);
|
||||
$server->listShares();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue