diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-06-27 12:45:00 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-06-28 00:42:18 -0400 |
commit | 50285882fdd919e2b9617fc844b4816b7833f115 (patch) | |
tree | dfe5f3d8ffd8ffd520f12234712ca3a07db69039 | |
parent | e65a5cb41718e0eb17a470bc3acf2c3b2f00f1d0 (diff) |
cifs: fix SMB2 signing enablement in cifs_enable_signing
Commit 9ddec56131 (cifs: move handling of signed connections into
separate function) broke signing on SMB2/3 connections. While the code
to enable signing on the connections was very similar between the two,
the bits that get set in the sec_mode are different.
Declare a couple of new smb_version_values fields and set them
appropriately for SMB1 and SMB2/3. Then change cifs_enable_signing to
use those instead.
Reported-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Tested-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r-- | fs/cifs/cifsglob.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 4 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb2ops.c | 8 |
4 files changed, 14 insertions, 2 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index b0f077ebb590..e66b08882548 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -387,6 +387,8 @@ struct smb_version_values { | |||
387 | unsigned int cap_nt_find; | 387 | unsigned int cap_nt_find; |
388 | unsigned int cap_large_files; | 388 | unsigned int cap_large_files; |
389 | unsigned int oplock_read; | 389 | unsigned int oplock_read; |
390 | __u16 signing_enabled; | ||
391 | __u16 signing_required; | ||
390 | }; | 392 | }; |
391 | 393 | ||
392 | #define HEADER_SIZE(server) (server->vals->header_size) | 394 | #define HEADER_SIZE(server) (server->vals->header_size) |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index a35aad2060c5..bc7dfa857384 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -407,8 +407,8 @@ decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr) | |||
407 | int | 407 | int |
408 | cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required) | 408 | cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required) |
409 | { | 409 | { |
410 | bool srv_sign_required = server->sec_mode & SECMODE_SIGN_REQUIRED; | 410 | bool srv_sign_required = server->sec_mode & server->vals->signing_required; |
411 | bool srv_sign_enabled = server->sec_mode & SECMODE_SIGN_ENABLED; | 411 | bool srv_sign_enabled = server->sec_mode & server->vals->signing_enabled; |
412 | bool mnt_sign_enabled = global_secflags & CIFSSEC_MAY_SIGN; | 412 | bool mnt_sign_enabled = global_secflags & CIFSSEC_MAY_SIGN; |
413 | 413 | ||
414 | /* | 414 | /* |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index b28aabd33edd..e813f04511d8 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -957,4 +957,6 @@ struct smb_version_values smb1_values = { | |||
957 | .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND, | 957 | .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND, |
958 | .cap_large_files = CAP_LARGE_FILES, | 958 | .cap_large_files = CAP_LARGE_FILES, |
959 | .oplock_read = OPLOCK_READ, | 959 | .oplock_read = OPLOCK_READ, |
960 | .signing_enabled = SECMODE_SIGN_ENABLED, | ||
961 | .signing_required = SECMODE_SIGN_REQUIRED, | ||
960 | }; | 962 | }; |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 48fe7c4dab7e..6d15cab95b99 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -729,6 +729,8 @@ struct smb_version_values smb20_values = { | |||
729 | .cap_nt_find = SMB2_NT_FIND, | 729 | .cap_nt_find = SMB2_NT_FIND, |
730 | .cap_large_files = SMB2_LARGE_FILES, | 730 | .cap_large_files = SMB2_LARGE_FILES, |
731 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | 731 | .oplock_read = SMB2_OPLOCK_LEVEL_II, |
732 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
733 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
732 | }; | 734 | }; |
733 | 735 | ||
734 | struct smb_version_values smb21_values = { | 736 | struct smb_version_values smb21_values = { |
@@ -747,6 +749,8 @@ struct smb_version_values smb21_values = { | |||
747 | .cap_nt_find = SMB2_NT_FIND, | 749 | .cap_nt_find = SMB2_NT_FIND, |
748 | .cap_large_files = SMB2_LARGE_FILES, | 750 | .cap_large_files = SMB2_LARGE_FILES, |
749 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | 751 | .oplock_read = SMB2_OPLOCK_LEVEL_II, |
752 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
753 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
750 | }; | 754 | }; |
751 | 755 | ||
752 | struct smb_version_values smb30_values = { | 756 | struct smb_version_values smb30_values = { |
@@ -765,6 +769,8 @@ struct smb_version_values smb30_values = { | |||
765 | .cap_nt_find = SMB2_NT_FIND, | 769 | .cap_nt_find = SMB2_NT_FIND, |
766 | .cap_large_files = SMB2_LARGE_FILES, | 770 | .cap_large_files = SMB2_LARGE_FILES, |
767 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | 771 | .oplock_read = SMB2_OPLOCK_LEVEL_II, |
772 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
773 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
768 | }; | 774 | }; |
769 | 775 | ||
770 | struct smb_version_values smb302_values = { | 776 | struct smb_version_values smb302_values = { |
@@ -783,4 +789,6 @@ struct smb_version_values smb302_values = { | |||
783 | .cap_nt_find = SMB2_NT_FIND, | 789 | .cap_nt_find = SMB2_NT_FIND, |
784 | .cap_large_files = SMB2_LARGE_FILES, | 790 | .cap_large_files = SMB2_LARGE_FILES, |
785 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | 791 | .oplock_read = SMB2_OPLOCK_LEVEL_II, |
792 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
793 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | ||
786 | }; | 794 | }; |