smbd: explain that/why we use the raw tevent_context for linux_oplock_signal_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_linux.c

index dd772bf6cb5b69bc1e9a0dabf3f25b68704848ac..7d1f0404512b2e223ee3bd4b677888b524a15356 100644 (file)
@@ -125,6 +125,12 @@ static void linux_oplock_signal_handler(struct tevent_context *ev_ctx,
        int fd = info->si_fd;
        files_struct *fsp;
 
+       /*
+        * This function doesn't expect any specific impersonation, as it only
+        * sends messages to other smbd processes. And messaging_send_iov_from()
+        * already handles EACCES.
+        */
+
        fsp = file_find_fd(sconn, fd);
        if (fsp == NULL) {
                DEBUG(0,("linux_oplock_signal_handler: failed to find fsp for file fd=%d (file was closed ?)\n", fd ));
@@ -237,7 +243,13 @@ struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *
        ctx->ops = &linux_koplocks;
        ctx->private_data = sconn;
 
-       se = tevent_add_signal(sconn->ev_ctx,
+       /*
+        * linux_oplock_signal_handler() only
+        * sends messages to other smbd processes
+        * and doesn't require any impersonation.
+        * So we can just use the raw tevent_context.
+        */
+       se = tevent_add_signal(sconn->raw_ev_ctx,
                               ctx,
                               RT_SIGNAL_LEASE, SA_SIGINFO,
                               linux_oplock_signal_handler,