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 lease_timeout_handler() X-Git-Tag: tevent-0.9.37~280 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52f098d38da72d6eff3c4cac61487da897a8651c;p=thirdparty%2Fsamba.git smbd: explain that/why we use the raw tevent_context for lease_timeout_handler() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 6d37f35babe..b13aae88820 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -338,6 +338,11 @@ static void lease_timeout_handler(struct tevent_context *ctx, struct share_mode_lock *lck; uint16_t old_epoch = lease->lease.lease_epoch; + /* + * This function runs without any specific impersonation + * and must not call any SMB_VFS operations! + */ + fsp = file_find_one_fsp_from_lease_key(lease->sconn, &lease->lease.lease_key); if (fsp == NULL) { @@ -429,7 +434,12 @@ bool fsp_lease_update(struct share_mode_lock *lck, DEBUG(10,("%s: setup timeout handler\n", __func__)); - lease->timeout = tevent_add_timer(lease->sconn->ev_ctx, + /* + * lease_timeout_handler() only accesses locking.tdb + * so we don't use any impersonation and use + * the raw tevent context. + */ + lease->timeout = tevent_add_timer(lease->sconn->raw_ev_ctx, lease, t, lease_timeout_handler, lease);