Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.
authorJeremy Allison <jra@samba.org>
Wed, 10 Apr 2013 23:21:39 +0000 (16:21 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 5 Jun 2013 10:02:42 +0000 (12:02 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit e89ec641fc98ffd7f7193deb3728b0a284a093eb)

source3/smbd/dir.c

index f7bc325d9fe4f57c701510e25f094875ddeaf14e..7cb5ffde02b6b71176a36c6d4e70de30d352b40b 100644 (file)
@@ -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,