1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

s3: smbd: Only pass fsp to set_unix_posix_acl(). No longer uses smb_fname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Jeremy Allison 2019-06-18 15:18:47 -07:00
parent 681f0f2337
commit caa4024a91
3 changed files with 10 additions and 30 deletions

View File

@ -4615,18 +4615,16 @@ static NTSTATUS remove_posix_acl(connection_struct *conn,
NTSTATUS set_unix_posix_acl(connection_struct *conn,
files_struct *fsp,
const struct smb_filename *smb_fname,
uint16_t num_acls,
const char *pdata)
{
SMB_ACL_T file_acl = NULL;
const char *fname = smb_fname->base_name;
int ret;
NTSTATUS status;
if (!num_acls) {
/* Remove the ACL from the file. */
return remove_posix_acl(conn, fsp, smb_fname);
return remove_posix_acl(conn, fsp, fsp->fsp_name);
}
file_acl = create_posix_acl_from_wire(conn,
@ -4637,34 +4635,18 @@ NTSTATUS set_unix_posix_acl(connection_struct *conn,
return map_nt_error_from_unix(errno);
}
if (fsp && fsp->fh->fd != -1) {
/* The preferred way - use an open fd. */
ret = SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
DBG_INFO("acl_set_file failed on %s (%s)\n",
fname,
strerror(errno));
TALLOC_FREE(file_acl);
return status;
}
} else {
ret = SMB_VFS_SYS_ACL_SET_FILE(conn,
smb_fname,
SMB_ACL_TYPE_ACCESS,
file_acl);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
DBG_INFO("acl_set_file failed on %s (%s)\n",
fname,
strerror(errno));
TALLOC_FREE(file_acl);
return status;
}
ret = SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl);
if (ret == -1) {
status = map_nt_error_from_unix(errno);
DBG_INFO("acl_set_file failed on %s (%s)\n",
fsp_str_dbg(fsp),
strerror(errno));
TALLOC_FREE(file_acl);
return status;
}
DBG_DEBUG("set acl for file %s\n",
fname);
fsp_str_dbg(fsp));
TALLOC_FREE(file_acl);
return NT_STATUS_OK;

View File

@ -811,7 +811,6 @@ NTSTATUS set_unix_posix_default_acl(connection_struct *conn,
const struct smb_filename *smb_fname,
uint16_t num_def_acls, const char *pdata);
NTSTATUS set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
const struct smb_filename *smb_fname,
uint16_t num_acls,
const char *pdata);
NTSTATUS get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname,

View File

@ -7464,7 +7464,6 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
if (valid_file_acls) {
status = set_unix_posix_acl(conn,
fsp,
fsp->fsp_name,
num_file_acls,
pdata);
if (!NT_STATUS_IS_OK(status)) {