smbd: explain that/why we use the raw tevent_context for lease_timeout_handler()
authorStefan Metzmacher <metze@samba.org>
Thu, 22 Mar 2018 09:54:41 +0000 (10:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Jun 2018 06:59:19 +0000 (08:59 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/oplock.c

index 6d37f35babe7c7efcf172ef8ee1c666e1f1beba7..b13aae888202437cf523fd4072d606ab43fb5cf1 100644 (file)
@@ -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);