[pve-devel] applied: [PATCH] Use enums for smbvers to prevent incorrect input

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 6 16:10:18 CEST 2018


On 6/6/18 4:01 PM, Wolfgang Link wrote:
>> Thomas Lamprecht <t.lamprecht at proxmox.com> hat am 6. Juni 2018 um 15:51 geschrieben:
>>
>>
>> On 6/6/18 1:23 PM, Wolfgang Link wrote:
>>> ---
>>>  PVE/Storage/CIFSPlugin.pm | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm
>>> index cb7c844..2124c87 100644
>>> --- a/PVE/Storage/CIFSPlugin.pm
>>> +++ b/PVE/Storage/CIFSPlugin.pm
>>> @@ -104,8 +104,9 @@ sub properties {
>>>  	    maxLength => 256,
>>>  	},
>>>  	smbversion => {
>>> -	    description => "",
>>> +	    description => "SMB protokoll version",
>>
>> s/protokoll/protocol/
>>
>>>  	    type => 'string',
>>> +	    enum => ['2.0', '2.1', '3.0'],
>>
>> We use the following code to tell smbclient about what version to use with
>> the -m option.
>>
>> my $cmd = ['/usr/bin/smbclient', $servicename, '-d', '0', '-m'];
>> push @$cmd, $scfg->{smbversion} ? "smb".int($scfg->{smbversion}) : 'smb3';
>>
>> Thus an user could (validly) used '2', '3', '3.0.2', '3.1.1' for this and
>> it'd have worked, but after this patch the user gets an verification error.
>> While maybe to to probable it's still not ideal...
>> Should we justThus an user could  hope nobody did that?
> 
> All options besides '3.0', '2.1', '2.0' and '1.0' will end in an mount error
> Only '1.0' is a working option what we would remove.
> 

Ah, OK, missed that, thanks for clarifying! Applied with s/protokoll/protocol/
followup.

> PVE/Storage/CIFSPlugin.pm
> @@ 70 @@
>     push @$cmd, '-o', defined($smbver) ? "vers=$smbver" : "vers=3.0";
> 
> man mount.cifs under vers=
> vers=
>            SMB protocol version. Allowed values are:
> 
>            ·   1.0 - The classic CIFS/SMBv1 protocol. This is the default.
> 
>            ·   2.0 - The SMBv2.002 protocol. This was initially introduced in Windows Vista Service Pack 1, and Windows Server 2008. Note that the initial release version of Windows Vista spoke a slightly
>                different dialect (2.000) that is not supported.
> 
>            ·   2.1 - The SMBv2.1 protocol that was introduced in Microsoft Windows 7 and Windows Server 2008R2.
> 
>            ·   3.0 - The SMBv3.0 protocol that was introduced in Microsoft Windows 8 and Windows Server 2012.
> 
>            Note too that while this option governs the protocol version used, not all features of each version are available.
> 
> 
>>
>>>  	    optional => 1,
>>>  	},
>>>      };
>>>
>>






More information about the pve-devel mailing list