1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

wezterm-ssh: default to libssh2. mux: revise bootstrap_via_ssh

This commit revises the tls domain bootstrap via ssh code and
makes it work again from a windows client.
This commit is contained in:
Wez Furlong 2021-12-15 11:10:16 -07:00
parent f398f333cd
commit 8b58f28125
2 changed files with 20 additions and 19 deletions

View File

@ -727,24 +727,25 @@ impl Reconnectable {
let mut exec = smol::block_on(sess.exec(&cmd, None)) let mut exec = smol::block_on(sess.exec(&cmd, None))
.with_context(|| format!("executing `{}` on remote host", cmd))?; .with_context(|| format!("executing `{}` on remote host", cmd))?;
// stdout holds an encoded pdu log::debug!("waiting for command to finish");
let mut buf = Vec::new(); let status = exec.child.wait()?;
exec.stdout if !status.success() {
.read_to_end(&mut buf) anyhow::bail!("{} failed", cmd);
.context("reading tlscreds response to buffer")?; }
drop(exec.stdin); drop(exec.stdin);
// stderr is ideally empty let mut stderr = exec.stderr;
let mut err = String::new(); thread::spawn(move || {
exec.stderr // stderr is ideally empty
.read_to_string(&mut err) let mut err = String::new();
.context("reading tlscreds stderr")?; let _ = stderr.read_to_string(&mut err);
if !err.is_empty() { if !err.is_empty() {
log::error!("remote: `{}` stderr -> `{}`", cmd, err); log::error!("remote: `{}` stderr -> `{}`", cmd, err);
} }
});
let creds = match Pdu::decode(buf.as_slice()) let creds = match Pdu::decode(exec.stdout)
.context("reading tlscreds response")? .context("reading tlscreds response")?
.pdu .pdu
{ {

View File

@ -70,7 +70,7 @@ impl SessionInner {
.config .config
.get("wezterm_ssh_backend") .get("wezterm_ssh_backend")
.map(|s| s.as_str()) .map(|s| s.as_str())
.unwrap_or("ssh2"); .unwrap_or("libssh");
match backend { match backend {
"ssh2" => self.run_impl_ssh2(), "ssh2" => self.run_impl_ssh2(),
"libssh" => self.run_impl_libssh(), "libssh" => self.run_impl_libssh(),
@ -128,10 +128,10 @@ impl SessionInner {
let function = CStr::from_ptr(function).to_string_lossy().to_string(); let function = CStr::from_ptr(function).to_string_lossy().to_string();
let message = CStr::from_ptr(message).to_string_lossy().to_string(); let message = CStr::from_ptr(message).to_string_lossy().to_string();
/// The message typically has "function: message" prefixed, which // The message typically has "function: message" prefixed, which
/// looks redundant when logged with the function prefix by the // looks redundant when logged with the function prefix by the
/// logging crate. // logging crate.
/// Strip that off! // Strip that off!
let message = match message.strip_prefix(&format!("{}: ", function)) { let message = match message.strip_prefix(&format!("{}: ", function)) {
Some(m) => m, Some(m) => m,
None => &message, None => &message,