summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/authfile.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2017-09-02 14:25:20 +0000
committerdes <des@FreeBSD.org>2017-09-02 14:25:20 +0000
commitce0d6faba2a9fd27ff0fc0942a4e51f5203bb88f (patch)
treee29bf4f30ea560420ac21b41c62cc53b42547a0b /crypto/openssh/authfile.c
parentfa127d1375fbc969c65e8d8a5f9f2f8efe4e36fc (diff)
downloadFreeBSD-src-ce0d6faba2a9fd27ff0fc0942a4e51f5203bb88f.zip
FreeBSD-src-ce0d6faba2a9fd27ff0fc0942a4e51f5203bb88f.tar.gz
MFH (r314527,r314576,r314601,r317998): Upgrade OpenSSH to 7.3p1.
Diffstat (limited to 'crypto/openssh/authfile.c')
-rw-r--r--crypto/openssh/authfile.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/crypto/openssh/authfile.c b/crypto/openssh/authfile.c
index d670424..f46b4e3 100644
--- a/crypto/openssh/authfile.c
+++ b/crypto/openssh/authfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfile.c,v 1.120 2015/12/11 04:21:11 mmcc Exp $ */
+/* $OpenBSD: authfile.c,v 1.121 2016/04/09 12:39:30 djm Exp $ */
/*
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
*
@@ -147,7 +147,8 @@ sshkey_load_public_rsa1(int fd, struct sshkey **keyp, char **commentp)
struct sshbuf *b = NULL;
int r;
- *keyp = NULL;
+ if (keyp != NULL)
+ *keyp = NULL;
if (commentp != NULL)
*commentp = NULL;
@@ -200,7 +201,8 @@ sshkey_load_private_type(int type, const char *filename, const char *passphrase,
{
int fd, r;
- *keyp = NULL;
+ if (keyp != NULL)
+ *keyp = NULL;
if (commentp != NULL)
*commentp = NULL;
@@ -231,6 +233,8 @@ sshkey_load_private_type_fd(int fd, int type, const char *passphrase,
struct sshbuf *buffer = NULL;
int r;
+ if (keyp != NULL)
+ *keyp = NULL;
if ((buffer = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
@@ -255,7 +259,8 @@ sshkey_load_private(const char *filename, const char *passphrase,
struct sshbuf *buffer = NULL;
int r, fd;
- *keyp = NULL;
+ if (keyp != NULL)
+ *keyp = NULL;
if (commentp != NULL)
*commentp = NULL;
@@ -408,7 +413,8 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp)
char *file = NULL;
int r = SSH_ERR_INTERNAL_ERROR;
- *keyp = NULL;
+ if (keyp != NULL)
+ *keyp = NULL;
if (asprintf(&file, "%s-cert.pub", filename) == -1)
return SSH_ERR_ALLOC_FAIL;
@@ -418,11 +424,12 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp)
}
if ((r = sshkey_try_load_public(pub, file, NULL)) != 0)
goto out;
-
- *keyp = pub;
- pub = NULL;
+ /* success */
+ if (keyp != NULL) {
+ *keyp = pub;
+ pub = NULL;
+ }
r = 0;
-
out:
free(file);
sshkey_free(pub);
@@ -437,7 +444,8 @@ sshkey_load_private_cert(int type, const char *filename, const char *passphrase,
struct sshkey *key = NULL, *cert = NULL;
int r;
- *keyp = NULL;
+ if (keyp != NULL)
+ *keyp = NULL;
switch (type) {
#ifdef WITH_OPENSSL
@@ -467,8 +475,10 @@ sshkey_load_private_cert(int type, const char *filename, const char *passphrase,
(r = sshkey_cert_copy(cert, key)) != 0)
goto out;
r = 0;
- *keyp = key;
- key = NULL;
+ if (keyp != NULL) {
+ *keyp = key;
+ key = NULL;
+ }
out:
sshkey_free(key);
sshkey_free(cert);
OpenPOWER on IntegriCloud