static DIR *dirsort_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr) { struct dirsort_privates *list_head = NULL; struct dirsort_privates *data = NULL; if (SMB_VFS_HANDLE_TEST_DATA(handle)) { /* Find the list head of all open directories. */ SMB_VFS_HANDLE_GET_DATA(handle, list_head, struct dirsort_privates, return NULL); } /* set up our private data about this directory */ data = talloc_zero(handle->conn, struct dirsort_privates); if (!data) { return NULL; } data->fsp = fsp; /* Open the underlying directory and count the number of entries */ data->source_directory = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); if (data->source_directory == NULL) { TALLOC_FREE(data); return NULL; } if (!open_and_sort_dir(handle, data)) { SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory); TALLOC_FREE(data); /* fd is now closed. */ fsp->fh->fd = -1; return NULL; } /* Add to the private list of all open directories. */ DLIST_ADD(list_head, data); SMB_VFS_HANDLE_SET_DATA(handle, list_head, NULL, struct dirsort_privates, return NULL); return data->source_directory; }
static SMB_STRUCT_DIR *dirsort_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr) { struct dirsort_privates *data = NULL; /* set up our private data about this directory */ data = (struct dirsort_privates *)SMB_MALLOC( sizeof(struct dirsort_privates)); if (!data) { return NULL; } data->directory_list = NULL; data->pos = 0; /* Open the underlying directory and count the number of entries */ data->source_directory = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); if (data->source_directory == NULL) { SAFE_FREE(data); return NULL; } data->fd = dirfd(data->source_directory); SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates, struct dirsort_privates, return NULL); if (!open_and_sort_dir(handle)) { SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory); /* fd is now closed. */ fsp->fh->fd = -1; return NULL; } return data->source_directory; }
static SMB_STRUCT_DIR *dirsort_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr) { struct dirsort_privates *data = NULL; /* set up our private data about this directory */ data = talloc_zero(handle->conn, struct dirsort_privates); if (!data) { return NULL; } data->fsp = fsp; /* Open the underlying directory and count the number of entries */ data->source_directory = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); if (data->source_directory == NULL) { TALLOC_FREE(data); return NULL; } if (!open_and_sort_dir(handle, data)) { SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory); TALLOC_FREE(data); /* fd is now closed. */ fsp->fh->fd = -1; return NULL; } SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates, struct dirsort_privates, return NULL); return data->source_directory; }
static DIR *atalk_fdopendir(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attr) { DIR *ret = 0; ret = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); if (ret == NULL) { return ret; } /* * when we try to perform delete operation upon file which has fork * in ./.AppleDouble and this directory wasn't hidden by Samba, * MS Windows explorer causes the error: "Cannot find the specified file" * There is some workaround to avoid this situation, i.e. if * connection has not .AppleDouble entry in either veto or hide * list then it would be nice to add one. */ atalk_add_to_list(&handle->conn->hide_list); atalk_add_to_list(&handle->conn->veto_list); return ret; }
static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attr) { return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); }