From patchwork Fri Dec 23 16:09:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Adamson X-Patchwork-Id: 9487587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F3BFA601D3 for ; Fri, 23 Dec 2016 16:11:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E70DF26246 for ; Fri, 23 Dec 2016 16:11:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBAC1277D9; Fri, 23 Dec 2016 16:11:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 759062711E for ; Fri, 23 Dec 2016 16:11:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966278AbcLWQLE (ORCPT ); Fri, 23 Dec 2016 11:11:04 -0500 Received: from mx141.netapp.com ([216.240.21.12]:55108 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941308AbcLWQLD (ORCPT ); Fri, 23 Dec 2016 11:11:03 -0500 X-IronPort-AV: E=Sophos;i="5.33,393,1477983600"; d="scan'208";a="172210619" Received: from vmwexchts04-prd.hq.netapp.com ([10.122.105.32]) by mx141-out.netapp.com with ESMTP; 23 Dec 2016 08:07:51 -0800 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) with Microsoft SMTP Server id 15.0.1210.3; Fri, 23 Dec 2016 08:11:00 -0800 Received: from controller.androsad.fake (dros-16.local.vpn.netapp.com [10.55.72.69]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id uBNGB0T8025377; Fri, 23 Dec 2016 08:11:01 -0800 (PST) From: To: CC: , Andy Adamson Subject: [PATCH 1/2] Use RPCSEC_GSS version 3 Date: Fri, 23 Dec 2016 11:09:26 -0500 Message-ID: <1482509367-22381-2-git-send-email-andros@netapp.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1482509367-22381-1-git-send-email-andros@netapp.com> References: <1482509367-22381-1-git-send-email-andros@netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andy Adamson If that fails, fall back to version 1 Signed-off-by: Andy Adamson --- autogen.sh | 0 src/auth_gss.c | 16 ++++++++++++---- tirpc/rpc/auth_gss.h | 10 ++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) mode change 100644 => 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh old mode 100644 new mode 100755 diff --git a/src/auth_gss.c b/src/auth_gss.c index cf96ada..5bb1685 100644 --- a/src/auth_gss.c +++ b/src/auth_gss.c @@ -156,9 +156,11 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec) AUTH *auth, *save_auth; struct rpc_gss_data *gd; OM_uint32 min_stat = 0; + int vers=RPCSEC_GSS3_VERSION; gss_log_debug("in authgss_create()"); +retry_gssv1: memset(&rpc_createerr, 0, sizeof(rpc_createerr)); if ((auth = calloc(sizeof(*auth), 1)) == NULL) { @@ -190,7 +192,7 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec) gd->ctx = GSS_C_NO_CONTEXT; gd->sec = *sec; - gd->gc.gc_v = RPCSEC_GSS_VERSION; + gd->gc.gc_v = vers; gd->gc.gc_proc = RPCSEC_GSS_INIT; gd->gc.gc_svc = gd->sec.svc; @@ -200,9 +202,14 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec) save_auth = clnt->cl_auth; clnt->cl_auth = auth; - if (!authgss_refresh(auth, NULL)) - auth = NULL; - else + fprintf(stderr, "authgss_create CALLING authgss_refresh\n"); + if (!authgss_refresh(auth, NULL)) { + if (vers == RPCSEC_GSS3_VERSION) { + vers = RPCSEC_GSS_VERSION; + goto retry_gssv1; + } else + auth = NULL; + } else auth_get(auth); /* Reference for caller */ clnt->cl_auth = save_auth; @@ -263,6 +270,7 @@ authgss_get_private_data(AUTH *auth, struct authgss_private_data *pd) pd->pd_ctx = gd->ctx; pd->pd_ctx_hndl = gd->gc.gc_ctx; pd->pd_seq_win = gd->win; + pd->pd_gss_vers = gd->gc.gc_v; /* * We've given this away -- don't try to use it ourself any more * Caller should call authgss_free_private_data to free data. diff --git a/tirpc/rpc/auth_gss.h b/tirpc/rpc/auth_gss.h index a17b34b..b662ac5 100644 --- a/tirpc/rpc/auth_gss.h +++ b/tirpc/rpc/auth_gss.h @@ -45,17 +45,22 @@ typedef enum { RPCSEC_GSS_DATA = 0, RPCSEC_GSS_INIT = 1, RPCSEC_GSS_CONTINUE_INIT = 2, - RPCSEC_GSS_DESTROY = 3 + RPCSEC_GSS_DESTROY = 3, + RPCSEC_GSS_BIND_CHANNEL = 4, /* GSSv2, not used */ + RPCSEC_GSS_CREATE = 5, /* GSSv3 */ + RPCSEC_GSS_LIST = 6 /* GSSv3 */ } rpc_gss_proc_t; /* RPCSEC_GSS services. */ typedef enum { RPCSEC_GSS_SVC_NONE = 1, RPCSEC_GSS_SVC_INTEGRITY = 2, - RPCSEC_GSS_SVC_PRIVACY = 3 + RPCSEC_GSS_SVC_PRIVACY = 3, + RPC_GSS_SVC_CHANNEL_PROT = 4 /* GSS2, not used */ } rpc_gss_svc_t; #define RPCSEC_GSS_VERSION 1 +#define RPCSEC_GSS3_VERSION 3 /* RPCSEC_GSS security triple. */ struct rpc_gss_sec { @@ -71,6 +76,7 @@ struct authgss_private_data { gss_ctx_id_t pd_ctx; /* Session context handle */ gss_buffer_desc pd_ctx_hndl; /* Credentials context handle */ u_int pd_seq_win; /* Sequence window */ + u_int pd_gss_vers; /* RPCSEC_GSS version */ }; #define g_OID_equal(o1, o2) \