mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ksmbd: fill sids in SMB_FIND_FILE_POSIX_INFO response
[ Upstream commit d5919f2a14 ]
This patch fill missing sids in SMB_FIND_FILE_POSIX_INFO response.
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
95b72edca5
commit
e925de7def
@@ -4754,7 +4754,9 @@ static int find_file_posix_info(struct smb2_query_info_rsp *rsp,
|
|||||||
{
|
{
|
||||||
struct smb311_posix_qinfo *file_info;
|
struct smb311_posix_qinfo *file_info;
|
||||||
struct inode *inode = file_inode(fp->filp);
|
struct inode *inode = file_inode(fp->filp);
|
||||||
|
struct user_namespace *user_ns = file_mnt_user_ns(fp->filp);
|
||||||
u64 time;
|
u64 time;
|
||||||
|
int out_buf_len = sizeof(struct smb311_posix_qinfo) + 32;
|
||||||
|
|
||||||
file_info = (struct smb311_posix_qinfo *)rsp->Buffer;
|
file_info = (struct smb311_posix_qinfo *)rsp->Buffer;
|
||||||
file_info->CreationTime = cpu_to_le64(fp->create_time);
|
file_info->CreationTime = cpu_to_le64(fp->create_time);
|
||||||
@@ -4771,10 +4773,24 @@ static int find_file_posix_info(struct smb2_query_info_rsp *rsp,
|
|||||||
file_info->HardLinks = cpu_to_le32(inode->i_nlink);
|
file_info->HardLinks = cpu_to_le32(inode->i_nlink);
|
||||||
file_info->Mode = cpu_to_le32(inode->i_mode & 0777);
|
file_info->Mode = cpu_to_le32(inode->i_mode & 0777);
|
||||||
file_info->DeviceId = cpu_to_le32(inode->i_rdev);
|
file_info->DeviceId = cpu_to_le32(inode->i_rdev);
|
||||||
rsp->OutputBufferLength =
|
|
||||||
cpu_to_le32(sizeof(struct smb311_posix_qinfo));
|
/*
|
||||||
inc_rfc1001_len(rsp_org, sizeof(struct smb311_posix_qinfo));
|
* Sids(32) contain two sids(Domain sid(16), UNIX group sid(16)).
|
||||||
return 0;
|
* UNIX sid(16) = revision(1) + num_subauth(1) + authority(6) +
|
||||||
|
* sub_auth(4 * 1(num_subauth)) + RID(4).
|
||||||
|
*/
|
||||||
|
id_to_sid(from_kuid_munged(&init_user_ns,
|
||||||
|
i_uid_into_mnt(user_ns, inode)),
|
||||||
|
SIDUNIX_USER,
|
||||||
|
(struct smb_sid *)&file_info->Sids[0]);
|
||||||
|
id_to_sid(from_kgid_munged(&init_user_ns,
|
||||||
|
i_gid_into_mnt(user_ns, inode)),
|
||||||
|
SIDUNIX_GROUP,
|
||||||
|
(struct smb_sid *)&file_info->Sids[16]);
|
||||||
|
|
||||||
|
rsp->OutputBufferLength = cpu_to_le32(out_buf_len);
|
||||||
|
inc_rfc1001_len(rsp_org, out_buf_len);
|
||||||
|
return out_buf_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smb2_get_info_file(struct ksmbd_work *work,
|
static int smb2_get_info_file(struct ksmbd_work *work,
|
||||||
@@ -4894,8 +4910,8 @@ static int smb2_get_info_file(struct ksmbd_work *work,
|
|||||||
pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n");
|
pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n");
|
||||||
rc = -EOPNOTSUPP;
|
rc = -EOPNOTSUPP;
|
||||||
} else {
|
} else {
|
||||||
rc = find_file_posix_info(rsp, fp, work->response_buf);
|
file_infoclass_size = find_file_posix_info(rsp, fp,
|
||||||
file_infoclass_size = sizeof(struct smb311_posix_qinfo);
|
work->response_buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user