mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 08:14:24 +02:00
- 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@
This commit is contained in:
parent
9f8703b573
commit
50af79b118
@ -1,3 +1,11 @@
|
|||||||
|
20100510
|
||||||
|
- 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@
|
||||||
|
|
||||||
20100423
|
20100423
|
||||||
- (dtucker) [configure.ac] Bug #1756: Check for the existence of a lib64 dir
|
- (dtucker) [configure.ac] Bug #1756: Check for the existence of a lib64 dir
|
||||||
in the openssl install directory (some newer openssl versions do this on at
|
in the openssl install directory (some newer openssl versions do this on at
|
||||||
|
20
ssh-keygen.c
20
ssh-keygen.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-keygen.c,v 1.187 2010/04/16 06:47:04 jmc Exp $ */
|
/* $OpenBSD: ssh-keygen.c,v 1.188 2010/04/23 01:47:41 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -1884,14 +1884,20 @@ main(int argc, char **argv)
|
|||||||
ask_filename(pw, "Enter file in which to save the key");
|
ask_filename(pw, "Enter file in which to save the key");
|
||||||
|
|
||||||
/* Create ~/.ssh directory if it doesn't already exist. */
|
/* Create ~/.ssh directory if it doesn't already exist. */
|
||||||
snprintf(dotsshdir, sizeof dotsshdir, "%s/%s", pw->pw_dir, _PATH_SSH_USER_DIR);
|
snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",
|
||||||
if (strstr(identity_file, dotsshdir) != NULL &&
|
pw->pw_dir, _PATH_SSH_USER_DIR);
|
||||||
stat(dotsshdir, &st) < 0) {
|
if (strstr(identity_file, dotsshdir) != NULL) {
|
||||||
if (mkdir(dotsshdir, 0700) < 0)
|
if (stat(dotsshdir, &st) < 0) {
|
||||||
error("Could not create directory '%s'.", dotsshdir);
|
if (errno != ENOENT) {
|
||||||
else if (!quiet)
|
error("Could not stat %s: %s", dotsshdir,
|
||||||
|
strerror(errno));
|
||||||
|
} else if (mkdir(dotsshdir, 0700) < 0) {
|
||||||
|
error("Could not create directory '%s': %s",
|
||||||
|
dotsshdir, strerror(errno));
|
||||||
|
} else if (!quiet)
|
||||||
printf("Created directory '%s'.\n", dotsshdir);
|
printf("Created directory '%s'.\n", dotsshdir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* If the file already exists, ask the user to confirm. */
|
/* If the file already exists, ask the user to confirm. */
|
||||||
if (stat(identity_file, &st) >= 0) {
|
if (stat(identity_file, &st) >= 0) {
|
||||||
char yesno[3];
|
char yesno[3];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user