From ac86e85c90bf674c3c6702ba4645f021e2f45de9 Mon Sep 17 00:00:00 2001 From: Stephen Touset Date: Tue, 10 Jul 2018 14:07:56 -0700 Subject: [PATCH] Clean up clippy warnings --- sample/bin/sudo_approve | 4 ++++ sudo_pair/src/lib.rs | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sample/bin/sudo_approve b/sample/bin/sudo_approve index 62d494d..0fa7c65 100755 --- a/sample/bin/sudo_approve +++ b/sample/bin/sudo_approve @@ -50,6 +50,10 @@ pair() { # (which causes a SIGPIPE to get sent). So the `kill` ensures the # subshell is killed without the user having to type something # additional that would cause the command to exit. + # + # FIXME: Technically, `echo` puts a secret value into an process + # argument list, which isn't great. However, the window for + # exploitation here is microscopic. { socat STDIO unix-connect:"${socket}"; kill $!; } < <( echo -n "${token}" ; cat - ) diff --git a/sudo_pair/src/lib.rs b/sudo_pair/src/lib.rs index 5bfb0a5..2eef721 100644 --- a/sudo_pair/src/lib.rs +++ b/sudo_pair/src/lib.rs @@ -282,7 +282,13 @@ impl SudoPair { ).context(ErrorKind::CommunicationError)?; let mut response : [u8; 16] = [0; 16]; - let _ = socket.read_exact(&mut response) + + // TODO: read_exact will cause this process to block + // indefinitely (even on Ctrl-C) until the correct number of + // bytes are read; this won't happen in normal circumstances, + // but a bug in (or untimely exit of) the approval script can + // cause this process to hang and require being killed + socket.read_exact(&mut response) .context(ErrorKind::CommunicationError)?; // non-constant comparison is fine here since a comparison