From owner-freebsd-bugs Thu Aug 12 8: 0:23 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 52566157B0 for ; Thu, 12 Aug 1999 08:00:21 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA28717; Thu, 12 Aug 1999 08:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from punish.uun.org (punish.uun.org [18.23.10.83]) by hub.freebsd.org (Postfix) with ESMTP id 17FE114EDF for ; Thu, 12 Aug 1999 07:51:26 -0700 (PDT) (envelope-from dm@punish.uun.org) Received: (from dm@localhost) by punish.uun.org (8.9.1/8.9.1) id KAA19945; Thu, 12 Aug 1999 10:51:25 -0400 (EDT) (envelope-from dm) Message-Id: <199908121451.KAA19945@punish.uun.org> Date: Thu, 12 Aug 1999 10:51:25 -0400 (EDT) From: David Mazieres Reply-To: dm@eecs.harvard.edu To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/13108: authunix_create_default inconsistent Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 13108 >Category: bin >Synopsis: authunix_create_default includes egid twice >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 12 08:00:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: David Mazieres >Release: FreeBSD 3.0-RELEASE i386 >Organization: >Environment: >Description: authunix_create_default includes the effictive group ID in the grouplist (as well as the gid field). This is inconsistent with almost all other operating systems, and also inconsistent with the FreeBSD kernel. For instance, in nfs_subs.c, the kernel avoids putting cr->cr_groups[0] in the grouplist, because it has already placed it in the gid field of the marshalled authunix structure. 714 for (i = 1; i <= grpsiz; i++) 715 *tl++ = txdr_unsigned(cr->cr_groups[i]); >How-To-Repeat: >Fix: The fix is to change authunix_create_default to compensate for the fact that FreeBSD keeps the effective group ID in the first element of a processes grouplist (unlike the operating systems for which the code was originally written). A simple patch is appended. Alternatively, you could change the kernel to behave like authunix_create_default. The current behavior of having the kernel and libc generate different authunix structures is quite annoying. (In particular, it makes it virtually impossible to "autoconf" RPC behavior in supposedly portable software). --- /usr/src/lib/libc/rpc/auth_unix.c Wed May 28 01:05:02 1997 +++ auth_unix.c Thu Aug 12 10:31:50 1999 @@ -206,9 +206,9 @@ gid = (int)getegid(); if ((len = getgroups(NGROUPS, real_gids)) < 0) abort(); - if(len > NGRPS) len = NGRPS; /* GW: turn `gid_t's into `int's */ + if(--len > NGRPS) len = NGRPS; /* GW: turn `gid_t's into `int's */ for(i = 0; i < len; i++) { - gids[i] = (int)real_gids[i]; + gids[i] = (int)real_gids[i+1]; } return (authunix_create(machname, uid, gid, len, gids)); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message