Blame SOURCES/0002-library-return-error-if-no-matching-key-was-found.patch

f441eb
From 4987a21f4839ab7ea50e932c72df05075efb89b3 Mon Sep 17 00:00:00 2001
f441eb
From: Sumit Bose <sbose@redhat.com>
f441eb
Date: Thu, 21 Mar 2019 15:05:33 +0100
f441eb
Subject: [PATCH 2/2] library: return error if no matching key was found
f441eb
f441eb
To avoid a misleading debug message indicating success a proper erro
f441eb
code should be returned the no matching key was found when trying to
f441eb
copy an keytab entry for a new principal.
f441eb
f441eb
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1644311
f441eb
---
f441eb
 library/adkrb5.c | 5 ++---
f441eb
 1 file changed, 2 insertions(+), 3 deletions(-)
f441eb
f441eb
diff --git a/library/adkrb5.c b/library/adkrb5.c
f441eb
index 033c181..7f77373 100644
f441eb
--- a/library/adkrb5.c
f441eb
+++ b/library/adkrb5.c
f441eb
@@ -298,11 +298,10 @@ _adcli_krb5_keytab_copy_entries (krb5_context k5,
f441eb
 
f441eb
 		code = _adcli_krb5_get_keyblock (k5, keytab, &entry.key,
f441eb
 		                                 match_enctype_and_kvno, &closure);
f441eb
-		if (code != 0) {
f441eb
-			return code;
f441eb
+		if (code != 0 || closure.matched == 0) {
f441eb
+			return code != 0 ? code : ENOKEY;
f441eb
 		}
f441eb
 
f441eb
-
f441eb
 		entry.principal = principal;
f441eb
 		entry.vno = kvno;
f441eb
 
f441eb
-- 
f441eb
2.20.1
f441eb