summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-05-10 11:52:00 +1000
committerDamien Miller <djm@mindrot.org>2010-05-10 11:52:00 +1000
commit50af79b1186b26425d100b1cf1ba615b72124c0e (patch)
tree4157f76380ef517b213c380a9d0b0b54976bb8ef
parent9f8703b5735f372e04d4ad550aed70508843e67f (diff)
- OpenBSD CVS Sync
- djm@cvs.openbsd.org 2010/04/23 01:47:41 [ssh-keygen.c] bz#1740: display a more helpful error message when $HOME is inaccessible while trying to create .ssh directory. Based on patch from jchadima AT redhat.com; ok dtucker@
-rw-r--r--ChangeLog8
-rw-r--r--ssh-keygen.c22
2 files changed, 22 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 6dbaa1647..2ceea43e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
120100510
2 - OpenBSD CVS Sync
3 - djm@cvs.openbsd.org 2010/04/23 01:47:41
4 [ssh-keygen.c]
5 bz#1740: display a more helpful error message when $HOME is
6 inaccessible while trying to create .ssh directory. Based on patch
7 from jchadima AT redhat.com; ok dtucker@
8
120100423 920100423
2 - (dtucker) [configure.ac] Bug #1756: Check for the existence of a lib64 dir 10 - (dtucker) [configure.ac] Bug #1756: Check for the existence of a lib64 dir
3 in the openssl install directory (some newer openssl versions do this on at 11 in the openssl install directory (some newer openssl versions do this on at
diff --git a/ssh-keygen.c b/ssh-keygen.c
index f0ddd4cfc..45248237c 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.187 2010/04/16 06:47:04 jmc Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.188 2010/04/23 01:47:41 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1884,13 +1884,19 @@ main(int argc, char **argv)
1884 ask_filename(pw, "Enter file in which to save the key"); 1884 ask_filename(pw, "Enter file in which to save the key");
1885 1885
1886 /* Create ~/.ssh directory if it doesn't already exist. */ 1886 /* Create ~/.ssh directory if it doesn't already exist. */
1887 snprintf(dotsshdir, sizeof dotsshdir, "%s/%s", pw->pw_dir, _PATH_SSH_USER_DIR); 1887 snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",
1888 if (strstr(identity_file, dotsshdir) != NULL && 1888 pw->pw_dir, _PATH_SSH_USER_DIR);
1889 stat(dotsshdir, &st) < 0) { 1889 if (strstr(identity_file, dotsshdir) != NULL) {
1890 if (mkdir(dotsshdir, 0700) < 0) 1890 if (stat(dotsshdir, &st) < 0) {
1891 error("Could not create directory '%s'.", dotsshdir); 1891 if (errno != ENOENT) {
1892 else if (!quiet) 1892 error("Could not stat %s: %s", dotsshdir,
1893 printf("Created directory '%s'.\n", dotsshdir); 1893 strerror(errno));
1894 } else if (mkdir(dotsshdir, 0700) < 0) {
1895 error("Could not create directory '%s': %s",
1896 dotsshdir, strerror(errno));
1897 } else if (!quiet)
1898 printf("Created directory '%s'.\n", dotsshdir);
1899 }
1894 } 1900 }
1895 /* If the file already exists, ask the user to confirm. */ 1901 /* If the file already exists, ask the user to confirm. */
1896 if (stat(identity_file, &st) >= 0) { 1902 if (stat(identity_file, &st) >= 0) {