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

s3: smbd: Change set_unix_posix_default_acl() to return NTSTATUS.

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:14:53 -07:00
parent 763b52d237
commit 681f0f2337
3 changed files with 14 additions and 14 deletions

View File

@ -4350,12 +4350,13 @@ static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn,
on the directory.
****************************************************************************/
bool set_unix_posix_default_acl(connection_struct *conn,
NTSTATUS set_unix_posix_default_acl(connection_struct *conn,
const struct smb_filename *smb_fname,
uint16_t num_def_acls,
const char *pdata)
{
SMB_ACL_T def_acl = NULL;
NTSTATUS status;
int ret;
if (!S_ISDIR(smb_fname->st.st_ex_mode)) {
@ -4363,24 +4364,23 @@ bool set_unix_posix_default_acl(connection_struct *conn,
DBG_INFO("Can't set default ACL on non-directory "
"file %s\n",
smb_fname->base_name);
errno = EISDIR;
return false;
} else {
return true;
return map_nt_error_from_unix(EISDIR);
}
return NT_STATUS_OK;
}
if (!num_def_acls) {
/* Remove the default ACL. */
ret = SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname);
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,
strerror(errno));
return false;
return status;
}
return true;
return NT_STATUS_OK;
}
def_acl = create_posix_acl_from_wire(conn,
@ -4388,7 +4388,7 @@ bool set_unix_posix_default_acl(connection_struct *conn,
pdata,
talloc_tos());
if (def_acl == NULL) {
return false;
return map_nt_error_from_unix(errno);
}
ret = SMB_VFS_SYS_ACL_SET_FILE(conn,
@ -4396,17 +4396,18 @@ bool set_unix_posix_default_acl(connection_struct *conn,
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,
strerror(errno));
TALLOC_FREE(def_acl);
return false;
return status;
}
DBG_DEBUG("set default acl for file %s\n",
smb_fname->base_name);
TALLOC_FREE(def_acl);
return true;
return NT_STATUS_OK;
}
/****************************************************************************

View File

@ -807,7 +807,7 @@ int inherit_access_posix_acl(connection_struct *conn,
const char *inherit_from_dir,
const struct smb_filename *smb_fname,
mode_t mode);
bool set_unix_posix_default_acl(connection_struct *conn,
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,

View File

@ -7476,12 +7476,11 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
pdata += (num_file_acls*SMB_POSIX_ACL_ENTRY_SIZE);
if (valid_def_acls) {
bool ok = set_unix_posix_default_acl(conn,
status = set_unix_posix_default_acl(conn,
fsp->fsp_name,
num_def_acls,
pdata);
if (!ok) {
status = map_nt_error_from_unix(errno);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
}