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 linux_oplock_signal_handler() X-Git-Tag: tevent-0.9.37~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc517b20f60a156d73fdd551557eb1d4366dfdeb;p=thirdparty%2Fsamba.git smbd: explain that/why we use the raw tevent_context for linux_oplock_signal_handler() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c index dd772bf6cb5..7d1f0404512 100644 --- a/source3/smbd/oplock_linux.c +++ b/source3/smbd/oplock_linux.c @@ -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,