Move the SEC_DIR_LIST check into dptr_create for SMB2 and now for SMB1.
authorJeremy Allison <jra@samba.org>
Fri, 4 Nov 2011 17:51:29 +0000 (10:51 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 5 Nov 2011 00:38:00 +0000 (01:38 +0100)
The pathname check still needs fixing.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Nov  5 01:38:00 CET 2011 on sn-devel-104

source3/smbd/dir.c
source3/smbd/smb2_find.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);
index e64db24d02be477b371227bc06a0e23a7c7eccb2..6369e7fdbece01087c0169c7a492b989255cde5c 100644 (file)
@@ -323,11 +323,6 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
        if (fsp->dptr == NULL) {
                bool wcard_has_wild;
 
-               if (!(fsp->access_mask & SEC_DIR_LIST)) {
-                       tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
-                       return tevent_req_post(req, ev);
-               }
-
                wcard_has_wild = ms_has_wild(in_file_name);
 
                status = dptr_create(conn,