Move the SEC_DIR_LIST check into dptr_create for SMB2 and now for SMB1.
[ddiss/samba.git] / source3 / smbd / dir.c
index 8af0dad8c3a6b92287719a7c1ee7abb07bbab9f0..a11c131b49c92e6b0373ef2aaba2125bad63d43b 100644 (file)
@@ -444,6 +444,12 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
        }
 
        if (fsp) {
+               if (!(fsp->access_mask & SEC_DIR_LIST)) {
+                       DEBUG(5,("dptr_create: directory %s "
+                               "not open for LIST access\n",
+                               path));
+                       return NT_STATUS_ACCESS_DENIED;
+               }
                dir_hnd = OpenDir_fsp(NULL, conn, fsp, wcard, attr);
        } else {
                dir_hnd = OpenDir(NULL, conn, path, wcard, attr);