1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-13 06:54:07 +00:00
This commit is contained in:
Bernd Schoolmann
2024-11-20 12:17:26 +01:00
parent 36a54403ae
commit 624e19c691
2 changed files with 7 additions and 9 deletions

View File

@@ -11,11 +11,14 @@ use tokio::{
};
use tokio_util::sync::CancellationToken;
use super::peerinfo;
use super::peerinfo::models::PeerInfo;
const PIPE_NAME: &str = r"\\.\pipe\openssh-ssh-agent";
#[pin_project::pin_project]
pub struct NamedPipeServerStream {
rx: tokio::sync::mpsc::Receiver<NamedPipeServer>,
rx: tokio::sync::mpsc::Receiver<(NamedPipeServer, PeerInfo)>,
}
impl NamedPipeServerStream {
@@ -48,12 +51,12 @@ impl NamedPipeServerStream {
}
impl Stream for NamedPipeServerStream {
type Item = io::Result<NamedPipeServer>;
type Item = io::Result<(NamedPipeServer, PeerInfo)>;
fn poll_next(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<io::Result<NamedPipeServer>>> {
) -> Poll<Option<io::Result<(NamedPipeServer, PeerInfo)>>> {
let this = self.project();
this.rx.poll_recv(cx).map(|v| v.map(Ok))

View File

@@ -46,13 +46,8 @@ impl Stream for PeercredUnixListenerStream {
};
let peer_info = peerinfo::gather::get_peer_info(pid as u32);
match peer_info {
Ok(info) => {
println!("name {:?}", info.process_name());
println!("uid {:?}", info.uid());
Poll::Ready(Some(Ok((stream, info))))
}
Ok(info) => Poll::Ready(Some(Ok((stream, info)))),
Err(err) => {
println!("Failed to get peer info: {}", err);
Poll::Ready(Some(Err(io::Error::new(
io::ErrorKind::Other,
format!("Failed to get peer info: {}", err),