summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-11-04 16:46:47 -0700
committerJeremy Allison <jra@samba.org>2011-11-07 21:11:03 +0100
commit60b7dae3fad482c2dabd6c0569e99cd23838d824 (patch)
treeb3eb3316ece11674a9996653ef58c58131c8bba9 /source3
parentce8b5d520bafe10fb048f5c61197c840263decb6 (diff)
downloadsamba-60b7dae3fad482c2dabd6c0569e99cd23838d824.tar.gz
samba-60b7dae3fad482c2dabd6c0569e99cd23838d824.tar.bz2
samba-60b7dae3fad482c2dabd6c0569e99cd23838d824.zip
Add the SEC_DIR_LIST check to dptr_create().
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Nov 7 21:11:03 CET 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dir.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index a11c131b49..322c2fe519 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -452,6 +452,33 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
}
dir_hnd = OpenDir_fsp(NULL, conn, fsp, wcard, attr);
} else {
+ int ret;
+ struct smb_filename *smb_dname = NULL;
+ NTSTATUS status = create_synthetic_smb_fname(talloc_tos(),
+ path,
+ NULL,
+ NULL,
+ &smb_dname);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LSTAT(conn, smb_dname);
+ } else {
+ ret = SMB_VFS_STAT(conn, smb_dname);
+ }
+ if (ret == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+ if (!S_ISDIR(smb_dname->st.st_ex_mode)) {
+ return NT_STATUS_NOT_A_DIRECTORY;
+ }
+ status = smbd_check_access_rights(conn,
+ smb_dname,
+ SEC_DIR_LIST);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
dir_hnd = OpenDir(NULL, conn, path, wcard, attr);
}