]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
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>
Wed, 22 Mar 2017 09:45:16 +0000 (10:45 +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 6b62f1415cfca7e6ec768e00936518f54041998f..3432788f6f739ed92a890c3b8dba5ece51cb4ef9 100644 (file)
@@ -1742,14 +1742,13 @@ 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_path, mask, attr);
-       }
-
-       if (!dirp->dir) {
-               DEBUG(5,("OpenDir_fsp: Can't open %s. %s\n", dirp->dir_path,
-                        strerror(errno) ));
-               goto fail;
+               /* FDOPENDIR is not supported. Use OPENDIR instead. */
+               TALLOC_FREE(dirp);
+               return open_dir_safely(mem_ctx,
+                                       conn,
+                                       fsp->fsp_name->base_name,
+                                       mask,
+                                       attr);
        }
 
        if (sconn && !sconn->using_smb2) {