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

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