summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-28 08:11:13 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-28 08:11:13 -0800
commit50c36039fe7cf65692acd34d5b849dbdb1caf9b2 (patch)
treed39f1bd6b641e80f68df7eda2f025ed587982242
parentf125dbfd31473fc5958955ac7546b06fafd04530 (diff)
downloadssh2-rs-50c36039fe7cf65692acd34d5b849dbdb1caf9b2.zip
Update to rust master
-rw-r--r--.gitignore4
-rw-r--r--Cargo.toml2
-rw-r--r--libssh2-sys/Cargo.toml2
-rw-r--r--libssh2-sys/build.rs14
-rw-r--r--src/channel.rs22
-rw-r--r--src/lib.rs12
-rw-r--r--src/session.rs26
-rw-r--r--src/sftp.rs46
-rw-r--r--tests/all.rs2
-rw-r--r--tests/channel.rs2
-rw-r--r--tests/session.rs4
-rw-r--r--tests/sftp.rs8
12 files changed, 72 insertions, 72 deletions
diff --git a/.gitignore b/.gitignore
index 4fffb2f..a9d37c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-/target
-/Cargo.lock
+target
+Cargo.lock
diff --git a/Cargo.toml b/Cargo.toml
index 39a9807..04659de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ssh2"
-version = "0.1.8"
+version = "0.1.9"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT/Apache-2.0"
keywords = ["ssh"]
diff --git a/libssh2-sys/Cargo.toml b/libssh2-sys/Cargo.toml
index 8a23510..b5f957d 100644
--- a/libssh2-sys/Cargo.toml
+++ b/libssh2-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libssh2-sys"
-version = "0.1.3"
+version = "0.1.4"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
links = "ssh2"
build = "build.rs"
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs
index e21a2ce..83e2baf 100644
--- a/libssh2-sys/build.rs
+++ b/libssh2-sys/build.rs
@@ -3,9 +3,9 @@
extern crate "pkg-config" as pkg_config;
use std::os;
-use std::io::{self, fs, Command};
-use std::io::process::InheritFd;
-use std::io::fs::PathExtensions;
+use std::old_io::{self, fs, Command};
+use std::old_io::process::InheritFd;
+use std::old_io::fs::PathExtensions;
fn main() {
match pkg_config::find_library("libssh2") {
@@ -50,7 +50,7 @@ fn main() {
let _ = fs::rmdir_recursive(&dst.join("include"));
let _ = fs::rmdir_recursive(&dst.join("lib"));
let _ = fs::rmdir_recursive(&dst.join("build"));
- fs::mkdir(&dst.join("build"), io::USER_DIR).unwrap();
+ fs::mkdir(&dst.join("build"), old_io::USER_DIR).unwrap();
let root = src.join("libssh2-1.4.4-20140901");
// Can't run ./configure directly on msys2 b/c we're handing in
@@ -75,7 +75,7 @@ fn main() {
// Don't run `make install` because apparently it's a little buggy on mingw
// for windows.
- fs::mkdir_recursive(&dst.join("lib/pkgconfig"), io::USER_DIR).unwrap();
+ fs::mkdir_recursive(&dst.join("lib/pkgconfig"), old_io::USER_DIR).unwrap();
// Which one does windows generate? Who knows!
let p1 = dst.join("build/src/.libs/libssh2.a");
@@ -92,11 +92,11 @@ fn main() {
let root = root.join("include");
let dst = dst.join("include");
for file in fs::walk_dir(&root).unwrap() {
- if fs::stat(&file).unwrap().kind != io::FileType::RegularFile { continue }
+ if fs::stat(&file).unwrap().kind != old_io::FileType::RegularFile { continue }
let part = file.path_relative_from(&root).unwrap();
let dst = dst.join(part);
- fs::mkdir_recursive(&dst.dir_path(), io::USER_DIR).unwrap();
+ fs::mkdir_recursive(&dst.dir_path(), old_io::USER_DIR).unwrap();
fs::copy(&file, &dst).unwrap();
}
}
diff --git a/src/channel.rs b/src/channel.rs
index 7dabcb8..e415af7 100644
--- a/src/channel.rs
+++ b/src/channel.rs
@@ -1,5 +1,5 @@
use std::cmp;
-use std::io;
+use std::old_io;
use libc::{c_uint, c_int, size_t, c_char, c_void, c_uchar};
use {raw, Session, Error};
@@ -398,20 +398,20 @@ impl<'sess> SessionBinding<'sess> for Channel<'sess> {
}
impl<'sess> Writer for Channel<'sess> {
- fn write(&mut self, buf: &[u8]) -> io::IoResult<()> {
+ fn write_all(&mut self, buf: &[u8]) -> old_io::IoResult<()> {
self.write_stream(0, buf).map_err(|e| {
- io::IoError {
- kind: io::OtherIoError,
+ old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "ssh write error",
detail: Some(e.to_string()),
}
})
}
- fn flush(&mut self) -> io::IoResult<()> {
+ fn flush(&mut self) -> old_io::IoResult<()> {
self.flush_stream(0).map_err(|e| {
- io::IoError {
- kind: io::OtherIoError,
+ old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "ssh write error",
detail: Some(e.to_string()),
}
@@ -420,13 +420,13 @@ impl<'sess> Writer for Channel<'sess> {
}
impl<'sess> Reader for Channel<'sess> {
- fn read(&mut self, buf: &mut [u8]) -> io::IoResult<usize> {
+ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
self.read_stream(0, buf).map_err(|e| {
if self.eof() {
- io::standard_error(io::EndOfFile)
+ old_io::standard_error(old_io::EndOfFile)
} else {
- io::IoError {
- kind: io::OtherIoError,
+ old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "ssh read error",
detail: Some(e.to_string()),
}
diff --git a/src/lib.rs b/src/lib.rs
index 0f55816..d52acc9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -32,7 +32,7 @@
//! ## Authenticating with ssh-agent
//!
//! ```no_run
-//! use std::io::TcpStream;
+//! use std::old_io::TcpStream;
//! use ssh2::Session;
//!
//! // Connect to the local SSH server
@@ -50,7 +50,7 @@
//! ## Authenticating with a password
//!
//! ```no_run
-//! use std::io::TcpStream;
+//! use std::old_io::TcpStream;
//! use ssh2::Session;
//!
//! // Connect to the local SSH server
@@ -65,7 +65,7 @@
//! ## Run a command
//!
//! ```no_run
-//! use std::io::{self, TcpStream};
+//! use std::old_io::{self, TcpStream};
//! use ssh2::Session;
//!
//! // Connect to the local SSH server
@@ -83,7 +83,7 @@
//! ## Upload a file
//!
//! ```no_run
-//! use std::io::{self, TcpStream};
+//! use std::old_io::{self, TcpStream};
//! use ssh2::Session;
//!
//! // Connect to the local SSH server
@@ -93,14 +93,14 @@
//! sess.userauth_agent("username").unwrap();
//!
//! let mut remote_file = sess.scp_send(&Path::new("remote"),
-//! io::USER_FILE, 10, None).unwrap();
+//! old_io::USER_FILE, 10, None).unwrap();
//! remote_file.write(b"1234567890").unwrap();
//! ```
//!
//! ## Download a file
//!
//! ```no_run
-//! use std::io::TcpStream;
+//! use std::old_io::TcpStream;
//! use ssh2::Session;
//!
//! // Connect to the local SSH server
diff --git a/src/session.rs b/src/session.rs
index fe96993..c4ea9ec 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -1,5 +1,5 @@
use std::ffi::CString;
-use std::io::{self, TcpStream};
+use std::old_io::{self, TcpStream};
use std::mem;
use std::slice;
use std::str;
@@ -406,7 +406,7 @@ impl Session {
/// sent over the returned channel. Some stat information is also returned
/// about the remote file to prepare for receiving the file.
pub fn scp_recv(&self, path: &Path)
- -> Result<(Channel, io::FileStat), Error> {
+ -> Result<(Channel, old_io::FileStat), Error> {
let path = CString::from_slice(path.as_vec());
unsafe {
let mut sb: libc::stat = mem::zeroed();
@@ -431,7 +431,7 @@ impl Session {
///
/// The size of the file, `size`, must be known ahead of time before
/// transmission.
- pub fn scp_send(&self, remote_path: &Path, mode: io::FilePermission,
+ pub fn scp_send(&self, remote_path: &Path, mode: old_io::FilePermission,
size: u64, times: Option<(u64, u64)>)
-> Result<Channel, Error> {
let path = CString::from_slice(remote_path.as_vec());
@@ -611,7 +611,7 @@ impl Binding for Session {
}
// Sure do wish this was exported in libnative!
-fn mkstat(stat: &libc::stat) -> io::FileStat {
+fn mkstat(stat: &libc::stat) -> old_io::FileStat {
#[cfg(windows)] type Mode = libc::c_int;
#[cfg(unix)] type Mode = libc::mode_t;
@@ -628,21 +628,21 @@ fn mkstat(stat: &libc::stat) -> io::FileStat {
#[cfg(any(target_os = "linux", target_os = "android"))]
fn gen(_stat: &libc::stat) -> u64 { 0 }
- io::FileStat {
+ old_io::FileStat {
size: stat.st_size as u64,
kind: match (stat.st_mode as Mode) & libc::S_IFMT {
- libc::S_IFREG => io::FileType::RegularFile,
- libc::S_IFDIR => io::FileType::Directory,
- libc::S_IFIFO => io::FileType::NamedPipe,
- libc::S_IFBLK => io::FileType::BlockSpecial,
- libc::S_IFLNK => io::FileType::Symlink,
- _ => io::FileType::Unknown,
+ libc::S_IFREG => old_io::FileType::RegularFile,
+ libc::S_IFDIR => old_io::FileType::Directory,
+ libc::S_IFIFO => old_io::FileType::NamedPipe,
+ libc::S_IFBLK => old_io::FileType::BlockSpecial,
+ libc::S_IFLNK => old_io::FileType::Symlink,
+ _ => old_io::FileType::Unknown,
},
- perm: io::FilePermission::from_bits_truncate(stat.st_mode as u32),
+ perm: old_io::FilePermission::from_bits_truncate(stat.st_mode as u32),
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64),
accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64),
- unstable: io::UnstableFileStat {
+ unstable: old_io::UnstableFileStat {
device: stat.st_dev as u64,
inode: stat.st_ino as u64,
rdev: stat.st_rdev as u64,
diff --git a/src/sftp.rs b/src/sftp.rs
index ec9dd39..038917a 100644
--- a/src/sftp.rs
+++ b/src/sftp.rs
@@ -1,6 +1,6 @@
use std::marker;
use std::mem;
-use std::io;
+use std::old_io;
use libc::{c_int, c_ulong, c_long, c_uint, size_t};
use {raw, Session, Error};
@@ -16,7 +16,7 @@ pub struct Sftp<'sess> {
/// A file handle to an SFTP connection.
///
-/// Files behave similarly to `std::io::File` in that they are readable and
+/// Files behave similarly to `std::old_io::File` in that they are readable and
/// writable and support operations like stat and seek.
///
/// Files are created through `open`, `create`, and `open_mode` on an instance
@@ -98,7 +98,7 @@ pub enum OpenType {
impl<'sess> Sftp<'sess> {
/// Open a handle to a file.
pub fn open_mode(&self, filename: &Path, flags: OpenFlags,
- mode: io::FilePermission,
+ mode: old_io::FilePermission,
open_type: OpenType) -> Result<File, Error> {
let filename = filename.as_vec();
unsafe {
@@ -118,17 +118,17 @@ impl<'sess> Sftp<'sess> {
/// Helper to open a file in the `Read` mode.
pub fn open(&self, filename: &Path) -> Result<File, Error> {
- self.open_mode(filename, READ, io::USER_FILE, OpenType::File)
+ self.open_mode(filename, READ, old_io::USER_FILE, OpenType::File)
}
/// Helper to create a file in write-only mode with truncation.
pub fn create(&self, filename: &Path) -> Result<File, Error> {
- self.open_mode(filename, WRITE | TRUNCATE, io::USER_FILE, OpenType::File)
+ self.open_mode(filename, WRITE | TRUNCATE, old_io::USER_FILE, OpenType::File)
}
/// Helper to open a directory for reading its contents.
pub fn opendir(&self, dirname: &Path) -> Result<File, Error> {
- self.open_mode(dirname, READ, io::USER_FILE, OpenType::Dir)
+ self.open_mode(dirname, READ, old_io::USER_FILE, OpenType::Dir)
}
/// Convenience function to read the files in a directory.
@@ -155,7 +155,7 @@ impl<'sess> Sftp<'sess> {
}
/// Create a directory on the remote file system.
- pub fn mkdir(&self, filename: &Path, mode: io::FilePermission)
+ pub fn mkdir(&self, filename: &Path, mode: old_io::FilePermission)
-> Result<(), Error> {
let filename = filename.as_vec();
self.rc(unsafe {
@@ -419,15 +419,15 @@ impl<'sftp> File<'sftp> {
}
impl<'sftp> Reader for File<'sftp> {
- fn read(&mut self, buf: &mut [u8]) -> io::IoResult<usize> {
+ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
unsafe {
let rc = raw::libssh2_sftp_read(self.raw,
buf.as_mut_ptr() as *mut _,
buf.len() as size_t);
match rc {
- 0 => Err(io::standard_error(io::EndOfFile)),
- n if n < 0 => Err(io::IoError {
- kind: io::OtherIoError,
+ 0 => Err(old_io::standard_error(old_io::EndOfFile)),
+ n if n < 0 => Err(old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "read error",
detail: Some(self.sftp.last_error().to_string()),
}),
@@ -438,7 +438,7 @@ impl<'sftp> Reader for File<'sftp> {
}
impl<'sftp> Writer for File<'sftp> {
- fn write(&mut self, mut buf: &[u8]) -> io::IoResult<()> {
+ fn write_all(&mut self, mut buf: &[u8]) -> old_io::IoResult<()> {
while buf.len() > 0 {
let rc = unsafe {
raw::libssh2_sftp_write(self.raw,
@@ -446,8 +446,8 @@ impl<'sftp> Writer for File<'sftp> {
buf.len() as size_t)
};
if rc < 0 {
- return Err(io::IoError {
- kind: io::OtherIoError,
+ return Err(old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "write error",
detail: Some(self.sftp.last_error().to_string()),
})
@@ -459,7 +459,7 @@ impl<'sftp> Writer for File<'sftp> {
}
impl<'sftp> Seek for File<'sftp> {
- fn tell(&self) -> io::IoResult<u64> {
+ fn tell(&self) -> old_io::IoResult<u64> {
Ok(unsafe { raw::libssh2_sftp_tell64(self.raw) })
}
@@ -473,21 +473,21 @@ impl<'sftp> Seek for File<'sftp> {
/// You MUST NOT seek during writing or reading a file with SFTP, as the
/// internals use outstanding packets and changing the "file position"
/// during transit will results in badness.
- fn seek(&mut self, offset: i64, whence: io::SeekStyle) -> io::IoResult<()> {
+ fn seek(&mut self, offset: i64, whence: old_io::SeekStyle) -> old_io::IoResult<()> {
let next = match whence {
- io::SeekSet => offset as u64,
- io::SeekCur => (self.tell().unwrap() as i64 + offset) as u64,
- io::SeekEnd => match self.stat() {
+ old_io::SeekSet => offset as u64,
+ old_io::SeekCur => (self.tell().unwrap() as i64 + offset) as u64,
+ old_io::SeekEnd => match self.stat() {
Ok(s) => match s.size {
Some(size) => (size as i64 + offset) as u64,
- None => return Err(io::IoError {
- kind: io::OtherIoError,
+ None => return Err(old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "no file size available",
detail: None,
})
},
- Err(e) => return Err(io::IoError {
- kind: io::OtherIoError,
+ Err(e) => return Err(old_io::IoError {
+ kind: old_io::OtherIoError,
desc: "failed to stat remote file",
detail: Some(e.to_string()),
}),
diff --git a/tests/all.rs b/tests/all.rs
index 590d7d9..448c6a6 100644
--- a/tests/all.rs
+++ b/tests/all.rs
@@ -4,7 +4,7 @@ extern crate libc;
use std::mem;
use std::num::Int;
use std::os;
-use std::io::TcpStream;
+use std::old_io::TcpStream;
mod agent;
mod session;
diff --git a/tests/channel.rs b/tests/channel.rs
index 5ff1e19..5879056 100644
--- a/tests/channel.rs
+++ b/tests/channel.rs
@@ -1,4 +1,4 @@
-use std::io::{TcpListener, Listener, Acceptor, TcpStream};
+use std::old_io::{TcpListener, Listener, Acceptor, TcpStream};
use std::thread::Thread;
#[test]
diff --git a/tests/session.rs b/tests/session.rs
index 1040dad..41eb5e0 100644
--- a/tests/session.rs
+++ b/tests/session.rs
@@ -1,5 +1,5 @@
use std::os;
-use std::io::{self, File, TempDir};
+use std::old_io::{self, File, TempDir};
use ssh2::{self, Session, MethodType, HashType};
@@ -65,7 +65,7 @@ fn scp_send() {
let td = TempDir::new("test").unwrap();
let (_tcp, sess) = ::authed_session();
let mut ch = sess.scp_send(&td.path().join("foo"),
- io::USER_FILE, 6, None).unwrap();
+ old_io::USER_FILE, 6, None).unwrap();
ch.write(b"foobar").unwrap();
drop(ch);
let actual = File::open(&td.path().join("foo")).read_to_end().unwrap();
diff --git a/tests/sftp.rs b/tests/sftp.rs
index c6ebd78..f7da4c8 100644
--- a/tests/sftp.rs
+++ b/tests/sftp.rs
@@ -1,5 +1,5 @@
-use std::io::{self, fs, File, TempDir};
-use std::io::fs::PathExtensions;
+use std::old_io::{self, fs, File, TempDir};
+use std::old_io::fs::PathExtensions;
#[test]
fn smoke() {
@@ -11,13 +11,13 @@ fn smoke() {
fn ops() {
let td = TempDir::new("foo").unwrap();
File::create(&td.path().join("foo")).unwrap();
- fs::mkdir(&td.path().join("bar"), io::USER_DIR).unwrap();
+ fs::mkdir(&td.path().join("bar"), old_io::USER_DIR).unwrap();
let (_tcp, sess) = ::authed_session();
let sftp = sess.sftp().unwrap();
sftp.opendir(&td.path().join("bar")).unwrap();
let mut foo = sftp.open(&td.path().join("foo")).unwrap();
- sftp.mkdir(&td.path().join("bar2"), io::USER_DIR).unwrap();
+ sftp.mkdir(&td.path().join("bar2"), old_io::USER_DIR).unwrap();
assert!(td.path().join("bar2").is_dir());
sftp.rmdir(&td.path().join("bar2")).unwrap();