From patchwork Tue Sep 17 15:44:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2903041 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0A6749F1C0 for ; Tue, 17 Sep 2013 15:45:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 502F020179 for ; Tue, 17 Sep 2013 15:45:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5B4C200E5 for ; Tue, 17 Sep 2013 15:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753144Ab3IQPpE (ORCPT ); Tue, 17 Sep 2013 11:45:04 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:54340 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752795Ab3IQPpD (ORCPT ); Tue, 17 Sep 2013 11:45:03 -0400 Received: by mail-ob0-f174.google.com with SMTP id uz6so5694620obc.33 for ; Tue, 17 Sep 2013 08:45:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=Tf+Ahc1BXJzoPccgiAxOWxSLHUxplrWuB/0AuUyjnZc=; b=i4oU8g1lE2SexjmhpIFpzWA2uBM3naCF9MeT9vX0pz3zgle9PuER15J+QdpnEfGyPT ze8HzPLuaueiuQfw7l+gCacmZko7N3dz70b/aFgW9eeyIDDGO9A+g0tWlLoJlRhlRrkx 1SUbTMPqDDPAwJGGVLVhPm1zbgYY7x3UKZEV5Zj/QkdeWw4Cb07dnwZPePf8m+YnE1wI g4uJd0kSlAG4V6pfcdWewE2au3RNLKS0EXSBnuJrIK2X+XCZe2ibW8IFuTxBhetdShs3 EmSo47dLiwt7T0nO7VCFcY1es1r6x0cnqAOFpVjMHbvQL3NkfU9+2NybdugOhljYGbus 0+yA== X-Gm-Message-State: ALoCoQkz1BcA0JrXtsf0KXTcQBgvB8Eyib7arUkQ12IaMA3fpzATeiskFgPg4jpNd2Jzaijwr2be X-Received: by 10.60.115.164 with SMTP id jp4mr6421078oeb.19.1379432702319; Tue, 17 Sep 2013 08:45:02 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id hl3sm37317323obb.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 17 Sep 2013 08:45:01 -0700 (PDT) From: Jeff Layton To: linux-cifs@vger.kernel.org Subject: [PATCH] cifs.upcall: try to use default credcache if we didn't find one Date: Tue, 17 Sep 2013 11:44:58 -0400 Message-Id: <1379432698-9704-1-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.8.3.1 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Jeff Layton --- cifs.upcall.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/cifs.upcall.c b/cifs.upcall.c index 20b562f..cc65824 100644 --- a/cifs.upcall.c +++ b/cifs.upcall.c @@ -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));