summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-12-19 16:25:26 -0800
committerKarolin Seeger <kseeger@samba.org>2017-03-22 10:45:16 +0100
commit9178d6d311d76a257ddaf4df295dad4f291ded5b (patch)
tree20e35c948dee634f6146d419f81b55c19ba0b2ee
parent203f454965c8a9ca92cb085623b16d4b21296679 (diff)
downloadsamba-9178d6d311d76a257ddaf4df295dad4f291ded5b.tar.gz
CVE-2017-2619: s3: smbd: Opendir_internal() early return if SMB_VFS_OPENDIR failed.
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>
-rw-r--r--source3/smbd/dir.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index cbd32e30704..ea4b301642b 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1601,20 +1601,12 @@ static struct smb_Dir *OpenDir_internal(TALLOC_CTX *mem_ctx,
return NULL;
}
- dirp->conn = conn;
- dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
-
dirp->dir_path = talloc_strdup(dirp, name);
if (!dirp->dir_path) {
errno = ENOMEM;
goto fail;
}
- if (sconn && !sconn->using_smb2) {
- sconn->searches.dirhandles_open++;
- }
- talloc_set_destructor(dirp, smb_Dir_destructor);
-
dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path, mask, attr);
if (!dirp->dir) {
DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path,
@@ -1622,6 +1614,14 @@ static struct smb_Dir *OpenDir_internal(TALLOC_CTX *mem_ctx,
goto fail;
}
+ dirp->conn = conn;
+ dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+
+ if (sconn && !sconn->using_smb2) {
+ sconn->searches.dirhandles_open++;
+ }
+ talloc_set_destructor(dirp, smb_Dir_destructor);
+
return dirp;
fail: