From owner-freebsd-current@freebsd.org Wed Jun 3 23:35:57 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2162D2F6A0E for ; Wed, 3 Jun 2020 23:35:57 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670059.outbound.protection.outlook.com [40.107.67.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49clf34lxxz43KB; Wed, 3 Jun 2020 23:35:55 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHMlaZB8N67uHZCiUAkCZkAPnc8hAPrJK6rz+y/H6XEeeB7haGV9VhO0GA4cdm+NqrOT0HKkLEf81+pTJ4GrwAdFr61Uv+B36ZZ83pDYfp/ITOxAKpd6ilkcolQFWzGk63zNBcT6UMXepa91YiepT/f2dxeXponaOXU+iDH+xnKDMbY+TsKMRjnAMW7kp8+ChkAfjQ1BmgAfmiCyrN3imFpwpd0rVn9EDrEyFBXuyf4FYELog30BBQw0ZF/FwEJcIobQ3l0IrObVGosSgZNIgocJp5o9ENbSe8MtfHaBQcxP0I9b8MtQP2RRReB2Yz+ODXYscXbB+LSO1BXxtURGLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MS4EZV5x7pI0RaVzRpi84ASlGdY1q3LOVcLbCRYzg2s=; b=fTaudZQGkMma7CZJSCatcFnDAueJ8irKcvS4sd09ApukkU/bfZ7gEGZ/hu0OjUPJN4N1XuHk1NXLoYuf3V1dCf1CTxxl9ig//lNwVkfBoBK5w8WeOqtdg7kknwUAnloZThbNHVM/JpkTFJTQgLfwNv29BhsnBww6G4Bi28p+oeJGo5uqTXw9m9f+t+S+Iy5/rN7QMF+QO+P2zcXYJXx7Y3XaCTQF2s8v/lMR09Ky7BlRFinMAMEFB4Fln84tJmV1Jpge5KWouAApzwXd4Etwxah6oX+DeS78vI7YXIF9yKEKTK6Q9UfcPs0lT9G5iowqTYUM8/5FyiPcm5b69AQ6YA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uoguelph.ca; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MS4EZV5x7pI0RaVzRpi84ASlGdY1q3LOVcLbCRYzg2s=; b=sihY1fmoe8JZ9jLKP2qLaN0p+wT+tqcK/CFgGCCswmXKfaY9pSWz+tdZM8Dwm2j6BM2oyzwfQzo0a2WWWEeEKOHeWHBz0VjzD95iIV+UFmW1SJYI9z1kJvrzJswVYHsrWHgnIMEuLdeUtsBNprNT6bzpeTjWuLoc73enU+Df2MLIP1BeoYF0zpcNWjymdGIs6OE0RiliME4+H//Omxox8u+YFjoKl+F+3ctG29QO3PbtEOFiljuCWIqJrRMCuTNoIzGUeCFR7AjIiRBLUHN861orQCooi1YTvCGBuDTSS5sXhZY3yVI/FB0BEUzLLcwFX88A5SGOHB2unGtgjbWEzA== Received: from QB1PR01MB3649.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:32::26) by QB1PR01MB3298.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:34::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Wed, 3 Jun 2020 23:35:54 +0000 Received: from QB1PR01MB3649.CANPRD01.PROD.OUTLOOK.COM ([fe80::dd96:945c:b6ee:ffa2]) by QB1PR01MB3649.CANPRD01.PROD.OUTLOOK.COM ([fe80::dd96:945c:b6ee:ffa2%6]) with mapi id 15.20.3066.018; Wed, 3 Jun 2020 23:35:54 +0000 From: Rick Macklem To: "freebsd-current@FreeBSD.org" CC: Kirk McKusick Subject: getgrouplist duplication of cr_groups[0] as cr_groups[1] Thread-Topic: getgrouplist duplication of cr_groups[0] as cr_groups[1] Thread-Index: AQHWOf3qv7Z3eM94XkOrWyN2eMMI7A== Date: Wed, 3 Jun 2020 23:35:54 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 01dd2ad9-79d5-48df-2ad4-08d80816dbdc x-ms-traffictypediagnostic: QB1PR01MB3298: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 04238CD941 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kGa7jS1rQe92d4lkoXzoG4DGzCPHZxqysdbRh3uTJyrxgNndiSQXDGgLLXpQHmtFz9Y0K5fCUiGqT0TH2K9MGM8fHIaU8HiDErEGx29Yf4GLbBfpsr0jvlfqoB8d3hh7WqV2/0HeJ0wHmnjETZG6PPha6hUi6xAqjBZNxuyoU7NM5QfTSyYWsLq0LNyKa8gE18GX4c25cLV/Mq2nLKcN5bKyELOWnijSh01Gwvv8z/p2h2tJymeQuOtRNIceflV33QxnuqHB1vD8xjEg0S4FOOnXwxOeYpZdriQooiu1iWoBcK3/BfhZ+P6HekkZL3Sm x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:QB1PR01MB3649.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(346002)(39860400002)(376002)(366004)(136003)(396003)(6916009)(55016002)(5660300002)(86362001)(52536014)(33656002)(66946007)(76116006)(6506007)(66446008)(91956017)(7696005)(64756008)(71200400001)(2906002)(450100002)(186003)(478600001)(66556008)(83380400001)(66476007)(9686003)(4326008)(8676002)(316002)(786003)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: BT3x3N2qwWl28QO1WeSdguHEWYuY/hznXB/ecEvl+0wrhtgD6APTBFQa8bnTpXy2IVaW7qkOH4uPTvv7vZvWrPZ4HUiQXqah2vCfImGXigaZ/ENPI8xAr+VDINjEVh4PpRWck1fh8jEmXi16BK21/VKEXxWeZoGtYMb8UbddtfI6YivDEPndW0CngiYb+wv8Q5YGyjW3HkNhIy20l5v7E5YDBY+LqW97pMwbz3ukBGhFK5B5RnRTydGWj/aGzmcNZGPkgfMoznagXtyh6d4RlD2jv32Mk73rdXir3mbi7SuSbxVDdKhti1gzO5NUd5GFM60ZOBR+61stdjIjNHhEZTmvs+Db5s22kAs+l84uYG480p8su8FyduB5VhpfUwAjih4u7bwHjlKNq1SJLQftwkC6ksXJe9jOJj3MXQrGyfDx2sIEtJOKt/+ZnQOIOodG17r9FoZB2k+X9aFXg7YSqLyoQt1wuVOpDEdwnA2TZL0Is4+jCgbc1fdhO6t9rMe5j0m0KyNvsDVawGTYOapqPdIOHyg0O0hOR3aCTCVxaYFCwFtx2Clke20ikEDRwHLQ x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 01dd2ad9-79d5-48df-2ad4-08d80816dbdc X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jun 2020 23:35:54.3327 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lTxweBEdpZfXbDyud9ulK11bRvBo7FUsXboa8QrTZ8hpvn8hXqLsvNa/t5UfmNhF7qEdGbY/PoEl0d23iBemOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: QB1PR01MB3298 X-Rspamd-Queue-Id: 49clf34lxxz43KB X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=uoguelph.ca header.s=selector1 header.b=sihY1fmo; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.59 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-5.71 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.969]; R_DKIM_ALLOW(-0.20)[uoguelph.ca:s=selector1]; RWL_MAILSPIKE_POSSIBLE(0.00)[40.107.67.59:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; NEURAL_HAM_LONG(-1.05)[-1.047]; DWL_DNSWL_LOW(-1.00)[uoguelph.ca:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[uoguelph.ca:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.09)[-1.090]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; RCVD_IN_DNSWL_LOW(-0.10)[40.107.67.59:from] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2020 23:35:57 -0000 Hi,=0A= =0A= During testing of a mountd.c patch I have, I found an "old bug" where the= =0A= mountd.c code assumed that getgrouplist() would always duplicate=0A= cr_groups[0] in cr_groups[1].=0A= =0A= If I read the commit logs correctly, this was always the case until=0A= r174547 (only 12years ago), which switched getgrouplist() to=0A= use __getgroupmembership().=0A= Kirk fixed the deduplication code in gr_addgid() in r328304 so that=0A= gr_addgid() would not deduplicate cr_groups[0,1].=0A= However, the case where the "user" is not also listed in the group=0A= database for the same group as their gid in the password database=0A= will not be duplicated.=0A= --> It also implies that getgrouplist() can return with ngroups =3D=3D 1,= =0A= with only the basegid in it.=0A= =0A= So, is getgrouplist(3) always returning with cr_groups[0] and cr_groups[1]= =0A= duplicated required behaviour?=0A= =0A= If the duplication is not required, then I can easily fix mountd to=0A= check for the non-duplicated case.=0A= I will probably patch it anyhow, since the one line change will be=0A= harmless even if getgrouplist() is changed to always return the=0A= duplicate of cr_groups[0] in cr_groups[1].=0A= =0A= rick=0A= =0A=