]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_...
authorJeremy Allison <jra@samba.org>
Wed, 17 Jul 2019 22:25:11 +0000 (15:25 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 6 Aug 2019 14:23:34 +0000 (14:23 +0000)
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>
source3/smbd/dir.c

index e4c348724ba5f83be4357e2c6e758b2b04e2c3d5..252468d9caa21b3ae44a70fea7e6de0a38c30f0f 100644 (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;
 }