提交 88ea5cb7 编写于 作者: R Ronnie Sahlberg 提交者: Steve French

cifs: remove rfc1002 header from smb2_sess_setup_req

Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: NSteve French <smfrench@gmail.com>
Reviewed-by: NAurelien Aptel <aaptel@suse.com>
Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
上级 661bb943
...@@ -808,20 +808,22 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data) ...@@ -808,20 +808,22 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data)
struct cifs_ses *ses = sess_data->ses; struct cifs_ses *ses = sess_data->ses;
struct smb2_sess_setup_req *req; struct smb2_sess_setup_req *req;
struct TCP_Server_Info *server = ses->server; struct TCP_Server_Info *server = ses->server;
unsigned int total_len;
rc = small_smb2_init(SMB2_SESSION_SETUP, NULL, (void **) &req); rc = smb2_plain_req_init(SMB2_SESSION_SETUP, NULL, (void **) &req,
&total_len);
if (rc) if (rc)
return rc; return rc;
/* First session, not a reauthenticate */ /* First session, not a reauthenticate */
req->hdr.sync_hdr.SessionId = 0; req->sync_hdr.SessionId = 0;
/* if reconnect, we need to send previous sess id, otherwise it is 0 */ /* if reconnect, we need to send previous sess id, otherwise it is 0 */
req->PreviousSessionId = sess_data->previous_session; req->PreviousSessionId = sess_data->previous_session;
req->Flags = 0; /* MBZ */ req->Flags = 0; /* MBZ */
/* to enable echos and oplocks */ /* to enable echos and oplocks */
req->hdr.sync_hdr.CreditRequest = cpu_to_le16(3); req->sync_hdr.CreditRequest = cpu_to_le16(3);
/* only one of SMB2 signing flags may be set in SMB2 request */ /* only one of SMB2 signing flags may be set in SMB2 request */
if (server->sign) if (server->sign)
...@@ -835,8 +837,8 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data) ...@@ -835,8 +837,8 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data)
req->Channel = 0; /* MBZ */ req->Channel = 0; /* MBZ */
sess_data->iov[0].iov_base = (char *)req; sess_data->iov[0].iov_base = (char *)req;
/* 4 for rfc1002 length field and 1 for pad */ /* 1 for pad */
sess_data->iov[0].iov_len = get_rfc1002_length(req) + 4 - 1; sess_data->iov[0].iov_len = total_len - 1;
/* /*
* This variable will be used to clear the buffer * This variable will be used to clear the buffer
* allocated above in case of any error in the calling function. * allocated above in case of any error in the calling function.
...@@ -862,15 +864,12 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data) ...@@ -862,15 +864,12 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
/* Testing shows that buffer offset must be at location of Buffer[0] */ /* Testing shows that buffer offset must be at location of Buffer[0] */
req->SecurityBufferOffset = req->SecurityBufferOffset =
cpu_to_le16(sizeof(struct smb2_sess_setup_req) - cpu_to_le16(sizeof(struct smb2_sess_setup_req) - 1 /* pad */);
1 /* pad */ - 4 /* rfc1001 len */);
req->SecurityBufferLength = cpu_to_le16(sess_data->iov[1].iov_len); req->SecurityBufferLength = cpu_to_le16(sess_data->iov[1].iov_len);
inc_rfc1001_len(req, sess_data->iov[1].iov_len - 1 /* pad */);
/* BB add code to build os and lm fields */ /* BB add code to build os and lm fields */
rc = SendReceive2(sess_data->xid, sess_data->ses, rc = smb2_send_recv(sess_data->xid, sess_data->ses,
sess_data->iov, 2, sess_data->iov, 2,
&sess_data->buf0_type, &sess_data->buf0_type,
CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov); CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov);
...@@ -1094,7 +1093,7 @@ SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data) ...@@ -1094,7 +1093,7 @@ SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data)
goto out; goto out;
req = (struct smb2_sess_setup_req *) sess_data->iov[0].iov_base; req = (struct smb2_sess_setup_req *) sess_data->iov[0].iov_base;
req->hdr.sync_hdr.SessionId = ses->Suid; req->sync_hdr.SessionId = ses->Suid;
rc = build_ntlmssp_auth_blob(&ntlmssp_blob, &blob_length, ses, rc = build_ntlmssp_auth_blob(&ntlmssp_blob, &blob_length, ses,
sess_data->nls_cp); sess_data->nls_cp);
......
...@@ -282,7 +282,7 @@ struct smb2_negotiate_rsp { ...@@ -282,7 +282,7 @@ struct smb2_negotiate_rsp {
#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04 #define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
struct smb2_sess_setup_req { struct smb2_sess_setup_req {
struct smb2_hdr hdr; struct smb2_sync_hdr sync_hdr;
__le16 StructureSize; /* Must be 25 */ __le16 StructureSize; /* Must be 25 */
__u8 Flags; __u8 Flags;
__u8 SecurityMode; __u8 SecurityMode;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册