diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab527c04..201edd9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable + - uses: dtolnay/rust-toolchain@1.60 - uses: Swatinem/rust-cache@v2 - run: rustup component add clippy - run: cargo clippy --all diff --git a/Cargo.lock b/Cargo.lock index 8a794150..3f1e037f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,6 +251,21 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "command-executer" +version = "0.1.0" +dependencies = [ + "byteorder", + "clap", + "log", + "nix 0.26.2", + "num", + "num-derive", + "num-traits", + "serde", + "serde_json", +] + [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -1098,6 +1113,41 @@ dependencies = [ "winapi", ] +[[package]] +name = "num" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -1109,6 +1159,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index 27adc146..59f5aa0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ num-traits = "0.2" tempfile = "3.5" [workspace] -members = [".", "driver-bindings", "eif_loader", "enclave_build", "vsock_proxy"] +members = [".", "samples/command_executer", "driver-bindings", "eif_loader", "enclave_build", "vsock_proxy"] [features] default = [] diff --git a/samples/command_executer/Cargo.toml b/samples/command_executer/Cargo.toml index b57c7295..f98ebb5e 100644 --- a/samples/command_executer/Cargo.toml +++ b/samples/command_executer/Cargo.toml @@ -17,5 +17,3 @@ byteorder = "1.3" num = "0.2" num-derive = "0.3" num-traits = "0.2" - -[workspace] diff --git a/samples/command_executer/src/command_parser.rs b/samples/command_executer/src/command_parser.rs index 0d321f44..9feaf7c3 100644 --- a/samples/command_executer/src/command_parser.rs +++ b/samples/command_executer/src/command_parser.rs @@ -101,11 +101,7 @@ fn parse_command(args: &ArgMatches) -> Result { } fn parse_no_wait(args: &ArgMatches) -> bool { - if args.is_present("no-wait") { - true - } else { - false - } + args.is_present("no-wait") } fn parse_localfile(args: &ArgMatches) -> Result { diff --git a/samples/command_executer/src/lib.rs b/samples/command_executer/src/lib.rs index afa635e5..f2c0bf44 100644 --- a/samples/command_executer/src/lib.rs +++ b/samples/command_executer/src/lib.rs @@ -120,7 +120,7 @@ fn run_server(fd: RawFd, no_wait: bool) -> Result<(), String> { let buf = json_output.as_bytes(); let len: u64 = buf.len().try_into().map_err(|err| format!("{:?}", err))?; send_u64(fd, len)?; - send_loop(fd, &buf, len)?; + send_loop(fd, buf, len)?; Ok(()) } @@ -261,7 +261,7 @@ pub fn run(args: RunArgs) -> Result { let buf = args.command.as_bytes(); let len: u64 = buf.len().try_into().map_err(|err| format!("{:?}", err))?; send_u64(socket_fd, len)?; - send_loop(socket_fd, &buf, len)?; + send_loop(socket_fd, buf, len)?; // recv output let mut buf = [0u8; BUF_MAX_LEN]; @@ -304,7 +304,7 @@ pub fn recv_file(args: FileArgs) -> Result<(), String> { let buf = args.remotefile.as_bytes(); let len: u64 = buf.len().try_into().map_err(|err| format!("{:?}", err))?; send_u64(socket_fd, len)?; - send_loop(socket_fd, &buf, len)?; + send_loop(socket_fd, buf, len)?; // Receive filesize let filesize = recv_u64(socket_fd)?; @@ -344,7 +344,7 @@ pub fn send_file(args: FileArgs) -> Result<(), String> { let buf = args.remotefile.as_bytes(); let len: u64 = buf.len().try_into().map_err(|err| format!("{:?}", err))?; send_u64(socket_fd, len)?; - send_loop(socket_fd, &buf, len)?; + send_loop(socket_fd, buf, len)?; let filesize = file .metadata() diff --git a/samples/command_executer/src/protocol_helpers.rs b/samples/command_executer/src/protocol_helpers.rs index 39d297c1..2cc171fe 100644 --- a/samples/command_executer/src/protocol_helpers.rs +++ b/samples/command_executer/src/protocol_helpers.rs @@ -7,7 +7,7 @@ use std::os::unix::io::RawFd; pub fn send_u64(fd: RawFd, val: u64) -> Result<(), String> { let mut buf = [0u8; 9]; LittleEndian::write_u64(&mut buf, val); - send_loop(fd, &mut buf, 9)?; + send_loop(fd, &buf, 9)?; Ok(()) } @@ -21,7 +21,7 @@ pub fn recv_u64(fd: RawFd) -> Result { pub fn send_i32(fd: RawFd, val: i32) -> Result<(), String> { let mut buf = [0u8; 4]; LittleEndian::write_i32(&mut buf, val); - send_loop(fd, &mut buf, 4)?; + send_loop(fd, &buf, 4)?; Ok(()) }