mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-25 23:05:21 +02:00
upstream commit
- Fix error message: passphrase needs to be at least 5 characters, not 4. - Remove unused function argument. - Remove two unnecessary variables. OK djm@ Upstream-ID: 13010c05bfa8b523da1c0dc19e81dd180662bc30
This commit is contained in:
parent
2681cdb6e0
commit
3c019a936b
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: authfile.c,v 1.116 2015/07/09 09:49:46 markus Exp $ */
|
/* $OpenBSD: authfile.c,v 1.117 2015/09/13 14:39:16 tim Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -272,8 +272,8 @@ sshkey_load_private(const char *filename, const char *passphrase,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((r = sshkey_load_file(fd, buffer)) != 0 ||
|
if ((r = sshkey_load_file(fd, buffer)) != 0 ||
|
||||||
(r = sshkey_parse_private_fileblob(buffer, passphrase, filename,
|
(r = sshkey_parse_private_fileblob(buffer, passphrase, keyp,
|
||||||
keyp, commentp)) != 0)
|
commentp)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
r = 0;
|
r = 0;
|
||||||
out:
|
out:
|
||||||
|
13
ssh-add.c
13
ssh-add.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-add.c,v 1.124 2015/09/13 13:48:19 tim Exp $ */
|
/* $OpenBSD: ssh-add.c,v 1.125 2015/09/13 14:39:16 tim Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -218,17 +218,16 @@ add_file(int agent_fd, const char *filename, int key_only)
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
/* At first, try empty passphrase */
|
/* At first, try empty passphrase */
|
||||||
if ((r = sshkey_parse_private_fileblob(keyblob, "", filename,
|
if ((r = sshkey_parse_private_fileblob(keyblob, "", &private,
|
||||||
&private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
|
&comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
|
||||||
fprintf(stderr, "Error loading key \"%s\": %s\n",
|
fprintf(stderr, "Error loading key \"%s\": %s\n",
|
||||||
filename, ssh_err(r));
|
filename, ssh_err(r));
|
||||||
goto fail_load;
|
goto fail_load;
|
||||||
}
|
}
|
||||||
/* try last */
|
/* try last */
|
||||||
if (private == NULL && pass != NULL) {
|
if (private == NULL && pass != NULL) {
|
||||||
if ((r = sshkey_parse_private_fileblob(keyblob, pass, filename,
|
if ((r = sshkey_parse_private_fileblob(keyblob, pass, &private,
|
||||||
&private, &comment)) != 0 &&
|
&comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
|
||||||
r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
|
|
||||||
fprintf(stderr, "Error loading key \"%s\": %s\n",
|
fprintf(stderr, "Error loading key \"%s\": %s\n",
|
||||||
filename, ssh_err(r));
|
filename, ssh_err(r));
|
||||||
goto fail_load;
|
goto fail_load;
|
||||||
@ -244,7 +243,7 @@ add_file(int agent_fd, const char *filename, int key_only)
|
|||||||
if (strcmp(pass, "") == 0)
|
if (strcmp(pass, "") == 0)
|
||||||
goto fail_load;
|
goto fail_load;
|
||||||
if ((r = sshkey_parse_private_fileblob(keyblob, pass,
|
if ((r = sshkey_parse_private_fileblob(keyblob, pass,
|
||||||
filename, &private, &comment)) == 0)
|
&private, &comment)) == 0)
|
||||||
break;
|
break;
|
||||||
else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
|
else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
4
ssherr.c
4
ssherr.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssherr.c,v 1.4 2015/02/16 22:13:32 djm Exp $ */
|
/* $OpenBSD: ssherr.c,v 1.5 2015/09/13 14:39:16 tim Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 Damien Miller
|
* Copyright (c) 2011 Damien Miller
|
||||||
*
|
*
|
||||||
@ -104,7 +104,7 @@ ssh_err(int n)
|
|||||||
case SSH_ERR_NEED_REKEY:
|
case SSH_ERR_NEED_REKEY:
|
||||||
return "rekeying not supported by peer";
|
return "rekeying not supported by peer";
|
||||||
case SSH_ERR_PASSPHRASE_TOO_SHORT:
|
case SSH_ERR_PASSPHRASE_TOO_SHORT:
|
||||||
return "passphrase is too short (minimum four characters)";
|
return "passphrase is too short (minimum five characters)";
|
||||||
case SSH_ERR_FILE_CHANGED:
|
case SSH_ERR_FILE_CHANGED:
|
||||||
return "file changed while reading";
|
return "file changed while reading";
|
||||||
case SSH_ERR_KEY_UNKNOWN_CIPHER:
|
case SSH_ERR_KEY_UNKNOWN_CIPHER:
|
||||||
|
20
sshkey.c
20
sshkey.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sshkey.c,v 1.22 2015/09/02 07:51:12 jsg Exp $ */
|
/* $OpenBSD: sshkey.c,v 1.23 2015/09/13 14:39:16 tim Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
|
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
|
||||||
@ -3833,8 +3833,6 @@ int
|
|||||||
sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
||||||
const char *passphrase, struct sshkey **keyp, char **commentp)
|
const char *passphrase, struct sshkey **keyp, char **commentp)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
|
|
||||||
*keyp = NULL;
|
*keyp = NULL;
|
||||||
if (commentp != NULL)
|
if (commentp != NULL)
|
||||||
*commentp = NULL;
|
*commentp = NULL;
|
||||||
@ -3856,8 +3854,8 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
|||||||
return sshkey_parse_private2(blob, type, passphrase,
|
return sshkey_parse_private2(blob, type, passphrase,
|
||||||
keyp, commentp);
|
keyp, commentp);
|
||||||
case KEY_UNSPEC:
|
case KEY_UNSPEC:
|
||||||
if ((r = sshkey_parse_private2(blob, type, passphrase, keyp,
|
if (sshkey_parse_private2(blob, type, passphrase, keyp,
|
||||||
commentp)) == 0)
|
commentp) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
#ifdef WITH_OPENSSL
|
#ifdef WITH_OPENSSL
|
||||||
return sshkey_parse_private_pem_fileblob(blob, type,
|
return sshkey_parse_private_pem_fileblob(blob, type,
|
||||||
@ -3872,10 +3870,8 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
|||||||
|
|
||||||
int
|
int
|
||||||
sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase,
|
sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase,
|
||||||
const char *filename, struct sshkey **keyp, char **commentp)
|
struct sshkey **keyp, char **commentp)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
|
|
||||||
if (keyp != NULL)
|
if (keyp != NULL)
|
||||||
*keyp = NULL;
|
*keyp = NULL;
|
||||||
if (commentp != NULL)
|
if (commentp != NULL)
|
||||||
@ -3883,13 +3879,11 @@ sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase,
|
|||||||
|
|
||||||
#ifdef WITH_SSH1
|
#ifdef WITH_SSH1
|
||||||
/* it's a SSH v1 key if the public key part is readable */
|
/* it's a SSH v1 key if the public key part is readable */
|
||||||
if ((r = sshkey_parse_public_rsa1_fileblob(buffer, NULL, NULL)) == 0) {
|
if (sshkey_parse_public_rsa1_fileblob(buffer, NULL, NULL) == 0) {
|
||||||
return sshkey_parse_private_fileblob_type(buffer, KEY_RSA1,
|
return sshkey_parse_private_fileblob_type(buffer, KEY_RSA1,
|
||||||
passphrase, keyp, commentp);
|
passphrase, keyp, commentp);
|
||||||
}
|
}
|
||||||
#endif /* WITH_SSH1 */
|
#endif /* WITH_SSH1 */
|
||||||
if ((r = sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC,
|
return sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC,
|
||||||
passphrase, keyp, commentp)) == 0)
|
passphrase, keyp, commentp);
|
||||||
return 0;
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
5
sshkey.h
5
sshkey.h
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sshkey.h,v 1.9 2015/08/04 05:23:06 djm Exp $ */
|
/* $OpenBSD: sshkey.h,v 1.10 2015/09/13 14:39:16 tim Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
||||||
@ -186,8 +186,7 @@ int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
|
|||||||
int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
|
int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
|
||||||
struct sshkey **keyp, char **commentp);
|
struct sshkey **keyp, char **commentp);
|
||||||
int sshkey_parse_private_fileblob(struct sshbuf *buffer,
|
int sshkey_parse_private_fileblob(struct sshbuf *buffer,
|
||||||
const char *passphrase, const char *filename, struct sshkey **keyp,
|
const char *passphrase, struct sshkey **keyp, char **commentp);
|
||||||
char **commentp);
|
|
||||||
int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
||||||
const char *passphrase, struct sshkey **keyp, char **commentp);
|
const char *passphrase, struct sshkey **keyp, char **commentp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user