Date: Thu, 12 Aug 1999 10:51:25 -0400 (EDT) From: David Mazieres <dm@eecs.harvard.edu> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/13108: authunix_create_default inconsistent Message-ID: <199908121451.KAA19945@punish.uun.org>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908121451.KAA19945>