CVE-2017-2619: s3: smbd: Correctly fallback to open_dir_safely if FDOPENDIR not suppo...
authorJeremy Allison <jra@samba.org>
Mon, 19 Dec 2016 20:35:32 +0000 (12:35 -0800)
committerKarolin Seeger <kseeger@samba.org>
Thu, 23 Mar 2017 18:10:19 +0000 (19:10 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12496

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/smbd/dir.c

index 2fd50850665f2b4d5669d8920d07c7c81681b1ad..1348d12298c68e1818615349602010141468865f 100644 (file)
@@ -1797,20 +1797,15 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
        }
 
        if (dirp->dir == NULL) {
-               /* FDOPENDIR didn't work. Use OPENDIR instead. */
-               dirp->dir = SMB_VFS_OPENDIR(conn,
-                                       dirp->dir_smb_fname,
+               /* FDOPENDIR is not supported. Use OPENDIR instead. */
+               TALLOC_FREE(dirp);
+               return open_dir_safely(mem_ctx,
+                                       conn,
+                                       fsp->fsp_name,
                                        mask,
                                        attr);
        }
 
-       if (!dirp->dir) {
-               DEBUG(5,("OpenDir_fsp: Can't open %s. %s\n",
-                       dirp->dir_smb_fname->base_name,
-                       strerror(errno) ));
-               goto fail;
-       }
-
        if (sconn && !sconn->using_smb2) {
                sconn->searches.dirhandles_open++;
        }