From: Jeremy Allison Date: Wed, 10 Apr 2013 23:21:39 +0000 (-0700) Subject: Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR. X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=2683c9ba9d85ca7f341ae3b21d6e0430a4e7b8d7 Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR. Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider (cherry picked from commit e89ec641fc98ffd7f7193deb3728b0a284a093eb) --- diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index f7bc325d9fe..7cb5ffde02b 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -49,6 +49,8 @@ struct smb_Dir { struct name_cache_entry *name_cache; unsigned int name_cache_index; unsigned int file_number; + files_struct *fsp; /* Back pointer to containing fsp, only + set from OpenDir_fsp(). */ }; struct dptr_struct { @@ -1440,7 +1442,9 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn, if (fsp->is_directory && fsp->fh->fd != -1) { dirp->dir = SMB_VFS_FDOPENDIR(fsp, mask, attr); - if (dirp->dir == NULL) { + if (dirp->dir != NULL) { + dirp->fsp = fsp; + } else { DEBUG(10,("OpenDir_fsp: SMB_VFS_FDOPENDIR on %s returned " "NULL (%s)\n", dirp->dir_path,