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

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