diff options
author | 2020-06-26 05:02:03 +0000 | |
---|---|---|
committer | 2020-06-26 05:02:03 +0000 | |
commit | 2f0dab9281a8112b1c5413e089c76a516d26a3f5 (patch) | |
tree | c45dad6b700f0e63784f71abba46225026e18667 /usr.bin/ssh/ssh.c | |
parent | drm/amdkfd: Use correct major in devcgroup check (diff) | |
download | wireguard-openbsd-2f0dab9281a8112b1c5413e089c76a516d26a3f5.tar.xz wireguard-openbsd-2f0dab9281a8112b1c5413e089c76a516d26a3f5.zip |
Defer creation of ~/.ssh by ssh(1) until we attempt to write to it so we
don't leave an empty .ssh directory when it's not needed. Use the same
function to replace the code in ssh-keygen that does the same thing.
bz#3156, ok djm@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index c206e996125..3cd24df7600 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.529 2020/06/05 03:15:26 dtucker Exp $ */ +/* $OpenBSD: ssh.c,v 1.530 2020/06/26 05:02:03 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -629,7 +629,7 @@ main(int ac, char **av) struct ssh *ssh = NULL; int i, r, opt, exit_status, use_syslog, direct, timeout_ms; int was_addr, config_test = 0, opt_terminated = 0, want_final_pass = 0; - char *p, *cp, *line, *argv0, buf[PATH_MAX], *logfile; + char *p, *cp, *line, *argv0, *logfile; char cname[NI_MAXHOST]; struct stat st; struct passwd *pw; @@ -1551,16 +1551,6 @@ main(int ac, char **av) } } - /* Create ~/.ssh * directory if it doesn't already exist. */ - if (config == NULL) { - r = snprintf(buf, sizeof buf, "%s%s%s", pw->pw_dir, - strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR); - if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) == -1) - if (mkdir(buf, 0700) == -1) - error("Could not create directory '%.200s'.", - buf); - } - /* load options.identity_files */ load_public_identity_files(pw); |