Apply patch from kern/5538:

Fix group mapping so members of group 0 get other group-ids mapped as well.
Avoid rename panic by checking (*this_vp_p) against NULLVP before
dereferencing it (same change as to NULLFS some time ago).
This commit is contained in:
perseant 1999-03-19 21:46:25 +00:00
parent be73d82871
commit 247156f4d2
3 changed files with 14 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: umap_subr.c,v 1.13 1998/03/01 02:21:51 fvdl Exp $ */ /* $NetBSD: umap_subr.c,v 1.14 1999/03/19 21:46:25 perseant Exp $ */
/* /*
* Copyright (c) 1992, 1993, 1995 * Copyright (c) 1992, 1993, 1995
@ -441,14 +441,13 @@ umap_mapids(v_mount, credp)
/* Now we must map each of the set of groups in the cr_groups /* Now we must map each of the set of groups in the cr_groups
structure. */ structure. */
i = 0; for(i=0; i < credp->cr_ngroups; i++) {
while (credp->cr_groups[i] != 0) {
gid = (gid_t) umap_findid(credp->cr_groups[i], gid = (gid_t) umap_findid(credp->cr_groups[i],
groupmap, gnentries); groupmap, gnentries);
if (gid != -1) if (gid != -1)
credp->cr_groups[i++] = gid; credp->cr_groups[i] = gid;
else else
credp->cr_groups[i++] = NULLGROUP; credp->cr_groups[i] = NULLGROUP;
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: umap_vfsops.c,v 1.21 1999/03/12 18:16:44 bouyer Exp $ */ /* $NetBSD: umap_vfsops.c,v 1.22 1999/03/19 21:46:26 perseant Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -89,6 +89,9 @@ umapfs_mount(mp, path, data, ndp, p)
struct umap_mount *amp; struct umap_mount *amp;
size_t size; size_t size;
int error; int error;
#ifdef UMAPFS_DIAGNOSTIC
int i;
#endif
/* only for root */ /* only for root */
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
@ -158,10 +161,10 @@ umapfs_mount(mp, path, data, ndp, p)
if (error) if (error)
return (error); return (error);
#ifdef UMAP_DIAGNOSTIC #ifdef UMAPFS_DIAGNOSTIC
printf("umap_mount:nentries %d\n",args.nentries); printf("umap_mount:nentries %d\n",args.nentries);
for (i = 0; i < args.nentries; i++) for (i = 0; i < args.nentries; i++)
printf(" %d maps to %d\n", amp->info_mapdata[i][0], printf(" %ld maps to %ld\n", amp->info_mapdata[i][0],
amp->info_mapdata[i][1]); amp->info_mapdata[i][1]);
#endif #endif
@ -170,10 +173,10 @@ umapfs_mount(mp, path, data, ndp, p)
if (error) if (error)
return (error); return (error);
#ifdef UMAP_DIAGNOSTIC #ifdef UMAPFS_DIAGNOSTIC
printf("umap_mount:gnentries %d\n",args.gnentries); printf("umap_mount:gnentries %d\n",args.gnentries);
for (i = 0; i < args.gnentries; i++) for (i = 0; i < args.gnentries; i++)
printf("\tgroup %d maps to %d\n", printf("\tgroup %ld maps to %ld\n",
amp->info_gmapdata[i][0], amp->info_gmapdata[i][0],
amp->info_gmapdata[i][1]); amp->info_gmapdata[i][1]);
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: umap_vnops.c,v 1.10 1998/03/01 02:21:51 fvdl Exp $ */ /* $NetBSD: umap_vnops.c,v 1.11 1999/03/19 21:46:26 perseant Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -157,7 +157,7 @@ umap_bypass(v)
* that aren't. (Must map first vp or vclean fails.) * that aren't. (Must map first vp or vclean fails.)
*/ */
if (i && (*this_vp_p)->v_op != umap_vnodeop_p) { if (i && ((*this_vp_p)==NULL || (*this_vp_p)->v_op != umap_vnodeop_p)) {
old_vps[i] = NULL; old_vps[i] = NULL;
} else { } else {
old_vps[i] = *this_vp_p; old_vps[i] = *this_vp_p;