From a7f6e0c1d8553df678aa7b401eb374cf179210f7 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Fri, 18 Apr 2014 13:55:30 +0200 Subject: use a boost stream directly instead of declaring an intermediate stream_buffer --- ssh-agent-filter.C | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C index 17090e9..a7844f9 100644 --- a/ssh-agent-filter.C +++ b/ssh-agent-filter.C @@ -25,7 +25,7 @@ namespace po = boost::program_options; #include namespace fs = boost::filesystem; -#include +#include #include namespace io = boost::iostreams; @@ -204,8 +204,7 @@ void parse_cmdline (int const argc, char const * const * const argv) { } void setup_filters () { - io::stream_buffer agent_filebuf{make_upstream_agent_conn(), io::close_handle}; - std::iostream agent{&agent_filebuf}; + io::stream agent{make_upstream_agent_conn(), io::close_handle}; agent.exceptions(std::ios::badbit | std::ios::failbit); agent << rfc4251string{std::string{SSH2_AGENTC_REQUEST_IDENTITIES}}; @@ -322,8 +321,7 @@ rfc4251string handle_request (rfc4251string const & r) { switch (request_code) { case SSH2_AGENTC_REQUEST_IDENTITIES: { - io::stream_buffer agent_filebuf{make_upstream_agent_conn(), io::close_handle}; - std::iostream agent{&agent_filebuf}; + io::stream agent{make_upstream_agent_conn(), io::close_handle}; agent.exceptions(std::ios::badbit | std::ios::failbit); agent << rfc4251string{std::string{SSH2_AGENTC_REQUEST_IDENTITIES}}; // temp to test key filtering when signing @@ -375,8 +373,7 @@ rfc4251string handle_request (rfc4251string const & r) { } if (allow) { - io::stream_buffer agent_filebuf{make_upstream_agent_conn(), io::close_handle}; - std::iostream agent{&agent_filebuf}; + io::stream agent{make_upstream_agent_conn(), io::close_handle}; agent.exceptions(std::ios::badbit | std::ios::failbit); rfc4251string agent_answer; @@ -416,8 +413,7 @@ rfc4251string handle_request (rfc4251string const & r) { } void handle_client (int const sock) try { - io::stream_buffer client_filebuf{sock, io::close_handle}; - std::iostream client{&client_filebuf}; + io::stream client{sock, io::close_handle}; client.exceptions(std::ios::badbit | std::ios::failbit); for (;;) -- cgit v1.2.3