diff options
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/knownhosts.rs | 2 | ||||
-rw-r--r-- | src/session.rs | 4 |
3 files changed, 4 insertions, 4 deletions
@@ -1,6 +1,6 @@ [package] name = "ssh2" -version = "0.1.1" +version = "0.1.2" authors = ["Alex Crichton <alex@alexcrichton.com>"] license = "MIT/Apache-2.0" keywords = ["ssh"] diff --git a/src/knownhosts.rs b/src/knownhosts.rs index 52ee3b1..6fec25e 100644 --- a/src/knownhosts.rs +++ b/src/knownhosts.rs @@ -260,7 +260,7 @@ impl<'kh> Host<'kh> { pub fn name(&self) -> Option<&str> { unsafe { ::opt_bytes(self, (*self.raw).name as *const _) - .and_then(str::from_utf8) + .and_then(|s| str::from_utf8(s).ok()) } } diff --git a/src/session.rs b/src/session.rs index c22d8e6..7d983cb 100644 --- a/src/session.rs +++ b/src/session.rs @@ -47,7 +47,7 @@ impl Session { /// /// May return `None` on invalid utf-8 or if an error has ocurred. pub fn banner(&self) -> Option<&str> { - self.banner_bytes().and_then(str::from_utf8) + self.banner_bytes().and_then(|s| str::from_utf8(s).ok()) } /// See `banner`. @@ -209,7 +209,7 @@ impl Session { unsafe { let ptr = raw::libssh2_session_methods(self.raw, method_type as c_int); - ::opt_bytes(self, ptr).and_then(str::from_utf8) + ::opt_bytes(self, ptr).and_then(|s| str::from_utf8(s).ok()) } } |