]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: update smb_Dir_destructor() to cope with fsp->dptr not being set
authorRalph Boehme <slow@samba.org>
Wed, 18 Mar 2020 17:25:33 +0000 (18:25 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 24 Mar 2020 19:48:41 +0000 (19:48 +0000)
Currently the only caller of OpenDir_fsp() is dptr_create() which means
fsp->dptr will always be set by dptr_create().

A subsequent commit will add another caller so that fsp->dptr will end up being
NULL.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dir.c

index 5faf139c097125095d83d35d43865d37d6e9351f..94e9061d5318572ed143689a492bb7261644673c 100644 (file)
@@ -1317,8 +1317,10 @@ static int smb_Dir_destructor(struct smb_Dir *dir_hnd)
 
        SMB_VFS_CLOSEDIR(dir_hnd->conn, dir_hnd->dir);
        fsp->fh->fd = -1;
-       SMB_ASSERT(fsp->dptr->dir_hnd == dir_hnd);
-       fsp->dptr->dir_hnd = NULL;
+       if (fsp->dptr != NULL) {
+               SMB_ASSERT(fsp->dptr->dir_hnd == dir_hnd);
+               fsp->dptr->dir_hnd = NULL;
+       }
        dir_hnd->fsp = NULL;
        return 0;
 }