diff options
author | markus@openbsd.org <markus@openbsd.org> | 2016-05-04 12:21:53 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2016-05-05 00:01:49 +1000 |
commit | b02ad1ce9105bfa7394ac7590c0729dd52e26a81 (patch) | |
tree | ffd061ffac036e169402e36282e8b8f1dd8566cf /ssh.c | |
parent | 910e59bba09ac309d78ce61e356da35292212935 (diff) | |
download | openssh-git-b02ad1ce9105bfa7394ac7590c0729dd52e26a81.tar.gz |
upstream commit
IdentityAgent for specifying specific agent sockets; ok
djm@
Upstream-ID: 3e6a15eb89ea0fd406f108826b7dc7dec4fbfac1
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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 @@ -1335,6 +1335,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); |