From: Jeremy Allison Date: Tue, 18 Jun 2019 22:36:58 +0000 (-0700) Subject: s3: smbd: Make set_unix_posix_default_acl() take an fsp argument, not smb_fname. X-Git-Tag: ldb-2.0.5~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=147ce70eeaf71d4aae0cb7af1f556e1404eaeb2c;p=thirdparty%2Fsamba.git s3: smbd: Make set_unix_posix_default_acl() take an fsp argument, not smb_fname. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index f4205b49e62..4393ef72de4 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -4351,7 +4351,7 @@ static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn, ****************************************************************************/ NTSTATUS set_unix_posix_default_acl(connection_struct *conn, - const struct smb_filename *smb_fname, + files_struct *fsp, uint16_t num_def_acls, const char *pdata) { @@ -4359,24 +4359,18 @@ NTSTATUS set_unix_posix_default_acl(connection_struct *conn, NTSTATUS status; int ret; - if (!S_ISDIR(smb_fname->st.st_ex_mode)) { - if (num_def_acls) { - DBG_INFO("Can't set default ACL on non-directory " - "file %s\n", - smb_fname->base_name); - return map_nt_error_from_unix(EISDIR); - } - return NT_STATUS_OK; + if (!fsp->is_directory) { + return NT_STATUS_INVALID_HANDLE; } if (!num_def_acls) { /* Remove the default ACL. */ - ret = SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname); + ret = SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, fsp->fsp_name); if (ret == -1) { status = map_nt_error_from_unix(errno); DBG_INFO("acl_delete_def_file failed on " "directory %s (%s)\n", - smb_fname->base_name, + fsp_str_dbg(fsp), strerror(errno)); return status; } @@ -4392,20 +4386,20 @@ NTSTATUS set_unix_posix_default_acl(connection_struct *conn, } ret = SMB_VFS_SYS_ACL_SET_FILE(conn, - smb_fname, + fsp->fsp_name, SMB_ACL_TYPE_DEFAULT, def_acl); if (ret == -1) { status = map_nt_error_from_unix(errno); DBG_INFO("acl_set_file failed on directory %s (%s)\n", - smb_fname->base_name, + fsp_str_dbg(fsp), strerror(errno)); TALLOC_FREE(def_acl); return status; } DBG_DEBUG("set default acl for file %s\n", - smb_fname->base_name); + fsp_str_dbg(fsp)); TALLOC_FREE(def_acl); return NT_STATUS_OK; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 4e5f82d0cdd..a0424388bec 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -808,7 +808,7 @@ int inherit_access_posix_acl(connection_struct *conn, const struct smb_filename *smb_fname, mode_t mode); NTSTATUS set_unix_posix_default_acl(connection_struct *conn, - const struct smb_filename *smb_fname, + files_struct *fsp, uint16_t num_def_acls, const char *pdata); NTSTATUS set_unix_posix_acl(connection_struct *conn, files_struct *fsp, uint16_t num_acls, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 7abf9bcfce0..1b8ebac1ae6 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7484,7 +7484,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn, if (valid_def_acls) { status = set_unix_posix_default_acl(conn, - fsp->fsp_name, + fsp, num_def_acls, pdata); if (!NT_STATUS_IS_OK(status)) {