Skip to contentSkip to conversation

cifs.upcall: try to use default credcache if we didn't find one

PATCH New Jeff Layton 1 participant 1 message Sep 17, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs.upcall: try to use default credcache if we didn't find one

Fedora is in the process of moving to KEYRING: credcaches which are not currently handled by cifs.upcall. We could try to detect when they're in use, but it's simpler and more robust to just try to use the default credcache whenever we don't find a FILE: or DIR: cache.

---
 cifs.upcall.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
cifs.upcall.c +14 -5
index 20b562f..cc65824 100644
@@ -382,11 +382,20 @@ cifs_krb5_get_req(const char *host, const char *ccname,
 		return ret;
 	}
 
-	ret = krb5_cc_resolve(context, ccname, &ccache);
-	if (ret) {
-		syslog(LOG_DEBUG, "%s: unable to resolve %s to ccache\n",
-		       __func__, ccname);
-		goto out_free_context;
+	if (ccname) {
+		ret = krb5_cc_resolve(context, ccname, &ccache);
+		if (ret) {
+			syslog(LOG_DEBUG, "%s: unable to resolve %s to ccache\n",
+			       __func__, ccname);
+			goto out_free_context;
+		}
+	} else {
+		ret = krb5_cc_default(context, &ccache);
+		if (ret) {
+			syslog(LOG_DEBUG, "%s: krb5_cc_default: %d",
+				__func__, (int)ret);
+			goto out_free_context;
+		}
 	}
 
 	memset(&in_creds, 0, sizeof(in_creds));
Signature · 1 line
1.8.3.1