summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/ssh.c b/ssh.c
index ce628848c6f5..0777c31e42b7 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.490 2018/07/27 05:34:42 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.494 2018/10/03 06:38:35 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -739,8 +739,15 @@ main(int ac, char **av)
cp = sshkey_alg_list(1, 0, 0, '\n');
else if (strcmp(optarg, "key-plain") == 0)
cp = sshkey_alg_list(0, 1, 0, '\n');
- else if (strcmp(optarg, "protocol-version") == 0) {
+ else if (strcmp(optarg, "sig") == 0)
+ cp = sshkey_alg_list(0, 1, 1, '\n');
+ else if (strcmp(optarg, "protocol-version") == 0)
cp = xstrdup("2");
+ else if (strcmp(optarg, "help") == 0) {
+ cp = xstrdup(
+ "cipher\ncipher-auth\nkex\nkey\n"
+ "key-cert\nkey-plain\nmac\n"
+ "protocol-version\nsig");
}
if (cp == NULL)
fatal("Unsupported query \"%s\"", optarg);
@@ -1130,10 +1137,9 @@ main(int ac, char **av)
if (addrs == NULL && options.num_permitted_cnames != 0 && (direct ||
options.canonicalize_hostname == SSH_CANONICALISE_ALWAYS)) {
if ((addrs = resolve_host(host, options.port,
- option_clear_or_none(options.proxy_command),
- cname, sizeof(cname))) == NULL) {
+ direct, cname, sizeof(cname))) == NULL) {
/* Don't fatal proxied host names not in the DNS */
- if (option_clear_or_none(options.proxy_command))
+ if (direct)
cleanup_exit(255); /* logged in resolve_host */
} else
check_follow_cname(direct, &host, cname);
@@ -1447,9 +1453,27 @@ main(int ac, char **av)
"r", options.user,
"u", pw->pw_name,
(char *)NULL);
- setenv(SSH_AUTHSOCKET_ENV_NAME, cp, 1);
- free(cp);
free(p);
+ /*
+ * If identity_agent represents an environment variable
+ * then recheck that it is valid (since processing with
+ * percent_expand() may have changed it) and substitute
+ * its value.
+ */
+ if (cp[0] == '$') {
+ if (!valid_env_name(cp + 1)) {
+ fatal("Invalid IdentityAgent "
+ "environment variable name %s", cp);
+ }
+ if ((p = getenv(cp + 1)) == NULL)
+ unsetenv(SSH_AUTHSOCKET_ENV_NAME);
+ else
+ setenv(SSH_AUTHSOCKET_ENV_NAME, p, 1);
+ } else {
+ /* identity_agent specifies a path directly */
+ setenv(SSH_AUTHSOCKET_ENV_NAME, cp, 1);
+ }
+ free(cp);
}
}