diff -Nur e-smith-samba-2.6.0.old/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol e-smith-samba-2.6.0/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol --- e-smith-samba-2.6.0.old/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol 2016-02-05 12:16:12.000000000 -0500 +++ e-smith-samba-2.6.0/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol 2020-06-23 13:57:15.530000000 -0400 @@ -1,12 +1,27 @@ { # Normally this should not be set as the automatic negotiation phase in the SMB protocol takes care of choosing the appropiate protocol. $OUT = ""; - if ($smb{ClientMaxProtocol}) - { - $OUT .= "client max protocol = $smb{ClientMaxProtocol}\n"; - } - if ($smb{ServerMaxProtocol}) - { - $OUT .= "server max protocol = $smb{ServerMaxProtocol}"; - } -} + our %ProtocolOrder = ( CORE => 1, # samba client default without explicit option; not available for server + COREPLUS => 2, # not available for server + LANMAN1 => 3, #samba server default without explicit option + LANMAN2 => 4, + NT1 => 5, # CIFS or SMB1 + SMB2_02 => 6, + SMB2_10 => 7, + SMB2 => 7, # yes SMB2 default to 2_10 + SMB2_22 => 8, + SMB2_24 => 9, + SMB3_00 => 10, + SMB3_02 => 11, + SMB3_10 => 12, + SMB3_11 => 13, + 'SMB3' => 13 # yes SMB3 default to SMB3_11 + ); + $clientMaxProt = $smb{ClientMaxProtocol} || "SMB3"; + $serverMaxProt = $smb{ServerMaxProtocol} || "SMB3"; + #checking option is possible + $clientMaxProt = ( exists($ProtocolOrder{$clientMaxProt}) ) ? $clientMaxProt : "SMB3"; + $serverMaxProt = ( exists($ProtocolOrder{$serverMaxProt}) && $ProtocolOrder{$serverMaxProt} >= 3) ? $serverMaxProt : "SMB3"; + $OUT .= "client max protocol = $clientMaxProt\n"; + $OUT .= "server max protocol = $serverMaxProt"; +} diff -Nur e-smith-samba-2.6.0.old/root/etc/e-smith/templates/etc/smb.conf/11minProtocol e-smith-samba-2.6.0/root/etc/e-smith/templates/etc/smb.conf/11minProtocol --- e-smith-samba-2.6.0.old/root/etc/e-smith/templates/etc/smb.conf/11minProtocol 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/etc/e-smith/templates/etc/smb.conf/11minProtocol 2020-06-23 13:57:34.819000000 -0400 @@ -0,0 +1,16 @@ +{ +# Normally this should not be set as the automatic negotiation phase in the SMB protocol takes care of choosing the appropiate protocol. + $OUT = ""; + $clientMinProt = $smb{ClientMinProtocol} || "SMB2"; + $serverMinProt = $smb{ServerMinProtocol} || "SMB2"; + $clientMinProt = ( exists($ProtocolOrder{$clientMinProt}) ) ? $clientMinProt : "SMB2"; + $serverMinProt = ( exists($ProtocolOrder{$serverMinProt}) && $ProtocolOrder{$serverMinProt} >= 3) ? $serverMinProt : "SMB3"; + #checking min prot is not higher + $clientMinProt = ( $ProtocolOrder{$clientMaxProt} >= $ProtocolOrder{$clientMinProt} ) ? $clientMinProt : $clientMaxProt; + $serverMinProt = ( $ProtocolOrder{$serverMaxProt} >= $ProtocolOrder{$serverMinProt} ) ? $serverMinProt : $serverMaxProt; + + $OUT .= "client min protocol = $clientMinProt\n"; + $OUT .= "server min protocol = $serverMinProt"; + +} + diff -Nur e-smith-samba-2.6.0.old/root/etc/e-smith/templates/etc/smb.conf/11smbPorts e-smith-samba-2.6.0/root/etc/e-smith/templates/etc/smb.conf/11smbPorts --- e-smith-samba-2.6.0.old/root/etc/e-smith/templates/etc/smb.conf/11smbPorts 2007-12-15 10:53:08.000000000 -0500 +++ e-smith-samba-2.6.0/root/etc/e-smith/templates/etc/smb.conf/11smbPorts 2020-06-23 13:57:48.232000000 -0400 @@ -1,5 +1,7 @@ { - my $smb_ports = $smb{SMBPorts} || 139; + my $smb_ports = $smb{SMBPorts} || "139 445"; + $smb_ports = "$smb_ports 445" unless ( $smb_ports =~ /445/ || $ProtocolOrder{$serverMaxProt} <= 5 ); + "smb ports = $smb_ports"; }