summaryrefslogtreecommitdiffstats
path: root/ssh.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2020-06-26 05:02:03 +0000
committerDamien Miller <djm@mindrot.org>2020-06-26 15:24:27 +1000
commit74344c3ca42c3f53b00b025daf09ae7f6aa38076 (patch)
tree4952081cdbd6c6f3e6e891cd09a7688f003ea639 /ssh.c
parentc9e24daac6324fcbdba171392c325bf9ccc3c768 (diff)
upstream: 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@ OpenBSD-Commit-ID: 59c073b569be1a60f4de36f491a4339bc4ae870f
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/ssh.c b/ssh.c
index dfae0a73..a767a183 100644
--- a/ssh.c
+++ b/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
@@ -645,7 +645,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;
@@ -1572,22 +1572,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) {
-#ifdef WITH_SELINUX
- ssh_selinux_setfscreatecon(buf);
-#endif
- if (mkdir(buf, 0700) < 0)
- error("Could not create directory '%.200s'.",
- buf);
-#ifdef WITH_SELINUX
- ssh_selinux_setfscreatecon(NULL);
-#endif
- }
- }
/* load options.identity_files */
load_public_identity_files(pw);