From patchwork Tue Apr 21 12:29:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 19169 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3LCVsx1020612 for ; Tue, 21 Apr 2009 12:31:54 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id D4FF3163C66 for ; Tue, 21 Apr 2009 12:31:32 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.8 tests=AWL,BAYES_00, FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx2.redhat.com (mx2.redhat.com [66.187.237.31]) by lists.samba.org (Postfix) with ESMTP id 5352D163B27; Tue, 21 Apr 2009 12:29:14 +0000 (GMT) Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3LCTZ2e016391; Tue, 21 Apr 2009 08:29:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3LCTY8r027021; Tue, 21 Apr 2009 08:29:34 -0400 Received: from localhost.localdomain (vpn-10-136.str.redhat.com [10.32.10.136]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3LCTQJc023950; Tue, 21 Apr 2009 08:29:30 -0400 From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Tue, 21 Apr 2009 08:29:00 -0400 Message-Id: <1240316940-15891-1-git-send-email-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Cc: samba-technical@lists.samba.org Subject: [linux-cifs-client] [PATCH] cifs: send password field to upcall if we need spnego key X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org We don't currently use the password field in sesInfo for krb5 auth. Hijack it in that case by treating it as a generic credential info field. For krb5 we can use it to pass $KRB5CCNAME to the upcall. To properly use this will require support in both mount.cifs and cifs.upcall. Signed-off-by: Jeff Layton --- fs/cifs/cifs_spnego.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 67bf93a..3e4d806 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c @@ -88,6 +88,9 @@ struct key_type cifs_spnego_key_type = { /* strlen of ";user=" */ #define USER_KEY_LEN 6 +/* strlen of ";credinfo=" */ +#define USER_CREDINFO_LEN 10 + /* get a key struct with a SPNEGO security blob, suitable for session setup */ struct key * cifs_get_spnego_key(struct cifsSesInfo *sesInfo) @@ -105,7 +108,8 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) IP_KEY_LEN + MAX_IPV6_ADDR_LEN + MAX_MECH_STR_LEN + UID_KEY_LEN + (sizeof(uid_t) * 2) + - USER_KEY_LEN + strlen(sesInfo->userName) + 1; + USER_KEY_LEN + strlen(sesInfo->userName) + 1 + + USER_CREDINFO_LEN + strlen(sesInfo->password + 1); spnego_key = ERR_PTR(-ENOMEM); description = kzalloc(desc_len, GFP_KERNEL); @@ -143,6 +147,11 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) dp = description + strlen(description); sprintf(dp, ";user=%s", sesInfo->userName); + if (sesInfo->password) { + dp = description + strlen(description); + sprintf(dp, ";credinfo=%s", sesInfo->password); + } + cFYI(1, ("key description = %s", description)); spnego_key = request_key(&cifs_spnego_key_type, description, "");