1 |
diff -urN e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol |
2 |
--- e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol 2020-06-29 10:28:03.771000183 +1000 |
3 |
+++ e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11maxProtocol 2020-06-29 10:30:59.000000000 +1000 |
4 |
@@ -1,12 +1,23 @@ |
5 |
{ |
6 |
# Normally this should not be set as the automatic negotiation phase in the SMB protocol takes care of choosing the appropiate protocol. |
7 |
- $OUT = ""; |
8 |
- if ($smb{ServerMinProtocol}) |
9 |
- { |
10 |
- $OUT .= "min protocol = $smb{ServerMinProtocol}\n"; |
11 |
- } |
12 |
- if ($smb{ServerMaxProtocol}) |
13 |
- { |
14 |
- $OUT .= "max protocol = $smb{ServerMaxProtocol}"; |
15 |
- } |
16 |
+$OUT = ""; |
17 |
+our %ProtocolOrder = ( CORE => 1, # samba client default without explicit option; not available for server |
18 |
+COREPLUS => 2, # not available for server |
19 |
+LANMAN1 => 3, #samba server default without explicit option |
20 |
+LANMAN2 => 4, |
21 |
+NT1 => 5, # CIFS or SMB1 |
22 |
+SMB2_02 => 6, |
23 |
+SMB2_10 => 7, |
24 |
+SMB2 => 7, # yes SMB2 default to 2_10 |
25 |
+SMB2_22 => 8, |
26 |
+SMB2_24 => 9, |
27 |
+); |
28 |
+$serverMinProt = $smb{ServerMinProtocol} || "LANMAN1"; |
29 |
+$serverMaxProt = $smb{ServerMaxProtocol} || "SMB2"; |
30 |
+#checking option is possible |
31 |
+$serverMinProt = ( exists($ProtocolOrder{$serverMinProt}) ) ? $serverMinProt : "LANMAN1"; |
32 |
+$serverMaxProt = ( exists($ProtocolOrder{$serverMaxProt}) && $ProtocolOrder{$serverMaxProt} >= 3) ? $serverMaxProt : "SMB2"; |
33 |
+$serverMinProt = ( $ProtocolOrder{$serverMaxProt} >= $ProtocolOrder{$serverMinProt} ) ? $serverMinProt : $serverMaxProt; |
34 |
+$OUT .= "min protocol = $serverMinProt\n"; |
35 |
+$OUT .= "max protocol = $serverMaxProt"; |
36 |
} |
37 |
diff -urN e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11smbPorts e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11smbPorts |
38 |
--- e-smith-samba-2.4.0.old/root/etc/e-smith/templates/etc/smb.conf/11smbPorts 2020-06-29 10:28:03.772000160 +1000 |
39 |
+++ e-smith-samba-2.4.0/root/etc/e-smith/templates/etc/smb.conf/11smbPorts 2020-06-29 10:34:32.000000000 +1000 |
40 |
@@ -1,5 +1,7 @@ |
41 |
{ |
42 |
- my $smb_ports = $smb{SMBPorts} || 139; |
43 |
+my $smb_ports = $smb{SMBPorts} || "139 445"; |
44 |
|
45 |
- "smb ports = $smb_ports"; |
46 |
+$smb_ports = "$smb_ports 445" unless ( $smb_ports =~ /445/ || $ProtocolOrder{$serverMinProt} <= 5 );# $ProtocolOrder{$serverMinProt} > 5 |
47 |
+ |
48 |
+"smb ports = $smb_ports"; |
49 |
} |