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 6ee0f8c68..3140fed4c 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.490 2018/07/27 05:34:42 dtucker Exp $ */ 1/* $OpenBSD: ssh.c,v 1.494 2018/10/03 06:38:35 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -739,8 +739,15 @@ main(int ac, char **av)
739 cp = sshkey_alg_list(1, 0, 0, '\n'); 739 cp = sshkey_alg_list(1, 0, 0, '\n');
740 else if (strcmp(optarg, "key-plain") == 0) 740 else if (strcmp(optarg, "key-plain") == 0)
741 cp = sshkey_alg_list(0, 1, 0, '\n'); 741 cp = sshkey_alg_list(0, 1, 0, '\n');
742 else if (strcmp(optarg, "protocol-version") == 0) { 742 else if (strcmp(optarg, "sig") == 0)
743 cp = sshkey_alg_list(0, 1, 1, '\n');
744 else if (strcmp(optarg, "protocol-version") == 0)
743 cp = xstrdup("2"); 745 cp = xstrdup("2");
746 else if (strcmp(optarg, "help") == 0) {
747 cp = xstrdup(
748 "cipher\ncipher-auth\nkex\nkey\n"
749 "key-cert\nkey-plain\nmac\n"
750 "protocol-version\nsig");
744 } 751 }
745 if (cp == NULL) 752 if (cp == NULL)
746 fatal("Unsupported query \"%s\"", optarg); 753 fatal("Unsupported query \"%s\"", optarg);
@@ -1130,10 +1137,9 @@ main(int ac, char **av)
1130 if (addrs == NULL && options.num_permitted_cnames != 0 && (direct || 1137 if (addrs == NULL && options.num_permitted_cnames != 0 && (direct ||
1131 options.canonicalize_hostname == SSH_CANONICALISE_ALWAYS)) { 1138 options.canonicalize_hostname == SSH_CANONICALISE_ALWAYS)) {
1132 if ((addrs = resolve_host(host, options.port, 1139 if ((addrs = resolve_host(host, options.port,
1133 option_clear_or_none(options.proxy_command), 1140 direct, cname, sizeof(cname))) == NULL) {
1134 cname, sizeof(cname))) == NULL) {
1135 /* Don't fatal proxied host names not in the DNS */ 1141 /* Don't fatal proxied host names not in the DNS */
1136 if (option_clear_or_none(options.proxy_command)) 1142 if (direct)
1137 cleanup_exit(255); /* logged in resolve_host */ 1143 cleanup_exit(255); /* logged in resolve_host */
1138 } else 1144 } else
1139 check_follow_cname(direct, &host, cname); 1145 check_follow_cname(direct, &host, cname);
@@ -1447,9 +1453,27 @@ main(int ac, char **av)
1447 "r", options.user, 1453 "r", options.user,
1448 "u", pw->pw_name, 1454 "u", pw->pw_name,
1449 (char *)NULL); 1455 (char *)NULL);
1450 setenv(SSH_AUTHSOCKET_ENV_NAME, cp, 1);
1451 free(cp);
1452 free(p); 1456 free(p);
1457 /*
1458 * If identity_agent represents an environment variable
1459 * then recheck that it is valid (since processing with
1460 * percent_expand() may have changed it) and substitute
1461 * its value.
1462 */
1463 if (cp[0] == '$') {
1464 if (!valid_env_name(cp + 1)) {
1465 fatal("Invalid IdentityAgent "
1466 "environment variable name %s", cp);
1467 }
1468 if ((p = getenv(cp + 1)) == NULL)
1469 unsetenv(SSH_AUTHSOCKET_ENV_NAME);
1470 else
1471 setenv(SSH_AUTHSOCKET_ENV_NAME, p, 1);
1472 } else {
1473 /* identity_agent specifies a path directly */
1474 setenv(SSH_AUTHSOCKET_ENV_NAME, cp, 1);
1475 }
1476 free(cp);
1453 } 1477 }
1454 } 1478 }
1455 1479