git: 744faa81ea34 - main - devel/busd: backport TCP fix
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 May 2024 21:55:31 UTC
The branch main has been updated by jbeich: URL: https://cgit.FreeBSD.org/ports/commit/?id=744faa81ea34f98530699b2893142e63aba070c9 commit 744faa81ea34f98530699b2893142e63aba070c9 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2024-05-02 21:16:40 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2024-05-02 21:55:19 +0000 devel/busd: backport TCP fix --- devel/busd/Makefile | 2 +- devel/busd/files/patch-zbus | 86 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/devel/busd/Makefile b/devel/busd/Makefile index 76cd7bdd7bf8..3a8ffc92d850 100644 --- a/devel/busd/Makefile +++ b/devel/busd/Makefile @@ -1,6 +1,6 @@ PORTNAME= busd DISTVERSION= 0.3.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MAINTAINER= jbeich@FreeBSD.org diff --git a/devel/busd/files/patch-zbus b/devel/busd/files/patch-zbus index f6d1c1014e41..194aa47b6311 100644 --- a/devel/busd/files/patch-zbus +++ b/devel/busd/files/patch-zbus @@ -1,5 +1,39 @@ https://github.com/dbus2/zbus/pull/757 +--- cargo-crates/zbus-4.2.0/src/connection/handshake/client.rs.orig 2006-07-24 01:21:28 UTC ++++ cargo-crates/zbus-4.2.0/src/connection/handshake/client.rs +@@ -95,21 +95,16 @@ impl Client { + #[instrument(skip(self))] + #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] + async fn send_zero_byte(&mut self) -> Result<()> { +- let written = self +- .common +- .socket_mut() +- .write_mut() +- .send_zero_byte() +- .await +- .map_err(|e| { +- Error::Handshake(format!("Could not send zero byte with credentials: {}", e)) +- }) +- .and_then(|n| match n { +- None => Err(Error::Handshake( +- "Could not send zero byte with credentials".to_string(), +- )), +- Some(n) => Ok(n), +- })?; ++ let write = self.common.socket_mut().write_mut(); ++ ++ let written = match write.send_zero_byte().await.map_err(|e| { ++ Error::Handshake(format!("Could not send zero byte with credentials: {}", e)) ++ })? { ++ // This likely means that the socket type is unable to send SCM_CREDS. ++ // Let's try to send the 0 byte as a regular message. ++ None => write.sendmsg(&[0], &[]).await?, ++ Some(n) => n, ++ }; + + if written != 1 { + return Err(Error::Handshake( --- cargo-crates/zbus-4.2.0/src/connection/handshake/common.rs.orig 2006-07-24 01:21:28 UTC +++ cargo-crates/zbus-4.2.0/src/connection/handshake/common.rs @@ -122,17 +122,13 @@ impl Common { @@ -26,3 +60,55 @@ https://github.com/dbus2/zbus/pull/757 }; let line_bytes = self.recv_buffer.drain(..=lf_index); +--- cargo-crates/zbus-4.2.0/src/connection/socket/tcp.rs.orig 2006-07-24 01:21:28 UTC ++++ cargo-crates/zbus-4.2.0/src/connection/socket/tcp.rs +@@ -26,32 +26,25 @@ impl ReadHalf for Arc<Async<TcpStream>> { + } + } + ++ #[cfg(windows)] + async fn peer_credentials(&mut self) -> io::Result<crate::fdo::ConnectionCredentials> { +- #[cfg(windows)] +- let creds = { +- let stream = self.clone(); +- crate::Task::spawn_blocking( +- move || { +- use crate::win32::{tcp_stream_get_peer_pid, ProcessToken}; ++ let stream = self.clone(); ++ crate::Task::spawn_blocking( ++ move || { ++ use crate::win32::{tcp_stream_get_peer_pid, ProcessToken}; + +- let pid = tcp_stream_get_peer_pid(stream.get_ref())? as _; +- let sid = ProcessToken::open(if pid != 0 { Some(pid as _) } else { None }) +- .and_then(|process_token| process_token.sid())?; +- io::Result::Ok( +- crate::fdo::ConnectionCredentials::default() +- .set_process_id(pid) +- .set_windows_sid(sid), +- ) +- }, +- "peer credentials", +- ) +- .await +- }?; +- +- #[cfg(not(windows))] +- let creds = crate::fdo::ConnectionCredentials::default(); +- +- Ok(creds) ++ let pid = tcp_stream_get_peer_pid(stream.get_ref())? as _; ++ let sid = ProcessToken::open(if pid != 0 { Some(pid as _) } else { None }) ++ .and_then(|process_token| process_token.sid())?; ++ io::Result::Ok( ++ crate::fdo::ConnectionCredentials::default() ++ .set_process_id(pid) ++ .set_windows_sid(sid), ++ ) ++ }, ++ "peer credentials", ++ ) ++ .await + } + } +