Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp316768lqp; Mon, 10 Jun 2024 05:20:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFeCt+AZ7pZMSGBzzPuxWOgAVwUyjija9B0CwWPuYbl2mAodvvkKbWgO+EIxyuST8vXcD+RLWTr9kalLwdhi3LFvL8wFytA/lFKtst1A== X-Google-Smtp-Source: AGHT+IE3/F66uRHKJgmuPWR7zGJ2qbh2fEEcR/41egi3RwgkCchBXCmvmdUzmedCxi7/d7NXrsyv X-Received: by 2002:a05:6102:4c05:b0:48c:2cf7:a260 with SMTP id ada2fe7eead31-48c2cf7ac03mr5889738137.13.1718022015575; Mon, 10 Jun 2024 05:20:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718022015; cv=pass; d=google.com; s=arc-20160816; b=CR5q81w07B91EThxEtqcokc2JUht+5DTlknF5hlUzgNs3TDgc1+1rIvglgUnaw3oTF A+gj8Xv0VUhkOo1IYWqtNU0/qZKaum8xbecvLIvxhIdzu/GIv6OhHt6QwNUAwTeAh0Jx ADtX/aunxGj4iJEgYOOuRPmisBZHD8yLqTBtyS/7FoNYO+4Z72FgRb8iw3AVLJR2cR8N mIT0tZkfqepckfprkLJO/4nvgKtrjkivKrM0Tp2FPl5JndhFFc8ukmqjzaYs5aCdJaOt 4/83FPTWe6SHT0fd+6ReVuUybPupPWSYuCImj/feTm/NHwCCvdr1i/zo6VR1/9Ipra5d lAAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=r1OJ4TsfB8UBIAfLoaQNjhurQcVI8y7HbrvFqJE4GSs=; fh=ATHBLT/CvMfY3lAcHR2hvPwjtAL/YNB30TF5/N+6c/k=; b=Jcv9vpKwlaPI9P3IqrG5zkx7gxky6UyXXWKSV6+jw9fhHk3dk+jOScEyiINKu1BJQ/ KusrtjMRlYrzGDKz7XMnheTuuYQYiJ6QsqsbuaVs20hiIu4zpzX4T1FG0S7d/dsEAOrx mzJ4VgkpSyh2MUYPmXuyxxWAyCDn/jbbljAyPego16/ntX18wpCoaJNK1KsIAOU0fLqq 5IGgxHPlzEdSQ0hk2WEb+lz8kgaBdT581N9pwYOxmf8TLlPcMQzlVcliwSTpfvhHHfnH aA9xZaGFHnF0LKegk03Eiy31YAqt5GRVE/O0AP0Gx1thKKTYyQTfgA7VTotWiAga6HFD /WlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PhYRw+13; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3627-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3627-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48c379d781dsi1130761137.11.2024.06.10.05.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 05:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3627-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PhYRw+13; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-3627-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3627-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4B4231C20FCE for ; Mon, 10 Jun 2024 12:20:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78BFF8004A; Mon, 10 Jun 2024 12:19:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PhYRw+13" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 548587FBDF for ; Mon, 10 Jun 2024 12:19:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718021983; cv=none; b=f7EiQbLvEQQQPQ4aXK0I3b9uK57PbStayV560KdAT5CKWL+00FBymfUzHQ4tJ2arx1E3Q+//e/VjzHOR8e7teV4eKWC8JaxDGZq5fEt3enUk6tnScNoh9edyOiSps+10+pOgAq5EoZhnkryCZtc+zZVj5Idh2XBfEgvxzVX4jN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718021983; c=relaxed/simple; bh=HU6U7WT9OzRLZRPUyGj7M5pDHABOxy36pLvoFTukhEM=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=sR8eCNX2KHRknru7gepLxPZmBLHX8NYTGEgtWl3XorAGqBlQ+x40TmKHZOImrHLPoYwlXxq6msm+s+22LjWWbbrqj3QfZkKicTfhzEnkQgsjFX0HzpQTiM2jxRh0OpQ95yzeyD0WXTT9GjVOEQjXnNF4uV0rSb+phJNopc89E/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PhYRw+13; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59E65C2BBFC; Mon, 10 Jun 2024 12:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718021983; bh=HU6U7WT9OzRLZRPUyGj7M5pDHABOxy36pLvoFTukhEM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=PhYRw+13W6EkuJ1yn6/aAFSX8zmxP8qImqrj3SNd2V4EFoU37p0Y53q+ncFpUxCDn 1lUEjz7iM32HzyHF6/GFui3ICIzsX94cTBDE2uMGc2FONtQwBsTm50V7zkU96+FXb7 YVMLfMROyrKgJQtm11DYGvkgtm0zCBKJF2c1z1HM6uqiCKrMlODaMqtGJLR24Ky9bN zVDfEV2tAH4l/pXgKOWKN4wBNpeNa1oltKaedZM0YrPi83kuZfaRZrubMRtllROEB0 Vt1q4AcExcsGouCqYF5eR0fGvgH49FsfpmYzXiSVTvjFx73uIfYHr5KpfjgFCzUX/h aPiEVizvnO8Ww== Message-ID: <99655e83d1b2f3fa86ab95adbe3fd1746e8b4343.camel@kernel.org> Subject: Re: [for-6.11 PATCH 06/29] sunrpc: add rpcauth_map_to_svc_cred From: Jeff Layton To: Mike Snitzer , linux-nfs@vger.kernel.org Cc: Chuck Lever , Trond Myklebust , snitzer@hammerspace.com Date: Mon, 10 Jun 2024 08:19:41 -0400 In-Reply-To: <20240607142646.20924-7-snitzer@kernel.org> References: <20240607142646.20924-1-snitzer@kernel.org> <20240607142646.20924-7-snitzer@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-06-07 at 10:26 -0400, Mike Snitzer wrote: > From: Weston Andros Adamson >=20 > Add new funtion rpcauth_map_to_svc_cred which maps a generic rpc_cred > to an > svc_cred suitable for use in nfsd. >=20 > This is needed by the localio code to map nfs client creds to nfs > server > credentials. >=20 > Signed-off-by: Weston Andros Adamson > Signed-off-by: Lance Shelton > Signed-off-by: Trond Myklebust > Signed-off-by: Mike Snitzer > --- > =C2=A0include/linux/sunrpc/auth.h |=C2=A0 4 ++++ > =C2=A0net/sunrpc/auth.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 16 ++++++++++++++++ > =C2=A02 files changed, 20 insertions(+) >=20 > diff --git a/include/linux/sunrpc/auth.h > b/include/linux/sunrpc/auth.h > index 61e58327b1aa..5ebf031361a1 100644 > --- a/include/linux/sunrpc/auth.h > +++ b/include/linux/sunrpc/auth.h > @@ -11,6 +11,7 @@ > =C2=A0#define _LINUX_SUNRPC_AUTH_H > =C2=A0 > =C2=A0#include > +#include > =C2=A0#include > =C2=A0#include > =C2=A0 > @@ -184,6 +185,9 @@ int rpcauth_uptodatecred(struct > rpc_task *); > =C2=A0int rpcauth_init_credcache(struct rpc_auth *); > =C2=A0void rpcauth_destroy_credcache(struct rpc_auth > *); > =C2=A0void rpcauth_clear_credcache(struct > rpc_cred_cache *); > +bool rpcauth_map_to_svc_cred(struct rpc_auth *, > + const struct cred *, > + struct svc_cred *); > =C2=A0char * rpcauth_stringify_acceptor(struct rpc_cred > *); > =C2=A0 > =C2=A0static inline > diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c > index 04534ea537c8..55a03a3bcac2 100644 > --- a/net/sunrpc/auth.c > +++ b/net/sunrpc/auth.c > @@ -308,6 +308,22 @@ rpcauth_init_credcache(struct rpc_auth *auth) > =C2=A0} > =C2=A0EXPORT_SYMBOL_GPL(rpcauth_init_credcache); > =C2=A0 > +bool > +rpcauth_map_to_svc_cred(struct rpc_auth *auth, const struct cred > *cred, > + struct svc_cred *svc) > +{ > + svc->cr_uid =3D cred->uid; > + svc->cr_gid =3D cred->gid; > + svc->cr_flavor =3D auth->au_flavor; > + svc->cr_principal =3D NULL; > + svc->cr_gss_mech =3D NULL; Setting the above to NULLs makes me a little nervous, but these values are usually handled at the RPC layer during svc_authenticate. The localio code hooks in below that, so this should hopefully not be a problem. =20 > + if (cred->group_info) > + svc->cr_group_info =3D get_group_info(cred- > >group_info); > + > + return true; > +} > +EXPORT_SYMBOL_GPL(rpcauth_map_to_svc_cred); > + > =C2=A0char * > =C2=A0rpcauth_stringify_acceptor(struct rpc_cred *cred) > =C2=A0{ --=20 Jeff Layton