s3:smb2_lock: call change_to_user_by_fsp() when dbwrap_watched_watch* finishes
authorStefan Metzmacher <metze@samba.org>
Wed, 4 Sep 2019 10:47:07 +0000 (12:47 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 9 Sep 2019 14:23:39 +0000 (14:23 +0000)
This is not strictly required as fd-based calls are used,
but it's more consistent to call SMB_VFS_BRL_LOCK_WINDOWS()
in the same environment on retry.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/smb2_lock.c

index 36ec36301b11d18fbefab8834eb7186b3f84bab0..e9c8d7f890e682096052467c910c635177a4a7c4 100644 (file)
@@ -421,6 +421,16 @@ static void smbd_smb2_lock_retry(struct tevent_req *subreq)
        struct server_id blocking_pid = { 0 };
        uint64_t blocking_smblctx;
        NTSTATUS status;
+       bool ok;
+
+       /*
+        * Make sure we run as the user again
+        */
+       ok = change_to_user_by_fsp(state->fsp);
+       if (!ok) {
+               tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
+               return;
+       }
 
        status = dbwrap_watched_watch_recv(subreq, NULL, NULL);
        TALLOC_FREE(subreq);