/* Search MS NFS style ACE with UNIX mode */
static NTSTATUS check_ms_nfs(vfs_handle_struct *handle,
files_struct *fsp,
- const struct security_descriptor *psd,
+ struct security_descriptor *psd,
mode_t *pmode,
bool *pdo_chmod)
{
uint32_t i;
struct fruit_config_data *config = NULL;
+ struct dom_sid sid;
+ NTSTATUS status = NT_STATUS_OK;
+ bool remove_ok = false;
*pdo_chmod = false;
}
}
+ /*
+ * Remove any incoming virtual ACE entries generated by
+ * fruit_fget_nt_acl().
+ */
+
+ /* MS NFS style mode */
+ sid_compose(&sid, &global_sid_Unix_NFS_Mode,
+ fsp->fsp_name->st.st_ex_mode);
+ status = security_descriptor_dacl_del(psd, &sid);
+ remove_ok = (NT_STATUS_IS_OK(status) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND));
+ if (!remove_ok) {
+ DBG_WARNING("failed to remove MS NFS_mode style ACE\n");
+ return status;
+ }
+
+ /* MS NFS style uid */
+ sid_compose(&sid, &global_sid_Unix_NFS_Users,
+ fsp->fsp_name->st.st_ex_uid);
+ status = security_descriptor_dacl_del(psd, &sid);
+ remove_ok = (NT_STATUS_IS_OK(status) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND));
+ if (!remove_ok) {
+ DBG_WARNING("failed to remove MS NFS_users style ACE\n");
+ return status;
+ }
+
+ /* MS NFS style gid */
+ sid_compose(&sid, &global_sid_Unix_NFS_Groups,
+ fsp->fsp_name->st.st_ex_gid);
+ status = security_descriptor_dacl_del(psd, &sid);
+ remove_ok = (NT_STATUS_IS_OK(status) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND));
+ if (!remove_ok) {
+ DBG_WARNING("failed to remove MS NFS_groups style ACE\n");
+ return status;
+ }
+
return NT_STATUS_OK;
}