From a321bf9a9a9957c42ce6318a3386c3f6d8d83b05 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Fri, 18 Jul 2025 01:59:28 -0300 Subject: [PATCH] When splicing, drop unix fds --- sidebus-common/src/raw.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sidebus-common/src/raw.rs b/sidebus-common/src/raw.rs index 4f8eb64..07aebfe 100644 --- a/sidebus-common/src/raw.rs +++ b/sidebus-common/src/raw.rs @@ -36,11 +36,24 @@ pub async fn splice_conns(client_conn: zbus::Connection, target_conn: zbus::Conn let target_bus_1 = target_conn.clone(); tokio::select! { _ = handle_msgs("FROM", client_conn.clone().into(), async |msg| { + if let Some(n) = msg.header().unix_fds() { + if n > 0 { + let new_msg = crate::rewrite::RewriteMessage::new(&msg).unwrap().build().unwrap(); + return target_bus_1.send(&new_msg).await; + } + } target_bus_1.send(&msg).await }) => { info!("from_client exited"); } _ = handle_msgs("TO", target_conn.into(), async |msg| { + // XXX: simply get rid of unix fds if they appear (they should not be sent in the first place buuut) + if let Some(n) = msg.header().unix_fds() { + if n > 0 { + let new_msg = crate::rewrite::RewriteMessage::new(&msg).unwrap().build().unwrap(); + return client_conn.send(&new_msg).await; + } + } client_conn.send(&msg).await }) => { info!("to_client exited");