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
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
||||
* 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;
|
||||
|
||||
class Server {
|
||||
|
||||
const LOCALE = 'en_US.UTF-8';
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +45,12 @@ class Server {
|
|||
*/
|
||||
private $timezoneProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string $maxProtocol
|
||||
*/
|
||||
private $maxProtocol;
|
||||
|
||||
/**
|
||||
* Check if the smbclient php extension is available
|
||||
*
|
||||
|
|
@ -126,11 +134,8 @@ class Server {
|
|||
*/
|
||||
public function listShares() {
|
||||
$workgroupArgument = ($this->workgroup) ? ' -W ' . escapeshellarg($this->workgroup) : '';
|
||||
$command = sprintf('%s %s --authentication-file=%s -gL %s',
|
||||
$this->system->getSmbclientPath(),
|
||||
$workgroupArgument,
|
||||
System::getFD(3),
|
||||
escapeshellarg($this->getHost())
|
||||
$maxProtocolArgument = ($this->maxProtocol) ? ' -m ' . escapeshellarg($this->maxProtocol) : '';
|
||||
$command = sprintf('%s %s %s --authentication-file=%s -gL %s', $this->system->getSmbclientPath(), $workgroupArgument, $maxProtocolArgument,System::getFD(3), escapeshellarg($this->getHost())
|
||||
);
|
||||
$connection = new RawConnection($command);
|
||||
$connection->writeAuthentication($this->getUser(), $this->getPassword());
|
||||
|
|
@ -162,4 +167,22 @@ class Server {
|
|||
public function getTimeZone() {
|
||||
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