Blame SOURCES/0001-cifs-use-krb5_kt_default-to-determine-default-keytab.patch

40fde1
From d32db5e1e2c32f0634a26de277fd91daf47ce32d Mon Sep 17 00:00:00 2001
40fde1
From: Jeff Layton <jlayton@samba.org>
40fde1
Date: Mon, 7 Apr 2014 14:35:17 -0400
40fde1
Subject: [PATCH] cifs: use krb5_kt_default() to determine default keytab
40fde1
 location
40fde1
40fde1
...don't assume that it's in /etc/krb5.keytab.
40fde1
40fde1
Reported-by: Konstantin Lepikhov <klepikho@redhat.com>
40fde1
Signed-off-by: Jeff Layton <jlayton@samba.org>
40fde1
(cherry picked from commit a016e18969d10e3c777f35fe21b1c1f8c1d70880)
40fde1
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
40fde1
---
40fde1
 cifs.upcall.c | 13 +++++++++----
40fde1
 1 file changed, 9 insertions(+), 4 deletions(-)
40fde1
40fde1
diff --git a/cifs.upcall.c b/cifs.upcall.c
40fde1
index cc65824..e8544c2 100644
40fde1
--- a/cifs.upcall.c
40fde1
+++ b/cifs.upcall.c
40fde1
@@ -55,7 +55,6 @@
40fde1
 #define	CIFS_DEFAULT_KRB5_DIR		"/tmp"
40fde1
 #define	CIFS_DEFAULT_KRB5_USER_DIR	"/run/user/%U"
40fde1
 #define	CIFS_DEFAULT_KRB5_PREFIX	"krb5cc"
40fde1
-#define CIFS_DEFAULT_KRB5_KEYTAB	"/etc/krb5.keytab"
40fde1
 
40fde1
 #define	MAX_CCNAME_LEN			PATH_MAX + 5
40fde1
 
40fde1
@@ -205,9 +204,15 @@ init_cc_from_keytab(const char *keytab_name, const char *user)
40fde1
 		goto icfk_cleanup;
40fde1
 	}
40fde1
 
40fde1
-	ret = krb5_kt_resolve(context, keytab_name, &keytab);
40fde1
+	if (keytab_name)
40fde1
+		ret = krb5_kt_resolve(context, keytab_name, &keytab);
40fde1
+	else
40fde1
+		ret = krb5_kt_default(context, &keytab);
40fde1
+
40fde1
 	if (ret) {
40fde1
-		syslog(LOG_DEBUG, "krb5_kt_resolve: %d", (int)ret);
40fde1
+		syslog(LOG_DEBUG, "%s: %d",
40fde1
+			keytab_name ? "krb5_kt_resolve" : "krb5_kt_default",
40fde1
+			(int)ret);
40fde1
 		goto icfk_cleanup;
40fde1
 	}
40fde1
 
40fde1
@@ -841,7 +846,7 @@ int main(const int argc, char *const argv[])
40fde1
 	struct decoded_args arg;
40fde1
 	const char *oid;
40fde1
 	uid_t uid;
40fde1
-	char *keytab_name = CIFS_DEFAULT_KRB5_KEYTAB;
40fde1
+	char *keytab_name = NULL;
40fde1
 	time_t best_time = 0;
40fde1
 
40fde1
 	hostbuf[0] = '\0';
40fde1
-- 
40fde1
1.9.3
40fde1