Skip to content

Commit 18f3948

Browse files
committed
samba: make SMBv2 + SMBv1 the default, and add a SMBv2-only option
1 parent ca28e0f commit 18f3948

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

release/src/router/libdisk/write_smb_conf.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,14 @@ int main(int argc, char *argv[])
378378
// fprintf(fp, "preferred master = yes\n");
379379
fprintf(fp, "load printers = no\n");
380380
fprintf(fp, "printable = no\n");
381-
if (nvram_get_int("smbd_enable_smb2"))
382-
fprintf(fp, "max protocol = SMB2\n");
383-
else
381+
// 0 - smb1, 1 = smb2, 2 = smb1 + smb2
382+
if (nvram_get_int("smbd_protocol") == 0)
384383
fprintf(fp, "max protocol = NT1\n");
384+
else
385+
fprintf(fp, "max protocol = SMB2\n");
386+
if (nvram_get_int("smbd_protocol") == 1)
387+
fprintf(fp, "min protocol = SMB2\n");
388+
385389
fprintf(fp, "smb encrypt = disabled\n");
386390
fprintf(fp, "min receivefile size = 16384\n");
387391
fprintf(fp, "passdb backend = smbpasswd\n");

release/src/router/shared/defaults.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ struct nvram_tuple router_defaults[] = {
17441744
// { "smbd_wgroup", "WORKGROUP" },
17451745
{ "smbd_wins", "0" },
17461746
{ "smbd_simpler_naming", "0" },
1747-
{ "smbd_enable_smb2", "0" },
1747+
{ "smbd_protocol", "2" }, /* 0 = SMB1, 1 = SMB2, 2 = SMB1+SMB2 */
17481748
{ "enable_samba_tuxera", "0" },
17491749

17501750
#ifdef RTCONFIG_NFS

release/src/router/www/Advanced_AiDisk_samba.asp

+5-2
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,11 @@ function validForm(){
794794
<tr>
795795
<th>Enable SMB2 protocol (default: No)</th>
796796
<td>
797-
<input type="radio" name="smbd_enable_smb2" class="input" value="1" <% nvram_match_x("", "smbd_enable_smb2", "1", "checked"); %>><#checkbox_Yes#>
798-
<input type="radio" name="smbd_enable_smb2" class="input" value="0" <% nvram_match_x("", "smbd_enable_smb2", "0", "checked"); %>><#checkbox_No#>
797+
<select name="smbd_protocol" class="input_option">
798+
<option class="content_input_fd" value="0" <% nvram_match("smbd_protocol", "0","selected"); %>>SMBv1</option>
799+
<option class="content_input_fd" value="1" <% nvram_match("smbd_protocol", "1","selected"); %>>SMBv2</option>
800+
<option class="content_input_fd" value="2" <% nvram_match("smbd_protocol", "2","selected"); %>>SMBv1 + SMBv2</option>
801+
</select>
799802
</td>
800803
</tr>
801804
<tr>

0 commit comments

Comments
 (0)