diff options
author | 2016-05-04 12:21:53 +0000 | |
---|---|---|
committer | 2016-05-04 12:21:53 +0000 | |
commit | 5e7f4732f72e672305d5d8dec43164540f622ace (patch) | |
tree | dae269f54debd5d2b3f8798a6bd6ee5216a598b4 /usr.bin/ssh/ssh.c | |
parent | fix junk characters after quotes (diff) | |
download | wireguard-openbsd-5e7f4732f72e672305d5d8dec43164540f622ace.tar.xz wireguard-openbsd-5e7f4732f72e672305d5d8dec43164540f622ace.zip |
IdentityAgent for specifying specific agent sockets; ok djm@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 623a611597d..e31857f49da 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.438 2016/04/29 08:07:53 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.439 2016/05/04 12:21:53 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1286,6 +1286,22 @@ main(int ac, char **av) /* load options.identity_files */ load_public_identity_files(); + /* optionally set the SSH_AUTHSOCKET_ENV_NAME varibale */ + if (options.identity_agent) { + if (strcmp(options.identity_agent, "none") == 0) { + unsetenv(SSH_AUTHSOCKET_ENV_NAME); + } else { + p = tilde_expand_filename(options.identity_agent, + original_real_uid); + cp = percent_expand(p, "d", pw->pw_dir, + "u", pw->pw_name, "l", thishost, "h", host, + "r", options.user, (char *)NULL); + setenv(SSH_AUTHSOCKET_ENV_NAME, cp, 1); + free(cp); + free(p); + } + } + /* Expand ~ in known host file names. */ tilde_expand_paths(options.system_hostfiles, options.num_system_hostfiles); |