aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-filter.C
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent-filter.C')
-rw-r--r--ssh-agent-filter.C19
1 files changed, 14 insertions, 5 deletions
diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C
index 4d9b2ba..2878678 100644
--- a/ssh-agent-filter.C
+++ b/ssh-agent-filter.C
@@ -1,7 +1,7 @@
/*
* ssh-agent-filter.C -- filtering proxy for ssh-agent meant to be forwarded to untrusted servers
*
- * Copyright (C) 2013-2015 Timo Weingärtner <timo@tiwe.de>
+ * Copyright (C) 2013-2016 Timo Weingärtner <timo@tiwe.de>
*
* This file is part of ssh-agent-filter.
*
@@ -192,7 +192,7 @@ int make_listen_sock () {
}
void parse_cmdline (int const argc, char const * const * const argv) {
- po::options_description opts{"OPTIONS"};
+ po::options_description opts{"Options"};
opts.add_options()
("all-confirmed,A", po::bool_switch(&all_confirmed),"allow all other keys with confirmation")
("comment,c", po::value(&allowed_comment), "key specified by comment")
@@ -211,13 +211,19 @@ void parse_cmdline (int const argc, char const * const * const argv) {
notify(config);
if (config.count("help")) {
- cout << "Invocation: ssh-agent-filter [ OPTIONS ]" << endl;
- cout << opts << endl;
+ cout << "Usage: ssh-agent-filter [ OPTIONS ]\n";
+ cout << opts;
+ cout << "Environment:\n";
+ cout << " SSH_AUTH_SOCK socket of upstream ssh-agent\n";
+ cout << " SSH_ASKPASS command to run for confirmation questions\n";
exit(EX_OK);
}
if (config.count("version")) {
- cout << SSH_AGENT_FILTER_VERSION << endl;
+ cout << SSH_AGENT_FILTER_VERSION "\n";
+ cout << "Written by Timo Weingärtner.\n";
+ cout << "Report bugs to the Debian BTS at https://bugs.debian.org/\n";
+ cout << "or by mail to timo@tiwe.de.\n";
exit(EX_OK);
}
@@ -497,6 +503,9 @@ rfc4251::string handle_request (rfc4251::string const & r) {
}
void handle_client (int const sock) try {
+ if (fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) & ~O_NONBLOCK))
+ throw system_error(errno, system_category(), "fcntl");
+
io::stream<io::file_descriptor> client{sock, io::close_handle};
arm(client);