mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
@@ -51,7 +51,7 @@ impl ssh_agent::Agent<peerinfo::models::PeerInfo> for BitwardenDesktopAgent {
|
|||||||
let request_data = match request_parser::parse_request(data) {
|
let request_data = match request_parser::parse_request(data) {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("[SSH Agent] Error while parsing request: {}", e);
|
println!("[SSH Agent] Error while parsing request: {e}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -178,7 +178,7 @@ impl BitwardenDesktopAgent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("[SSH Agent Native Module] Error while parsing key: {}", e);
|
eprintln!("[SSH Agent Native Module] Error while parsing key: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,10 +234,9 @@ fn parse_key_safe(pem: &str) -> Result<ssh_key::private::PrivateKey, anyhow::Err
|
|||||||
Ok(key) => match key.public_key().to_bytes() {
|
Ok(key) => match key.public_key().to_bytes() {
|
||||||
Ok(_) => Ok(key),
|
Ok(_) => Ok(key),
|
||||||
Err(e) => Err(anyhow::Error::msg(format!(
|
Err(e) => Err(anyhow::Error::msg(format!(
|
||||||
"Failed to parse public key: {}",
|
"Failed to parse public key: {e}"
|
||||||
e
|
|
||||||
))),
|
))),
|
||||||
},
|
},
|
||||||
Err(e) => Err(anyhow::Error::msg(format!("Failed to parse key: {}", e))),
|
Err(e) => Err(anyhow::Error::msg(format!("Failed to parse key: {e}"))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,16 +65,10 @@ impl BitwardenDesktopAgent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
println!(
|
println!("[SSH Agent Native Module] Starting SSH Agent server on {ssh_path:?}");
|
||||||
"[SSH Agent Native Module] Starting SSH Agent server on {:?}",
|
|
||||||
ssh_path
|
|
||||||
);
|
|
||||||
let sockname = std::path::Path::new(&ssh_path);
|
let sockname = std::path::Path::new(&ssh_path);
|
||||||
if let Err(e) = std::fs::remove_file(sockname) {
|
if let Err(e) = std::fs::remove_file(sockname) {
|
||||||
println!(
|
println!("[SSH Agent Native Module] Could not remove existing socket file: {e}");
|
||||||
"[SSH Agent Native Module] Could not remove existing socket file: {}",
|
|
||||||
e
|
|
||||||
);
|
|
||||||
if e.kind() != std::io::ErrorKind::NotFound {
|
if e.kind() != std::io::ErrorKind::NotFound {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -85,10 +79,7 @@ impl BitwardenDesktopAgent {
|
|||||||
// Only the current user should be able to access the socket
|
// Only the current user should be able to access the socket
|
||||||
if let Err(e) = fs::set_permissions(sockname, fs::Permissions::from_mode(0o600))
|
if let Err(e) = fs::set_permissions(sockname, fs::Permissions::from_mode(0o600))
|
||||||
{
|
{
|
||||||
println!(
|
println!("[SSH Agent Native Module] Could not set socket permissions: {e}");
|
||||||
"[SSH Agent Native Module] Could not set socket permissions: {}",
|
|
||||||
e
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,10 +103,7 @@ impl BitwardenDesktopAgent {
|
|||||||
println!("[SSH Agent Native Module] SSH Agent server exited");
|
println!("[SSH Agent Native Module] SSH Agent server exited");
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!(
|
eprintln!("[SSH Agent Native Module] Error while starting agent server: {e}");
|
||||||
"[SSH Agent Native Module] Error while starting agent server: {}",
|
|
||||||
e
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -214,8 +214,7 @@ impl MacOSProviderClient {
|
|||||||
.remove(&sequence_number)
|
.remove(&sequence_number)
|
||||||
{
|
{
|
||||||
cb.error(BitwardenError::Internal(format!(
|
cb.error(BitwardenError::Internal(format!(
|
||||||
"Error sending message: {}",
|
"Error sending message: {e}"
|
||||||
e
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ pub mod sshagent {
|
|||||||
.expect("should be able to send auth response to agent");
|
.expect("should be able to send auth response to agent");
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("[SSH Agent Native Module] calling UI callback promise was rejected: {}", e);
|
println!("[SSH Agent Native Module] calling UI callback promise was rejected: {e}");
|
||||||
let _ = auth_response_tx_arc
|
let _ = auth_response_tx_arc
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@@ -246,7 +246,7 @@ pub mod sshagent {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("[SSH Agent Native Module] calling UI callback could not create promise: {}", e);
|
println!("[SSH Agent Native Module] calling UI callback could not create promise: {e}");
|
||||||
let _ = auth_response_tx_arc
|
let _ = auth_response_tx_arc
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -80,8 +80,7 @@ mod objc {
|
|||||||
Ok(value) => value,
|
Ok(value) => value,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!(
|
println!(
|
||||||
"Error: Failed to convert ObjCString to Rust string during commandReturn: {}",
|
"Error: Failed to convert ObjCString to Rust string during commandReturn: {e}"
|
||||||
e
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -91,10 +90,7 @@ mod objc {
|
|||||||
match context.send(value) {
|
match context.send(value) {
|
||||||
Ok(_) => 0,
|
Ok(_) => 0,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!(
|
println!("Error: Failed to return ObjCString from ObjC code to Rust code: {e}");
|
||||||
"Error: Failed to return ObjCString from ObjC code to Rust code: {}",
|
|
||||||
e
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ fn init_logging(log_path: &Path, console_level: LevelFilter, file_level: LevelFi
|
|||||||
loggers.push(simplelog::WriteLogger::new(file_level, config, file));
|
loggers.push(simplelog::WriteLogger::new(file_level, config, file));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Can't create file: {}", e);
|
eprintln!("Can't create file: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = CombinedLogger::init(loggers) {
|
if let Err(e) = CombinedLogger::init(loggers) {
|
||||||
eprintln!("Failed to initialize logger: {}", e);
|
eprintln!("Failed to initialize logger: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user