From patchwork Tue Feb 7 22:19:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Mayhew X-Patchwork-Id: 9561347 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 79F006047A for ; Tue, 7 Feb 2017 22:19:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 682812848D for ; Tue, 7 Feb 2017 22:19:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A03A28485; Tue, 7 Feb 2017 22:19:36 +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 0036528485 for ; Tue, 7 Feb 2017 22:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932101AbdBGWTY (ORCPT ); Tue, 7 Feb 2017 17:19:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41326 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932313AbdBGWTX (ORCPT ); Tue, 7 Feb 2017 17:19:23 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 337E780F9C for ; Tue, 7 Feb 2017 22:19:19 +0000 (UTC) Received: from tonberry.usersys.redhat.com (dhcp145-110.rdu.redhat.com [10.13.145.110]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17MJIJi001039; Tue, 7 Feb 2017 17:19:19 -0500 Received: by tonberry.usersys.redhat.com (Postfix, from userid 1000) id C5B8C12075C; Tue, 7 Feb 2017 17:19:18 -0500 (EST) From: Scott Mayhew To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Subject: [libnfsidmap PATCH] libnfsidmap: nss_gss_princ_to_ids() and nss_gss_princ_to_grouplist() must strip the realm Date: Tue, 7 Feb 2017 17:19:18 -0500 Message-Id: <1486505958-41507-1-git-send-email-smayhew@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 07 Feb 2017 22:19:19 +0000 (UTC) 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 nss_gss_princ_to_ids() and nss_gss_princ_to_grouplist() were hard-coded to call nss_getpwnam with the 'dostrip' arg set to 0, which is the opposite of what they should have had. Note: there's no point making the decision to strip or not to strip configurable in these two functions. Ideally both of these functions should be taking a gss_name_t instead of a char * for the principal, calling gss_localname() on that, and passing the result to nss_getpwnam... but that would require changes in both rpc.svcgssd and libgssglue (both of which have been deprecated for a while). Fixes: 4db1bb1 (libnfsidmap: add options to aid id mapping in multi domain environments) Signed-off-by: Scott Mayhew --- nss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nss.c b/nss.c index 67e657a..82799ce 100644 --- a/nss.c +++ b/nss.c @@ -415,7 +415,7 @@ static int nss_gss_princ_to_ids(char *secname, char *princ, return -ENOENT; } /* XXX: this should call something like getgssauthnam instead? */ - pw = nss_getpwnam(princ, NULL, &err, 0); + pw = nss_getpwnam(princ, NULL, &err, 1); if (pw == NULL) { err = -ENOENT; goto out; @@ -438,7 +438,7 @@ int nss_gss_princ_to_grouplist(char *secname, char *princ, goto out; /* XXX: not quite right? Need to know default realm? */ /* XXX: this should call something like getgssauthnam instead? */ - pw = nss_getpwnam(princ, NULL, &ret, 0); + pw = nss_getpwnam(princ, NULL, &ret, 1); if (pw == NULL) { ret = -ENOENT; goto out;