s3:smbd: perform impersonation in dos_mode_at_vfs_get_dosmode_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/dosmode.c

index 177fe68..a462571 100644 (file)
@@ -811,6 +811,13 @@ static void dos_mode_at_vfs_get_dosmode_done(struct tevent_req *subreq)
        struct smb_filename *smb_path = NULL;
        struct vfs_aio_state aio_state;
        NTSTATUS status;
+       bool ok;
+
+       /*
+        * Make sure we run as the user again
+        */
+       ok = change_to_user_by_fsp(state->dir_fsp);
+       SMB_ASSERT(ok);
 
        status = SMB_VFS_GET_DOS_ATTRIBUTES_RECV(subreq,
                                                 &aio_state,