From 02b7bb3399f778883914ed64ef9e777d6b49d43e Mon Sep 17 00:00:00 2001 From: djm Date: Thu, 30 Mar 2023 03:05:01 +0000 Subject: [PATCH] return SSH_ERR_KEY_NOT_FOUND if the allowed_signers file is empty, not SSH_ERR_INTERNAL_ERROR. Also remove some dead code spotted by Coverity; with/ok dtucker@ --- usr.bin/ssh/sshsig.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/ssh/sshsig.c b/usr.bin/ssh/sshsig.c index bdfb3b44442..4a359b8d483 100644 --- a/usr.bin/ssh/sshsig.c +++ b/usr.bin/ssh/sshsig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshsig.c,v 1.30 2022/08/19 03:06:30 djm Exp $ */ +/* $OpenBSD: sshsig.c,v 1.31 2023/03/30 03:05:01 djm Exp $ */ /* * Copyright (c) 2019 Google LLC * @@ -975,7 +975,7 @@ sshsig_check_allowed_keys(const char *path, const struct sshkey *sign_key, char *line = NULL; size_t linesize = 0; u_long linenum = 0; - int r = SSH_ERR_INTERNAL_ERROR, oerrno; + int r = SSH_ERR_KEY_NOT_FOUND, oerrno; /* Check key and principal against file */ if ((f = fopen(path, "r")) == NULL) { @@ -1005,7 +1005,7 @@ sshsig_check_allowed_keys(const char *path, const struct sshkey *sign_key, /* Either we hit an error parsing or we simply didn't find the key */ fclose(f); free(line); - return r == 0 ? SSH_ERR_KEY_NOT_FOUND : r; + return r; } int -- 2.20.1