From: Stefan Metzmacher Date: Thu, 22 Mar 2018 09:54:41 +0000 (+0100) Subject: smbd: explain that/why we use the raw tevent_context for do_break_to_none() X-Git-Tag: tevent-0.9.37~278 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d5210b615035e46b90758ac7aa4ceec9174bee5;p=thirdparty%2Fsamba.git smbd: explain that/why we use the raw tevent_context for do_break_to_none() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index f7654176a88..34bebc61f7a 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -1150,7 +1150,15 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp, TALLOC_FREE(state); return; } - tevent_schedule_immediate(im, sconn->ev_ctx, do_break_to_none, state); + + /* + * do_break_to_none() only operates on the + * locking.tdb and send network packets to + * the client. That doesn't require any + * impersonation, so we just use the + * raw tevent context here. + */ + tevent_schedule_immediate(im, sconn->raw_ev_ctx, do_break_to_none, state); } static void send_break_to_none(struct messaging_context *msg_ctx, @@ -1177,6 +1185,11 @@ static void do_break_to_none(struct tevent_context *ctx, struct share_mode_lock *lck; struct share_mode_data *d; + /* + * Note this function doesn't run under any specific impersonation and + * is not expected to call any SMB_VFS operation! + */ + lck = get_existing_share_mode_lock(talloc_tos(), state->id); if (lck == NULL) { DEBUG(1, ("%s: failed to lock share mode entry for file %s.\n",