cifs: remove rfc1002 header from smb2_create_req
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com> Acked-by: Pavel Shilovsky <pshilov@microsoft.com> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
This commit is contained in:
parent
88ea5cb7d4
commit
4f33bc3587
@ -1525,11 +1525,10 @@ add_lease_context(struct TCP_Server_Info *server, struct kvec *iov,
|
|||||||
req->RequestedOplockLevel = SMB2_OPLOCK_LEVEL_LEASE;
|
req->RequestedOplockLevel = SMB2_OPLOCK_LEVEL_LEASE;
|
||||||
if (!req->CreateContextsOffset)
|
if (!req->CreateContextsOffset)
|
||||||
req->CreateContextsOffset = cpu_to_le32(
|
req->CreateContextsOffset = cpu_to_le32(
|
||||||
sizeof(struct smb2_create_req) - 4 +
|
sizeof(struct smb2_create_req) +
|
||||||
iov[num - 1].iov_len);
|
iov[num - 1].iov_len);
|
||||||
le32_add_cpu(&req->CreateContextsLength,
|
le32_add_cpu(&req->CreateContextsLength,
|
||||||
server->vals->create_lease_size);
|
server->vals->create_lease_size);
|
||||||
inc_rfc1001_len(&req->hdr, server->vals->create_lease_size);
|
|
||||||
*num_iovec = num + 1;
|
*num_iovec = num + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1609,10 +1608,9 @@ add_durable_v2_context(struct kvec *iov, unsigned int *num_iovec,
|
|||||||
iov[num].iov_len = sizeof(struct create_durable_v2);
|
iov[num].iov_len = sizeof(struct create_durable_v2);
|
||||||
if (!req->CreateContextsOffset)
|
if (!req->CreateContextsOffset)
|
||||||
req->CreateContextsOffset =
|
req->CreateContextsOffset =
|
||||||
cpu_to_le32(sizeof(struct smb2_create_req) - 4 +
|
cpu_to_le32(sizeof(struct smb2_create_req) +
|
||||||
iov[1].iov_len);
|
iov[1].iov_len);
|
||||||
le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable_v2));
|
le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable_v2));
|
||||||
inc_rfc1001_len(&req->hdr, sizeof(struct create_durable_v2));
|
|
||||||
*num_iovec = num + 1;
|
*num_iovec = num + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1633,12 +1631,10 @@ add_durable_reconnect_v2_context(struct kvec *iov, unsigned int *num_iovec,
|
|||||||
iov[num].iov_len = sizeof(struct create_durable_handle_reconnect_v2);
|
iov[num].iov_len = sizeof(struct create_durable_handle_reconnect_v2);
|
||||||
if (!req->CreateContextsOffset)
|
if (!req->CreateContextsOffset)
|
||||||
req->CreateContextsOffset =
|
req->CreateContextsOffset =
|
||||||
cpu_to_le32(sizeof(struct smb2_create_req) - 4 +
|
cpu_to_le32(sizeof(struct smb2_create_req) +
|
||||||
iov[1].iov_len);
|
iov[1].iov_len);
|
||||||
le32_add_cpu(&req->CreateContextsLength,
|
le32_add_cpu(&req->CreateContextsLength,
|
||||||
sizeof(struct create_durable_handle_reconnect_v2));
|
sizeof(struct create_durable_handle_reconnect_v2));
|
||||||
inc_rfc1001_len(&req->hdr,
|
|
||||||
sizeof(struct create_durable_handle_reconnect_v2));
|
|
||||||
*num_iovec = num + 1;
|
*num_iovec = num + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1669,10 +1665,9 @@ add_durable_context(struct kvec *iov, unsigned int *num_iovec,
|
|||||||
iov[num].iov_len = sizeof(struct create_durable);
|
iov[num].iov_len = sizeof(struct create_durable);
|
||||||
if (!req->CreateContextsOffset)
|
if (!req->CreateContextsOffset)
|
||||||
req->CreateContextsOffset =
|
req->CreateContextsOffset =
|
||||||
cpu_to_le32(sizeof(struct smb2_create_req) - 4 +
|
cpu_to_le32(sizeof(struct smb2_create_req) +
|
||||||
iov[1].iov_len);
|
iov[1].iov_len);
|
||||||
le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable));
|
le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable));
|
||||||
inc_rfc1001_len(&req->hdr, sizeof(struct create_durable));
|
|
||||||
*num_iovec = num + 1;
|
*num_iovec = num + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1743,6 +1738,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
__u32 file_attributes = 0;
|
__u32 file_attributes = 0;
|
||||||
char *dhc_buf = NULL, *lc_buf = NULL;
|
char *dhc_buf = NULL, *lc_buf = NULL;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
unsigned int total_len;
|
||||||
|
|
||||||
cifs_dbg(FYI, "create/open\n");
|
cifs_dbg(FYI, "create/open\n");
|
||||||
|
|
||||||
@ -1751,7 +1747,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
else
|
else
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
rc = small_smb2_init(SMB2_CREATE, tcon, (void **) &req);
|
rc = smb2_plain_req_init(SMB2_CREATE, tcon, (void **) &req, &total_len);
|
||||||
|
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
@ -1772,12 +1769,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
req->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK);
|
req->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK);
|
||||||
|
|
||||||
iov[0].iov_base = (char *)req;
|
iov[0].iov_base = (char *)req;
|
||||||
/* 4 for rfc1002 length field */
|
|
||||||
iov[0].iov_len = get_rfc1002_length(req) + 4;
|
|
||||||
/* -1 since last byte is buf[0] which is sent below (path) */
|
/* -1 since last byte is buf[0] which is sent below (path) */
|
||||||
iov[0].iov_len--;
|
iov[0].iov_len = total_len - 1;
|
||||||
|
|
||||||
req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req) - 4);
|
req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req));
|
||||||
|
|
||||||
/* [MS-SMB2] 2.2.13 NameOffset:
|
/* [MS-SMB2] 2.2.13 NameOffset:
|
||||||
* If SMB2_FLAGS_DFS_OPERATIONS is set in the Flags field of
|
* If SMB2_FLAGS_DFS_OPERATIONS is set in the Flags field of
|
||||||
@ -1790,7 +1785,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
if (tcon->share_flags & SHI1005_FLAGS_DFS) {
|
if (tcon->share_flags & SHI1005_FLAGS_DFS) {
|
||||||
int name_len;
|
int name_len;
|
||||||
|
|
||||||
req->hdr.sync_hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;
|
req->sync_hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;
|
||||||
rc = alloc_path_with_tree_prefix(©_path, ©_size,
|
rc = alloc_path_with_tree_prefix(©_path, ©_size,
|
||||||
&name_len,
|
&name_len,
|
||||||
tcon->treeName, path);
|
tcon->treeName, path);
|
||||||
@ -1817,8 +1812,6 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
|
|
||||||
iov[1].iov_len = uni_path_len;
|
iov[1].iov_len = uni_path_len;
|
||||||
iov[1].iov_base = path;
|
iov[1].iov_base = path;
|
||||||
/* -1 since last byte is buf[0] which was counted in smb2_buf_len */
|
|
||||||
inc_rfc1001_len(req, uni_path_len - 1);
|
|
||||||
|
|
||||||
if (!server->oplocks)
|
if (!server->oplocks)
|
||||||
*oplock = SMB2_OPLOCK_LEVEL_NONE;
|
*oplock = SMB2_OPLOCK_LEVEL_NONE;
|
||||||
@ -1856,7 +1849,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
dhc_buf = iov[n_iov-1].iov_base;
|
dhc_buf = iov[n_iov-1].iov_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov);
|
rc = smb2_send_recv(xid, ses, iov, n_iov, &resp_buftype, flags,
|
||||||
|
&rsp_iov);
|
||||||
cifs_small_buf_release(req);
|
cifs_small_buf_release(req);
|
||||||
rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
|
rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ struct smb2_tree_disconnect_rsp {
|
|||||||
#define SVHDX_OPEN_DEVICE_CONTEXT 0x83CE6F1AD851E0986E34401CC9BCFCE9
|
#define SVHDX_OPEN_DEVICE_CONTEXT 0x83CE6F1AD851E0986E34401CC9BCFCE9
|
||||||
|
|
||||||
struct smb2_create_req {
|
struct smb2_create_req {
|
||||||
struct smb2_hdr hdr;
|
struct smb2_sync_hdr sync_hdr;
|
||||||
__le16 StructureSize; /* Must be 57 */
|
__le16 StructureSize; /* Must be 57 */
|
||||||
__u8 SecurityFlags;
|
__u8 SecurityFlags;
|
||||||
__u8 RequestedOplockLevel;
|
__u8 RequestedOplockLevel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user