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)) {
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,
pdata,
talloc_tos());
if (def_acl == NULL) {
- return false;
+ return map_nt_error_from_unix(errno);
}
ret = SMB_VFS_SYS_ACL_SET_FILE(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;
}
/****************************************************************************
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,
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;
}
}