1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

s3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_destructor().

We know we always have a dir_hnd->dir and dir_hnd->fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2019-07-17 15:25:11 -07:00 committed by Ralph Boehme
parent 84312fc5c2
commit 247515982f

View File

@ -1431,31 +1431,25 @@ bool is_visible_file(connection_struct *conn, const char *dir_path,
static int smb_Dir_destructor(struct smb_Dir *dir_hnd)
{
if (dir_hnd->dir != NULL) {
SMB_VFS_CLOSEDIR(dir_hnd->conn, dir_hnd->dir);
if (dir_hnd->fsp != NULL) {
files_struct *fsp = dir_hnd->fsp;
/*
* The SMB_VFS_CLOSEDIR above
* closes the underlying fd inside
* dirp->fsp, unless fallback_opendir
* was set in which case the fd
* in dir_hnd->fsp->fh->fd isn't
* the one being closed. Close
* it separately.
*/
if (dir_hnd->fallback_opendir) {
SMB_VFS_CLOSE(fsp);
}
fsp->fh->fd = -1;
if (fsp->dptr != NULL) {
SMB_ASSERT(fsp->dptr->dir_hnd ==
dir_hnd);
fsp->dptr->dir_hnd = NULL;
}
dir_hnd->fsp = NULL;
}
files_struct *fsp = dir_hnd->fsp;
SMB_VFS_CLOSEDIR(dir_hnd->conn, dir_hnd->dir);
/*
* The SMB_VFS_CLOSEDIR above
* closes the underlying fd inside
* dirp->fsp, unless fallback_opendir
* was set in which case the fd
* in dir_hnd->fsp->fh->fd isn't
* the one being closed. Close
* it separately.
*/
if (dir_hnd->fallback_opendir) {
SMB_VFS_CLOSE(fsp);
}
fsp->fh->fd = -1;
SMB_ASSERT(fsp->dptr->dir_hnd == dir_hnd);
fsp->dptr->dir_hnd = NULL;
dir_hnd->fsp = NULL;
return 0;
}