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

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