mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-04 01:34:07 +02:00
Update Server.php
Adicionado método para definir o protocolo de SMB máximo.
This commit is contained in:
parent
97ea247c5c
commit
499148909e
1 changed files with 174 additions and 151 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
||||||
* This file is licensed under the Licensed under the MIT license:
|
* This file is licensed under the Licensed under the MIT license:
|
||||||
|
|
@ -11,6 +12,7 @@ use Icewind\SMB\Exception\AuthenticationException;
|
||||||
use Icewind\SMB\Exception\InvalidHostException;
|
use Icewind\SMB\Exception\InvalidHostException;
|
||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
|
|
||||||
const LOCALE = 'en_US.UTF-8';
|
const LOCALE = 'en_US.UTF-8';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -43,6 +45,12 @@ class Server {
|
||||||
*/
|
*/
|
||||||
private $timezoneProvider;
|
private $timezoneProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string $maxProtocol
|
||||||
|
*/
|
||||||
|
private $maxProtocol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the smbclient php extension is available
|
* Check if the smbclient php extension is available
|
||||||
*
|
*
|
||||||
|
|
@ -126,11 +134,8 @@ class Server {
|
||||||
*/
|
*/
|
||||||
public function listShares() {
|
public function listShares() {
|
||||||
$workgroupArgument = ($this->workgroup) ? ' -W ' . escapeshellarg($this->workgroup) : '';
|
$workgroupArgument = ($this->workgroup) ? ' -W ' . escapeshellarg($this->workgroup) : '';
|
||||||
$command = sprintf('%s %s --authentication-file=%s -gL %s',
|
$maxProtocolArgument = ($this->maxProtocol) ? ' -m ' . escapeshellarg($this->maxProtocol) : '';
|
||||||
$this->system->getSmbclientPath(),
|
$command = sprintf('%s %s %s --authentication-file=%s -gL %s', $this->system->getSmbclientPath(), $workgroupArgument, $maxProtocolArgument,System::getFD(3), escapeshellarg($this->getHost())
|
||||||
$workgroupArgument,
|
|
||||||
System::getFD(3),
|
|
||||||
escapeshellarg($this->getHost())
|
|
||||||
);
|
);
|
||||||
$connection = new RawConnection($command);
|
$connection = new RawConnection($command);
|
||||||
$connection->writeAuthentication($this->getUser(), $this->getPassword());
|
$connection->writeAuthentication($this->getUser(), $this->getPassword());
|
||||||
|
|
@ -162,4 +167,22 @@ class Server {
|
||||||
public function getTimeZone() {
|
public function getTimeZone() {
|
||||||
return $this->timezoneProvider->get();
|
return $this->timezoneProvider->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getMaxProtocol() {
|
||||||
|
return $this->maxProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer $maxProtocol
|
||||||
|
*/
|
||||||
|
public function setMaxProtocol($maxProtocol) {
|
||||||
|
if((ctype_digit(strval($maxProtocol)))){
|
||||||
|
$this->maxProtocol = 'SMB' . $maxProtocol;
|
||||||
|
} else {
|
||||||
|
throw new Exception\InvalidTypeException("Parameter is invalid, integer type only is accepted");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue