s3:smbd: perform impersonation in smb2_query_directory_dos_mode_done()
authorRalph Boehme <slow@samba.org>
Mon, 14 Jan 2019 12:51:23 +0000 (13:51 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 14 Jan 2019 18:13:15 +0000 (19:13 +0100)
This is needed as the callback might be called in an arbitrary
impersonation state.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_query_directory.c

index fdb87188f93386018ec2eefe920d220ad596bf3e..2a426a0dfa3843465df609e0a52d8405d00a8a5a 100644 (file)
@@ -752,6 +752,13 @@ static void smb2_query_directory_dos_mode_done(struct tevent_req *subreq)
                tevent_req_data(req,
                struct smbd_smb2_query_directory_state);
        NTSTATUS status;
+       bool ok;
+
+       /*
+        * Make sure we run as the user again
+        */
+       ok = change_to_user_by_fsp(state->fsp);
+       SMB_ASSERT(ok);
 
        status = fetch_dos_mode_recv(subreq);
        TALLOC_FREE(subreq);