aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-10-11 06:41:32 -0400
committerSteve French <smfrench@gmail.com>2011-10-13 00:41:41 -0400
commit826a95e4a33f3e9bfa0d31ab769d5b01130f7111 (patch)
treeca1345ef9b0887b1b2985e7fbbf19f80eb4a5e61 /fs/cifs/transport.c
parent376b43f41c8b9315f7efdf085d214b6024337381 (diff)
cifs: consolidate signature generating code
We have two versions of signature generating code. A vectorized and non-vectorized version. Eliminate a large chunk of cut-and-paste code by turning the non-vectorized version into a wrapper around the vectorized one. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 10ca6b2c26b7..33a3fbf3a3a5 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -496,13 +496,18 @@ int
496cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server, 496cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
497 bool log_error) 497 bool log_error)
498{ 498{
499 dump_smb(mid->resp_buf, 499 unsigned int len = be32_to_cpu(mid->resp_buf->smb_buf_length) + 4;
500 min_t(u32, 92, be32_to_cpu(mid->resp_buf->smb_buf_length))); 500
501 dump_smb(mid->resp_buf, min_t(u32, 92, len));
501 502
502 /* convert the length into a more usable form */ 503 /* convert the length into a more usable form */
503 if (server->sec_mode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { 504 if (server->sec_mode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) {
505 struct kvec iov;
506
507 iov.iov_base = mid->resp_buf;
508 iov.iov_len = len;
504 /* FIXME: add code to kill session */ 509 /* FIXME: add code to kill session */
505 if (cifs_verify_signature(mid->resp_buf, server, 510 if (cifs_verify_signature(&iov, 1, server,
506 mid->sequence_number + 1) != 0) 511 mid->sequence_number + 1) != 0)
507 cERROR(1, "Unexpected SMB signature"); 512 cERROR(1, "Unexpected SMB signature");
508 } 513 }