CVE-2017-2619: s3: smbd: Move the reference counting and destructor setup to just...
authorJeremy Allison <jra@samba.org>
Mon, 19 Dec 2016 20:32:07 +0000 (12:32 -0800)
committerKarolin Seeger <kseeger@samba.org>
Thu, 23 Mar 2017 18:10:19 +0000 (19:10 +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 42e787bed6cd0d543c73df66d5fe52a04092a282..2fd50850665f2b4d5669d8920d07c7c81681b1ad 100644 (file)
@@ -1783,11 +1783,6 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
                goto fail;
        }
 
-       if (sconn && !sconn->using_smb2) {
-               sconn->searches.dirhandles_open++;
-       }
-       talloc_set_destructor(dirp, smb_Dir_destructor);
-
        dirp->dir = SMB_VFS_FDOPENDIR(fsp, mask, attr);
        if (dirp->dir != NULL) {
                dirp->fsp = fsp;
@@ -1816,6 +1811,11 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
                goto fail;
        }
 
+       if (sconn && !sconn->using_smb2) {
+               sconn->searches.dirhandles_open++;
+       }
+       talloc_set_destructor(dirp, smb_Dir_destructor);
+
        return dirp;
 
   fail: