upstream: principalsp is optional, pubkey required; ok djm

OpenBSD-Commit-ID: 2cc3ea5018c28ed97edaccd7f17d2cc796f01024
This commit is contained in:
markus@openbsd.org 2020-03-06 18:27:15 +00:00 committed by Damien Miller
parent e26a31757c
commit 31c39e7840
1 changed files with 3 additions and 3 deletions

View File

@ -963,7 +963,7 @@ get_matching_principals_from_line(const char *path, u_long linenum, char *line,
goto done; goto done;
} }
done: done:
if (found) { if (found && principalsp != NULL) {
*principalsp = principals; *principalsp = principals;
principals = NULL; /* transferred */ principals = NULL; /* transferred */
} }
@ -1026,8 +1026,8 @@ sshsig_get_pubkey(struct sshbuf *signature, struct sshkey **pubkey)
struct sshkey *pk = NULL; struct sshkey *pk = NULL;
int r = SSH_ERR_SIGNATURE_INVALID; int r = SSH_ERR_SIGNATURE_INVALID;
if (pubkey != NULL) if (pubkey == NULL)
*pubkey = NULL; return SSH_ERR_INTERNAL_ERROR;
if ((r = sshsig_parse_preamble(signature)) != 0) if ((r = sshsig_parse_preamble(signature)) != 0)
return r; return r;
if ((r = sshkey_froms(signature, &pk)) != 0) if ((r = sshkey_froms(signature, &pk)) != 0)